I have FreeRTOS that runs OK if linker is configured like this:
/***********************THIS MAP WORKS OK****************************/
/*----------------------------------------------------------------------------*/
define memory mem with size = 4G;
define region VECTORS = mem:[from 0x00000000 size 0x00000020];
define region KERNEL = mem:[from 0x00000020 size 0x00008000];
define region FLASH = mem:[from 0x00008020 size 0x00177FE0]
| mem:[from 0x00180000 size 0x00180000];
define region STACK = mem:[from 0x08000000 size 0x00000800];
define region KRAM = mem:[from 0x08000800 size 0x00000800];
define region RAM = mem:[from (0x08000800+0x00000800) size (0x0003F800 - 0x00000800)];
define block HEAP with size = 0x800, alignment = 8{ };
initialize by copy {readwrite};
do not initialize {section .noinit};
place in VECTORS {readonly section .intvecs};
place in KERNEL {readonly section .kernelTEXT};
place in FLASH {readonly};
place in RAM {readwrite section .kernelHEAP};
place in KRAM {readwrite section .kernelBSS};
place in RAM {readwrite};
place in RAM {block HEAP};
/*----------------------------------------------------------------------------*/
When I start from any other address like shown below, the RTOS stalls when it's creating the first task.
It stalls on the instruction "BaseType_t xRunningPrivileged = prvRaisePrivilege()" in xTaskCreate function below. My registers before and after are also shown below.
It vectors to address 0x8 (why isn't it vectoring to address 0x10108 if it's a real vPortSWI?). How should I define my linker cmd file and init vector table?
BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask ) { BaseType_t xReturn; BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskCreate( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ); portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; }
/***********************THIS MAP DOES NOT WORK****************************/
/*----------------------------------------------------------------------------*/
define memory mem with size = 4G;
define region VECTORS = mem:[from 0x00010100 size 0x00000020];
define region KERNEL = mem:[from 0x00010120 size 0x00008000];
define region FLASH = mem:[from 0x00018120 size 0x00167EE0]
| mem:[from 0x00180000 size 0x00180000];
define region STACK = mem:[from 0x08000000 size 0x00000800];
define region KRAM = mem:[from 0x08000800 size 0x00000800];
define region RAM = mem:[from (0x08000800+0x00000800) size (0x0003F800 - 0x00000800)];
define block HEAP with size = 0x800, alignment = 8{ };
initialize by copy {readwrite};
do not initialize {section .noinit};
place in VECTORS {readonly section .intvecs};
place in KERNEL {readonly section .kernelTEXT};
place in FLASH {readonly};
place in RAM {readwrite section .kernelHEAP};
place in KRAM {readwrite section .kernelBSS};
place in RAM {readwrite};
place in RAM {block HEAP};
/*----------------------------------------------------------------------------*/