Skip to content

Commit

Permalink
Add initial pack contents
Browse files Browse the repository at this point in the history
  • Loading branch information
ZigaMahne authored and DavidLesnjak committed Oct 7, 2024
1 parent 5d238eb commit 28f4471
Show file tree
Hide file tree
Showing 115 changed files with 143,639 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Continuous Integration (CI) Test for Board Support Pack (BSP)

Content of `.ci` Directory | Description
:----------------------------|:-----------------
`vcpkg-configuration.json` | Tool setup for the CI test

The [GitHub Actions](https://github.com/Open-CMSIS-Pack/ST_B-L475E-IOT01A_BSP/tree/main/README.md#github-actions) in the directory [`.github/workflows`](https://github.com/Open-CMSIS-Pack/ST_B-L475E-IOT01A_BSP/tree/main/.github/workflows) are the scripts for the CI tests. These scripts contain detailed comments about each step that is executed.
17 changes: 17 additions & 0 deletions .ci/vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"registries": [
{
"name": "arm",
"kind": "artifact",
"location": "https://artifacts.tools.arm.com/vcpkg-registry"
}
],
"requires": {
"arm:tools/open-cmsis-pack/cmsis-toolbox": "^2.6.0",
"arm:tools/arm/mdk-toolbox":" ^1.0.0",
"arm:tools/kitware/cmake": "^3.28.4",
"arm:tools/ninja-build/ninja": "^1.12.0",
"arm:compilers/arm/armclang": "^6.22.0",
"arm:compilers/arm/arm-none-eabi-gcc": "^13.3.1"
}
}
81 changes: 81 additions & 0 deletions .github/workflows/Test-Examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Test-Examples # BSP Examples
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '00 20 * * 6'

jobs:
Test-Examples: # Install tools, build
strategy:
fail-fast: false

runs-on: ubuntu-latest

steps:
- name: Checkout .ci folder
uses: actions/checkout@v4
with:
sparse-checkout: |
.ci
- name: Install tools
uses: ARM-software/cmsis-actions/vcpkg@v1
with:
config: "./.ci/vcpkg-configuration.json"

- name: Activate Arm tool license
uses: ARM-software/cmsis-actions/armlm@v1

- name: Checkout current repository
uses: actions/checkout@v4
with:
path: ./BSP

- name: Checkout STM32L4xx_DFP
uses: actions/checkout@v4
with:
repository: Open-CMSIS-Pack/STM32L4xx_DFP
path: ./DFP

- name: Checkout CMSIS-Driver_STM32
uses: actions/checkout@v4
with:
repository: Open-CMSIS-Pack/CMSIS-Driver_STM32
path: ./Drivers

- name: Initialize CMSIS pack root folder
run: |
cpackget init https://www.keil.com/pack/index.pidx
cpackget update-index
- name: Add local CMSIS packs
run: |
cpackget add ./BSP/Keil.B-L475E-IOT01A_BSP.pdsc
cpackget add ./DFP/Keil.STM32L4xx_DFP.pdsc
cpackget add ./Drivers/ARM.CMSIS-Driver_STM32.pdsc
- name: Copy Blinky example to CI/Examples/ folder
working-directory: ./
run: |
mkdir -p ./CI/Examples/Blinky
cp -rf ./BSP/Examples/Blinky/* ./CI/Examples/Blinky/
- name: Build Blinky AC6
if: always()
working-directory: ./CI/Examples/Blinky
run: |
cbuild ./Blinky.csolution.yml --packs --update-rte --packs --toolchain AC6 --rebuild
- name: Upload Artifact of the Blinky AC6 build
if: always()
uses: actions/upload-artifact@v4
with:
name: Blinky_AC6
path: |
./CI/Examples/Blinky/
!./CI/Examples/Blinky/tmp/
retention-days: 1
33 changes: 33 additions & 0 deletions .github/workflows/pack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build pack
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pack:
name: Generate pack
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch tags
if: github.event_name == 'release'
run: |
git fetch --tags --force
- uses: Open-CMSIS-Pack/gen-pack-action@main
with:
doxygen-version: none
packchk-version: 1.4.1
gen-pack-script: ./gen_pack.sh
gen-pack-output: ./output
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Pack build files
/build/
/output/
231 changes: 231 additions & 0 deletions CMSIS/Driver/vio_B-L475E-IOT01A.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
/******************************************************************************
* @file vio_B-L475E-IOT01A.c
* @brief Virtual I/O implementation for board B-L475E-IOT01A
* @version V2.0.0
* @date 20. September 2024
******************************************************************************/
/*
* Copyright (c) 2020-2024 Arm Limited (or its affiliates).
* All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*! \page vio_B-L475E-IOT01A Physical I/O Mapping
The table below lists the physical I/O mapping of this CMSIS-Driver VIO implementation.
| Virtual I/O | Variable | Board component | Pin
|:--------------|:---------------|:---------------------|:------
| vioBUTTON0 | vioSignalIn.0 | USER button (B2) | PC13
| vioLED0 | vioSignalOut.0 | LED green (LD2) | PB14
*/

