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.

TMS570LC4357: Bootloader CAN and FreeRTOS

Part Number: TMS570LC4357

Hello, I've got a problem while running a program using FreeRTOS and loading it throught the bootloader. A program without FreeRTOS works perfectly, but when I use FreeRTOS in the application the program doesn't work. I'm able to load it but when I put the RUN command it doesn't work. What should I do? Thank you

Here you can find the application linker settings

/* Linker Settings */
--retain="*(.intvecs)"
/*----------------------------------------------------------------------------*/
/* Memory Map */
MEMORY
{
VECTORS (X) : origin=0x00010020 length=0x00000040
/*sector 4/5 are used for application */
FLASH_CODE (RX) : origin=0x00010060 length=0x80000 - 0x40 fill=0xFFFFFFFF
FLASH0 (RX) : origin=0x00090020 length=0x00200000 - 0x18000
FLASH1 (RX) : origin=0x00300020 length=0x00200000
STACKS (RW) : origin=0x08000000 length=0x00001500
RAM (RW) : origin=0x08001500 length=0x0007EB00
}
/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
.intvecs : {} > VECTORS
.text align(32) : {} > FLASH_CODE
.const align(32) : {} > FLASH_CODE
.cinit align(32) : {} > FLASH_CODE
.pinit align(32) : {} > FLASH_CODE
.kernelBSS align(32) : {} > FLASH_CODE
.kernelHEAP align(32) : {} > FLASH_CODE
.kernelTEXT align(32) : {} > FLASH_CODE
.bss : {} > RAM
.data : {} > RAM
.sysmem : {} > RAM
}

An here there's the bootloader intvecs.asm

    .sect ".intvecs"
    .arm

;-------------------------------------------------------------------------------
; import reference for interrupt routines

    .ref _c_int00
    .ref phantomInterrupt
    .def resetEntry

;-------------------------------------------------------------------------------
; interrupt vectors

resetEntry
        b   _c_int00
undefEntry
        b   undefEntry
svcEntry
        b   svcEntry
prefetchEntry
        b   prefetchEntry
dataEntry
        b   dataEntry
        b   phantomInterrupt
        ldr pc,[pc,#-0x1b0]
        ldr pc,[pc,#-0x1b0]

If you need any additional files please ask me, I will provid them

Thank you again

  • Hi Lorenzo,

    Can you please refer below thread:

    (+) TMS570LC4357: freertos bootloader application getting problem in I2C - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    This is a recent thread similar to yours and solved by me. Please do apply the modifications suggested in above thread.

    --

    Thanks & regards,
    Jagadish.

  • Ok, after trying some solutions the working solution is:

    Modify the HL_sys_link.cmd of the APPLICATION like this:

    /*----------------------------------------------------------------------------*/
    /* Memory Map                                                                 */
    
    MEMORY
    {
        VECTORS (X)  : origin=0x00010020  length=0x00000020 vfill = 0xffffffff
        KERNEL  (RX) : origin=0x00010040  length=0x00008000 vfill = 0xffffffff
        FLASH0  (RX) : origin=0x00018040 length=0x001F7FE0 vfill = 0xffffffff
        FLASH1  (RX) : origin=0x00210020 length=0x00200000 vfill = 0xffffffff
        STACKS  (RW) : origin=0x08000000 length=0x00000800
        KRAM    (RW) : origin=0x08000800 length=0x00000800
        RAM     (RW) : origin=(0x08000800+0x00000800) length=(0x0007f800 - 0x00000800)
        
    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }
    
    /* USER CODE BEGIN (3) */
    /* USER CODE END */
    
    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */
    
    SECTIONS
    {
        .intvecs : {} > VECTORS
        /* FreeRTOS Kernel in protected region of Flash */
        .kernelTEXT  align(32) : {} > KERNEL
        .cinit       align(32) : {} > KERNEL
        .pinit       align(32) : {} > KERNEL
        /* Rest of code to user mode flash region */
        .text        align(32) : {} > FLASH0 | FLASH1
        .const       align(32) : {} > FLASH0 | FLASH1
        /* FreeRTOS Kernel data in protected region of RAM */
        .kernelBSS    : {} > KRAM
        .kernelHEAP   : {} > RAM
        .bss          : {} > RAM
        .data         : {} > RAM    
    
    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }
    

    I had to recalculate the origin of the memory because of the offset of 0x00010020 fot the bootloader.

    So just start from 0x00010020 and then sum the lenght with Windows exadecimal calculator to find the next origin.

    Remeber to do vfill to avoid ECC errors.

    I didn't have to modify the SECTIONS.

     

    The next thing to do is to modify BOOTLOADER code

    This is HL_sys_intvecs.asm

        .sect ".intvecs"
        .arm
    
    ;-------------------------------------------------------------------------------
    ; import reference for interrupt routines
    
        .ref _c_int00
        .ref phantomInterrupt
        .def resetEntry
    
    ;-------------------------------------------------------------------------------
    ; interrupt vectors
    
    resetEntry
            b   _c_int00
    undefEntry
            b   #0x10018
    svcEntry
            b   #0x10018
    prefetchEntry
            b   #0x10018
    dataEntry
            b   #0x10018
            b   phantomInterrupt
            ldr pc,[pc,#-0x1b0]
            ldr pc,[pc,#-0x1b0]
    
        
    ;-------------------------------------------------------------------------------

    I modified the original one, changing to #0x10018 to redirect the varius things like interrupts, whatchdogs, FreeRTOS functions and so on

    It's working now, thank you