Kernel updates:

- Add user configurable thread local storage array, with get/set access function.
This commit is contained in:
Richard Barry 2015-01-26 17:40:35 +00:00
parent 51aa373c4c
commit dfdc319518
7 changed files with 95 additions and 25 deletions

View File

@ -227,7 +227,7 @@ void vRegisterSampleCLICommands( void )
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
const char *const pcHeader = " State\tPriority\tStack\t#\r\n************************************************\r\n";
const char *const pcHeader = " State Priority Stack #\r\n************************************************\r\n";
BaseType_t xSpacePadding;
/* Remove compile time warnings about unused parameters, and check the

View File

@ -149,7 +149,6 @@ 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

View File

@ -18,6 +18,7 @@ _HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x4;
MEMORY
{
microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr : ORIGIN = 0x00000050, LENGTH = 0x0003FFB0
mig_7series_0 : ORIGIN = 0x80000000, LENGTH = 0x40000000
}
/* Specify the default entry point to the program */
@ -48,15 +49,15 @@ SECTIONS
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.init : {
KEEP (*(.init))
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.fini : {
KEEP (*(.fini))
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.ctors : {
__CTOR_LIST__ = .;
@ -67,7 +68,7 @@ SECTIONS
KEEP (*(.ctors))
__CTOR_END__ = .;
___CTORS_END___ = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.dtors : {
__DTOR_LIST__ = .;
@ -78,7 +79,7 @@ SECTIONS
KEEP (*(.dtors))
PROVIDE(__DTOR_END__ = .);
PROVIDE(___DTORS_END___ = .);
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.rodata : {
__rodata_start = .;
@ -86,7 +87,7 @@ SECTIONS
*(.rodata.*)
*(.gnu.linkonce.r.*)
__rodata_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.sdata2 : {
. = ALIGN(8);
@ -96,7 +97,7 @@ SECTIONS
*(.gnu.linkonce.s2.*)
. = ALIGN(8);
__sdata2_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.sbss2 : {
__sbss2_start = .;
@ -104,7 +105,7 @@ SECTIONS
*(.sbss2.*)
*(.gnu.linkonce.sb2.*)
__sbss2_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.data : {
. = ALIGN(4);
@ -113,31 +114,31 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d.*)
__data_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.got : {
*(.got)
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.got1 : {
*(.got1)
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.got2 : {
*(.got2)
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.eh_frame : {
*(.eh_frame)
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.jcr : {
*(.jcr)
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.gcc_except_table : {
*(.gcc_except_table)
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.sdata : {
. = ALIGN(8);
@ -146,7 +147,7 @@ SECTIONS
*(.sdata.*)
*(.gnu.linkonce.s.*)
__sdata_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.sbss (NOLOAD) : {
. = ALIGN(4);
@ -156,7 +157,7 @@ SECTIONS
*(.gnu.linkonce.sb.*)
. = ALIGN(8);
__sbss_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.tdata : {
__tdata_start = .;
@ -164,7 +165,7 @@ SECTIONS
*(.tdata.*)
*(.gnu.linkonce.td.*)
__tdata_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.tbss : {
__tbss_start = .;
@ -172,7 +173,7 @@ SECTIONS
*(.tbss.*)
*(.gnu.linkonce.tb.*)
__tbss_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.bss (NOLOAD) : {
. = ALIGN(4);
@ -183,7 +184,7 @@ SECTIONS
*(COMMON)
. = ALIGN(4);
__bss_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
@ -197,7 +198,7 @@ _SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
_heap_start = .;
. += _HEAP_SIZE;
_heap_end = .;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
.stack (NOLOAD) : {
_stack_end = .;
@ -205,7 +206,7 @@ _SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
. = ALIGN(8);
_stack = .;
__stack = _stack;
} > microblaze_0_local_memory_ilmb_bram_if_cntlr_microblaze_0_local_memory_dlmb_bram_if_cntlr
} > mig_7series_0
_end = .;
}

View File

@ -168,12 +168,14 @@ static void prvSetupHardware( void )
#if defined( XPAR_MICROBLAZE_USE_ICACHE ) && ( XPAR_MICROBLAZE_USE_ICACHE != 0 )
{
Xil_ICacheInvalidate();
Xil_ICacheEnable();
}
#endif
#if defined( XPAR_MICROBLAZE_USE_DCACHE ) && ( XPAR_MICROBLAZE_USE_DCACHE != 0 )
{
Xil_DCacheInvalidate();
Xil_DCacheEnable();
}
#endif

View File

@ -195,6 +195,10 @@ extern "C" {
#define configUSE_APPLICATION_TASK_TAG 0
#endif
#ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
#endif
#ifndef INCLUDE_uxTaskGetStackHighWaterMark
#define INCLUDE_uxTaskGetStackHighWaterMark 0
#endif

View File

@ -1158,6 +1158,18 @@ constant. */
#endif /* configUSE_APPLICATION_TASK_TAG ==1 */
#endif /* ifdef configUSE_APPLICATION_TASK_TAG */
#if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
/* Each task contains an array of pointers that is dimensioned by the
configNUM_THREAD_LOCAL_STORAGE_POINTERS setting in FreeRTOSConfig.h. The
kernel does not use the pointers itself, so the application writer can use
the pointers for any purpose they wish. The following two functions are
used to set and query a pointer respectively. */
void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue );
void *pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex );
#endif
/**
* task.h
* <pre>BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );</pre>

View File

@ -168,6 +168,10 @@ typedef struct tskTaskControlBlock
TaskHookFunction_t pxTaskTag;
#endif
#if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
void *pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#endif
#if ( configGENERATE_RUN_TIME_STATS == 1 )
uint32_t ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
#endif
@ -2882,6 +2886,15 @@ UBaseType_t x;
}
#endif /* portUSING_MPU_WRAPPERS */
#if( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
{
for( x = 0; x < ( UBaseType_t ) configNUM_THREAD_LOCAL_STORAGE_POINTERS; x++ )
{
pxTCB->pvThreadLocalStoragePointers[ x ] = NULL;
}
}
#endif
#if ( configUSE_TASK_NOTIFICATIONS == 1 )
{
pxTCB->ulNotifiedValue = 0;
@ -2898,6 +2911,45 @@ UBaseType_t x;
}
/*-----------------------------------------------------------*/
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue )
{
TCB_t *pxTCB;
if( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS )
{
pxTCB = prvGetTCBFromHandle( xTaskToSet );
pxTCB->pvThreadLocalStoragePointers[ xIndex ] = pvValue;
}
}
#endif /* configNUM_THREAD_LOCAL_STORAGE_POINTERS */
/*-----------------------------------------------------------*/
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
void *pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex )
{
void *pvReturn = NULL;
TCB_t *pxTCB;
if( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS )
{
pxTCB = prvGetTCBFromHandle( xTaskToQuery );
pvReturn = pxTCB->pvThreadLocalStoragePointers[ xIndex ];
}
else
{
pvReturn = NULL;
}
return pvReturn;
}
#endif /* configNUM_THREAD_LOCAL_STORAGE_POINTERS */
/*-----------------------------------------------------------*/
#if ( portUSING_MPU_WRAPPERS == 1 )
void vTaskAllocateMPURegions( TaskHandle_t xTaskToModify, const MemoryRegion_t * const xRegions )
@ -4100,7 +4152,7 @@ TickType_t uxReturn;
{
/* The notified task has a priority above the currently
executing task so a yield is required. */
portYIELD_WITHIN_API();
taskYIELD_IF_USING_PREEMPTION();
}
else
{