This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SAFETI_DIAG_LIB: TMS570LC43x SAFETI Diagnostic

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

  • Hi Pankaj,

    We started working on your issue and we will provide an update ASAP.

    --

    Thanks & regards,
    Jagadish.

  • Hi Pankaj,

    What compiler and its version number are you using? 

  • Ok, you use TI CCS + TI ARM compiler:

  • Hi Wang,

    I have tried to change compiler version asper your instruction but same result.

    Not getting any memory space to .sl_stflash_SRAM 

    Thanks 

    Pankaj Verma

  • Hi Pankaj,

    The .sl_stflash_SRAM is only required to run the selftest on TMS570LC43x and RM57 devices. Have you defined _TMS570LC43x_ in the project property? 

  • Can you please comment out line #841 and #843 to check if the section is generated in map file:

  • Hi Wang,

    I have already define macro and i have tried to comment line which you have suggested.

    But same result  

    Not getting any memory space to .sl_stflash_SRAM 

    Thanks 

    Pankaj Verma

  • Hi Pankaj,

    Please try: #pragma retain(SL_SelfTest_Flash)

    The RETAIN indicates to the linker that the section will not be omitted from conditionally linked output even if it is not referenced.

  • HI Wang,

    Thanks for your support.

    After using #pragma retain(SL_SelfTest_Flash) below are the memory allocation,

    Can you please is it fine or not.

    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
    00010560 00010560 000246a0 000246a0 r-x
    00010560 00010560 00024620 00024620 r-x .unpriv_flash
    00034b80 00034b80 00000080 00000080 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
    08003800 08003800 00000504 00000000 rw-
    08003800 08003800 00000504 00000000 rw- KERNEL_DATA
    08005000 08005000 00005618 00000000 rw-
    08005000 08005000 000054e4 00000000 rw- .data
    0800a4e4 0800a4e4 00000128 00000000 rw- .bss
    0800a60c 0800a60c 0000000c 00000000 rw- __idle_hook_data__
    08073000 00010000 0000055c 0000055c r-x
    08073000 00010000 0000055c 0000055c r-x .sl_stflash_SRAM                <---- value is 55C but in demo code it was 370 Is it fine?
    0807b800 0807b800 00003800 00003800 r--
    0807b800 0807b800 00003800 00003800 r-- $fill000
    f0200000 f0200000 00000064 00000064 r--
    f0200000 f0200000 00000064 00000064 r-- $fill001

    SECTION ALLOCATION MAP

    .sl_stflash_SRAM
    * 0 00010000 0000055c RUN ADDR = 08073000
    00010000 00000534 sl_selftest.obj (.sl_stflash_SRAM:retain)
    00010534 00000008 sl_asm_api.obj (.tramp._SL_Get_ARM_Mode.1)
    0001053c 00000008 sl_esm.obj (.tramp.SL_ESM_nERROR_Active.1)
    00010544 00000008 sl_priv.obj (.tramp.SL_FLAG_SET.1)
    0001054c 00000008 sl_priv.obj (.tramp.SL_FLAG_CLEAR.1)
    00010554 00000008 sl_priv.obj (.tramp._SL_HoldNClear_nError.1)

    Point downPoint downPoint downPoint down we are in afterSTC();

    And now code reach to the SL_SelfTest_VIM(VIM_SOFTWARE_TEST); function and fail here

    Here the inside the "tmp = SL_SelfTest_CCMR5F(CCMR5F_CPUCOMP_ERROR_FORCING_TEST, TRUE, &failInfoCCMR5F);"

    *ccmr5fKeyReg = CCMR5F_CCMKEYR_MODE_ERRFORCING;                    <-- the value inside "CCMkeyR1" register 0xfffff604 is 0

    while (CCMR5F_CCMKEYR_MODE_LOCKSTEP != (*ccmr5fKeyReg & CCMR5F_CCMKEYR_MODE)) {

     stuck here and system is going to SW reset.
    }

    i am also working on it, but can you tell what is the reason behind that, we have already did viminit();

    Both SL_SelfTest_VIM(VIM_SOFTWARE_TEST); and SL_SelfTest_DMA(DMA_SOFTWARE_TEST);   failing

    Thanks 

    Pankaj Verma

  •   <---- value is 55C but in demo code it was 370 Is it fine?

    The size is 0x55C --> 0x534 + 0x8 +  0x8 +  0x8 +  0x8 +  0x8 

    Can you please is it fine or not.

    It is fine.

  • Hi Pankaj,

    Can you open a new thread for the new question? Thanks

  • The section .sl_stflash_SRAM is created correctly after using #pragma retain(SL_SelfTest_Flash).