Skip to content

Commit c266e53

Browse files
DavidLesnjakRobertRostohar
authored andcommitted
Examples: Update framework
Use recent packs: - ARM::CMSIS@>=6.0.0 - ARM::CMSIS-Driver@>=2.8.0 - ARM::ARM::CMSIS-View@>=1.0.0 - ARM::CMSIS-Compiler@>=2.0.0 - MDK-Packs::[email protected] - Keil::[email protected] CMSIS-Driver:[email protected] - Custom implementations for B-U585I-IOT2A and IMXRT1050-EVKB boards Add sensor initialization in main.c for IMXRT1050-EVKB board
1 parent cd12ec9 commit c266e53

File tree

14 files changed

+467
-225
lines changed

14 files changed

+467
-225
lines changed

examples/framework/interface/gpio/include/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The API is defined in the [Driver_GPIO.h](./Driver_GPIO.h) header file.
1212

1313
## API aligned with CMSIS-Driver specification
1414

15-
This proposal is aligned with [CMSIS-Driver](https://arm-software.github.io/CMSIS_5/Driver/html/group__mci__interface__gr.html) specification with some exceptions.
15+
This proposal is aligned with [CMSIS-Driver](https://arm-software.github.io/CMSIS_6/latest/Driver/group__gpio__interface__gr.html) specification with some exceptions.
1616

17-
The API provides common driver functions and expects function calls as described in CMSIS-Driver [Theory of Operation](https://arm-software.github.io/CMSIS_5/Driver/html/theoryOperation.html).
17+
The API provides common driver functions and expects function calls as described in CMSIS-Driver [Theory of Operation](https://arm-software.github.io/CMSIS_6/latest/Driver/theoryOperation.html).
1818

1919
>Note: The term GPIO is used consistently in the API despite that it defines operations on pin level.
2020

examples/framework/layer/Board/AVH_MPS3_Corstone-300/Board.clayer.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ layer:
2323

2424
packs:
2525
- pack: ARM::[email protected]
26-
- pack: ARM::CMSIS@5.9.0
27-
- pack: ARM::CMSIS-Driver
28-
- pack: ARM::CMSIS-View
26+
- pack: ARM::CMSIS@>=6.0.0
27+
- pack: ARM::CMSIS-Driver@>=2.8.0
28+
- pack: ARM::CMSIS-View@>=1.0.0
2929

3030
define:
3131
- CMSIS_board_header: "\"AVH_MPS3_Corstone_300.h\""
Lines changed: 19 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/******************************************************************************
22
* @file vio.c
33
* @brief Virtual I/O implementation template
4-
* @version V1.0.0
5-
* @date 23. March 2020
4+
* @version V2.0.0
5+
* @date 18. October 2023
66
******************************************************************************/
77
/*
8-
* Copyright (c) 2019-2020 Arm Limited. All rights reserved.
8+
* Copyright (c) 2019-2023 Arm Limited (or its affiliates).
9+
* All rights reserved.
910
*
1011
* SPDX-License-Identifier: Apache-2.0
1112
*
@@ -38,12 +39,17 @@ vioLED6 | vioSignalOut.6 | User LED UL6
3839
vioLED7 | vioSignalOut.7 | User LED UL7 |
3940
*/
4041

41-
#include <stdio.h>
42+
/* History:
43+
* Version 2.0.0
44+
* Updated to API 1.0.0
45+
* Version 1.0.0
46+
* Initial release
47+
*/
48+
4249
#include <string.h>
43-
#include <stdarg.h>
4450
#include "cmsis_vio.h"
4551

46-
#include "RTE_Components.h" // Component selection
52+
#include "RTE_Components.h" // Component selection
4753
#include CMSIS_device_header
4854

4955
#if !defined CMSIS_VOUT || !defined CMSIS_VIN
@@ -53,21 +59,12 @@ vioLED7 | vioSignalOut.7 | User LED UL7
5359
#endif
5460

5561
// VIO input, output definitions
56-
#define VIO_PRINT_MAX_SIZE 64U // maximum size of print memory
57-
#define VIO_PRINTMEM_NUM 4U // number of print memories
58-
#define VIO_VALUE_NUM 3U // number of values
59-
#define VIO_VALUEXYZ_NUM 3U // number of XYZ values
60-
#define VIO_IPV4_ADDRESS_NUM 2U // number of IPv4 addresses
61-
#define VIO_IPV6_ADDRESS_NUM 2U // number of IPv6 addresses
62+
#define VIO_VALUE_NUM 3U // Number of values
6263

6364
// VIO input, output variables
64-
__USED uint32_t vioSignalIn; // Memory for incoming signal
65-
__USED uint32_t vioSignalOut; // Memory for outgoing signal
66-
__USED char vioPrintMem[VIO_PRINTMEM_NUM][VIO_PRINT_MAX_SIZE]; // Memory for the last value for each level
67-
__USED int32_t vioValue [VIO_VALUE_NUM]; // Memory for value used in vioGetValue/vioSetValue
68-
__USED vioValueXYZ_t vioValueXYZ[VIO_VALUEXYZ_NUM]; // Memory for XYZ value for 3-D vector
69-
__USED vioAddrIPv4_t vioAddrIPv4[VIO_IPV4_ADDRESS_NUM]; // Memory for IPv4 address value used in vioSetIPv4/vioGetIPv4
70-
__USED vioAddrIPv6_t vioAddrIPv6[VIO_IPV6_ADDRESS_NUM]; // Memory for IPv6 address value used in vioSetIPv6/vioGetIPv6
65+
__USED uint32_t vioSignalIn; // Memory for incoming signal
66+
__USED uint32_t vioSignalOut; // Memory for outgoing signal
67+
__USED int32_t vioValue[VIO_VALUE_NUM]; // Memory for value used in vioGetValue/vioSetValue
7168

7269
#if !defined CMSIS_VOUT
7370
// Add global user types, variables, functions here:
@@ -93,11 +90,7 @@ void vioInit (void) {
9390
vioSignalIn = 0U;
9491
vioSignalOut = 0U;
9592

96-
memset (vioPrintMem, 0, sizeof(vioPrintMem));
97-
memset (vioValue, 0, sizeof(vioValue));
98-
memset (vioValueXYZ, 0, sizeof(vioValueXYZ));
99-
memset (vioAddrIPv4, 0, sizeof(vioAddrIPv4));
100-
memset (vioAddrIPv6, 0, sizeof(vioAddrIPv6));
93+
memset(vioValue, 0, sizeof(vioValue));
10194

10295
#if !defined CMSIS_VOUT
10396
// Turn off all LEDs
@@ -110,37 +103,6 @@ void vioInit (void) {
110103
#endif
111104
}
112105

113-
// Print formated string to test terminal.
114-
int32_t vioPrint (uint32_t level, const char *format, ...) {
115-
va_list args;
116-
int32_t ret;
117-
#if !defined CMSIS_VOUT
118-
// Add user variables here:
119-
120-
#endif
121-
122-
if (level > vioLevelError) {
123-
return (-1);
124-
}
125-
126-
if (level > VIO_PRINTMEM_NUM) {
127-
return (-1);
128-
}
129-
130-
va_start(args, format);
131-
132-
ret = vsnprintf((char *)vioPrintMem[level], sizeof(vioPrintMem[level]), format, args);
133-
134-
va_end(args);
135-
136-
#if !defined CMSIS_VOUT
137-
// Add user code here:
138-
139-
#endif
140-
141-
return (ret);
142-
}
143-
144106
// Set signal output.
145107
void vioSetSignal (uint32_t mask, uint32_t signal) {
146108
#if !defined CMSIS_VOUT
@@ -171,9 +133,9 @@ uint32_t vioGetSignal (uint32_t mask) {
171133
vioSignalIn = arm_mps3_io_read_buttons(&MPS3_IO_DEV, ARM_MPS3_IO_ACCESS_PORT, 0);
172134
#endif
173135

174-
signal = vioSignalIn;
136+
signal = vioSignalIn & mask;
175137

176-
return (signal & mask);
138+
return signal;
177139
}
178140

179141
// Set value output.
@@ -219,136 +181,3 @@ int32_t vioGetValue (uint32_t id) {
219181

220182
return value;
221183
}
222-
223-
// Set XYZ value output.
224-
void vioSetXYZ (uint32_t id, vioValueXYZ_t valueXYZ) {
225-
uint32_t index = id;
226-
#if !defined CMSIS_VOUT
227-
// Add user variables here:
228-
229-
#endif
230-
231-
if (index >= VIO_VALUEXYZ_NUM) {
232-
return; /* return in case of out-of-range index */
233-
}
234-
235-
vioValueXYZ[index] = valueXYZ;
236-
237-
#if !defined CMSIS_VOUT
238-
// Add user code here:
239-
240-
#endif
241-
}
242-
243-
// Get XYZ value input.
244-
vioValueXYZ_t vioGetXYZ (uint32_t id) {
245-
uint32_t index = id;
246-
vioValueXYZ_t valueXYZ = {0, 0, 0};
247-
#if !defined CMSIS_VIN
248-
// Add user variables here:
249-
250-
#endif
251-
252-
if (index >= VIO_VALUEXYZ_NUM) {
253-
return valueXYZ; /* return default in case of out-of-range index */
254-
}
255-
256-
#if !defined CMSIS_VIN
257-
// Add user code here:
258-
259-
// vioValueXYZ[index] = ...;
260-
#endif
261-
262-
valueXYZ = vioValueXYZ[index];
263-
264-
return valueXYZ;
265-
}
266-
267-
// Set IPv4 address output.
268-
void vioSetIPv4 (uint32_t id, vioAddrIPv4_t addrIPv4) {
269-
uint32_t index = id;
270-
#if !defined CMSIS_VOUT
271-
// Add user variables here:
272-
273-
#endif
274-
275-
if (index >= VIO_IPV4_ADDRESS_NUM) {
276-
return; /* return in case of out-of-range index */
277-
}
278-
279-
vioAddrIPv4[index] = addrIPv4;
280-
281-
#if !defined CMSIS_VOUT
282-
// Add user code here:
283-
284-
#endif
285-
}
286-
287-
// Get IPv4 address input.
288-
vioAddrIPv4_t vioGetIPv4 (uint32_t id) {
289-
uint32_t index = id;
290-
vioAddrIPv4_t addrIPv4 = {0U, 0U, 0U, 0U};
291-
#if !defined CMSIS_VIN
292-
// Add user variables here:
293-
294-
#endif
295-
296-
if (index >= VIO_IPV4_ADDRESS_NUM) {
297-
return addrIPv4; /* return default in case of out-of-range index */
298-
}
299-
300-
#if !defined CMSIS_VIN
301-
// Add user code here:
302-
303-
// vioAddrIPv4[index] = ...;
304-
#endif
305-
306-
addrIPv4 = vioAddrIPv4[index];
307-
308-
return addrIPv4;
309-
}
310-
311-
// Set IPv6 address output.
312-
void vioSetIPv6 (uint32_t id, vioAddrIPv6_t addrIPv6) {
313-
uint32_t index = id;
314-
#if !defined CMSIS_VOUT
315-
// Add user variables here:
316-
317-
#endif
318-
319-
if (index >= VIO_IPV6_ADDRESS_NUM) {
320-
return; /* return in case of out-of-range index */
321-
}
322-
323-
vioAddrIPv6[index] = addrIPv6;
324-
325-
#if !defined CMSIS_VOUT
326-
// Add user code here:
327-
328-
#endif
329-
}
330-
331-
// Get IPv6 address input.
332-
vioAddrIPv6_t vioGetIPv6 (uint32_t id) {
333-
uint32_t index = id;
334-
vioAddrIPv6_t addrIPv6 = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U,
335-
0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U};
336-
#if !defined CMSIS_VIN
337-
// Add user variables here:
338-
339-
#endif
340-
341-
if (index >= VIO_IPV6_ADDRESS_NUM) {
342-
return addrIPv6; /* return default in case of out-of-range index */
343-
}
344-
345-
#if !defined CMSIS_VIN
346-
// Add user code here:
347-
348-
// vioAddrIPv6[index] = ...;
349-
#endif
350-
351-
addrIPv6 = vioAddrIPv6[index];
352-
353-
return addrIPv6;
354-
}

examples/framework/layer/Board/B-U585I-IOT02A/Board.clayer.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ layer:
4141
packs:
4242
- pack: Keil::[email protected]
4343
- pack: Keil::[email protected]
44-
- pack: ARM::CMSIS@5.9.0
45-
- pack: ARM::CMSIS-View
46-
- pack: ARM::CMSIS-Compiler@1.0.0
44+
- pack: ARM::CMSIS@>=6.0.0
45+
- pack: ARM::CMSIS-View@>=1.0.0
46+
- pack: ARM::CMSIS-Compiler@>=2.0.0
4747

4848
define:
4949
- CMSIS_board_header: "\"B_U585I_IOT02A_DK.h\""
@@ -111,13 +111,16 @@ layer:
111111
- component: Keil::CMSIS Driver:SPI
112112
- component: Keil::CMSIS Driver:USART
113113
- component: Keil::CMSIS Driver:USB Device
114-
- component: Keil::CMSIS Driver:VIO
114+
# - component: Keil::CMSIS Driver:VIO
115115
- component: Keil::CMSIS Driver:WiFi:EMW3080
116116

117+
- component: ARM::CMSIS Driver:VIO:Custom
118+
117119
- component: ARM::CMSIS-View:Event Recorder&DAP
118-
- component: ARM::CMSIS-Compiler:I/O:STDERR&User
119-
- component: ARM::CMSIS-Compiler:I/O:STDOUT&User
120-
- component: ARM::CMSIS-Compiler:I/O:STDIN&User
120+
- component: ARM::CMSIS-Compiler:CORE
121+
- component: ARM::CMSIS-Compiler:STDERR:Custom
122+
- component: ARM::CMSIS-Compiler:STDOUT:Custom
123+
- component: ARM::CMSIS-Compiler:STDIN:Custom
121124

122125
groups:
123126
- group: GPIO Interface
@@ -138,3 +141,4 @@ layer:
138141
- file: ./Driver/sensor_drv_hw.c
139142
- file: ./Driver/Audio_B-U585I-IOT02A.c
140143
- file: ./Driver/ism330dhcx_fifo.c
144+
- file: ./Driver/vio_B-U585I-IOT02A.c

examples/framework/layer/Board/B-U585I-IOT02A/Board/B-U585I-IOT02A/STM32CubeMX/Src/main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,11 @@ static void BSP_SENSOR_Init (void) {
201201
BSP_ENV_SENSOR_Init(0U, ENV_TEMPERATURE);
202202
BSP_ENV_SENSOR_Init(0U, ENV_HUMIDITY);
203203
BSP_ENV_SENSOR_Init(1U, ENV_PRESSURE);
204-
// BSP_MOTION_SENSOR_Init(0U, MOTION_ACCELERO);
205-
// BSP_MOTION_SENSOR_Init(0U, MOTION_GYRO);
206-
// BSP_MOTION_SENSOR_Init(1U, MOTION_MAGNETO);
204+
#ifndef RTE_VIO_BOARD
205+
BSP_MOTION_SENSOR_Init(0U, MOTION_ACCELERO);
206+
BSP_MOTION_SENSOR_Init(0U, MOTION_GYRO);
207+
BSP_MOTION_SENSOR_Init(1U, MOTION_MAGNETO);
208+
#endif
207209
BSP_ENV_SENSOR_Disable(0U, ENV_TEMPERATURE);
208210
BSP_ENV_SENSOR_Disable(0U, ENV_HUMIDITY);
209211
BSP_ENV_SENSOR_Disable(1U, ENV_PRESSURE);

0 commit comments

Comments
 (0)