mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-01-22 01:30:31 -05:00
Kernel timers.c tasks.c Unit Test (#539)
* Test: add multi config ability to build system * Remove Tests that are not implemented yet from the makefile * Fix header check * Test: Unit Test tasks.c * UnitTest: tasks.c Save progress * saving some work 70% coverage * coverage 77% * tasks.c coverage 90% * tasks.c coverage 95% * Cleanup and common header * Cover some extra branches, no_mutex +stack growth * Fix Makefile not to use modified version of c-preprocessor * Remove c-preprocessor errros * Rebase and add some tests * Fortify_source=1 and O0 are mutually exclusive * Style: Uncrustify code * Style: Fix indent * Fix Header checks * Add prototypes * Build: use unifdef instead of the c-preprocessor to generate different configurations * Build: fix makefile cflags * Fix UT after upgrading kernel version * Resolve conflicts and test failures * Comment fix version number * Fix build error * Update FreeRTOS/Test/CMock/Makefile Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
This commit is contained in:
parent
c00078e729
commit
1ac492d6aa
30 changed files with 9949 additions and 398 deletions
|
|
@ -79,9 +79,13 @@
|
|||
/* Run time stats gathering configuration options. */
|
||||
unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */
|
||||
void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()
|
||||
#define portUSING_MPU_WRAPPERS 0
|
||||
#define portHAS_STACK_OVERFLOW_CHECKING 1
|
||||
#define configENABLE_MPU 0
|
||||
|
||||
/* Co-routine related configuration options. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
|
|
|
|||
|
|
@ -42,5 +42,9 @@ void vFakePortAssertIfInterruptPriorityInvalid( void );
|
|||
|
||||
void vFakePortEnterCriticalSection( void );
|
||||
void vFakePortExitCriticalSection( void );
|
||||
void vPortCurrentTaskDying( void * pxTaskToDelete,
|
||||
volatile BaseType_t * pxPendYield );
|
||||
void portSetupTCB_CB( void * tcb );
|
||||
void vFakePortAssertIfISR();
|
||||
|
||||
#endif /* FAKE_PORT_H */
|
||||
|
|
|
|||
|
|
@ -48,11 +48,13 @@
|
|||
*/
|
||||
|
||||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Port specific definitions.
|
||||
|
|
@ -64,45 +66,48 @@
|
|||
*-----------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Type definitions. */
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long 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
|
||||
#endif
|
||||
#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
|
||||
#endif
|
||||
#define portPOINTER_SIZE_TYPE uint64_t
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Requires definition of UBaseType_t */
|
||||
#include "fake_port.h"
|
||||
#include "fake_port.h"
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portNOP() __asm volatile ( "NOP" )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portNOP() __asm volatile ( "NOP" )
|
||||
|
||||
/*
|
||||
* These define the timer to use for generating the tick interrupt.
|
||||
* They are put in this file so they can be shared between "port.c"
|
||||
* and "portisr.c".
|
||||
*/
|
||||
#define portTIMER_REG_BASE_PTR
|
||||
#define portTIMER_CLK_ENABLE_BIT
|
||||
#define portTIMER_AIC_CHANNEL
|
||||
#define portTIMER_REG_BASE_PTR
|
||||
#define portTIMER_CLK_ENABLE_BIT
|
||||
#define portTIMER_AIC_CHANNEL
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task utilities. */
|
||||
|
|
@ -114,39 +119,64 @@
|
|||
* THUMB mode code will result in a compile time error.
|
||||
*/
|
||||
|
||||
#define portRESTORE_CONTEXT()
|
||||
#define portRESTORE_CONTEXT()
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#define portSAVE_CONTEXT()
|
||||
#define portYIELD() vFakePortYield()
|
||||
#define portYIELD_WITHIN_API() vFakePortYieldWithinAPI()
|
||||
#define portYIELD_FROM_ISR() vFakePortYieldFromISR()
|
||||
#define portSAVE_CONTEXT()
|
||||
#define portYIELD() vFakePortYield()
|
||||
#define portYIELD_WITHIN_API() vFakePortYieldWithinAPI()
|
||||
#define portYIELD_FROM_ISR() vFakePortYieldFromISR()
|
||||
|
||||
/* Critical section handling. */
|
||||
#define portDISABLE_INTERRUPTS() vFakePortDisableInterrupts()
|
||||
#define portENABLE_INTERRUPTS() vFakePortEnableInterrupts()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) \
|
||||
#define portDISABLE_INTERRUPTS() vFakePortDisableInterrupts()
|
||||
#define portENABLE_INTERRUPTS() vFakePortEnableInterrupts()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) \
|
||||
vFakePortClearInterruptMaskFromISR( x )
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() \
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() \
|
||||
ulFakePortSetInterruptMaskFromISR()
|
||||
#define portSET_INTERRUPT_MASK() ulFakePortSetInterruptMask()
|
||||
#define portCLEAR_INTERRUPT_MASK( x ) vFakePortClearInterruptMask( x )
|
||||
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() \
|
||||
#define portSET_INTERRUPT_MASK() ulFakePortSetInterruptMask()
|
||||
#define portCLEAR_INTERRUPT_MASK( x ) vFakePortClearInterruptMask( x )
|
||||
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() \
|
||||
vFakePortAssertIfInterruptPriorityInvalid()
|
||||
#define portENTER_CRITICAL() vFakePortEnterCriticalSection()
|
||||
#define portEXIT_CRITICAL() vFakePortExitCriticalSection()
|
||||
|
||||
#define portENTER_CRITICAL() vFakePortEnterCriticalSection()
|
||||
#define portEXIT_CRITICAL() vFakePortExitCriticalSection()
|
||||
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) \
|
||||
vPortCurrentTaskDying( ( pvTaskToDelete ), ( pxPendYield ) )
|
||||
#define portSETUP_TCB( pxTCB ) portSetupTCB_CB( pxTCB );
|
||||
#define portASSERT_IF_IN_ISR() vFakePortAssertIfISR();
|
||||
|
||||
#undef portUSING_MPU_WRAPPERS
|
||||
|
||||
static uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap )
|
||||
{
|
||||
uint8_t ucReturn;
|
||||
|
||||
ucReturn = __builtin_clz( ulBitmap );
|
||||
return ucReturn;
|
||||
}
|
||||
|
||||
|
||||
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) \
|
||||
( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
|
||||
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) \
|
||||
( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) \
|
||||
uxTopPriority = ( 31UL - ( uint32_t ) ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) \
|
||||
volatile int fool_static = 0; \
|
||||
void vFunction( void * ( pvParameters ) )
|
||||
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) \
|
||||
volatile int fool_static2 = 0; \
|
||||
void vFunction( void * ( pvParameters ) )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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 )
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#endif /* PORTMACRO_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue