X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FCORTEX_MPU_M33F_Simulator_Keil_GCC%2FSecure%2Fmain_s.c;h=7972a95bede74d5fdbc1a0b92049820aa57f715c;hb=b15dfacb6026af3b0ba697e5753844923b468d2b;hp=0d7600a41b8b9fe96fa8271bf12fbbe5fdc68adf;hpb=d647e5f3b1c1bd19a081bf05b3d81341c1e7858e;p=freertos 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 0d7600a41..7972a95be 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 @@ -1,6 +1,6 @@ /* - * FreeRTOS Kernel V10.2.0 - * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * FreeRTOS Kernel V10.3.0 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in @@ -34,46 +34,63 @@ #include "secure_port_macros.h" /* Start address of non-secure application. */ -#define mainNONSECURE_APP_START_ADDRESS ( 0x200000U ) +#define mainNONSECURE_APP_START_ADDRESS ( 0x200000U ) /* typedef for non-secure Reset Handler. */ -typedef void ( *NonSecureResetHandler_t ) ( void ) __attribute__( ( cmse_nonsecure_call ) ); +typedef void ( *NonSecureResetHandler_t ) ( void ) __attribute__( ( cmse_nonsecure_call ) ); /*-----------------------------------------------------------*/ /* Boot into the non-secure code. */ void BootNonSecure( uint32_t ulNonSecureStartAddress ); /*-----------------------------------------------------------*/ -void BootNonSecure( uint32_t ulNonSecureStartAddress ) -{ - NonSecureResetHandler_t pxNonSecureResetHandler; - - /* Main Stack Pointer value for the non-secure side is the first entry in - * the non-secure vector table. Read the first entry and assign the same to - * the non-secure main stack pointer(MSP_NS). */ - secureportSET_MSP_NS( *( ( 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". + */ - /* Non secure Reset Handler is the second entry in the non-secure vector - * table. Read the non-secure reset handler. - */ - pxNonSecureResetHandler = ( NonSecureResetHandler_t )( * ( ( uint32_t * ) ( ( ulNonSecureStartAddress ) + 4U ) ) ); +/* Secure main() */ +int main( void ) +{ + /* Boot the non-secure code. */ + BootNonSecure( mainNONSECURE_APP_START_ADDRESS ); - /* Start non-secure software application by jumping to the non-secure Reset - * Handler. */ - pxNonSecureResetHandler(); + /* Non-secure software does not return, this code is not executed. */ + for( ; ; ) + { + /* Should not reach here. */ + } } /*-----------------------------------------------------------*/ -/* Secure main() */ -int main( void ) +void BootNonSecure( uint32_t ulNonSecureStartAddress ) { - /* Boot the non-secure code. */ - BootNonSecure( mainNONSECURE_APP_START_ADDRESS ); + NonSecureResetHandler_t pxNonSecureResetHandler; - /* Non-secure software does not return, this code is not executed. */ - for( ; ; ) - { - /* Should not reach here. */ - } + /* Main Stack Pointer value for the non-secure side is the first entry in + * the non-secure vector table. Read the first entry and assign the same to + * the non-secure main stack pointer(MSP_NS). */ + secureportSET_MSP_NS( *( ( uint32_t * )( ulNonSecureStartAddress ) ) ); + + /* Non secure Reset Handler is the second entry in the non-secure vector + * table. Read the non-secure reset handler. + */ + pxNonSecureResetHandler = ( NonSecureResetHandler_t )( * ( ( uint32_t * ) ( ( ulNonSecureStartAddress ) + 4U ) ) ); + + /* Start non-secure software application by jumping to the non-secure Reset + * Handler. */ + pxNonSecureResetHandler(); } /*-----------------------------------------------------------*/ +