#include "cmsis_vio.h"

#include "RTE_Components.h" // Component selection
#include CMSIS_device_header

#if !defined CMSIS_VOUT || !defined CMSIS_VIN
#include "GPIO_STM32.h"
#endif

// VIO input, output definitions
#ifndef VIO_VALUE_NUM
#define VIO_VALUE_NUM 5U // Number of values
#endif

// VIO input, output variables
static uint32_t vioSignalIn __USED; // Memory for incoming signal
static uint32_t vioSignalOut __USED; // Memory for outgoing signal
static int32_t vioValue[VIO_VALUE_NUM] __USED; // Memory for value used in vioGetValue/vioSetValue

#if !defined CMSIS_VOUT || !defined CMSIS_VIN

// VIO Active State
#define VIO_ACTIVE_LOW 0U
#define VIO_ACTIVE_HIGH 1U

typedef struct {
uint32_t vioSignal;
uint16_t pin;
uint8_t pullResistor;
uint8_t activeState;
} pinCfg_t;

#if !defined CMSIS_VOUT
// VOUT Configuration
static const pinCfg_t outputCfg[] = {
// signal, pin, pull resistor, active state
{ vioLED0, GPIO_PIN_ID_PORTB(14), ARM_GPIO_PULL_NONE, VIO_ACTIVE_HIGH }
};
#endif

#if !defined CMSIS_VIN
// VIN Configuration
static const pinCfg_t inputCfg[] = {
// signal, pin, pull resistor, active state
{ vioBUTTON0, GPIO_PIN_ID_PORTC(13), ARM_GPIO_PULL_NONE, VIO_ACTIVE_LOW }
};
#endif

// External GPIO Driver
extern ARM_DRIVER_GPIO Driver_GPIO0;
static ARM_DRIVER_GPIO *pGPIODrv = &Driver_GPIO0;
#endif

// Initialize test input, output.
void vioInit (void) {
uint32_t n;
#if !defined(CMSIS_VOUT) || !defined(CMSIS_VIN)
ARM_GPIO_Pin_t pin;
#endif

vioSignalIn = 0U;
vioSignalOut = 0U;

for (n = 0U; n < VIO_VALUE_NUM; n++) {
vioValue[n] = 0U;
}

#if !defined CMSIS_VOUT
for (n = 0U; n < (sizeof(outputCfg) / sizeof(pinCfg_t)); n++) {
pin = (ARM_GPIO_Pin_t)outputCfg[n].pin;
pGPIODrv->Setup(pin, NULL);
pGPIODrv->SetOutputMode(pin, ARM_GPIO_PUSH_PULL);
pGPIODrv->SetPullResistor(pin, outputCfg[n].pullResistor);
pGPIODrv->SetDirection(pin, ARM_GPIO_OUTPUT);

// Set initial pin state to inactive
if (outputCfg[n].activeState == VIO_ACTIVE_HIGH) {
pGPIODrv->SetOutput(pin, 0U);
} else {
pGPIODrv->SetOutput(pin, 1U);
}
}
#endif

#if !defined CMSIS_VIN
for (n = 0U; n < (sizeof(inputCfg) / sizeof(pinCfg_t)); n++) {
pin = (ARM_GPIO_Pin_t)inputCfg[n].pin;
pGPIODrv->Setup(pin, NULL);
pGPIODrv->SetPullResistor(pin, inputCfg[n].pullResistor);
pGPIODrv->SetDirection(pin, ARM_GPIO_INPUT);
}
#endif
}

