Part Number: SAFETI_DIAG_LIB
Hi All,
I am using TMS570LC43 MCU with safeTI Diagnostic Library and intigrate with RTOS.
I am facing a problem that the HIGHHANDLER is not getting memory allocation. And the value of "uint32 size=(uint32)&ulHighHandlerSize;" is always 0. and system goes into SWRST mode.
I saw in map file it is not allocate any memory to ".sl_stflash_SRAM".
I am sharing linker code below.
--retain="*(.intvecs)"
--entry_point=_c_int00
/*----------------------------------------------------------------------------*/
/* Memory Map */
MEMORY
{
/* These configuration settings are required for all SafeRTOS based
* applications.
* If the whole build is using ARM mode then VECTORS length can be 0x20.
* When using thumb mode, 0x80 is required to accommodate the interwork
* code. */
VECTORS (X) : origin=0x00000000 length=0x00000080 vfill = 0xffffffff
KERN_FUNC (RX) : origin=0x00000080 length=0x0000ff80 vfill = 0xffffffff
FLASH0 (RX) : origin=0x00010000 length=0x001F0000 vfill = 0xffffffff
FLASH1 (RX) : origin=0x00200000 length=0x00200000 vfill = 0xffffffff
STACKS (RW) : origin=0x08000000 length=0x00003800
KERN_DATA (RW) : origin=0x08003800 length=0x00001800
RAM (RW) : origin=0x08005000 length=0x00070000
HIGH_HANDLER (RWX) : origin=0x8075000 length=0x000800
PROFILE(RW) : origin=0x8075800 length=0x00006000 // Added for profiling purposes
LOG (RW) : origin=0x807B800 length=0x00003800 fill=0xDEADBEEF // Added for logging purposes
FEE (R) : origin=0xF0200000 length=0x00000064 fill=0xDEADBEEF // For FEE testing, Valid only for sample application
}
/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
/* These configuration settings are required for all SafeRTOS based
* applications. */
/* The following symbols need to be exported:
*
* lnkKernelFuncStartAddr - the start of the Flash memory section used during runtime.
*
* IMPORTANT NOTE: lnkKernelFuncStartAddr can be relocated (e.g. when a
* bootloader is used), but it must be aligned according to its size
* (rounded up to the next power of 2), otherwise the MPU will be
* configured incorrectly.
*
* lnkEndFlashAddress - the end of the Flash memory section used during runtime.
*
* lnkKernelFuncStartAddr - the start address of the Flash block containing
* the interrupt vector table and the kernel functions.
* NOTE: This should be aligned according to the section size, i.e. 0x8000.
*
* lnkKernelFuncEndAddr - the end address of the Flash block containing
* the interrupt vector table and the kernel functions.
*
* lnkKernelDataStartAddr - the start address of the RAM block containing
* the system stacks and the kernel data.
*
* lnkKernelDataEndAddr - the end address of the RAM block containing
* the system stacks and the kernel data.
*/
/* On this demo application, the kernel functions section is placed at the
* start of the Flash memory; this will not be the case if the application is relocated. */
.intvecs palign(32), START( lnkStartFlashAddress ),START( lnkKernelFuncStartAddr )
fill =0xffffffff {} > VECTORS
.sl_stflash_SRAM : RUN = HIGH_HANDLER, LOAD = FLASH0|FLASH1, LOAD_START(ulHighHandlerLoadStart), LOAD_END(ulHighHandlerLoadEnd),
LOAD_SIZE(ulHighHandlerSize), RUN_START( ulHighHandlerStartAddr ), RUN_END( ulHighHandlerEndAddr )
.kernel_function END( lnkKernelFuncEndAddr ) :
{
*(KERNEL_FUNCTION)
} > KERN_FUNC
.unpriv_flash palign(32), END( lnkEndFlashAddress ) :
{
*(.text)
*(.const)
} > FLASH0 | FLASH1
.cinit align(32) : {} > FLASH0 | FLASH1
.pinit align(32) : {} > FLASH0 | FLASH1
STACK_DATA START( lnkKernelDataStartAddr ) : {} > STACKS
KERNEL_DATA END( lnkKernelDataEndAddr ) : {} > KERN_DATA
.bss : {} > RAM
.data : {} > RAM
.sysmem : {} > RAM
.STACK_DATA_svc : {. += 1024;} > STACKS, RUN_START(StackModeSVC)
.STACK_DATA_fiq : {. += 1024;} > STACKS, RUN_START(StackModeFIQ)
.STACK_DATA_irq : {. += 1024;} > STACKS, RUN_START(StackModeIRQ)
.STACK_DATA_abt : {. += 1024;} > STACKS, RUN_START(StackModeABT)
.STACK_DATA_und : {. += 1024;} > STACKS, RUN_START(StackModeUND)
.STACK_DATA_sys : {. += 1024;} > STACKS, RUN_START(StackModeSYS)
LOG_DATA : START( ulLOGStartAddr ), END( ulLOGEndAddr ) > LOG
PROFILE_DATA : START( ulPROFILEStartAddr ), END( ulPROFILEEndAddr ) > PROFILE
/* These configuration settings are for the SafeRTOS TMS570LC43x FPU demonstration
* project. They are included as a demonstration of how task data can be
* grouped together into known locations, therefore enabling MPU regions to
* be defined. */
__idle_hook_data__
: START( lnkIdleTaskDataStartAddr )
{} > RAM palign( 0x20 )
}
Below is the map file image.
MEMORY CONFIGURATION
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
VECTORS 00000000 00000080 00000020 00000060 X (ffffffff)
KERN_FUNC 00000080 0000ff80 0000864c 00007934 R X (ffffffff)
FLASH0 00010000 001f0000 00025090 001caf70 R X (ffffffff)
FLASH1 00200000 00200000 00000000 00200000 R X (ffffffff)
STACKS 08000000 00001800 00001800 00000000 RW
KERN_DATA 08001800 00000800 00000504 000002fc RW
RAM 08004000 00019000 00005630 000139d0 RW
HIGH_HANDLER 08075000 00000800 00000000 00000800 RW X <-- not getting memory to sl_stflash_SRAM
PROFILE 08075800 00006000 00003e78 00002188 RW
LOG 0807b800 00003800 00003800 00000000 RW deadbeef
FEE f0200000 00000064 00000064 00000000 R deadbeef
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
00000000 00000000 00000020 00000020 r-x
00000000 00000000 00000020 00000020 r-x .intvecs
00000080 00000080 0000864c 0000864c r-x
00000080 00000080 0000864c 0000864c r-x .kernel_function
00010000 00010000 00025090 00025090 r-x
00010000 00010000 00025000 00025000 r-x .unpriv_flash
00035000 00035000 00000090 00000090 r-- .cinit
08000000 08000000 00001800 00000000 r--
08000000 08000000 00000400 00000000 r-- .STACK_DATA_abt
08000400 08000400 00000400 00000000 r-- .STACK_DATA_fiq
08000800 08000800 00000400 00000000 r-- .STACK_DATA_irq
08000c00 08000c00 00000400 00000000 r-- .STACK_DATA_svc
08001000 08001000 00000400 00000000 r-- .STACK_DATA_sys
08001400 08001400 00000400 00000000 r-- .STACK_DATA_und
08001800 08001800 00000504 00000000 rw-
08001800 08001800 00000504 00000000 rw- KERNEL_DATA
08004000 08004000 00005610 00000000 rw-
08004000 08004000 000054e8 00000000 rw- .data
080094e8 080094e8 00000128 00000000 rw- .bss
08009620 08009620 00000020 00000000 rw-
08009620 08009620 00000020 00000000 rw- __idle_hook_data__
08075800 08075800 00003e78 00000000 rw-
08075800 08075800 00003e78 00000000 rw- PROFILE_DATA
0807b800 0807b800 00003800 00003800 r--
0807b800 0807b800 00003800 00003800 r-- $fill000
f0200000 f0200000 00000064 00000064 r--
f0200000 f0200000 00000064 00000064 r-- $fill001
Can you please tell me why i am not getting memory allocation for HIGH_HANDLER or ".sl_stflash_SRAM"?
Due to this the below section of code is not execute and system goes into reset mode.
uint32 i; /*TODO*/
uint32 size=(uint32)&ulHighHandlerSize; /*TODO*/
for(i=0;i<size;i++) /*TODO*/
{
((char *)&ulHighHandlerStartAddr)[i] =((char *)&ulHighHandlerLoadStart)[i]; /*TODO*/
}
We also having pragma in sl_selftest.c
#ifdef __TI_COMPILER_VERSION__
#pragma CODE_SECTION (SL_SelfTest_Flash, ".sl_stflash_SRAM")
#endif