Skip to content

Commit adba678

Browse files
fpistmABOSTM
authored andcommitted
Support STM32L5 family with TZ=0
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 08a4e9c commit adba678

File tree

6 files changed

+92
-32
lines changed

6 files changed

+92
-32
lines changed

src/FreeRTOSConfig_Default.h

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
* http://aws.amazon.com/freertos
2424
*
2525
* 1 tab == 4 spaces!
26-
*/
27-
26+
*/
2827

29-
#ifndef FREERTOS_CONFIG_H
30-
#define FREERTOS_CONFIG_H
28+
#ifndef FREERTOS_CONFIG_DEFAULT_H
29+
#define FREERTOS_CONFIG_DEFAULT_H
3130

3231
/*-----------------------------------------------------------
3332
* Application specific definitions.
@@ -140,28 +139,38 @@ extern char _Min_Stack_Size; /* Defined in the linker script */
140139
*/
141140
#define configUSE_NEWLIB_REENTRANT 1
142141

142+
/* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
143+
currently used in ARMv8M ports. */
144+
#define configENABLE_MPU 0
145+
/* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
146+
currently used in ARMv8M ports. */
147+
#define configENABLE_FPU 1
148+
/* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
149+
This is currently used in ARMv8M ports. */
150+
#define configENABLE_TRUSTZONE 0
151+
143152
/* Co-routine definitions. */
144-
#define configUSE_CO_ROUTINES 0
145-
#define configMAX_CO_ROUTINE_PRIORITIES (2)
153+
#define configUSE_CO_ROUTINES 0
154+
#define configMAX_CO_ROUTINE_PRIORITIES (2)
146155

147156
/* Software timer definitions. */
148-
#define configUSE_TIMERS 1
149-
#define configTIMER_TASK_PRIORITY (2)
150-
#define configTIMER_QUEUE_LENGTH 10
151-
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)
157+
#define configUSE_TIMERS 1
158+
#define configTIMER_TASK_PRIORITY (2)
159+
#define configTIMER_QUEUE_LENGTH 10
160+
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)
152161

153162
/* Set the following definitions to 1 to include the API function, or zero
154163
to exclude the API function. */
155-
#define INCLUDE_vTaskPrioritySet 1
156-
#define INCLUDE_uxTaskPriorityGet 1
157-
#define INCLUDE_vTaskDelete 1
158-
#define INCLUDE_vTaskCleanUpResources 1
159-
#define INCLUDE_vTaskSuspend 1
160-
#define INCLUDE_vTaskDelayUntil 1
161-
#define INCLUDE_vTaskDelay 1
162-
#define INCLUDE_xTaskGetSchedulerState 1
164+
#define INCLUDE_vTaskPrioritySet 1
165+
#define INCLUDE_uxTaskPriorityGet 1
166+
#define INCLUDE_vTaskDelete 1
167+
#define INCLUDE_vTaskCleanUpResources 1
168+
#define INCLUDE_vTaskSuspend 1
169+
#define INCLUDE_vTaskDelayUntil 1
170+
#define INCLUDE_vTaskDelay 1
171+
#define INCLUDE_xTaskGetSchedulerState 1
163172
#define INCLUDE_uxTaskGetStackHighWaterMark 1
164-
#define INCLUDE_xTaskGetIdleTaskHandle 1
173+
#define INCLUDE_xTaskGetIdleTaskHandle 1
165174

166175
#if defined(configUSE_CMSIS_RTOS_V2) && (configUSE_CMSIS_RTOS_V2 == 1)
167176
#define INCLUDE_xSemaphoreGetMutexHolder 1
@@ -173,9 +182,9 @@ to exclude the API function. */
173182
/* Cortex-M specific definitions. */
174183
#ifdef __NVIC_PRIO_BITS
175184
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
176-
#define configPRIO_BITS __NVIC_PRIO_BITS
185+
#define configPRIO_BITS __NVIC_PRIO_BITS
177186
#else
178-
#define configPRIO_BITS 4 /* 15 priority levels */
187+
#define configPRIO_BITS 4 /* 15 priority levels */
179188
#endif
180189

181190
/* The lowest interrupt priority that can be used in a call to a "set priority"
@@ -206,8 +215,7 @@ header file. */
206215

207216
/*
208217
* IMPORTANT:
209-
* osSystickHandler is called in the core SysTick_Handler definition
210-
* and is defined as weak.
218+
* osSystickHandler is called in the core SysTick_Handler definition and is defined as weak.
211219
* For CMSIS-RTOSv2: osSystickHandler is defined as xPortSysTickHandler
212220
* For CMSIS-RTOS: osSystickHandler is defined by the cmsis_os and xPortSysTickHandler
213221
* must not be defined to prevent overwriting SysTick_Handler
@@ -217,5 +225,5 @@ header file. */
217225
#define xPortSysTickHandler osSystickHandler
218226
#endif
219227

220-
#endif /* FREERTOS_CONFIG_H */
228+
#endif /* FREERTOS_CONFIG_DEFAULT_H */
221229

src/mpu_wrappers.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* @file mpu_wrappers.h
3+
* @author Frederic Pillon <frederic.pillon@st.com> for STMicroelectronics.
4+
* @brief Include source file to match Arduino library format
5+
*/
6+
7+
/* MPU not supported */
8+
#include "FreeRTOS/Source/include/mpu_wrappers.h"

