From 57d1623fd97ce1c1d98f778bd7454f67205aa8eb Mon Sep 17 00:00:00 2001 From: rtel Date: Wed, 20 Feb 2019 17:55:59 +0000 Subject: [PATCH] Add instructions on building the Cortex-M33 secure and non secure projects into the comments of that project and into a readme.txt file. Enable configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES setting to be used in statically allocated systems. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2639 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../NonSecure/main_ns.c | 48 ++++++++++++------- .../ReadMe.txt | 8 ++++ .../Secure/main_s.c | 43 ++++++++++++----- FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h | 2 +- FreeRTOS/Demo/WIN32-MSVC/main.c | 4 +- FreeRTOS/Source/include/FreeRTOS.h | 29 ++++++++--- FreeRTOS/Source/portable/ARMv8M/ReadMe.txt | 10 ++++ .../portable/ARMv8M/non_secure/ReadMe.txt | 10 ++++ .../portable/ARMv8M/non_secure/portmacro.h | 7 +-- .../Source/portable/ARMv8M/secure/ReadMe.txt | 10 ++++ .../GCC/ARM_CM33/non_secure/portmacro.h | 7 +-- .../GCC/ARM_CM33_NTZ/non_secure/portmacro.h | 7 +-- .../portable/IAR/ARM_CM33/non_secure/port.c | 2 +- .../IAR/ARM_CM33/non_secure/portmacro.h | 6 +-- .../IAR/ARM_CM33_NTZ/non_secure/portmacro.h | 6 +-- 15 files changed, 144 insertions(+), 55 deletions(-) create mode 100644 FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/ReadMe.txt create mode 100644 FreeRTOS/Source/portable/ARMv8M/ReadMe.txt create mode 100644 FreeRTOS/Source/portable/ARMv8M/non_secure/ReadMe.txt create mode 100644 FreeRTOS/Source/portable/ARMv8M/secure/ReadMe.txt diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/main_ns.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/main_ns.c index faffb007d..6faa97b31 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/main_ns.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/main_ns.c @@ -65,6 +65,38 @@ const uint32_t * __unprivileged_sram_end__ = ( uint32_t * ) ( 0x20220000 - 0x1 static void prvCreateTasks( void ); /*-----------------------------------------------------------*/ +/* + Instructions to Build and Run: + - The Keil multi-project workspace FreeRTOSDemo.uvmpw contains projects for + both the secure project, and non secure project. + - Set the FreeRTOSDemo_s project as Active - Right click on + "Project: FreeRTOSDemo_s" and select "Set as Active Project". + - Build the FreeRTOSDemo_s project using "Project --> Build" or by pressing + F7. + - Set the FreeRTOSDemo_ns project as Active – Right click on + "Project: FreeRTOSDemo_ns" and select "Set as Active Project". + - Build the FreeRTOSDemo_ns project using "Project --> Build" or by + pressing "F7". + - Start Debug Session using "Debug -> Start/Stop Debug Session" or by + pressing "Ctrl+F5". +*/ + +/* Non-Secure main. */ +int main( void ) +{ + /* Create tasks. */ + prvCreateTasks(); + + /* Start scheduler. */ + vTaskStartScheduler(); + + /* Should not reach here as the scheduler is already started. */ + for( ; ; ) + { + } +} +/*-----------------------------------------------------------*/ + static void prvCreateTasks( void ) { /* Create tasks for the MPU Demo. */ @@ -84,22 +116,6 @@ void vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName } /*-----------------------------------------------------------*/ -/* Non-Secure main. */ -int main( void ) -{ - /* Create tasks. */ - prvCreateTasks(); - - /* Start scheduler. */ - vTaskStartScheduler(); - - /* Should not reach here as the schedular is already started. */ - for( ; ; ) - { - } -} -/*-----------------------------------------------------------*/ - /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an * implementation of vApplicationGetIdleTaskMemory() to provide the memory that * is used by the Idle task. */ diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/ReadMe.txt b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/ReadMe.txt new file mode 100644 index 000000000..42ab96b7c --- /dev/null +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/ReadMe.txt @@ -0,0 +1,8 @@ +Instructions to Build and Run: + - The Keil multi-project workspace FreeRTOSDemo.uvmpw contains projects for both the secure project, and non secure project. + - Set the FreeRTOSDemo_s project as Active - Right click on "Project: FreeRTOSDemo_s" and select "Set as Active Project". + - Build the FreeRTOSDemo_s project using "Project --> Build" or by pressing F7. + - Set the FreeRTOSDemo_ns project as Active – Right click on "Project: FreeRTOSDemo_ns" and select "Set as Active Project". + - Build the FreeRTOSDemo_ns project using "Project --> Build" or by pressing "F7". + - Start Debug Session using "Debug -> Start/Stop Debug Session" or by pressing "Ctrl+F5". + diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c index b3e6c5676..72b81131c 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c @@ -44,6 +44,36 @@ typedef void ( *NonSecureResetHandler_t ) ( void ) __attribute__( ( cmse_nonsecu void BootNonSecure( uint32_t ulNonSecureStartAddress ); /*-----------------------------------------------------------*/ +/* + Instructions to Build and Run: + - The Keil multi-project workspace FreeRTOSDemo.uvmpw contains projects for + both the secure project, and non secure project. + - Set the FreeRTOSDemo_s project as Active - Right click on + "Project: FreeRTOSDemo_s" and select "Set as Active Project". + - Build the FreeRTOSDemo_s project using "Project --> Build" or by pressing + F7. + - Set the FreeRTOSDemo_ns project as Active – Right click on + "Project: FreeRTOSDemo_ns" and select "Set as Active Project". + - Build the FreeRTOSDemo_ns project using "Project --> Build" or by + pressing "F7". + - Start Debug Session using "Debug -> Start/Stop Debug Session" or by + pressing "Ctrl+F5". +*/ + +/* Secure main() */ +int main( void ) +{ + /* Boot the non-secure code. */ + BootNonSecure( mainNONSECURE_APP_START_ADDRESS ); + + /* Non-secure software does not return, this code is not executed. */ + for( ; ; ) + { + /* Should not reach here. */ + } +} +/*-----------------------------------------------------------*/ + void BootNonSecure( uint32_t ulNonSecureStartAddress ) { NonSecureResetHandler_t pxNonSecureResetHandler; @@ -64,16 +94,3 @@ void BootNonSecure( uint32_t ulNonSecureStartAddress ) } /*-----------------------------------------------------------*/ -/* Secure main() */ -int main( void ) -{ - /* Boot the non-secure code. */ - BootNonSecure( mainNONSECURE_APP_START_ADDRESS ); - - /* Non-secure software does not return, this code is not executed. */ - for( ; ; ) - { - /* Should not reach here. */ - } -} -/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h b/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h index 976d980e7..a23b311f3 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h @@ -47,7 +47,7 @@ #define configUSE_DAEMON_TASK_STARTUP_HOOK 1 #define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */ #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */ -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 45 * 1024 ) ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 52 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 12 ) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 diff --git a/FreeRTOS/Demo/WIN32-MSVC/main.c b/FreeRTOS/Demo/WIN32-MSVC/main.c index 73917d2d5..02df03820 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/main.c +++ b/FreeRTOS/Demo/WIN32-MSVC/main.c @@ -75,9 +75,9 @@ that make up the total heap. heap_5 is only used for test and example purposes as this demo could easily create one large heap region instead of multiple smaller heap regions - in which case heap_4.c would be the more appropriate choice. See http://www.freertos.org/a00111.html for an explanation. */ -#define mainREGION_1_SIZE 7201 +#define mainREGION_1_SIZE 8201 #define mainREGION_2_SIZE 29905 -#define mainREGION_3_SIZE 6407 +#define mainREGION_3_SIZE 7607 /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h index 6e3deed52..3afd3bb24 100644 --- a/FreeRTOS/Source/include/FreeRTOS.h +++ b/FreeRTOS/Source/include/FreeRTOS.h @@ -1039,25 +1039,40 @@ the Secure Side only. */ */ struct xSTATIC_LIST_ITEM { - TickType_t xDummy1; - void *pvDummy2[ 4 ]; + #if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 ) + TickType_t xDummy1; + #endif + TickType_t xDummy2; + void *pvDummy3[ 4 ]; + #if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 ) + TickType_t xDummy4; + #endif }; typedef struct xSTATIC_LIST_ITEM StaticListItem_t; /* See the comments above the struct xSTATIC_LIST_ITEM definition. */ struct xSTATIC_MINI_LIST_ITEM { - TickType_t xDummy1; - void *pvDummy2[ 2 ]; + #if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 ) + TickType_t xDummy1; + #endif + TickType_t xDummy2; + void *pvDummy3[ 2 ]; }; typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t; /* See the comments above the struct xSTATIC_LIST_ITEM definition. */ typedef struct xSTATIC_LIST { - UBaseType_t uxDummy1; - void *pvDummy2; - StaticMiniListItem_t xDummy3; + #if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 ) + TickType_t xDummy1; + #endif + UBaseType_t uxDummy2; + void *pvDummy3; + StaticMiniListItem_t xDummy4; + #if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 ) + TickType_t xDummy5; + #endif } StaticList_t; /* diff --git a/FreeRTOS/Source/portable/ARMv8M/ReadMe.txt b/FreeRTOS/Source/portable/ARMv8M/ReadMe.txt new file mode 100644 index 000000000..4ac3bad55 --- /dev/null +++ b/FreeRTOS/Source/portable/ARMv8M/ReadMe.txt @@ -0,0 +1,10 @@ +This directory tree contains the master copy of the FreeeRTOS Cortex-M33 port. +Do not use the files located here! These file are copied into separate +FreeRTOS/Source/portable/[compiler]/ARM_CM33_NNN directories prior to each +FreeRTOS release. + +If your Cortex-M33 application uses TrustZone then use the files from the +FreeRTOS/Source/portable/[compiler]/ARM_CM33 directories. + +If you Cortex-M33 application is not going to use TrustZone then use the files +from the FreeRTOS/Source/portable/[compiler]/ARM_CM33_NTZ directories. diff --git a/FreeRTOS/Source/portable/ARMv8M/non_secure/ReadMe.txt b/FreeRTOS/Source/portable/ARMv8M/non_secure/ReadMe.txt new file mode 100644 index 000000000..4ac3bad55 --- /dev/null +++ b/FreeRTOS/Source/portable/ARMv8M/non_secure/ReadMe.txt @@ -0,0 +1,10 @@ +This directory tree contains the master copy of the FreeeRTOS Cortex-M33 port. +Do not use the files located here! These file are copied into separate +FreeRTOS/Source/portable/[compiler]/ARM_CM33_NNN directories prior to each +FreeRTOS release. + +If your Cortex-M33 application uses TrustZone then use the files from the +FreeRTOS/Source/portable/[compiler]/ARM_CM33 directories. + +If you Cortex-M33 application is not going to use TrustZone then use the files +from the FreeRTOS/Source/portable/[compiler]/ARM_CM33_NTZ directories. diff --git a/FreeRTOS/Source/portable/ARMv8M/non_secure/portmacro.h b/FreeRTOS/Source/portable/ARMv8M/non_secure/portmacro.h index 4bd9a6f50..504257070 100644 --- a/FreeRTOS/Source/portable/ARMv8M/non_secure/portmacro.h +++ b/FreeRTOS/Source/portable/ARMv8M/non_secure/portmacro.h @@ -43,16 +43,17 @@ extern "C" { */ #ifndef configENABLE_FPU - #error configENABLE_FPU must be defined in FreeRTOSConfig.h. + #error configENABLE_FPU must be defined in FreeRTOSConfig.h. Set configENABLE_FPU to 1 to enable the FPU or 0 to disable the FPU. #endif /* configENABLE_FPU */ #ifndef configENABLE_MPU - #error configENABLE_MPU must be defined in FreeRTOSConfig.h. + #error configENABLE_MPU must be defined in FreeRTOSConfig.h. Set configENABLE_MPU to 1 to enable the MPU or 0 to disable the MPU. #endif /* configENABLE_MPU */ #ifndef configENABLE_TRUSTZONE - #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. + #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. Set configENABLE_TRUSTZONE to 1 to enable TrustZone or 0 to disable TrustZone. #endif /* configENABLE_TRUSTZONE */ + /*-----------------------------------------------------------*/ /** diff --git a/FreeRTOS/Source/portable/ARMv8M/secure/ReadMe.txt b/FreeRTOS/Source/portable/ARMv8M/secure/ReadMe.txt new file mode 100644 index 000000000..4ac3bad55 --- /dev/null +++ b/FreeRTOS/Source/portable/ARMv8M/secure/ReadMe.txt @@ -0,0 +1,10 @@ +This directory tree contains the master copy of the FreeeRTOS Cortex-M33 port. +Do not use the files located here! These file are copied into separate +FreeRTOS/Source/portable/[compiler]/ARM_CM33_NNN directories prior to each +FreeRTOS release. + +If your Cortex-M33 application uses TrustZone then use the files from the +FreeRTOS/Source/portable/[compiler]/ARM_CM33 directories. + +If you Cortex-M33 application is not going to use TrustZone then use the files +from the FreeRTOS/Source/portable/[compiler]/ARM_CM33_NTZ directories. diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/portmacro.h index 4bd9a6f50..504257070 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/portmacro.h @@ -43,16 +43,17 @@ extern "C" { */ #ifndef configENABLE_FPU - #error configENABLE_FPU must be defined in FreeRTOSConfig.h. + #error configENABLE_FPU must be defined in FreeRTOSConfig.h. Set configENABLE_FPU to 1 to enable the FPU or 0 to disable the FPU. #endif /* configENABLE_FPU */ #ifndef configENABLE_MPU - #error configENABLE_MPU must be defined in FreeRTOSConfig.h. + #error configENABLE_MPU must be defined in FreeRTOSConfig.h. Set configENABLE_MPU to 1 to enable the MPU or 0 to disable the MPU. #endif /* configENABLE_MPU */ #ifndef configENABLE_TRUSTZONE - #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. + #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. Set configENABLE_TRUSTZONE to 1 to enable TrustZone or 0 to disable TrustZone. #endif /* configENABLE_TRUSTZONE */ + /*-----------------------------------------------------------*/ /** diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM33_NTZ/non_secure/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM33_NTZ/non_secure/portmacro.h index 4bd9a6f50..504257070 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM33_NTZ/non_secure/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM33_NTZ/non_secure/portmacro.h @@ -43,16 +43,17 @@ extern "C" { */ #ifndef configENABLE_FPU - #error configENABLE_FPU must be defined in FreeRTOSConfig.h. + #error configENABLE_FPU must be defined in FreeRTOSConfig.h. Set configENABLE_FPU to 1 to enable the FPU or 0 to disable the FPU. #endif /* configENABLE_FPU */ #ifndef configENABLE_MPU - #error configENABLE_MPU must be defined in FreeRTOSConfig.h. + #error configENABLE_MPU must be defined in FreeRTOSConfig.h. Set configENABLE_MPU to 1 to enable the MPU or 0 to disable the MPU. #endif /* configENABLE_MPU */ #ifndef configENABLE_TRUSTZONE - #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. + #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. Set configENABLE_TRUSTZONE to 1 to enable TrustZone or 0 to disable TrustZone. #endif /* configENABLE_TRUSTZONE */ + /*-----------------------------------------------------------*/ /** diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM33/non_secure/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM33/non_secure/port.c index 9d9229050..57c5e23bb 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM33/non_secure/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM33/non_secure/port.c @@ -64,7 +64,7 @@ * configRUN_FREERTOS_SECURE_ONLY = 0 and configENABLE_TRUSTZONE = 0 */ #if( ( configRUN_FREERTOS_SECURE_ONLY == 1 ) && ( configENABLE_TRUSTZONE == 1 ) ) - #error Trust Zone needs to be disabled in order to run FreeRTOS on the Secure Side. + #error TrustZone needs to be disabled in order to run FreeRTOS on the Secure Side. #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM33/non_secure/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM33/non_secure/portmacro.h index 4bd9a6f50..a5242006e 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM33/non_secure/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM33/non_secure/portmacro.h @@ -43,15 +43,15 @@ extern "C" { */ #ifndef configENABLE_FPU - #error configENABLE_FPU must be defined in FreeRTOSConfig.h. + #error configENABLE_FPU must be defined in FreeRTOSConfig.h. Set configENABLE_FPU to 1 to enable the FPU or 0 to disable the FPU. #endif /* configENABLE_FPU */ #ifndef configENABLE_MPU - #error configENABLE_MPU must be defined in FreeRTOSConfig.h. + #error configENABLE_MPU must be defined in FreeRTOSConfig.h. Set configENABLE_MPU to 1 to enable the MPU or 0 to disable the MPU. #endif /* configENABLE_MPU */ #ifndef configENABLE_TRUSTZONE - #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. + #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. Set configENABLE_TRUSTZONE to 1 to enable TrustZone or 0 to disable TrustZone. #endif /* configENABLE_TRUSTZONE */ /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM33_NTZ/non_secure/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM33_NTZ/non_secure/portmacro.h index 4bd9a6f50..a5242006e 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM33_NTZ/non_secure/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM33_NTZ/non_secure/portmacro.h @@ -43,15 +43,15 @@ extern "C" { */ #ifndef configENABLE_FPU - #error configENABLE_FPU must be defined in FreeRTOSConfig.h. + #error configENABLE_FPU must be defined in FreeRTOSConfig.h. Set configENABLE_FPU to 1 to enable the FPU or 0 to disable the FPU. #endif /* configENABLE_FPU */ #ifndef configENABLE_MPU - #error configENABLE_MPU must be defined in FreeRTOSConfig.h. + #error configENABLE_MPU must be defined in FreeRTOSConfig.h. Set configENABLE_MPU to 1 to enable the MPU or 0 to disable the MPU. #endif /* configENABLE_MPU */ #ifndef configENABLE_TRUSTZONE - #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. + #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. Set configENABLE_TRUSTZONE to 1 to enable TrustZone or 0 to disable TrustZone. #endif /* configENABLE_TRUSTZONE */ /*-----------------------------------------------------------*/ -- 2.39.5