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.

Hercules Bootloader Example

Other Parts Discussed in Thread: HALCOGEN

Hi,

I'm trying to modify the Hercules Bootloader example. I have found several challenges:

    1  I couldn't find a clear explanation of the linker file. The way memory is organized and the sintaxis used for the sections.

    2  I tried a few things to be able to debug the original code and see what is happening but I was unsuccessful. Breakpoints just don't work (probably because the code is running from RAM). Is there a way to debug this example? If not, what could be a useful trick to be able to customize this example?

Please point me in the right direction for the proper documentation or any reading that might help.

Thanks,

Scott

  • Hello Scott,

    If you could provide a copy of the linker command file you are using and what you are trying to accomplish, I can provide some examples of the syntax that you will need to use to define the needed sections.

    In regard to the memory map, it is defined within the device datasheet and should help you correlate to some of the syntax in the linke command file. For additional information/reading material, you can go to the CCS Help-->Search and you will find information on the syntax and how to setup SECTIONS within the linker command file.

  • Thanks for the response Chuck,

    I have been having a lot of trouble customizing the bootloader example.This is mainly because of two things:

       1 I am not able to debug. I can not set a single breakpoint. Any thoughts about this problem?

       2 Code Composer returns this error when I want to program the device :

    CortexR4: Trouble Writing Memory Block at 0xaf9c on Page 0 of Length 0x28
    CortexR4: Unable to terminate memory download: (Error -1003 @ 0x2BC5) Internal error: Invalid parameter passed to function. Restart the application. If error persists, please report the error. (Emulation package 5.0.762.0)
    CortexR4: GEL: File: C:\Program Files\Texas Instruments\Hercules\Hercules Bootloader\Debug\Hercules Bootloader.out: Load failed.

    This error started with the original bl_linl.cmd file so I edited it to give more memory to the loader (what I am using requires more memory). However the error keeps showing with the following file (I just gave more memory to the BOOT_LOAD code):

    What does the following code mean? Why are only bl_boot_eaby.obj and startup_eabi.obj referenced?

       boot_code :    {..\Debug\src\bl_boot_eabi.obj (.text)} > BOOT_LOAD
       eabi_start :   {..\Debug\src\startup_eabi.obj (.text)} > BOOT_LOAD

    --retain="*(.intvecs)"

    MEMORY
    {
        VECTORS     (X)  : origin=0x00000000 length=0x00000060
        BOOT_LOAD  (RX)  : origin=0x00000060 length=0x000FF700
        FLASH0     (RX)  : origin=0x00100000 length=0x00080000
        FLASH1     (RX)  : origin=0x00180000 length=0x00080000
        SRAM       (RW)  : origin=0x08000000 length=0x00030000
    }


    SECTIONS
    {
       .intvecs : {} > VECTORS

       boot_code :    {..\Debug\src\bl_boot_eabi.obj (.text)} > BOOT_LOAD
       eabi_start :   {..\Debug\src\startup_eabi.obj (.text)} > BOOT_LOAD

       GROUP
        {
            .text
            .const
            .data
            .cinit
            .pinit
        } load = FLASH0, run = SRAM, LOAD_START(init_load), RUN_START(init_run), SIZE(init_size)

        GROUP
        {
            .bss
            .stack   :                                               /* SOFTWARE SYSTEM STACK                 */
               {                                                       /* initial stack pointer values          */
                . += 0x600;  _StackSVC_pv   = .;                       /* (must point to the top of the stack)  */
                . += 0x100;  _StackABT_pv   = .;
                . += 0x100;  _StackUDEF_pv  = .;
                . += 0x100;  _StackFIQ_pv   = .;
                . += 0x180;  _StackIRQ_pv   = .;
                . += 0x800;  _StackUSER_pv  = .;
               }
        } run = SRAM, RUN_START(bss_run), RUN_END(bss_end), SIZE(bss_size), RUN_END(__STACK_TOP)

    }

  • Hello Scott:

    The code you highlighted (see below) is mapping the specific object files to the section of memory defined by BOOT_LOAD.

       boot_code :    {..\Debug\src\bl_boot_eabi.obj (.text)} > BOOT_LOAD
       eabi_start :   {..\Debug\src\startup_eabi.obj (.text)} > BOOT_LOAD

    Also, it seems that the reason you are not able to debug your code is because it is afailing the load operation. It is not being programmed into the device and therefore there is no code executing on your device.

    As I am not familiar with the boot loader example, I am forwarding your post to the author of the code and he should be able to help you through the process of getting this up and running. This might be an issue with the endianess of the device since the device utilizes the flash api and the RM48 version requires a LE version of these libraries.

  • Hi Chuck,

    Thanks for the answer.

    Yes, It seems that it is the mapping to BOOT_LOAD. But:

         1 Why is this done?
         2 Why the rest of the object files are not specifically mapped to memory sections?
         3 The linker file generated by HalCoGen does not include any groups or mapping by object files. Is there somewhere good documentation of the linker file or the bootloader example?

    Also, I know that the code is not being programmed in the device. I did not explained myself very well. This is what happens:

        1 I test the example as it is without any changes.
        2 The program does not stop in the main when debugging.
        3 If I set any breakpoint the example does not stop. It just keeps running until it is waiting for a signal in the SPI module.
        4 I decided to keep working like that and try to make the changes that I need.
        5 After a few changes the following error code started showing up:

    CortexR4: Trouble Writing Memory Block at 0xaf9c on Page 0 of Length 0x28
    CortexR4: Unable to terminate memory download: (Error -1003 @ 0x2BC5) Internal error: Invalid parameter passed to function. Restart the application. If error persists, please report the error. (Emulation package 5.0.762.0)
    CortexR4: GEL: File: C:\Program Files\Texas Instruments\Hercules\Hercules Bootloader\Debug\Hercules Bootloader.out: Load failed.

        6 I do not know what caused the error. I am guessing it has something to do with the linker file. However, as I am not able to understand the linker file I can not fix it.

    I hope this clarifies my doubts.

    Thanks for forwarding the post to the author of the code. I will be waiting for a reply.

  • Just wondering if anyone has any hints regarding my doubts.

  • Hello Scott,

    I am sorry hearing you could not debug the bootloader code. Are you still working on bootloader? Which bootloader are you using: SPI, CAN , or UART? 

    Regards,

    QJ