mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-09-24 12:23:57 +08:00
Add non trustzone (NTZ) projects for M2351 (#1003)
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
*.uvgui*
|
||||
settings/
|
||||
Nu_Link_Driver.ini
|
||||
EventRecorderStub.scvd
|
||||
*.ewt
|
||||
*.dep
|
||||
|
||||
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
See http://www.freertos.org/a00110.html for an explanation of the
|
||||
definitions contained in this file.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* https://www.FreeRTOS.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
/* The #ifdef guards against the file being included from IAR assembly files. */
|
||||
#ifndef __IASMARM__
|
||||
|
||||
extern uint32_t SystemCoreClock;
|
||||
|
||||
#endif /* __IASMARM__ */
|
||||
|
||||
/* Cortex M33 port configuration. */
|
||||
#define configENABLE_MPU 1
|
||||
#define configENABLE_FPU 0
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||
|
||||
/* Constants related to the behaviour or the scheduler. */
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
|
||||
|
||||
/* Constants that describe the hardware and memory usage. */
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 20 * 1024 ) )
|
||||
|
||||
/* Constants that build features in or out. */
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
|
||||
/* Constants that define which hook (callback) functions should be used. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
/* Constants provided for debugging and optimisation assistance. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( 3 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
|
||||
* only necessary if the linker does not automatically remove functions that are
|
||||
* not referenced anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTaskResumeFromISR 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 0
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to
|
||||
* human readable ASCII form. See the notes in the implementation of vTaskList()
|
||||
* within FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Dimensions a buffer that can be used by the FreeRTOS+CLI command interpreter.
|
||||
* See the FreeRTOS+CLI documentation for more information:
|
||||
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/ */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
|
||||
|
||||
/* Interrupt priority configuration follows...................... */
|
||||
|
||||
/* Use the system definition, if there is one. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 3 /* 8 priority levels. */
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
* function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
|
||||
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
|
||||
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
* to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
/* The #ifdef guards against the file being included from IAR assembly files. */
|
||||
#ifndef __IASMARM__
|
||||
|
||||
/* Constants related to the generation of run time stats. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 100 )
|
||||
|
||||
#endif /* __IASMARM__ */
|
||||
|
||||
/* Enable static allocation. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
+1554
File diff suppressed because it is too large
Load Diff
+1198
File diff suppressed because it is too large
Load Diff
+19
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\FreeRTOSDemo.ewp</path>
|
||||
</project>
|
||||
|
||||
<batchBuild>
|
||||
<batchDefinition>
|
||||
<name>all</name>
|
||||
<member>
|
||||
<project>FreeRTOSDemo</project>
|
||||
<configuration>Release</configuration>
|
||||
</member>
|
||||
</batchDefinition>
|
||||
</batchBuild>
|
||||
</workspace>
|
||||
|
||||
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v2_1.xml" */
|
||||
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
|
||||
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_IROM1_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_IROM1_end__ = 0x0007FFFF;
|
||||
define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_IRAM1_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_IRAM1_end__ = 0x20017FFF;
|
||||
define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_IRAM2_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM1_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM2_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x800;
|
||||
define symbol __ICFEDIT_size_proc_s_stack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_main_ns_stack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_proc_ns_stack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x0;
|
||||
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
/* Flash Organization
|
||||
* 1. Privileged Code:
|
||||
* Start : 0x00000000
|
||||
* End : 0x00006FFF
|
||||
* Size : 28 Kbytes
|
||||
* 2. System calls:
|
||||
* Start : 0x00007000
|
||||
* End : 0x00007FFF
|
||||
* Size : 4 Kbytes
|
||||
* 3. Unprivileged Code:
|
||||
* Start : 0x00008000
|
||||
* End : 0x0007FFFF
|
||||
* Size : 480 Kbytes
|
||||
*/
|
||||
define symbol __region_ROM_Privileged_start__ = 0x00000000;
|
||||
define symbol __region_ROM_Privileged_end__ = 0x00006FFF;
|
||||
define symbol __region_ROM_SystemCalls_start__ = 0x00007000;
|
||||
define symbol __region_ROM_SystemCalls_end__ = 0x00007FFF;
|
||||
define symbol __region_ROM_Unprivileged_start__ = 0x00008000;
|
||||
define symbol __region_ROM_Unprivileged_end__ = 0x0007FFFF;
|
||||
|
||||
/* RAM Organization
|
||||
* 1. Privileged Data:
|
||||
* Start : 0x20000000
|
||||
* End : 0x20007FFF
|
||||
* Size : 32 Kbytes
|
||||
* 2. Unprivileged Data:
|
||||
* Start : 0x20008000
|
||||
* End : 0x20017FFF
|
||||
* Size : 64 Kbytes
|
||||
*/
|
||||
define symbol __region_RAM_Privileged_start__ = 0x20000000;
|
||||
define symbol __region_RAM_Privileged_end__ = 0x20007FFF;
|
||||
define symbol __region_RAM_Unprivileged_start__ = 0x20008000;
|
||||
define symbol __region_RAM_Unprivileged_end__ = 0x20017FFF;
|
||||
|
||||
/* Memory Regions. */
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_Privileged_region = mem:[from __region_ROM_Privileged_start__ to __region_ROM_Privileged_end__];
|
||||
define region ROM_SystemCalls_region = mem:[from __region_ROM_SystemCalls_start__ to __region_ROM_SystemCalls_end__];
|
||||
define region ROM_Unprivileged_region = mem:[from __region_ROM_Unprivileged_start__ to __region_ROM_Unprivileged_end__];
|
||||
define region RAM_Privileged_region = mem:[from __region_RAM_Privileged_start__ to __region_RAM_Privileged_end__];
|
||||
define region RAM_Unprivileged_region = mem:[from __region_RAM_Unprivileged_start__ to __region_RAM_Unprivileged_end__];
|
||||
|
||||
/* Stack and Heap. */
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block PROC_STACK_S with alignment = 8, size = __ICFEDIT_size_proc_s_stack__ { };
|
||||
define block MAIN_STACK_NS with alignment = 8, size = __ICFEDIT_size_main_ns_stack__ { };
|
||||
define block PROC_STACK_NS with alignment = 8, size = __ICFEDIT_size_proc_ns_stack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
/* Initialization. */
|
||||
do not initialize { section .noinit };
|
||||
initialize by copy { readwrite };
|
||||
if( isdefinedsymbol(__USE_DLIB_PERTHREAD) )
|
||||
{
|
||||
/* Required in a multi-threaded application. */
|
||||
initialize by copy with packing = none { section __DLIB_PERTHREAD };
|
||||
}
|
||||
|
||||
/* Exported symbols. */
|
||||
define exported symbol __privileged_functions_start__ = __region_ROM_Privileged_start__;
|
||||
define exported symbol __privileged_functions_end__ = __region_ROM_Privileged_end__;
|
||||
define exported symbol __syscalls_flash_start__ = __region_ROM_SystemCalls_start__;
|
||||
define exported symbol __syscalls_flash_end__ = __region_ROM_SystemCalls_end__;
|
||||
define exported symbol __unprivileged_flash_start__ = __region_ROM_Unprivileged_start__;
|
||||
define exported symbol __unprivileged_flash_end__ = __region_ROM_Unprivileged_end__;
|
||||
define exported symbol __privileged_sram_start__ = __region_RAM_Privileged_start__;
|
||||
define exported symbol __privileged_sram_end__ = __region_RAM_Privileged_end__;
|
||||
|
||||
/* Placements. */
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_Privileged_region { readonly section privileged_functions };
|
||||
place in ROM_SystemCalls_region { readonly section freertos_system_calls };
|
||||
place in ROM_Unprivileged_region { readonly };
|
||||
|
||||
place in RAM_Privileged_region { readwrite section privileged_data };
|
||||
place in RAM_Unprivileged_region { readwrite,
|
||||
block CSTACK, block PROC_STACK_S, block MAIN_STACK_NS, block PROC_STACK_NS, block HEAP };
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
EXTERN vHandleMemoryFault
|
||||
PUBLIC HardFault_Handler
|
||||
|
||||
SECTION .text:CODE:NOROOT(2)
|
||||
THUMB
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
HardFault_Handler:
|
||||
movs r0, #4
|
||||
mov r1, lr
|
||||
tst r0, r1
|
||||
beq stacking_used_msp
|
||||
mrs r0, psp
|
||||
b vHandleMemoryFault
|
||||
stacking_used_msp:
|
||||
mrs r0, msp
|
||||
b vHandleMemoryFault
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
END
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* Device includes. */
|
||||
#include <arm_cmse.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Demo includes. */
|
||||
#include "mpu_demo.h"
|
||||
#include "reg_tests.h"
|
||||
|
||||
/**
|
||||
* @brief Sets up the hardware - clocks and UARTs.
|
||||
*/
|
||||
static void prvSetupHardware( void );
|
||||
|
||||
/**
|
||||
* @brief Create all demo tasks.
|
||||
*/
|
||||
static void prvCreateTasks( void );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Initialize the hardware. */
|
||||
prvSetupHardware();
|
||||
|
||||
/* Print banner. */
|
||||
printf( "\r\n" );
|
||||
printf( "+---------------------------------------------+\r\n" );
|
||||
printf( "| Application is running ... |\r\n" );
|
||||
printf( "+---------------------------------------------+\r\n" );
|
||||
|
||||
/* Create tasks. */
|
||||
prvCreateTasks();
|
||||
|
||||
/* Start scheduler. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* Will not get here if the scheduler starts successfully. If you do end up
|
||||
here then there wasn't enough heap memory available to start either the idle
|
||||
task or the timer/daemon task. https://www.freertos.org/a00111.html */
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
/* Unlock protected registers. */
|
||||
SYS_UnlockReg();
|
||||
|
||||
/* Init System Clock. */
|
||||
/* Enable PLL */
|
||||
CLK->PLLCTL = CLK_PLLCTL_64MHz_HIRC;
|
||||
/* Wait for PLL to be stable. */
|
||||
while( ( CLK->STATUS & CLK_STATUS_PLLSTB_Msk ) == 0 );
|
||||
|
||||
/* Set HCLK divider to 1. */
|
||||
CLK->CLKDIV0 = ( CLK->CLKDIV0 & ( ~CLK_CLKDIV0_HCLKDIV_Msk ) );
|
||||
|
||||
/* Switch HCLK clock source to PLL. */
|
||||
CLK->CLKSEL0 = ( CLK->CLKSEL0 & ( ~CLK_CLKSEL0_HCLKSEL_Msk ) ) | CLK_CLKSEL0_HCLKSEL_PLL;
|
||||
|
||||
/* Initialize UART0 - It is used for debug output from the non-secure side. */
|
||||
/* Enable UART0 clock. */
|
||||
CLK->APBCLK0 |= CLK_APBCLK0_UART0CKEN_Msk;
|
||||
|
||||
/* Select UART0 clock source. */
|
||||
CLK->CLKSEL1 = ( CLK->CLKSEL1 & ( ~CLK_CLKSEL1_UART0SEL_Msk ) ) | CLK_CLKSEL1_UART0SEL_HIRC;
|
||||
|
||||
/* Set multi-function pins for UART0 RXD and TXD. */
|
||||
SYS->GPB_MFPH = ( SYS->GPB_MFPH & ( ~UART0_RXD_PB12_Msk ) ) | UART0_RXD_PB12;
|
||||
SYS->GPB_MFPH = ( SYS->GPB_MFPH & ( ~UART0_TXD_PB13_Msk ) ) | UART0_TXD_PB13;
|
||||
|
||||
/* Initialize UART1 - It is used for debug output from the secure side. */
|
||||
/* Enable UART1 clock. */
|
||||
CLK->APBCLK0 |= CLK_APBCLK0_UART1CKEN_Msk;
|
||||
|
||||
/* Select UART1 clock source. */
|
||||
CLK->CLKSEL1 = ( CLK->CLKSEL1 & ( ~CLK_CLKSEL1_UART1SEL_Msk ) ) | CLK_CLKSEL1_UART1SEL_HIRC;
|
||||
|
||||
/* Set multi-function pins for UART1 RXD and TXD. */
|
||||
SYS->GPA_MFPL = ( SYS->GPA_MFPL & ( ~UART1_RXD_PA2_Msk ) ) | UART1_RXD_PA2;
|
||||
SYS->GPA_MFPL = ( SYS->GPA_MFPL & ( ~UART1_TXD_PA3_Msk ) ) | UART1_TXD_PA3;
|
||||
|
||||
/* Update System Core Clock. */
|
||||
PllClock = 64000000; /* PLL. */
|
||||
SystemCoreClock = 64000000 / 1; /* HCLK. */
|
||||
CyclesPerUs = 64000000 / 1000000; /* For SYS_SysTickDelay(). */
|
||||
|
||||
/* Initialize the debug port. */
|
||||
DEBUG_PORT->BAUD = UART_BAUD_MODE2 | UART_BAUD_MODE2_DIVIDER(__HIRC, 115200);
|
||||
DEBUG_PORT->LINE = UART_WORD_LEN_8 | UART_PARITY_NONE | UART_STOP_BIT_1;
|
||||
|
||||
/* Lock protected registers. */
|
||||
SYS_LockReg();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCreateTasks( void )
|
||||
{
|
||||
/* Create tasks for the MPU Demo. */
|
||||
vStartMPUDemo();
|
||||
|
||||
/* Create tasks for register tests. */
|
||||
vStartRegTests();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Stack overflow hook. */
|
||||
void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )
|
||||
{
|
||||
/* Force an assert. */
|
||||
configASSERT( pcTaskName == 0 );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be
|
||||
* allocated on the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle
|
||||
* task's state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be
|
||||
* allocated on the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ] __attribute__( ( aligned( 32 ) ) );
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
See http://www.freertos.org/a00110.html for an explanation of the
|
||||
definitions contained in this file.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* https://www.FreeRTOS.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
extern uint32_t SystemCoreClock;
|
||||
|
||||
/* Cortex M23 port configuration. */
|
||||
#define configENABLE_MPU 1
|
||||
#define configENABLE_FPU 0
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||
|
||||
/* Constants related to the behaviour or the scheduler. */
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
|
||||
|
||||
/* Constants that describe the hardware and memory usage. */
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
|
||||
|
||||
/* Constants that build features in or out. */
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
|
||||
/* Constants that define which hook (callback) functions should be used. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
/* Constants provided for debugging and optimisation assistance. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( 3 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
|
||||
* only necessary if the linker does not automatically remove functions that are
|
||||
* not referenced anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTaskResumeFromISR 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 0
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to
|
||||
* human readable ASCII form. See the notes in the implementation of vTaskList()
|
||||
* within FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Dimensions a buffer that can be used by the FreeRTOS+CLI command interpreter.
|
||||
* See the FreeRTOS+CLI documentation for more information:
|
||||
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/ */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
|
||||
|
||||
/* Interrupt priority configuration follows...................... */
|
||||
|
||||
/* Use the system definition, if there is one. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 3 /* 8 priority levels. */
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
* function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
|
||||
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
|
||||
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
* to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
/* The #ifdef guards against the file being included from IAR assembly files. */
|
||||
#ifndef __IASMARM__
|
||||
|
||||
/* Constants related to the generation of run time stats. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 100 )
|
||||
|
||||
#endif /* __IASMARM__ */
|
||||
|
||||
/* Enable static allocation. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
; NOTE: ARMv8-M MPU requires that each region must start on a 32 byte aligned
|
||||
; address and the size of a region must be a multiple of 32 bytes.
|
||||
;
|
||||
; Flash Layout
|
||||
;
|
||||
; ---------------------
|
||||
; | Privileged Code |
|
||||
; ---------------------
|
||||
; | System Calls |
|
||||
; ---------------------
|
||||
; | Unprivileged Code |
|
||||
; ---------------------
|
||||
;
|
||||
; RAM Layout
|
||||
;
|
||||
; ---------------------
|
||||
; | Privileged Data |
|
||||
; ---------------------
|
||||
; | Unprivileged Data |
|
||||
; ---------------------
|
||||
|
||||
LR_APP 0x00000000 ; load region
|
||||
{
|
||||
ER_IROM_PRIVILEGED +0 ALIGN 32
|
||||
{
|
||||
*.o(RESET, +First)
|
||||
*(InRoot$$Sections) ; All sections that must be in a root region
|
||||
*(privileged_functions)
|
||||
}
|
||||
|
||||
ER_IROM_PRIVILEGED_ALIGN +0 ALIGN 32 EMPTY 0x0
|
||||
{
|
||||
}
|
||||
|
||||
ER_IROM_FREERTOS_SYSTEM_CALLS +0 ALIGN 32
|
||||
{
|
||||
*(freertos_system_calls)
|
||||
}
|
||||
|
||||
ER_IROM_FREERTOS_SYSTEM_CALLS_ALIGN +0 ALIGN 32 EMPTY 0x0
|
||||
{
|
||||
}
|
||||
|
||||
ER_IROM_UNPRIVILEGED +0 ALIGN 32
|
||||
{
|
||||
*(+RO)
|
||||
}
|
||||
|
||||
ER_IROM_UNPRIVILEGED_ALIGN +0 ALIGN 32 EMPTY 0x0
|
||||
{
|
||||
}
|
||||
|
||||
ER_IRAM_PRIVILEGED 0x20000000 ALIGN 32
|
||||
{
|
||||
*(privileged_data)
|
||||
}
|
||||
|
||||
ER_IRAM_PRIVILEGED_ALIGN +0 ALIGN 32 EMPTY 0x0
|
||||
{
|
||||
}
|
||||
|
||||
ER_IRAM_UNPRIVILEGED +0 ALIGN 32
|
||||
{
|
||||
*(+RW, +ZI)
|
||||
}
|
||||
|
||||
ER_IRAM_UNPRIVILEGED_ALIGN +0 ALIGN 32 EMPTY 0x0
|
||||
{
|
||||
}
|
||||
}
|
||||
+547
File diff suppressed because it is too large
Load Diff
+615
File diff suppressed because it is too large
Load Diff
+3
@@ -0,0 +1,3 @@
|
||||
LOAD ".\\Objects\\FreeRTOSDemo.axf" incremental
|
||||
RESET
|
||||
g, \\FreeRTOSDemo\main\main
|
||||
+265
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* Device includes. */
|
||||
#include <arm_cmse.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Demo includes. */
|
||||
#include "mpu_demo.h"
|
||||
#include "reg_tests.h"
|
||||
|
||||
/* Externs needed by the MPU setup code. These are defined in Scatter-Loading
|
||||
* description file (FreeRTOSDemo.sct). */
|
||||
extern uint32_t Image$$ER_IROM_PRIVILEGED$$Base;
|
||||
extern uint32_t Image$$ER_IROM_PRIVILEGED_ALIGN$$Limit;
|
||||
extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base;
|
||||
extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS_ALIGN$$Limit;
|
||||
extern uint32_t Image$$ER_IROM_UNPRIVILEGED$$Base;
|
||||
extern uint32_t Image$$ER_IROM_UNPRIVILEGED_ALIGN$$Limit;
|
||||
|
||||
extern uint32_t Image$$ER_IRAM_PRIVILEGED$$Base;
|
||||
extern uint32_t Image$$ER_IRAM_PRIVILEGED_ALIGN$$Limit;
|
||||
extern uint32_t Image$$ER_IRAM_UNPRIVILEGED$$Base;
|
||||
extern uint32_t Image$$ER_IRAM_UNPRIVILEGED_ALIGN$$Limit;
|
||||
|
||||
/* Privileged flash. */
|
||||
const uint32_t * __privileged_functions_start__ = ( uint32_t * ) &( Image$$ER_IROM_PRIVILEGED$$Base );
|
||||
const uint32_t * __privileged_functions_end__ = ( uint32_t * ) ( ( uint32_t ) &( Image$$ER_IROM_PRIVILEGED_ALIGN$$Limit ) - 0x1 ); /* Last address in privileged Flash region. */
|
||||
|
||||
/* Flash containing system calls. */
|
||||
const uint32_t * __syscalls_flash_start__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base );
|
||||
const uint32_t * __syscalls_flash_end__ = ( uint32_t * ) ( ( uint32_t ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS_ALIGN$$Limit ) - 0x1 ); /* Last address in Flash region containing system calls. */
|
||||
|
||||
/* Unprivileged flash. Note that the section containing system calls is
|
||||
* unprivileged so that unprivileged tasks can make system calls. */
|
||||
const uint32_t * __unprivileged_flash_start__ = ( uint32_t * ) &( Image$$ER_IROM_UNPRIVILEGED$$Base );
|
||||
const uint32_t * __unprivileged_flash_end__ = ( uint32_t * ) ( ( uint32_t ) &( Image$$ER_IROM_UNPRIVILEGED_ALIGN$$Limit ) - 0x1 ); /* Last address in un-privileged Flash region. */
|
||||
|
||||
/* RAM with priviledged access only. This contains kernel data. */
|
||||
const uint32_t * __privileged_sram_start__ = ( uint32_t * ) &( Image$$ER_IRAM_PRIVILEGED$$Base );
|
||||
const uint32_t * __privileged_sram_end__ = ( uint32_t * ) ( ( uint32_t ) &( Image$$ER_IRAM_PRIVILEGED_ALIGN$$Limit ) - 0x1 ); /* Last address in privileged RAM. */
|
||||
|
||||
/* Unprivileged RAM. */
|
||||
const uint32_t * __unprivileged_sram_start__ = ( uint32_t * ) &( Image$$ER_IRAM_UNPRIVILEGED$$Base );
|
||||
const uint32_t * __unprivileged_sram_end__ = ( uint32_t * ) ( ( uint32_t ) &( Image$$ER_IRAM_UNPRIVILEGED_ALIGN$$Limit ) - 0x1 ); /* Last address in un-privileged RAM. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Sets up the hardware - clocks and UARTs.
|
||||
*/
|
||||
static void prvSetupHardware( void );
|
||||
|
||||
/**
|
||||
* @brief Create all demo tasks.
|
||||
*/
|
||||
static void prvCreateTasks( void );
|
||||
|
||||
/**
|
||||
* @brief The hard fault handler.
|
||||
*
|
||||
* It calls a function called vHandleMemoryFault.
|
||||
*/
|
||||
void HardFault_Handler( void ) __attribute__ ( ( naked ) );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Initialize the hardware. */
|
||||
prvSetupHardware();
|
||||
|
||||
/* Print banner. */
|
||||
printf( "\r\n" );
|
||||
printf( "+---------------------------------------------+\r\n" );
|
||||
printf( "| Application is running ... |\r\n" );
|
||||
printf( "+---------------------------------------------+\r\n" );
|
||||
|
||||
/* Create tasks. */
|
||||
prvCreateTasks();
|
||||
|
||||
/* Start scheduler. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* Will not get here if the scheduler starts successfully. If you do end up
|
||||
here then there wasn't enough heap memory available to start either the idle
|
||||
task or the timer/daemon task. https://www.freertos.org/a00111.html */
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
/* Unlock protected registers. */
|
||||
SYS_UnlockReg();
|
||||
|
||||
/* Init System Clock. */
|
||||
/* Enable PLL */
|
||||
CLK->PLLCTL = CLK_PLLCTL_64MHz_HIRC;
|
||||
/* Wait for PLL to be stable. */
|
||||
while( ( CLK->STATUS & CLK_STATUS_PLLSTB_Msk ) == 0 );
|
||||
|
||||
/* Set HCLK divider to 1. */
|
||||
CLK->CLKDIV0 = ( CLK->CLKDIV0 & ( ~CLK_CLKDIV0_HCLKDIV_Msk ) );
|
||||
|
||||
/* Switch HCLK clock source to PLL. */
|
||||
CLK->CLKSEL0 = ( CLK->CLKSEL0 & ( ~CLK_CLKSEL0_HCLKSEL_Msk ) ) | CLK_CLKSEL0_HCLKSEL_PLL;
|
||||
|
||||
/* Initialize UART0 - It is used for debug output from the non-secure side. */
|
||||
/* Enable UART0 clock. */
|
||||
CLK->APBCLK0 |= CLK_APBCLK0_UART0CKEN_Msk;
|
||||
|
||||
/* Select UART0 clock source. */
|
||||
CLK->CLKSEL1 = ( CLK->CLKSEL1 & ( ~CLK_CLKSEL1_UART0SEL_Msk ) ) | CLK_CLKSEL1_UART0SEL_HIRC;
|
||||
|
||||
/* Set multi-function pins for UART0 RXD and TXD. */
|
||||
SYS->GPB_MFPH = ( SYS->GPB_MFPH & ( ~UART0_RXD_PB12_Msk ) ) | UART0_RXD_PB12;
|
||||
SYS->GPB_MFPH = ( SYS->GPB_MFPH & ( ~UART0_TXD_PB13_Msk ) ) | UART0_TXD_PB13;
|
||||
|
||||
/* Initialize UART1 - It is used for debug output from the secure side. */
|
||||
/* Enable UART1 clock. */
|
||||
CLK->APBCLK0 |= CLK_APBCLK0_UART1CKEN_Msk;
|
||||
|
||||
/* Select UART1 clock source. */
|
||||
CLK->CLKSEL1 = ( CLK->CLKSEL1 & ( ~CLK_CLKSEL1_UART1SEL_Msk ) ) | CLK_CLKSEL1_UART1SEL_HIRC;
|
||||
|
||||
/* Set multi-function pins for UART1 RXD and TXD. */
|
||||
SYS->GPA_MFPL = ( SYS->GPA_MFPL & ( ~UART1_RXD_PA2_Msk ) ) | UART1_RXD_PA2;
|
||||
SYS->GPA_MFPL = ( SYS->GPA_MFPL & ( ~UART1_TXD_PA3_Msk ) ) | UART1_TXD_PA3;
|
||||
|
||||
/* Update System Core Clock. */
|
||||
PllClock = 64000000; /* PLL. */
|
||||
SystemCoreClock = 64000000 / 1; /* HCLK. */
|
||||
CyclesPerUs = 64000000 / 1000000; /* For SYS_SysTickDelay(). */
|
||||
|
||||
/* Initialize the debug port. */
|
||||
DEBUG_PORT->BAUD = UART_BAUD_MODE2 | UART_BAUD_MODE2_DIVIDER(__HIRC, 115200);
|
||||
DEBUG_PORT->LINE = UART_WORD_LEN_8 | UART_PARITY_NONE | UART_STOP_BIT_1;
|
||||
|
||||
/* Lock protected registers. */
|
||||
SYS_LockReg();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCreateTasks( void )
|
||||
{
|
||||
/* Create tasks for the MPU Demo. */
|
||||
vStartMPUDemo();
|
||||
|
||||
/* Create tasks for register tests. */
|
||||
vStartRegTests();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Stack overflow hook. */
|
||||
void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )
|
||||
{
|
||||
/* Force an assert. */
|
||||
configASSERT( pcTaskName == 0 );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be
|
||||
* allocated on the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle
|
||||
* task's state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be
|
||||
* allocated on the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ] __attribute__( ( aligned( 32 ) ) );
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void HardFault_Handler( void )
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
" movs r0, #4 \n"
|
||||
" mov r1, lr \n"
|
||||
" tst r0, r1 \n"
|
||||
" beq msp_used_for_stacking \n"
|
||||
" mrs r0, psp \n"
|
||||
" ldr r2, handler_address_const \n"
|
||||
" bx r2 \n"
|
||||
"msp_used_for_stacking: \n"
|
||||
" mrs r0, msp \n"
|
||||
" ldr r2, handler_address_const \n"
|
||||
" bx r2 \n"
|
||||
" \n"
|
||||
" .align 4 \n"
|
||||
" handler_address_const: .word vHandleMemoryFault \n"
|
||||
);
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
+88
-54
@@ -31,7 +31,9 @@
|
||||
/* Reg test includes. */
|
||||
#include "reg_tests.h"
|
||||
#include "reg_test_asm.h"
|
||||
#include "secure_reg_test_asm.h"
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
#include "secure_reg_test_asm.h"
|
||||
#endif
|
||||
|
||||
/* Device includes. */
|
||||
#include "NuMicro.h"
|
||||
@@ -41,9 +43,10 @@
|
||||
*/
|
||||
static void prvRegTest1_Task( void * pvParameters );
|
||||
static void prvRegTest2_Task( void * pvParameters );
|
||||
static void prvRegTest_Secure_Task( void * pvParameters );
|
||||
static void prvRegTest_NonSecureCallback_Task( void * pvParameters );
|
||||
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
static void prvRegTest_Secure_Task( void * pvParameters );
|
||||
static void prvRegTest_NonSecureCallback_Task( void * pvParameters );
|
||||
#endif
|
||||
/*
|
||||
* Check task periodically checks that reg tests tasks
|
||||
* are running fine.
|
||||
@@ -54,8 +57,13 @@ static void prvCheckTask( void * pvParameters );
|
||||
/*
|
||||
* On board LEDs.
|
||||
*/
|
||||
#define YELLOW_LED PA11_NS
|
||||
#define GREEN_LED PA10_NS
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
#define YELLOW_LED PA11_NS
|
||||
#define GREEN_LED PA10_NS
|
||||
#else
|
||||
#define YELLOW_LED PA11
|
||||
#define GREEN_LED PA10
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Priority of the check task.
|
||||
@@ -84,8 +92,10 @@ static void prvCheckTask( void * pvParameters );
|
||||
* incrementing, then an error has been found.
|
||||
*/
|
||||
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
|
||||
volatile unsigned long ulRegTestSecureLoopCounter = 0UL;
|
||||
volatile unsigned long ulRegTestNonSecureCallbackLoopCounter = 0UL;
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
volatile unsigned long ulRegTestSecureLoopCounter = 0UL;
|
||||
volatile unsigned long ulRegTestNonSecureCallbackLoopCounter = 0UL;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Counter to keep a count of how may times the check task loop has detected
|
||||
@@ -98,9 +108,11 @@ void vStartRegTests( void )
|
||||
{
|
||||
static StackType_t xRegTest1TaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
static StackType_t xRegTest2TaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
static StackType_t xRegTestSecureTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
static StackType_t xRegTestNonSecureCallbackTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
static StackType_t xCheckTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
static StackType_t xRegTestSecureTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
static StackType_t xRegTestNonSecureCallbackTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
|
||||
#endif
|
||||
|
||||
TaskParameters_t xRegTest1TaskParameters =
|
||||
{
|
||||
@@ -130,35 +142,6 @@ TaskParameters_t xRegTest2TaskParameters =
|
||||
{ 0, 0, 0 }
|
||||
}
|
||||
};
|
||||
TaskParameters_t xRegTestSecureTaskParameters =
|
||||
{
|
||||
.pvTaskCode = prvRegTest_Secure_Task,
|
||||
.pcName = "RegTestSecure",
|
||||
.usStackDepth = configMINIMAL_STACK_SIZE,
|
||||
.pvParameters = REG_TEST_SECURE_TASK_PARAMETER,
|
||||
.uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
|
||||
.puxStackBuffer = xRegTestSecureTaskStack,
|
||||
.xRegions = {
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 }
|
||||
}
|
||||
};
|
||||
TaskParameters_t xRegTestNonSecureCallbackTaskParameters =
|
||||
{
|
||||
.pvTaskCode = prvRegTest_NonSecureCallback_Task,
|
||||
.pcName = "RegTestNonSecureCallback",
|
||||
.usStackDepth = configMINIMAL_STACK_SIZE,
|
||||
.pvParameters = REG_TEST_NON_SECURE_CALLBACK_TASK_PARAMETER,
|
||||
.uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
|
||||
.puxStackBuffer = xRegTestNonSecureCallbackTaskStack,
|
||||
.xRegions = {
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 }
|
||||
}
|
||||
};
|
||||
|
||||
TaskParameters_t xCheckTaskParameters =
|
||||
{
|
||||
.pvTaskCode = prvCheckTask,
|
||||
@@ -174,8 +157,43 @@ TaskParameters_t xCheckTaskParameters =
|
||||
}
|
||||
};
|
||||
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
TaskParameters_t xRegTestSecureTaskParameters =
|
||||
{
|
||||
.pvTaskCode = prvRegTest_Secure_Task,
|
||||
.pcName = "RegTestSecure",
|
||||
.usStackDepth = configMINIMAL_STACK_SIZE,
|
||||
.pvParameters = REG_TEST_SECURE_TASK_PARAMETER,
|
||||
.uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
|
||||
.puxStackBuffer = xRegTestSecureTaskStack,
|
||||
.xRegions = {
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 }
|
||||
}
|
||||
};
|
||||
TaskParameters_t xRegTestNonSecureCallbackTaskParameters =
|
||||
{
|
||||
.pvTaskCode = prvRegTest_NonSecureCallback_Task,
|
||||
.pcName = "RegTestNonSecureCallback",
|
||||
.usStackDepth = configMINIMAL_STACK_SIZE,
|
||||
.pvParameters = REG_TEST_NON_SECURE_CALLBACK_TASK_PARAMETER,
|
||||
.uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
|
||||
.puxStackBuffer = xRegTestNonSecureCallbackTaskStack,
|
||||
.xRegions = {
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 }
|
||||
}
|
||||
};
|
||||
#endif /* configENABLE_TRUSTZONE */
|
||||
|
||||
/* Configure pins in output mode to drive external LEDs. */
|
||||
GPIO_SetMode( PA_NS, BIT10 | BIT11, GPIO_MODE_OUTPUT );
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
GPIO_SetMode( PA_NS, BIT10 | BIT11, GPIO_MODE_OUTPUT );
|
||||
#else
|
||||
GPIO_SetMode( PA, BIT10 | BIT11, GPIO_MODE_OUTPUT );
|
||||
#endif
|
||||
|
||||
/* Start with both LEDs off. */
|
||||
YELLOW_LED = 1;
|
||||
@@ -183,9 +201,11 @@ TaskParameters_t xCheckTaskParameters =
|
||||
|
||||
xTaskCreateRestricted( &( xRegTest1TaskParameters ), NULL );
|
||||
xTaskCreateRestricted( &( xRegTest2TaskParameters ), NULL );
|
||||
xTaskCreateRestricted( &( xRegTestSecureTaskParameters ), NULL );
|
||||
xTaskCreateRestricted( &( xRegTestNonSecureCallbackTaskParameters ), NULL );
|
||||
xTaskCreateRestricted( &( xCheckTaskParameters ), NULL );
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
xTaskCreateRestricted( &( xRegTestSecureTaskParameters ), NULL );
|
||||
xTaskCreateRestricted( &( xRegTestNonSecureCallbackTaskParameters ), NULL );
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -227,6 +247,8 @@ static void prvRegTest2_Task( void * pvParameters )
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
|
||||
static void prvRegTest_Secure_Task( void * pvParameters )
|
||||
{
|
||||
/* This task is going to call secure side functions. */
|
||||
@@ -257,8 +279,12 @@ static void prvRegTest_Secure_Task( void * pvParameters )
|
||||
* an error. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
|
||||
static void prvRegTest_NonSecureCallback_Task( void * pvParameters )
|
||||
{
|
||||
/* This task is going to call secure side functions. */
|
||||
@@ -290,6 +316,8 @@ static void prvRegTest_NonSecureCallback_Task( void * pvParameters )
|
||||
* an error. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCheckTask( void * pvParameters )
|
||||
@@ -298,7 +326,9 @@ TickType_t xDelayPeriod = NO_ERROR_CHECK_TASK_PERIOD;
|
||||
TickType_t xLastExecutionTime;
|
||||
unsigned long ulErrorFound = pdFALSE;
|
||||
static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
|
||||
static unsigned long ulLastRegTestSecureValue = 0, ulLastRegTestNonSecureCallbackValue = 0;
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
static unsigned long ulLastRegTestSecureValue = 0, ulLastRegTestNonSecureCallbackValue = 0;
|
||||
#endif
|
||||
|
||||
/* Just to stop compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
@@ -332,20 +362,24 @@ static unsigned long ulLastRegTestSecureValue = 0, ulLastRegTestNonSecureCallbac
|
||||
}
|
||||
ulLastRegTest2Value = ulRegTest2LoopCounter;
|
||||
|
||||
/* Check that the register test secure task is still running. */
|
||||
if( ulLastRegTestSecureValue == ulRegTestSecureLoopCounter )
|
||||
#if( configENABLE_TRUSTZONE == 1 )
|
||||
{
|
||||
ulErrorFound |= 1UL << 2UL;
|
||||
}
|
||||
ulLastRegTestSecureValue = ulRegTestSecureLoopCounter;
|
||||
/* Check that the register test secure task is still running. */
|
||||
if( ulLastRegTestSecureValue == ulRegTestSecureLoopCounter )
|
||||
{
|
||||
ulErrorFound |= 1UL << 2UL;
|
||||
}
|
||||
ulLastRegTestSecureValue = ulRegTestSecureLoopCounter;
|
||||
|
||||
/* Check that the register test non-secure callback task is
|
||||
* still running. */
|
||||
if( ulLastRegTestNonSecureCallbackValue == ulRegTestNonSecureCallbackLoopCounter )
|
||||
{
|
||||
ulErrorFound |= 1UL << 3UL;
|
||||
/* Check that the register test non-secure callback task is
|
||||
* still running. */
|
||||
if( ulLastRegTestNonSecureCallbackValue == ulRegTestNonSecureCallbackLoopCounter )
|
||||
{
|
||||
ulErrorFound |= 1UL << 3UL;
|
||||
}
|
||||
ulLastRegTestNonSecureCallbackValue = ulRegTestNonSecureCallbackLoopCounter;
|
||||
}
|
||||
ulLastRegTestNonSecureCallbackValue = ulRegTestNonSecureCallbackLoopCounter;
|
||||
#endif /* configENABLE_TRUSTZONE */
|
||||
|
||||
/* Toggle the green LED to give an indication of the system status.
|
||||
* If the LED toggles every NO_ERROR_CHECK_TASK_PERIOD milliseconds
|
||||
|
||||
Reference in New Issue
Block a user