Merge branch 'master' into fix/configUSE_TIME_SLICING

This commit is contained in:
Cobus van Eeden 2020-10-29 18:53:22 -07:00 committed by GitHub
commit 74dbc72290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 124 additions and 62 deletions

39
.github/CODEOWNERS vendored Normal file
View file

@ -0,0 +1,39 @@
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @FreeRTOS/pr-bar-raiser
# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
# modifies JS files, only @js-owner and not the global
# owner(s) will be requested for a review.
# *.c FreeRTOS/pr-bar-raiser
# You can also use email addresses if you prefer. They'll be
# used to look up users just like we do for commit author
# emails.
# *.go docs@example.com
# In this example, @doctocat owns any files in the build/logs
# directory at the root of the repository and any of its
# subdirectories.
# /build/logs/ @doctocat
# The `docs/*` pattern will match files like
# `docs/getting-started.md` but not further nested files like
# `docs/build-app/troubleshooting.md`.
# docs/* docs@example.com
# In this example, @octocat owns any file in an apps directory
# anywhere in your repository.
# apps/ @octocat
# In this example, @doctocat owns any file in the `/docs`
# directory in the root of your repository and any of its
# subdirectories.
# /docs/ @doctocat

View file

View file

View file

@ -28,7 +28,7 @@ jobs:
PATH=$PATH:main/tools/spell PATH=$PATH:main/tools/spell
# Make sure that the portable directory is not included in the spellcheck. # Make sure that the portable directory is not included in the spellcheck.
sed -i 's/find $DIRNAME/find $DIRNAME -not -path '*portable*'/g' main/tools/spell/find-unknown-comment-words sed -i 's/find $DIRNAME/find $DIRNAME -not -path '*portable*'/g' main/tools/spell/find-unknown-comment-words
find-unknown-comment-words --directory kernel/ find-unknown-comment-words --directory kernel/ --lexicon ./kernel/.github/lexicon.txt
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
exit 0 exit 0
else else

View file

@ -129,7 +129,7 @@ typedef struct xMEMORY_REGION
typedef struct xTASK_PARAMETERS typedef struct xTASK_PARAMETERS
{ {
TaskFunction_t pvTaskCode; TaskFunction_t pvTaskCode;
const char * const pcName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * pcName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
configSTACK_DEPTH_TYPE usStackDepth; configSTACK_DEPTH_TYPE usStackDepth;
void * pvParameters; void * pvParameters;
UBaseType_t uxPriority; UBaseType_t uxPriority;

View file

@ -402,8 +402,8 @@ uint8_t ucHighByte, ucLowByte;
* the context is saved at the start of vPortYieldFromTick(). The tick * the context is saved at the start of vPortYieldFromTick(). The tick
* count is incremented after the context is saved. * count is incremented after the context is saved.
*/ */
void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal, naked ) ); void TIMER1_COMPA_vect( void ) __attribute__ ( ( signal, naked ) );
void SIG_OUTPUT_COMPARE1A( void ) void TIMER1_COMPA_vect( void )
{ {
vPortYieldFromTick(); vPortYieldFromTick();
asm volatile ( "reti" ); asm volatile ( "reti" );
@ -415,8 +415,8 @@ uint8_t ucHighByte, ucLowByte;
* tick count. We don't need to switch context, this can only be done by * tick count. We don't need to switch context, this can only be done by
* manual calls to taskYIELD(); * manual calls to taskYIELD();
*/ */
void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal ) ); void TIMER1_COMPA_vect( void ) __attribute__ ( ( signal ) );
void SIG_OUTPUT_COMPARE1A( void ) void TIMER1_COMPA_vect( void )
{ {
xTaskIncrementTick(); xTaskIncrementTick();
} }

View file

