Skip to content

Commit 3defdb0

Browse files
ZigaMahneDavidLesnjak
authored andcommitted
Add initial pack contents
1 parent 7aad893 commit 3defdb0

136 files changed

Lines changed: 183029 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Continuous Integration (CI) Test for Board Support Pack (BSP)
2+
3+
Content of `.ci` Directory | Description
4+
:----------------------------|:-----------------
5+
`vcpkg-configuration.json` | Tool setup for the CI test
6+
7+
The [GitHub Actions](https://github.com/Open-CMSIS-Pack/STM32L496G-DISCO_BSP/tree/main/README.md#github-actions) in the directory [`.github/workflows`](https://github.com/Open-CMSIS-Pack/STM32L496G-DISCO_BSP/tree/main/.github/workflows) are the scripts for the CI tests. These scripts contain detailed comments about each step that is executed.

.ci/vcpkg-configuration.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"registries": [
3+
{
4+
"name": "arm",
5+
"kind": "artifact",
6+
"location": "https://artifacts.tools.arm.com/vcpkg-registry"
7+
}
8+
],
9+
"requires": {
10+
"arm:tools/open-cmsis-pack/cmsis-toolbox": "^2.6.0",
11+
"arm:tools/arm/mdk-toolbox":" ^1.0.0",
12+
"arm:tools/kitware/cmake": "^3.28.4",
13+
"arm:tools/ninja-build/ninja": "^1.12.0",
14+
"arm:compilers/arm/armclang": "^6.22.0",
15+
"arm:compilers/arm/arm-none-eabi-gcc": "^13.3.1"
16+
}
17+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Test-Examples # BSP Examples
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
schedule:
9+
- cron: '00 20 * * 6'
10+
11+
jobs:
12+
Test-Examples: # Install tools, build
13+
strategy:
14+
fail-fast: false
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout .ci folder
20+
uses: actions/checkout@v4
21+
with:
22+
sparse-checkout: |
23+
.ci
24+
25+
- name: Install tools
26+
uses: ARM-software/cmsis-actions/vcpkg@v1
27+
with:
28+
config: "./.ci/vcpkg-configuration.json"
29+
30+
- name: Activate Arm tool license
31+
uses: ARM-software/cmsis-actions/armlm@v1
32+
33+
- name: Checkout current repository
34+
uses: actions/checkout@v4
35+
with:
36+
path: ./BSP
37+
38+
- name: Checkout STM32L4xx_DFP
39+
uses: actions/checkout@v4
40+
with:
41+
repository: Open-CMSIS-Pack/STM32L4xx_DFP
42+
path: ./DFP
43+
44+
- name: Checkout CMSIS-Driver_STM32
45+
uses: actions/checkout@v4
46+
with:
47+
repository: Open-CMSIS-Pack/CMSIS-Driver_STM32
48+
path: ./Drivers
49+
50+
- name: Initialize CMSIS pack root folder
51+
run: |
52+
cpackget init https://www.keil.com/pack/index.pidx
53+
cpackget update-index
54+
55+
- name: Add local CMSIS packs
56+
run: |
57+
cpackget add ./BSP/Keil.STM32L496G-DISCO_BSP.pdsc
58+
cpackget add ./DFP/Keil.STM32L4xx_DFP.pdsc
59+
cpackget add ./Drivers/ARM.CMSIS-Driver_STM32.pdsc
60+
61+
- name: Copy Blinky example to CI/Examples/ folder
62+
working-directory: ./
63+
run: |
64+
mkdir -p ./CI/Examples/Blinky
65+
cp -rf ./BSP/Examples/Blinky/* ./CI/Examples/Blinky/
66+
67+
- name: Build Blinky AC6
68+
if: always()
69+
working-directory: ./CI/Examples/Blinky
70+
run: |
71+
cbuild ./Blinky.csolution.yml --packs --update-rte --packs --toolchain AC6 --rebuild
72+
73+
- name: Upload Artifact of the Blinky AC6 build
74+
if: always()
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: Blinky_AC6
78+
path: |
79+
./CI/Examples/Blinky/
80+
!./CI/Examples/Blinky/tmp/
81+
retention-days: 1

.github/workflows/pack.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build pack
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
release:
8+
types: [published]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
pack:
16+
name: Generate pack
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Fetch tags
24+
if: github.event_name == 'release'
25+
run: |
26+
git fetch --tags --force
27+
28+
- uses: Open-CMSIS-Pack/gen-pack-action@main
29+
with:
30+
doxygen-version: none
31+
packchk-version: 1.4.1
32+
gen-pack-script: ./gen_pack.sh
33+
gen-pack-output: ./output

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Pack build files
2+
/build/
3+
/output/
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
/******************************************************************************
2+
* @file vio_STM32L496G-DISCO.c
3+
* @brief Virtual I/O implementation for board STM32L496G-DISCO
4+
* @version V1.0.0
5+
* @date 19. September 2024
6+
******************************************************************************/
7+
/*
8+
* Copyright (c) 2024 Arm Limited (or its affiliates).
9+
* All rights reserved.
10+
*
11+
* SPDX-License-Identifier: Apache-2.0
12+
*
13+
* Licensed under the Apache License, Version 2.0 (the License); you may
14+
* not use this file except in compliance with the License.
15+
* You may obtain a copy of the License at
16+
*
17+
* www.apache.org/licenses/LICENSE-2.0
18+
*
19+
* Unless required by applicable law or agreed to in writing, software
20+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
21+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+
* See the License for the specific language governing permissions and
23+
* limitations under the License.
24+
*/
25+
26+
/*! \page vio_STM32L496G-DISCO Physical I/O Mapping
27+
28+
The table below lists the physical I/O mapping of this CMSIS-Driver VIO implementation.
29+
30+
| Virtual I/O | Variable | Board component | Pin
31+
|:--------------|:---------------|:---------------------|:------
32+
| vioBUTTON0 | vioSignalIn.0 | Joystick select (B2) | PC13
33+
| vioLED0 | vioSignalOut.0 | LED green (LD2)| PB13
34+
*/
35+
36+
#include "cmsis_vio.h"
37+
38+
#include "RTE_Components.h" // Component selection
39+
#include CMSIS_device_header
40+
41+
#if !defined CMSIS_VOUT || !defined CMSIS_VIN
42+
#include "GPIO_STM32.h"
43+
#endif
44+
45+
// VIO input, output definitions
46+
#ifndef VIO_VALUE_NUM
47+
#define VIO_VALUE_NUM 5U // Number of values
48+
#endif
49+
50+
// VIO input, output variables
51+
static uint32_t vioSignalIn __USED; // Memory for incoming signal
52+
static uint32_t vioSignalOut __USED; // Memory for outgoing signal
53+
static int32_t vioValue[VIO_VALUE_NUM] __USED; // Memory for value used in vioGetValue/vioSetValue
54+
55+
#if !defined CMSIS_VOUT || !defined CMSIS_VIN
56+
57+
// VIO Active State
58+
#define VIO_ACTIVE_LOW 0U
59+
#define VIO_ACTIVE_HIGH 1U
60+
61+
typedef struct {
62+
uint32_t vioSignal;
63+
uint16_t pin;
64+
uint8_t pullResistor;
65+
uint8_t activeState;
66+
} pinCfg_t;
67+
68+
#if !defined CMSIS_VOUT
69+
// VOUT Configuration
70+
static const pinCfg_t outputCfg[] = {
71+
// signal, pin, pull resistor, active state
72+
{ vioLED0, GPIO_PIN_ID_PORTB(13), ARM_GPIO_PULL_NONE, VIO_ACTIVE_LOW }
73+
};
74+
#endif
75+
76+
#if !defined CMSIS_VIN
77+
// VIN Configuration
78+
static const pinCfg_t inputCfg[] = {
79+
// signal, pin, pull resistor, active state
80+
{ vioBUTTON0, GPIO_PIN_ID_PORTC(13), ARM_GPIO_PULL_DOWN, VIO_ACTIVE_HIGH }
81+
};
82+
#endif
83+
84+
// External GPIO Driver
85+
extern ARM_DRIVER_GPIO Driver_GPIO0;
86+
static ARM_DRIVER_GPIO *pGPIODrv = &Driver_GPIO0;
87+
#endif
88+
89+
// Initialize test input, output.
90+
void vioInit (void) {
91+
uint32_t n;
92+
#if !defined(CMSIS_VOUT) || !defined(CMSIS_VIN)
93+
ARM_GPIO_Pin_t pin;
94+
#endif
95+
96+
vioSignalIn = 0U;
97+
vioSignalOut = 0U;
98+
99+
for (n = 0U; n < VIO_VALUE_NUM; n++) {
100+
vioValue[n] = 0U;
101+
}
102+
103+
#if !defined CMSIS_VOUT
104+
for (n = 0U; n < (sizeof(outputCfg) / sizeof(pinCfg_t)); n++) {
105+
pin = (ARM_GPIO_Pin_t)outputCfg[n].pin;
106+
pGPIODrv->Setup(pin, NULL);
107+
pGPIODrv->SetOutputMode(pin, ARM_GPIO_PUSH_PULL);
108+
pGPIODrv->SetPullResistor(pin, outputCfg[n].pullResistor);
109+
pGPIODrv->SetDirection(pin, ARM_GPIO_OUTPUT);
110+
111+
// Set initial pin state to inactive
112+
if (outputCfg[n].activeState == VIO_ACTIVE_HIGH) {
113+
pGPIODrv->SetOutput(pin, 0U);
114+
} else {
115+
pGPIODrv->SetOutput(pin, 1U);
116+
}
117+
}
118+
#endif
119+
120+
#if !defined CMSIS_VIN
121+
for (n = 0U; n < (sizeof(inputCfg) / sizeof(pinCfg_t)); n++) {
122+
pin = (ARM_GPIO_Pin_t)inputCfg[n].pin;
123+
pGPIODrv->Setup(pin, NULL);
124+
pGPIODrv->SetPullResistor(pin, inputCfg[n].pullResistor);
125+
pGPIODrv->SetDirection(pin, ARM_GPIO_INPUT);
126+
}
127+
#endif
128+
}
129+
130+
// Set signal output.
131+
void vioSetSignal (uint32_t mask, uint32_t signal) {
132+
#if !defined CMSIS_VOUT
133+
ARM_GPIO_Pin_t pin;
134+
uint32_t pinValue, n;
135+
#endif
136+
137+
vioSignalOut &= ~mask;
138+
vioSignalOut |= mask & signal;
139+
140+
#if !defined CMSIS_VOUT
141+
// Output signals to LEDs
142+
for (n = 0U; n < (sizeof(outputCfg) / sizeof(pinCfg_t)); n++) {
143+
pin = (ARM_GPIO_Pin_t)outputCfg[n].pin;
144+
if ((mask & outputCfg[n].vioSignal) != 0U) {
145+
if ((signal & outputCfg[n].vioSignal) != 0U) {
146+
pinValue = 1U;
147+
} else {
148+
pinValue = 0U;
149+
}
150+
if (pinValue == outputCfg[n].activeState) {
151+
pGPIODrv->SetOutput(pin, 1U);
152+
} else {
153+
pGPIODrv->SetOutput(pin, 0U);
154+
}
155+
}
156+
}
157+
#endif
158+
}
159+
160+
// Get signal input.
161+
uint32_t vioGetSignal (uint32_t mask) {
162+
uint32_t signal;
163+
#if !defined CMSIS_VIN
164+
ARM_GPIO_Pin_t pin;
165+
uint32_t pinValue, n;
166+
#endif
167+
168+
#if !defined CMSIS_VIN
169+
// Get input signals from buttons
170+
for (n = 0U; n < (sizeof(inputCfg) / sizeof(pinCfg_t)); n++) {
171+
pin = (ARM_GPIO_Pin_t)inputCfg[n].pin;
172+
if ((mask & inputCfg[n].vioSignal) != 0U) {
173+
pinValue = pGPIODrv->GetInput(pin);
174+
if (pinValue == inputCfg[n].activeState) {
175+
vioSignalIn |= inputCfg[n].vioSignal;
176+
} else {
177+
vioSignalIn &= ~inputCfg[n].vioSignal;
178+
}
179+
}
180+
}
181+
#endif
182+
183+
signal = vioSignalIn & mask;
184+
185+
return signal;
186+
}
187+
188+
// Set value output.
189+
// Note: vioAOUT not supported.
190+
void vioSetValue (uint32_t id, int32_t value) {
191+
uint32_t index = id;
192+
#if !defined CMSIS_VOUT
193+
// Add user variables here:
194+
195+
#endif
196+
197+
if (index >= VIO_VALUE_NUM) {
198+
return; /* return in case of out-of-range index */
199+
}
200+
201+
vioValue[index] = value;
202+
203+
#if !defined CMSIS_VOUT
204+
// Add user code here:
205+
206+
#endif
207+
}
208+
209+
// Get value input.
210+
// Note: vioAIN not supported.
211+
int32_t vioGetValue (uint32_t id) {
212+
uint32_t index = id;
213+
int32_t value;
214+
#if !defined CMSIS_VIN
215+
// Add user variables here:
216+
217+
#endif
218+
219+
if (index >= VIO_VALUE_NUM) {
220+
return 0U; /* return 0 in case of out-of-range index */
221+
}
222+
223+
#if !defined CMSIS_VIN
224+
// Add user code here:
225+
226+
#endif
227+
228+
value = vioValue[index];
229+
230+
return value;
231+
}

Documents/OVERVIEW.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# STM32L496G-DISCO_BSP
2+
3+
The **STMicroelectronics STM32L496G-DISCO Board Support Pack (BSP)**:
4+
5+
- 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.
6+
- Requires the [Device Family Pack (DFP) for the STM32L4 series](https://www.keil.arm.com/packs/stm32l4xx_dfp-keil).
7+
- Is configured with [STM32CubeMX](https://www.st.com/en/development-tools/stm32cubemx.html) for the Arm Compiler 6 (MDK).
8+
9+
## Content in *csolution format*
10+
11+
- [Examples/Blinky](https://github.com/Open-CMSIS-Pack/STM32L496G-DISCO_BSP/tree/main/Examples/Blinky) shows the basic usage of this board.

0 commit comments

Comments
 (0)