From e7d96e749ef665750edc80372ad5308ad4b081a3 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 26 Oct 2023 04:09:20 +0000 Subject: [PATCH] Add mpu_v1 and mpu_v2 test project --- FreeRTOS/Test/Coverity/CMakeLists.txt | 39 +++++ .../Test/Coverity/mpu_v1/FreeRTOSConfig.h | 149 +++++++++++++++++ FreeRTOS/Test/Coverity/mpu_v1/portmacro.h | 117 ++++++++++++++ .../Test/Coverity/mpu_v2/FreeRTOSConfig.h | 152 ++++++++++++++++++ FreeRTOS/Test/Coverity/mpu_v2/portmacro.h | 117 ++++++++++++++ 5 files changed, 574 insertions(+) create mode 100644 FreeRTOS/Test/Coverity/mpu_v1/FreeRTOSConfig.h create mode 100644 FreeRTOS/Test/Coverity/mpu_v1/portmacro.h create mode 100644 FreeRTOS/Test/Coverity/mpu_v2/FreeRTOSConfig.h create mode 100644 FreeRTOS/Test/Coverity/mpu_v2/portmacro.h diff --git a/FreeRTOS/Test/Coverity/CMakeLists.txt b/FreeRTOS/Test/Coverity/CMakeLists.txt index f22ef261e6b..ed045f442ca 100644 --- a/FreeRTOS/Test/Coverity/CMakeLists.txt +++ b/FreeRTOS/Test/Coverity/CMakeLists.txt @@ -49,6 +49,12 @@ file( GLOB FREERTOS_CONFIG_INCLUDE_MULTI_CORE2 file( GLOB FREERTOS_CONFIG_INCLUDE_SINGLE_CORE ${CMAKE_CURRENT_LIST_DIR}/SingleCoreConfig ) +file( GLOB FREERTOS_CONFIG_INCLUDE_MPU_V1 + ${CMAKE_CURRENT_LIST_DIR}/mpu_v1 ) + +file( GLOB FREERTOS_CONFIG_INCLUDE_MPU_V2 + ${CMAKE_CURRENT_LIST_DIR}/mpu_v2 ) + # A better way would be to create a library such that all other dependencies are # ignored by the static analysis tool. But, since +TCP is very closely linked # with the FreeRTOS-Kernel, an executable had to be created. @@ -101,5 +107,38 @@ target_compile_options(single PRIVATE -Wall -Wextra -Wpedantic ) +# Add the executable for static analysis +add_executable( mpu_v1 ${KERNEL_SOURCES} + ${KERNEL_DIRECTORY}/portable/Common/mpu_wrappers.c + ${CMAKE_CURRENT_LIST_DIR}/Portable.c ) + +# Link the include directories with the target +target_include_directories( mpu_v1 + PUBLIC "${KERNEL_DIRECTORY}/include" + PUBLIC "${FREERTOS_CONFIG_INCLUDE_MPU_V1}" ) + +# Uncomment the below line if the desired platform is 32-bit +# set_target_properties( mpu_v1 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" ) + +target_compile_options(mpu_v1 PRIVATE + -Wall -Wextra -Wpedantic +) + +# Add the executable for static analysis +add_executable( mpu_v2 ${KERNEL_SOURCES} + ${KERNEL_DIRECTORY}/portable/Common/mpu_wrappers_v2.c + ${CMAKE_CURRENT_LIST_DIR}/Portable.c ) + +# Link the include directories with the target +target_include_directories( mpu_v2 + PUBLIC "${KERNEL_DIRECTORY}/include" + PUBLIC "${FREERTOS_CONFIG_INCLUDE_MPU_V2}" ) + +# Uncomment the below line if the desired platform is 32-bit +# set_target_properties( mpu_v2 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" ) + +target_compile_options(mpu_v2 PRIVATE + -Wall -Wextra -Wpedantic +) diff --git a/FreeRTOS/Test/Coverity/mpu_v1/FreeRTOSConfig.h b/FreeRTOS/Test/Coverity/mpu_v1/FreeRTOSConfig.h new file mode 100644 index 00000000000..bf4e9926b78 --- /dev/null +++ b/FreeRTOS/Test/Coverity/mpu_v1/FreeRTOSConfig.h @@ -0,0 +1,149 @@ +/* + * FreeRTOS + * Copyright (C) 2022 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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + */ + + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +#define mtCOVERAGE_TEST_MARKER() /* _asm will be reported by coverity */ + +#define configRUN_TIME_COUNTER_TYPE uint32_t + +/*----------------------------------------------------------- +* 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. See +* http://www.freertos.org/a00110.html +*----------------------------------------------------------*/ + +#define configNUMBER_OF_CORES 1U +#define configUSE_MUTEXES 1 +#define configUSE_PASSIVE_IDLE_HOOK 1 +#define configUSE_PREEMPTION 1 +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 +#define configUSE_TRACE_FACILITY 1 +#define configGENERATE_RUN_TIME_STATS 1 +#define configSUPPORT_DYNAMIC_ALLOCATION 1 +#define configSUPPORT_STATIC_ALLOCATION 1 +#define configUSE_TASK_PREEMPTION_DISABLE 0 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_xTaskDelayUntil 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xTaskAbortDelay 1 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_xTaskGetIdleTaskHandle 1 +#define configUSE_TIME_SLICING 1 +#define configRUN_MULTIPLE_PRIORITIES 0 + +#define configUSE_TICKLESS_IDLE 1 +#define configCPU_CLOCK_HZ 60000000 +#define configSYSTICK_CLOCK_HZ 1000000 +#define configTICK_RATE_HZ ( 1000U ) +#define configMAX_PRIORITIES ( 7U ) +#define configMINIMAL_STACK_SIZE ( ( configSTACK_DEPTH_TYPE ) 70U ) +#define configMAX_TASK_NAME_LEN ( 5U ) +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_TASK_NOTIFICATIONS 1 +#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_ALTERNATIVE_API 0 +#define configQUEUE_REGISTRY_SIZE 20 +#define configUSE_QUEUE_SETS 1 +#define configUSE_NEWLIB_REENTRANT 0 +#define configENABLE_BACKWARD_COMPATIBILITY 1 +#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 +#define configUSE_MINI_LIST_ITEM 0 +#define configSTACK_DEPTH_TYPE uint16_t +#define configMESSAGE_BUFFER_LENGTH_TYPE size_t +#define configHEAP_CLEAR_MEMORY_ON_FREE 1 +#define configINITIAL_TICK_COUNT ( ( TickType_t ) 0 ) +#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2U + +/* Memory allocation related definitions. */ +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 52 * 1024 ) ) +#define configAPPLICATION_ALLOCATED_HEAP 1 +#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0 + +/* Hook function related definitions. */ +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 1 +#define configCHECK_FOR_STACK_OVERFLOW 0 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configUSE_DAEMON_TASK_STARTUP_HOOK 1 +#define configUSE_SB_COMPLETED_CALLBACK 1 + +/* Run time and task stats gathering related definitions. */ +#define configUSE_STATS_FORMATTING_FUNCTIONS 1 + +/* Software timer related definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY ( 6U ) +#define configTIMER_QUEUE_LENGTH 20 +#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2U ) + +/* Interrupt nesting behaviour configuration. */ +#define configKERNEL_INTERRUPT_PRIORITY ( configMAX_PRIORITIES - 1U ) +#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configMAX_PRIORITIES - 1U ) +#define configMAX_API_CALL_INTERRUPT_PRIORITY ( configMAX_PRIORITIES - 1U ) + +/* FreeRTOS MPU specific definitions. */ +#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0 +#define configTOTAL_MPU_REGIONS 8 /* Default value. */ +#define configTEX_S_C_B_FLASH 0x07UL /* Default value. */ +#define configTEX_S_C_B_SRAM 0x07UL /* Default value. */ +#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 1 +#define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 +#define configENABLE_ERRATA_837070_WORKAROUND 1 + +/* ARMv8-M secure side port related definitions. */ +#define secureconfigMAX_SECURE_CONTEXTS 5 + +/* Optional functions - most linkers will remove unused functions anyway. */ +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_xResumeFromISR 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 +#define INCLUDE_uxTaskGetStackHighWaterMark2 1 +#define INCLUDE_xEventGroupSetBitFromISR 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_xTaskGetHandle 1 +#define INCLUDE_xTaskResumeFromISR 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 +#define INCLUDE_xSemaphoreGetMutexHolder 1 + +/* Run time stats gathering configuration options. */ +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() + +#endif /* FREERTOS_CONFIG_H */ diff --git a/FreeRTOS/Test/Coverity/mpu_v1/portmacro.h b/FreeRTOS/Test/Coverity/mpu_v1/portmacro.h new file mode 100644 index 00000000000..d4b445e9e70 --- /dev/null +++ b/FreeRTOS/Test/Coverity/mpu_v1/portmacro.h @@ -0,0 +1,117 @@ +/* + * FreeRTOS + * Copyright (C) 2022 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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + */ + +#ifndef PORTMACRO_H +#define PORTMACRO_H + +/****************************************************************************** +* Defines +******************************************************************************/ +/* Type definitions. */ +#define portCHAR char +#define portFLOAT float +#define portDOUBLE double +#define portLONG long +#define portSHORT short +#define portSTACK_TYPE int32_t +#define portBASE_TYPE int32_t + +#define configISR_STACK_SIZE_WORDS + +typedef portSTACK_TYPE StackType_t; +typedef int32_t BaseType_t; +typedef uint32_t UBaseType_t; + +#if ( configUSE_16_BIT_TICKS == 1 ) + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff +#else + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL + +/* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick + * count do not need to be guarded with a critical section. */ + #define portTICK_TYPE_IS_ATOMIC 1 +#endif + +/* Hardware specifics. */ +#define portSTACK_GROWTH ( -1 ) +#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portINLINE + +#if defined( __x86_64__ ) || defined( _M_X64 ) + #define portBYTE_ALIGNMENT 8 +#else + #define portBYTE_ALIGNMENT 4 +#endif + +#define portYIELD() +#define portSOFTWARE_BARRIER() + + +/* Simulated interrupts return pdFALSE if no context switch should be performed, + * or a non-zero number if a context switch should be performed. */ +#define portYIELD_FROM_ISR( x ) ( void ) x +#define portEND_SWITCHING_ISR( x ) portYIELD_FROM_ISR( ( x ) ) + +#define portCLEAN_UP_TCB( pxTCB ) +#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) +#define portDISABLE_INTERRUPTS() +#define portENABLE_INTERRUPTS() +#define portSET_INTERRUPT_MASK( x ) ( 0 ) +#define portCLEAR_INTERRUPT_MASK( x ) ( ( void )( x ) ) + +/* Critical section handling. */ +#define portENTER_CRITICAL() +#define portEXIT_CRITICAL() + +/* Task function macros as described on the FreeRTOS.org WEB site. */ +#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) +#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) + +#define portINTERRUPT_YIELD ( 0UL ) + +#define portGET_RUN_TIME_COUNTER_VALUE(...) ( UBaseType_t )( rand() ) + +extern void vResetPrivilege( void ); +extern BaseType_t xIsPrivileged( void ); +extern void vRaisePrivilege( void ); +#define portIS_PRIVILEGED() xIsPrivileged() +#define portRESET_PRIVILEGE() vResetPrivilege() +#define portRAISE_PRIVILEGE() vRaisePrivilege() + +#define portUSING_MPU_WRAPPERS 1 +#define portCRITICAL_NESTING_IN_TCB 1 +#define portPRIVILEGE_BIT 1U + +/** + * @brief MPU settings as stored in the TCB. + */ +typedef struct MPU_SETTINGS +{ + uint32_t dummy; +} xMPU_SETTINGS; + +#endif /* ifndef PORTMACRO_H */ diff --git a/FreeRTOS/Test/Coverity/mpu_v2/FreeRTOSConfig.h b/FreeRTOS/Test/Coverity/mpu_v2/FreeRTOSConfig.h new file mode 100644 index 00000000000..142aac85e7b --- /dev/null +++ b/FreeRTOS/Test/Coverity/mpu_v2/FreeRTOSConfig.h @@ -0,0 +1,152 @@ +/* + * FreeRTOS + * Copyright (C) 2022 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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + */ + + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +#define mtCOVERAGE_TEST_MARKER() /* _asm will be reported by coverity */ + +#define configRUN_TIME_COUNTER_TYPE uint32_t + +/*----------------------------------------------------------- +* 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. See +* http://www.freertos.org/a00110.html +*----------------------------------------------------------*/ + +#define configNUMBER_OF_CORES 1U +#define configUSE_MUTEXES 1 +#define configUSE_PASSIVE_IDLE_HOOK 1 +#define configUSE_PREEMPTION 1 +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 +#define configUSE_TRACE_FACILITY 1 +#define configGENERATE_RUN_TIME_STATS 1 +#define configSUPPORT_DYNAMIC_ALLOCATION 1 +#define configSUPPORT_STATIC_ALLOCATION 1 +#define configUSE_TASK_PREEMPTION_DISABLE 0 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_xTaskDelayUntil 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xTaskAbortDelay 1 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_xTaskGetIdleTaskHandle 1 +#define configUSE_TIME_SLICING 1 +#define configRUN_MULTIPLE_PRIORITIES 0 + +#define configUSE_TICKLESS_IDLE 1 +#define configCPU_CLOCK_HZ 60000000 +#define configSYSTICK_CLOCK_HZ 1000000 +#define configTICK_RATE_HZ ( 1000U ) +#define configMAX_PRIORITIES ( 7U ) +#define configMINIMAL_STACK_SIZE ( ( configSTACK_DEPTH_TYPE ) 70U ) +#define configMAX_TASK_NAME_LEN ( 5U ) +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_TASK_NOTIFICATIONS 1 +#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_ALTERNATIVE_API 0 +#define configQUEUE_REGISTRY_SIZE 20 +#define configUSE_QUEUE_SETS 1 +#define configUSE_NEWLIB_REENTRANT 0 +#define configENABLE_BACKWARD_COMPATIBILITY 1 +#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 +#define configUSE_MINI_LIST_ITEM 0 +#define configSTACK_DEPTH_TYPE uint16_t +#define configMESSAGE_BUFFER_LENGTH_TYPE size_t +#define configHEAP_CLEAR_MEMORY_ON_FREE 1 +#define configINITIAL_TICK_COUNT ( ( TickType_t ) 0 ) +#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2U + +/* Memory allocation related definitions. */ +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 52 * 1024 ) ) +#define configAPPLICATION_ALLOCATED_HEAP 1 +#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0 + +/* Hook function related definitions. */ +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 1 +#define configCHECK_FOR_STACK_OVERFLOW 0 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configUSE_DAEMON_TASK_STARTUP_HOOK 1 +#define configUSE_SB_COMPLETED_CALLBACK 1 + +/* Run time and task stats gathering related definitions. */ +#define configUSE_STATS_FORMATTING_FUNCTIONS 1 + +/* Software timer related definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY ( 6U ) +#define configTIMER_QUEUE_LENGTH 20 +#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2U ) + +/* Interrupt nesting behaviour configuration. */ +#define configKERNEL_INTERRUPT_PRIORITY ( configMAX_PRIORITIES - 1U ) +#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configMAX_PRIORITIES - 1U ) +#define configMAX_API_CALL_INTERRUPT_PRIORITY ( configMAX_PRIORITIES - 1U ) + +/* FreeRTOS MPU specific definitions. */ +#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0 +#define configTOTAL_MPU_REGIONS 8 /* Default value. */ +#define configTEX_S_C_B_FLASH 0x07UL /* Default value. */ +#define configTEX_S_C_B_SRAM 0x07UL /* Default value. */ +#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 1 +#define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 +#define configENABLE_ERRATA_837070_WORKAROUND 1 + +/* ARMv8-M secure side port related definitions. */ +#define secureconfigMAX_SECURE_CONTEXTS 5 + +/* Optional functions - most linkers will remove unused functions anyway. */ +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_xResumeFromISR 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 +#define INCLUDE_uxTaskGetStackHighWaterMark2 1 +#define INCLUDE_xEventGroupSetBitFromISR 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_xTaskGetHandle 1 +#define INCLUDE_xTaskResumeFromISR 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 +#define INCLUDE_xSemaphoreGetMutexHolder 1 + +/* Run time stats gathering configuration options. */ +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() + +#define configUSE_MPU_WRAPPERS_V1 0 +#define configPROTECTED_KERNEL_OBJECT_POOL_SIZE 32 + +#endif /* FREERTOS_CONFIG_H */ diff --git a/FreeRTOS/Test/Coverity/mpu_v2/portmacro.h b/FreeRTOS/Test/Coverity/mpu_v2/portmacro.h new file mode 100644 index 00000000000..d4b445e9e70 --- /dev/null +++ b/FreeRTOS/Test/Coverity/mpu_v2/portmacro.h @@ -0,0 +1,117 @@ +/* + * FreeRTOS + * Copyright (C) 2022 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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + */ + +#ifndef PORTMACRO_H +#define PORTMACRO_H + +/****************************************************************************** +* Defines +******************************************************************************/ +/* Type definitions. */ +#define portCHAR char +#define portFLOAT float +#define portDOUBLE double +#define portLONG long +#define portSHORT short +#define portSTACK_TYPE int32_t +#define portBASE_TYPE int32_t + +#define configISR_STACK_SIZE_WORDS + +typedef portSTACK_TYPE StackType_t; +typedef int32_t BaseType_t; +typedef uint32_t UBaseType_t; + +#if ( configUSE_16_BIT_TICKS == 1 ) + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff +#else + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL + +/* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick + * count do not need to be guarded with a critical section. */ + #define portTICK_TYPE_IS_ATOMIC 1 +#endif + +/* Hardware specifics. */ +#define portSTACK_GROWTH ( -1 ) +#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portINLINE + +#if defined( __x86_64__ ) || defined( _M_X64 ) + #define portBYTE_ALIGNMENT 8 +#else + #define portBYTE_ALIGNMENT 4 +#endif + +#define portYIELD() +#define portSOFTWARE_BARRIER() + + +/* Simulated interrupts return pdFALSE if no context switch should be performed, + * or a non-zero number if a context switch should be performed. */ +#define portYIELD_FROM_ISR( x ) ( void ) x +#define portEND_SWITCHING_ISR( x ) portYIELD_FROM_ISR( ( x ) ) + +#define portCLEAN_UP_TCB( pxTCB ) +#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) +#define portDISABLE_INTERRUPTS() +#define portENABLE_INTERRUPTS() +#define portSET_INTERRUPT_MASK( x ) ( 0 ) +#define portCLEAR_INTERRUPT_MASK( x ) ( ( void )( x ) ) + +/* Critical section handling. */ +#define portENTER_CRITICAL() +#define portEXIT_CRITICAL() + +/* Task function macros as described on the FreeRTOS.org WEB site. */ +#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) +#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) + +#define portINTERRUPT_YIELD ( 0UL ) + +#define portGET_RUN_TIME_COUNTER_VALUE(...) ( UBaseType_t )( rand() ) + +extern void vResetPrivilege( void ); +extern BaseType_t xIsPrivileged( void ); +extern void vRaisePrivilege( void ); +#define portIS_PRIVILEGED() xIsPrivileged() +#define portRESET_PRIVILEGE() vResetPrivilege() +#define portRAISE_PRIVILEGE() vRaisePrivilege() + +#define portUSING_MPU_WRAPPERS 1 +#define portCRITICAL_NESTING_IN_TCB 1 +#define portPRIVILEGE_BIT 1U + +/** + * @brief MPU settings as stored in the TCB. + */ +typedef struct MPU_SETTINGS +{ + uint32_t dummy; +} xMPU_SETTINGS; + +#endif /* ifndef PORTMACRO_H */