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.

AM2634: Use FreeRTOS in secondary bootloader

Part Number: AM2634


Hello,

We are trying to use Ethernet / LWIP stack  and FreeRTOS in our secondary bootloader. To test if it is feasible I integrated the example code of enet_cpsw_tcpserver into the sbl_qspi code and made some changes to linker.cmd file. After the project was built, the error came up like this:

undefined 
symbol 
--------- 
_vectors_sbl

The modified version of linker.cmd file is attached as below:

--stack_size=16384
--heap_size=32768
-e_vectors_sbl  /* for SBL make sure to set entry point to _vectors_sbl */

__IRQ_STACK_SIZE = 256;
__FIQ_STACK_SIZE = 256;
__SVC_STACK_SIZE = 4096;
__ABORT_STACK_SIZE = 256;
__UNDEFINED_STACK_SIZE = 256;

SECTIONS
{
    .sbl_init_code: palign(8), fill=0xabcdabcd
    {
       *(.vectors) /* IVT is put at the beginning of the section */
       . = align(8);
    } load=MSRAM_VECS, run=R5F_VECS
    .vectors:{} palign(8) > MSRAM_VECS
    GROUP {
        .text:   {} palign(8)
        .text.hwi: palign(8)
        .text.cache: palign(8)
        .text.mpu: palign(8)
        .text.boot: palign(8)
        .data:   {} palign(8)
        .rodata: {} palign(8)
    } > MSRAM_0
    .bss:    {} palign(8) > MSRAM_0
    RUN_START(__BSS_START)
    RUN_END(__BSS_END)
    .sysmem: {} palign(8) > MSRAM_0
    .stack:  {} palign(8) > MSRAM_0
    GROUP {
        .irqstack: {. = . + __IRQ_STACK_SIZE;} align(8)
        RUN_START(__IRQ_STACK_START)
        RUN_END(__IRQ_STACK_END)
        .fiqstack: {. = . + __FIQ_STACK_SIZE;} align(8)
        RUN_START(__FIQ_STACK_START)
        RUN_END(__FIQ_STACK_END)
        .svcstack: {. = . + __SVC_STACK_SIZE;} align(8)
        RUN_START(__SVC_STACK_START)
        RUN_END(__SVC_STACK_END)
        .abortstack: {. = . + __ABORT_STACK_SIZE;} align(8)
        RUN_START(__ABORT_STACK_START)
        RUN_END(__ABORT_STACK_END)
        .undefinedstack: {. = . + __UNDEFINED_STACK_SIZE;} align(8)
        RUN_START(__UNDEFINED_STACK_START)
        RUN_END(__UNDEFINED_STACK_END)
    } > MSRAM_0

    /* For NDK packet memory*/
    .bss:ENET_CPPI_DESC        (NOLOAD) {} ALIGN (128) > CPPI_DESC
    .bss:ENET_DMA_PKT_MEMPOOL  (NOLOAD) {} ALIGN (128) > MSRAM_0
}

MEMORY
{
    R5F_VECS :  ORIGIN = 0x00000000 , LENGTH = 0x00000100
    R5F_TCMA :  ORIGIN = 0x00000100 , LENGTH = 0x00007F00
    R5F_TCMB0:  ORIGIN = 0x41010000 , LENGTH = 0x00008000
    MSRAM_VECS: ORIGIN = 0x70002000 , LENGTH = 0x00000100
    /* CPPI descriptor memory */
    CPPI_DESC : ORIGIN = 0x70002100 , LENGTH = 0x00004000
    MSRAM_0  :  ORIGIN = 0x70006100 , LENGTH = 0x40000 - 0x4100
}

I wonder what could cause this error?

Thanks,

Wenkai

  • Hi Wenkai,

    This is because you are not taking the nortos*lib which contains HwiP_armv7r_vectors_nortos_sbl_asm.S which has the definition of _vectors_sbl.
    As you have implemented freertos, and its libs you are using HwiP_armv7r_vectors_freertos_asm.S .

    In your linker.cmd change the -e_vectors_sbl to -e_vectors and this will set your entry point to be _vectors and will execute the code accordingly.

    Hope that helps.

    Best Regards,
    Aakash

  • Hi Aakash,

    Thanks for the clarification.

    I noticed nortos*lib contains both HwiP_armv7r_vectors_nortos_sbl_asm.S and HwiP_armv7r_vectors_nortos_asm.S files; and freertos lib only has HwiP_armv7r_vectors_freertos_asm.S but there is no HwiP_armv7r_vectors_freertos_sbl_asm.S

    Why nortos version has two different asm files but freertos version has only one?

    After I changed to -e_vectors, the original error was gone, but there were some other linker script related errors showing up:

    "../linker.cmd", line 20: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment fails for section "GROUP_1" size 0x71471.  Available memory ranges:
       MSRAM_0      size: 0x3bf00      unused: 0x2eb00      max hole: 0x2eb00   
    "../linker.cmd", line 29: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment fails for section ".bss" size 0x423e1.  Available memory ranges:
       MSRAM_0      size: 0x3bf00      unused: 0x2eb00      max hole: 0x2eb00

    Did above errors indicate there were not enough memory for sbl? After I changed the memory space for sbl to 800KB, it successfully built.

    What is the upper limit for sbl memory size anyway?

    Thanks,

    Wenkai

  • Hi Wenkai,

    Why nortos version has two different asm files but freertos version has only one?

    SBL is only available in NORTOS mode. So NORTOS can be either of the two applications -- General Example, SBL Example. So there are two files for the same.

    What is the upper limit for sbl memory size anyway?

    BootROM/RBL can boot up to 960KB of SBL.

    Best Regards,
    Aakash

  • Hi Aakash,

    SBL is only available in NORTOS mode

    Can RTOS be used in SBL as freertos version doesn't have HwiP_armv7r_vectors_freertos_sbl_asm.S?

    Thanks,

    Wenkai

  • Hello Aakash,

    If I used freeRTOS in sbl, it couldn't bootload the application code. Does TI have the plan to include FreeRTOS usage in sbl in near future?

    Thanks,
    Wenkai

  • Hi Wenkai,

    We do not plan to support FreeRTOS in SBL anytime.

    Best Regards,
    Aakash 

  • Okay, it seems we have to wait for NO RTOS support for Enet- lwip which will be available in MCU SDK 8.5 if we need to use Enet- lwip stack in our SBL.

  • Hi Wenkai,

    That's true. We are working on integrating ENET-LWIP with NORTOS to have a Ethernet support in SBL. This is planned in 8.5 release of MCU_PLUS_SDK.

    Hope this helps.

    Best Regards,
    Aakash