// Set signal output.
void vioSetSignal (uint32_t mask, uint32_t signal) {
#if !defined CMSIS_VOUT
ARM_GPIO_Pin_t pin;
uint32_t pinValue, n;
#endif

vioSignalOut &= ~mask;
vioSignalOut |= mask & signal;

#if !defined CMSIS_VOUT
// Output signals to LEDs
for (n = 0U; n < (sizeof(outputCfg) / sizeof(pinCfg_t)); n++) {
pin = (ARM_GPIO_Pin_t)outputCfg[n].pin;
if ((mask & outputCfg[n].vioSignal) != 0U) {
if ((signal & outputCfg[n].vioSignal) != 0U) {
pinValue = 1U;
} else {
pinValue = 0U;
}
if (pinValue == outputCfg[n].activeState) {
pGPIODrv->SetOutput(pin, 1U);
} else {
pGPIODrv->SetOutput(pin, 0U);
}
}
}
#endif
}

// Get signal input.
uint32_t vioGetSignal (uint32_t mask) {
uint32_t signal;
#if !defined CMSIS_VIN
ARM_GPIO_Pin_t pin;
uint32_t pinValue, n;
#endif

#if !defined CMSIS_VIN
// Get input signals from buttons
for (n = 0U; n < (sizeof(inputCfg) / sizeof(pinCfg_t)); n++) {
pin = (ARM_GPIO_Pin_t)inputCfg[n].pin;
if ((mask & inputCfg[n].vioSignal) != 0U) {
pinValue = pGPIODrv->GetInput(pin);
if (pinValue == inputCfg[n].activeState) {
vioSignalIn |= inputCfg[n].vioSignal;
} else {
vioSignalIn &= ~inputCfg[n].vioSignal;
}
}
}
#endif

signal = vioSignalIn & mask;

return signal;
}

// Set value output.
// Note: vioAOUT not supported.
void vioSetValue (uint32_t id, int32_t value) {
uint32_t index = id;
#if !defined CMSIS_VOUT
// Add user variables here:

#endif

if (index >= VIO_VALUE_NUM) {
return; /* return in case of out-of-range index */
}

vioValue[index] = value;

#if !defined CMSIS_VOUT
// Add user code here:

#endif
}

// Get value input.
// Note: vioAIN not supported.
int32_t vioGetValue (uint32_t id) {
uint32_t index = id;
int32_t value;
#if !defined CMSIS_VIN
// Add user variables here:

#endif

if (index >= VIO_VALUE_NUM) {
return 0U; /* return 0 in case of out-of-range index */
}

#if !defined CMSIS_VIN
// Add user code here:

#endif

value = vioValue[index];

return value;
}
11 changes: 11 additions & 0 deletions Documents/OVERVIEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# B-L475E-IOT01A_BSP

The **STMicroelectronics B-L475E-IOT01A Board Support Pack (BSP)**:

- Contains examples in *csolution format* for usage with the [CMSIS-Toolbox](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/README.md) and the [VS Code CMSIS Solution](https://marketplace.visualstudio.com/items?itemName=Arm.cmsis-csolution) extension.
- Requires the [Device Family Pack (DFP) for the STM32L4 series](https://www.keil.arm.com/packs/stm32l4xx_dfp-keil).
- Is configured with [STM32CubeMX](https://www.st.com/en/development-tools/stm32cubemx.html) for the Arm Compiler 6 (MDK).

## Content in *csolution format*

- [Examples/Blinky](https://github.com/Open-CMSIS-Pack/ST_B-L475E-IOT01A_BSP/tree/main/Examples/Blinky) shows the basic usage of this board.
Loading

0 comments on commit 28f4471

Please sign in to comment.