@ -1,7 +1,9 @@
#ifndef PORTHARDWARE_H #ifndef PORTHARDWARE_H
#define PORTHARDWARE_H #define PORTHARDWARE_H
#include <ioavr.h> #ifndef __IAR_SYSTEMS_ASM__
#include <ioavr.h>
#endif
#include "FreeRTOSConfig.h" #include "FreeRTOSConfig.h"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -1,7 +1,9 @@
#ifndef PORTHARDWARE_H #ifndef PORTHARDWARE_H
#define PORTHARDWARE_H #define PORTHARDWARE_H
#include <ioavr.h> #ifndef __IAR_SYSTEMS_ASM__
#include <ioavr.h>
#endif
#include "FreeRTOSConfig.h" #include "FreeRTOSConfig.h"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -176,7 +176,7 @@ void _xt_user_exit( void );
#endif #endif
/* Create interrupt stack frame aligned to 16 byte boundary */ /* Create interrupt stack frame aligned to 16 byte boundary */
sp = ( StackType_t * ) ( ( ( UBaseType_t ) ( pxTopOfStack + 1 ) - XT_CP_SIZE - XT_STK_FRMSZ ) & ~0xf ); sp = ( StackType_t * ) ( ( ( UBaseType_t ) pxTopOfStack - XT_CP_SIZE - XT_STK_FRMSZ ) & ~0xf );
/* Clear the entire frame (do not use memset() because we don't depend on C library) */ /* Clear the entire frame (do not use memset() because we don't depend on C library) */
for( tp = sp; tp <= pxTopOfStack; ++tp ) for( tp = sp; tp <= pxTopOfStack; ++tp )
@ -229,6 +229,7 @@ void _xt_user_exit( void );
* //p = (uint32_t *) xMPUSettings->coproc_area; * //p = (uint32_t *) xMPUSettings->coproc_area;
*/ */
p = ( uint32_t * ) ( ( ( uint32_t ) pxTopOfStack - XT_CP_SIZE ) & ~0xf ); p = ( uint32_t * ) ( ( ( uint32_t ) pxTopOfStack - XT_CP_SIZE ) & ~0xf );
configASSERT( ( uint32_t ) p >= frame->a1 );
p[ 0 ] = 0; p[ 0 ] = 0;
p[ 1 ] = 0; p[ 1 ] = 0;
p[ 2 ] = ( ( ( uint32_t ) p ) + 12 + XCHAL_TOTAL_SA_ALIGN - 1 ) & -XCHAL_TOTAL_SA_ALIGN; p[ 2 ] = ( ( ( uint32_t ) p ) + 12 + XCHAL_TOTAL_SA_ALIGN - 1 ) & -XCHAL_TOTAL_SA_ALIGN;
@ -319,7 +320,9 @@ void vPortYieldOtherCore( BaseType_t coreid )
uint32_t usStackDepth ) uint32_t usStackDepth )
{ {
#if XCHAL_CP_NUM > 0 #if XCHAL_CP_NUM > 0
xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( ( uint32_t ) ( pxBottomOfStack + usStackDepth - 1 ) ) - XT_CP_SIZE ) & ~0xf ); xMPUSettings->coproc_area = ( StackType_t * ) ( ( uint32_t ) ( pxBottomOfStack + usStackDepth - 1 ));
xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) xMPUSettings->coproc_area ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( uint32_t ) xMPUSettings->coproc_area - XT_CP_SIZE ) & ~0xf );
/* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to /* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to

View file

@ -157,7 +157,7 @@ void _xt_user_exit( void );
#endif #endif
/* Create interrupt stack frame aligned to 16 byte boundary */ /* Create interrupt stack frame aligned to 16 byte boundary */
sp = ( StackType_t * ) ( ( ( UBaseType_t ) ( pxTopOfStack + 1 ) - XT_CP_SIZE - XT_STK_FRMSZ ) & ~0xf ); sp = ( StackType_t * ) ( ( ( UBaseType_t ) pxTopOfStack - XT_CP_SIZE - XT_STK_FRMSZ ) & ~0xf );
/* Clear the entire frame (do not use memset() because we don't depend on C library) */ /* Clear the entire frame (do not use memset() because we don't depend on C library) */
for( tp = sp; tp <= pxTopOfStack; ++tp ) for( tp = sp; tp <= pxTopOfStack; ++tp )
@ -196,6 +196,7 @@ void _xt_user_exit( void );
* //p = (uint32_t *) xMPUSettings->coproc_area; * //p = (uint32_t *) xMPUSettings->coproc_area;
*/ */
p = ( uint32_t * ) ( ( ( uint32_t ) pxTopOfStack - XT_CP_SIZE ) & ~0xf ); p = ( uint32_t * ) ( ( ( uint32_t ) pxTopOfStack - XT_CP_SIZE ) & ~0xf );
configASSERT( ( uint32_t ) p >= frame->a1 );
p[ 0 ] = 0; p[ 0 ] = 0;
p[ 1 ] = 0; p[ 1 ] = 0;
p[ 2 ] = ( ( ( uint32_t ) p ) + 12 + XCHAL_TOTAL_SA_ALIGN - 1 ) & -XCHAL_TOTAL_SA_ALIGN; p[ 2 ] = ( ( ( uint32_t ) p ) + 12 + XCHAL_TOTAL_SA_ALIGN - 1 ) & -XCHAL_TOTAL_SA_ALIGN;
@ -286,7 +287,9 @@ void vPortYieldOtherCore( BaseType_t coreid )
uint32_t usStackDepth ) uint32_t usStackDepth )
{ {
#if XCHAL_CP_NUM > 0 #if XCHAL_CP_NUM > 0
xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( ( uint32_t ) ( pxBottomOfStack + usStackDepth - 1 ) ) - XT_CP_SIZE ) & ~0xf ); xMPUSettings->coproc_area = ( StackType_t * ) ( ( uint32_t ) ( pxBottomOfStack + usStackDepth - 1 ));
xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) xMPUSettings->coproc_area ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( uint32_t ) xMPUSettings->coproc_area - XT_CP_SIZE ) & ~0xf );
/* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to /* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to

View file

@ -90,36 +90,39 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
#endif #endif
{ {
StackType_t *sp, *tp; StackType_t * sp, * tp;
XtExcFrame *frame; XtExcFrame * frame;
#if XCHAL_CP_NUM > 0 #if XCHAL_CP_NUM > 0
uint32_t *p; uint32_t * p;
#endif #endif
/* Create interrupt stack frame aligned to 16 byte boundary */ /* Create interrupt stack frame aligned to 16 byte boundary */
sp = (StackType_t *) (((UBaseType_t)(pxTopOfStack + 1) - XT_CP_SIZE - XT_STK_FRMSZ) & ~0xf); sp = ( StackType_t * ) ( ( ( UBaseType_t ) pxTopOfStack - XT_CP_SIZE - XT_STK_FRMSZ ) & ~0xf );
/* Clear the entire frame (do not use memset() because we don't depend on C library) */ /* Clear the entire frame (do not use memset() because we don't depend on C library) */
for (tp = sp; tp <= pxTopOfStack; ++tp) for( tp = sp; tp <= pxTopOfStack; ++tp )
{
*tp = 0; *tp = 0;
}
frame = (XtExcFrame *) sp; frame = ( XtExcFrame * ) sp;
/* Explicitly initialize certain saved registers */ /* Explicitly initialize certain saved registers */
frame->pc = (UBaseType_t) pxCode; /* task entrypoint */ frame->pc = ( UBaseType_t ) pxCode; /* task entrypoint */
frame->a0 = 0; /* to terminate GDB backtrace */ frame->a0 = 0; /* to terminate GDB backtrace */
frame->a1 = (UBaseType_t) sp + XT_STK_FRMSZ; /* physical top of stack frame */ frame->a1 = ( UBaseType_t ) sp + XT_STK_FRMSZ; /* physical top of stack frame */
frame->exit = (UBaseType_t) _xt_user_exit; /* user exception exit dispatcher */ frame->exit = ( UBaseType_t ) _xt_user_exit; /* user exception exit dispatcher */
/* Set initial PS to int level 0, EXCM disabled ('rfe' will enable), user mode. */ /* Set initial PS to int level 0, EXCM disabled ('rfe' will enable), user mode. */
/* Also set entry point argument parameter. */ /* Also set entry point argument parameter. */
#ifdef __XTENSA_CALL0_ABI__ #ifdef __XTENSA_CALL0_ABI__
frame->a2 = (UBaseType_t) pvParameters; frame->a2 = ( UBaseType_t ) pvParameters;
frame->ps = PS_UM | PS_EXCM; frame->ps = PS_UM | PS_EXCM;
#else #else
/* + for windowed ABI also set WOE and CALLINC (pretend task was 'call4'd). */ /* + for windowed ABI also set WOE and CALLINC (pretend task was 'call4'd). */
frame->a6 = (UBaseType_t) pvParameters; frame->a6 = ( UBaseType_t ) pvParameters;
frame->ps = PS_UM | PS_EXCM | PS_WOE | PS_CALLINC(1); frame->ps = PS_UM | PS_EXCM | PS_WOE | PS_CALLINC( 1 );
#endif #endif
#ifdef XT_USE_SWPRI #ifdef XT_USE_SWPRI
@ -129,13 +132,15 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
#if XCHAL_CP_NUM > 0 #if XCHAL_CP_NUM > 0
/* Init the coprocessor save area (see xtensa_context.h) */ /* Init the coprocessor save area (see xtensa_context.h) */
/* No access to TCB here, so derive indirectly. Stack growth is top to bottom. /* No access to TCB here, so derive indirectly. Stack growth is top to bottom.
* //p = (uint32_t *) xMPUSettings->coproc_area; * //p = (uint32_t *) xMPUSettings->coproc_area;
*/ */
p = (uint32_t *)(((uint32_t) pxTopOfStack - XT_CP_SIZE) & ~0xf); p = ( uint32_t * ) ( ( ( uint32_t ) pxTopOfStack - XT_CP_SIZE ) & ~0xf );
p[0] = 0; configASSERT( ( uint32_t ) p >= frame->a1 );
p[1] = 0; p[ 0 ] = 0;
p[2] = (((uint32_t) p) + 12 + XCHAL_TOTAL_SA_ALIGN - 1) & -XCHAL_TOTAL_SA_ALIGN; p[ 1 ] = 0;
p[ 2 ] = ( ( ( uint32_t ) p ) + 12 + XCHAL_TOTAL_SA_ALIGN - 1 ) & -XCHAL_TOTAL_SA_ALIGN;
#endif #endif
return sp; return sp;
@ -207,16 +212,19 @@ BaseType_t xPortSysTickHandler( void )
* Used to set coprocessor area in stack. Current hack is to reuse MPU pointer for coprocessor area. * Used to set coprocessor area in stack. Current hack is to reuse MPU pointer for coprocessor area.
*/ */
#if portUSING_MPU_WRAPPERS #if portUSING_MPU_WRAPPERS
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
const struct xMEMORY_REGION * const xRegions,
StackType_t * pxBottomOfStack,
uint32_t ulStackDepth )
{ {
#if XCHAL_CP_NUM > 0 #if XCHAL_CP_NUM > 0
xMPUSettings->coproc_area = (StackType_t*)((((uint32_t)(pxBottomOfStack + ulStackDepth - 1)) - XT_CP_SIZE ) & ~0xf); xMPUSettings->coproc_area = ( StackType_t * ) ( ( uint32_t ) ( pxBottomOfStack + ulStackDepth - 1 ));
xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) xMPUSettings->coproc_area ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( uint32_t ) xMPUSettings->coproc_area - XT_CP_SIZE ) & ~0xf );
/* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to /* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to
* clear the stack area after we return. This is done in pxPortInitialiseStack(). * clear the stack area after we return. This is done in pxPortInitialiseStack().
*/ */
#endif #endif
} }
#endif #endif /* if portUSING_MPU_WRAPPERS */

View file

@ -1949,6 +1949,11 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority ) if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
{ {
xYieldRequired = pdTRUE; xYieldRequired = pdTRUE;
/* Mark that a yield is pending in case the user is not
* using the return value to initiate a context switch
* from the ISR using portYIELD_FROM_ISR. */
xYieldPending = pdTRUE;
} }
else else
{ {