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.

Need to jump from bootloader to downloaded executable file

Hi,

Precondition:

I am using TMS570LS controller, I Flashed the bootloader available in FLASH BANK 0 of TMS570LS through CCS.

Now,

I developed one model through MATLAB and compiled through TargetLink software. As a result of compiling through PIL(Product in Loop) mode, TargetLink software generated executable files for the MATLAB model in SREC (S - Record) and FLD (Fast-Download).

This SREC file format holds the starting address which is going to execute after flashing this FLD file. I flashed this executable file in FLASH BANK 1 of TMS570LS through TargetLink software itself and i verified that too.

But the SREC file holds the starting address of FLASH BANK 0 (0x00000000) always, Instead of FLASH BANK 1.

Please tell me, is that any other way to code the linker command file to start the execution from FLASH BANK 1?

Thanks and Regards

Gowdham Natarajan

  • This should be pretty easy to do.

    There are different ways to write a linker command file, but for the TI linker and TMS570 you might have something like what is pasted below.

    You can either:

     a) change the origin of FLASH0 for the Mathworks project,  so that it starts after your bootloader.    (Make sure to reduce the length too).

     b) in the SECTIONS area where you see FLASH0 | FLASH1 just change this to FLASH1 only

    If your linker command file is very different and you want us to look at it then pls. post and we'll make a suggestion.

    MEMORY

    {

        VECTORS (X)  : origin=0x00000000 length=0x00000020

        FLASH0  (RX) : origin=0x00000020 length=0x0017FFE0

        FLASH1  (RX) : origin=0x00180000 length=0x00180000

        STACKS  (RW) : origin=0x08000000 length=0x00001500

        RAM     (RW) : origin=0x08001500 length=0x00026b00

    }

    SECTIONS

    {

        .intvecs : {} > VECTORS

        .text    : {} > FLASH0 | FLASH1

        .const   : {} > FLASH0 | FLASH1

        .cinit   : {} > FLASH0 | FLASH1

        .pinit   : {} > FLASH0 | FLASH1

        .bss     : {} > RAM

        .data    : {} > RAM

     

    }

     

  •  

    Hi,

    I did the same way you mentioned above. But, i didn't understand what you are trying to say? First i will make you clear, I have two linker command files. One which i use to flash the bootloader in Flash Bank 0 through CCS and the other linker file which i have to flash my executable (FLD file) to Flash Bank 1 through Target Link tool.

    Now in which linker file you want me to make these changes?

    and

    you mention in point (a) as change the origin of FLASH0 for the Mathworks project. Please give me more explanation for this.

    Sorry, i couldn't place the linker file here.

    Thanks and Regards

    Gowdham Natarajan

  • Hi Natarajan,

    If I understand correctly, you want to link your Matlab program such that it loads and executes from Flash Bank 1.   Whereas you have your bootloader always in Flash Bank 0?

    If that's correct, then you should change the linker command file for your Matlab code. (executable) not your bootloader.

    To confirm are you using TI's hex conversion utility to convert from EABI to SREC?   Are you using the default --motorola=3 or -m3 command line option such that the S record is generated with 32-bit addresses?   If you're not sure, but can paste your first couple of lines from SREC here I can tell you.

    Also, I assume you are not trying to relocate the SREC before executing.   In other words, you are using the bootloader only to flash the SREC into the device through some serial port link...   But once the SREC is flashed you're intending to execute it in place.   Is that correct?

    Last, do you see any lines like Load = or Run = in your linker command file?   Reason is it is possible to specify these differently,  and that might make your SREC still try to load at address 0 even if you run at a higher address.   If you don't see these lines, then the load and run addresses should be the same;  which is what you'd want if you're going to execute the image in place.

    Best Regards,
    Anthony

  • Hi Anthony,

    Thanks for understood clearly. As you said, i made the modification in my Linker command file for MATLAB code, but still the issue remains same.

    Yeah, I am sure. am using TI utility.

    Also, I am not using any load = or Run = in my linker file.

    I pasted memory block and sections block of the linker file.

    /*----------------------------------------------------------------------------*/
    /* Linker Settings                                                            */

    --retain="*(.intvecs)"

    /*----------------------------------------------------------------------------*/
    /* Memory Map                                                                 */

    MEMORY
    {
        VECTORS (X)  : origin=0x00000000 length=0x00000020
    /*    FLASH0  (RX) : origin=0x00000020 length=0x001FFFE0 */
        FLASH1  (RX) : origin=0x00080000 length=0x00080000
    /*    FLASH2  (RX) : origin=0x00100000 length=0x00080000
        FLASH3  (RX) : origin=0x00180000 length=0x00080000
        STACKS  (RW) : origin=0x00000000 length=0x00001300*/
        RAM     (RW) : origin=0x08000000 length=0x00006D00

    }

    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */

    SECTIONS
    {
        .intvecs : {} > FLASH1
        .text    : {} > FLASH1 /*FLASH0 | FLASH1 | FLASH2 | FLASH3*/
        .const   : {} > FLASH1 /*> FLASH0 /*| FLASH1 | FLASH2 | FLASH3*/
        .cinit   : {} > FLASH1 /*> FLASH0 /*| FLASH1 | FLASH2 | FLASH3*/
        .pinit   : {} > FLASH1 /*> FLASH0 /*| FLASH1 | FLASH2 | FLASH3*/
        .bss     : {} > RAM /*FLASH0 /*RAM*/
        .data    : {} > RAM /*FLASH0 /*RAM*/

    }

    Thanks and Regards

    Gowdham Natarajan

  • Hello Gowdham, 

    Is this issue still open/un-resolved?

  • Dear Brian,

          Thanks for reminding me and really sorry i forgot to update the answer for this discussion. I found the way to replace the address in SREC format.

    Solution:

    Added one parser file and called finally in make file which tells the linker, to find the start address from MAP file and replace the default address present in SREC format. Then the SREC format is converted to FLD format for flashing the code.

     

    Thanks and Regards

    Gowdham Natarajan