src/port.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#pragma GCC error "no \"__CORTEX_M\" definition"
1010
#endif
1111

12-
#if (__CORTEX_M == 0x00U)
12+
#if (__CORTEX_M == 0U)
1313
#include "../portable/GCC/ARM_CM0/port.c"
1414
#endif
1515

16-
#if (__CORTEX_M == 0x03U)
16+
#if (__CORTEX_M == 3U)
1717
/* MPU not supported */
1818
#if 0 /*(__MPU_PRESENT == 1)*/
1919
#include "../portable/GCC/ARM_CM3_MPU/port.c"
@@ -22,7 +22,7 @@
2222
#endif
2323
#endif
2424

25-
#if (__CORTEX_M == 0x04U)
25+
#if (__CORTEX_M == 4U)
2626
/* MPU not supported */
2727
#if 0 /*(__MPU_PRESENT == 1)*/
2828
#include "../portable/GCC/ARM_CM4_MPU/port.c"
@@ -31,11 +31,16 @@
3131
#endif
3232
#endif
3333

34-
#if (__CORTEX_M == 0x07U)
34+
#if (__CORTEX_M == 7U)
3535
/* MPU not supported */
3636
#if 0 /*(__MPU_PRESENT == 1)*/
3737
#include "../portable/GCC/ARM_CM7_MPU/r0p1/port.c"
3838
#else
3939
#include "../portable/GCC/ARM_CM7/r0p1/port.c"
4040
#endif
4141
#endif
42+
43+
#if (__CORTEX_M == 33U)
44+
/* TZ = 0 */
45+
#include "../portable/GCC/ARM_CM33_NTZ/non_secure/port.c"
46+
#endif

src/portasm.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* @file portasm.c
3+
* @author Frederic Pillon <frederic.pillon@st.com> for STMicroelectronics.
4+
* @brief Include source of FreeRTOS portable layer file to match Arduino library format
5+
*/
6+
#include <Arduino.h>
7+
8+
#ifndef __CORTEX_M
9+
#pragma GCC error "no \"__CORTEX_M\" definition"
10+
#endif
11+
12+
#if (__CORTEX_M == 33U)
13+
/* TZ = 0 */
14+
#include "../portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c"
15+
#endif

src/portasm.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* @file portasm.h
3+
* @author Frederic Pillon <frederic.pillon@st.com> for STMicroelectronics.
4+
* @brief Include header of FreeRTOS portable layer file to match Arduino library format
5+
*/
6+
7+
#ifndef _PORTASM_H_
8+
#define _PORTASM_H_
9+
#include "stm32_def.h"
10+
11+
#ifndef __CORTEX_M
12+
#pragma GCC error "no \"__CORTEX_M\" definition"
13+
#endif
14+
15+
#if (__CORTEX_M == 33U)
16+
/* TZ = 0 */
17+
#include "../portable/GCC/ARM_CM33_NTZ/non_secure/portasm.h"
18+
#endif
19+
20+
#endif //_PORTASM_H_

src/portmacro.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
#pragma GCC error "no \"__CORTEX_M\" definition"
1313
#endif
1414

15-
#if (__CORTEX_M == 0x00U)
15+
#if (__CORTEX_M == 0U)
1616
#include "../portable/GCC/ARM_CM0/portmacro.h"
1717
/* Stub for heap_useNewlib_ST */
1818
inline __attribute__(( always_inline )) static BaseType_t xPortIsInsideInterrupt( void ) { return pdFALSE; }
1919
#endif
2020

21-
#if (__CORTEX_M == 0x03U)
21+
#if (__CORTEX_M == 3U)
2222
/* MPU not supported */
2323
#if 0 /*(__MPU_PRESENT == 1)*/
2424
#include "../portable/GCC/ARM_CM3_MPU/portmacro.h"
@@ -27,7 +27,7 @@ inline __attribute__(( always_inline )) static BaseType_t xPortIsInsideInterrupt
2727
#endif
2828
#endif
2929

30-
#if (__CORTEX_M == 0x04U)
30+
#if (__CORTEX_M == 4U)
3131
/* MPU not supported */
3232
#if 0 /*(__MPU_PRESENT == 1)*/
3333
#include "../portable/GCC/ARM_CM4_MPU/portmacro.h"
@@ -36,7 +36,7 @@ inline __attribute__(( always_inline )) static BaseType_t xPortIsInsideInterrupt
3636
#endif
3737
#endif
3838

39-
#if (__CORTEX_M == 0x07U)
39+
#if (__CORTEX_M == 7U)
4040
/* MPU not supported */
4141
#if 0 /*(__MPU_PRESENT == 1)*/
4242
#include "../portable/GCC/ARM_CM7_MPU/r0p1/portmacro.h"
@@ -45,4 +45,8 @@ inline __attribute__(( always_inline )) static BaseType_t xPortIsInsideInterrupt
4545
#endif
4646
#endif
4747

48+
#if (__CORTEX_M == 33U)
49+
#include "../portable/GCC/ARM_CM33_NTZ/non_secure/portmacro.h"
50+
#endif
51+
4852
#endif //_PORTMACRO_H_

0 commit comments

Comments
 (0)