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.

Bootloader for TIRTOS application

Other Parts Discussed in Thread: TM4C123GH6PGE, SYSBIOS, TM4C1294NCPDT

Hi,

I am using USB bootloader to update the firmware for Tiva TM4C123GH6PGE.

Using LM Flash Programmer I flash usb bootloader at 0x0 via JTAG. Then in my application, I re-define the APP_BASE value in "appname_ccs.cmd" to 0x00002800, and flash it to chip via USB DFU interface. That is OK with the normal application.

But with the TIRTOS application, when I change app base address in EKS_LM4F232.cmd to become any value other than default 0x0, I got the compile error, it says:

#10264 DEFAULT memory range overlaps existing memory range FLASH SD_log C/C++ Problem
#10264 DEFAULT memory range overlaps existing memory range SRAM SD_log C/C++ Problem

Any idea on this issue?

I want to update new TIRTOS firmware via USB with USB loader, but got stuck at this step.

Thanks,

Tin

  • The TM4C123GH6PGE device has the USB bootloader stored in ROM so you can use that instead of putting it into flash.  Is there a reason you need bootloader in flash?

    The compile errors sound like linker errors in the compiler.  It is unlikely the version of TI-RTOS you are loading is exceeding available memory.  Please try USB bootloader in ROM and see if that resolves the errors.

    -Joel

  • Hi Joe,

    With the USB ROM bootloader, I don't need to shift the APP_BASE address and everything worked just fine.

    But the reason I need a bootloader placed in flash is that I want to customize something in bootloader (adding some funtion), but got failed due to changing the APP_BASE address of application.

    In my application at 0x2800, it observes pulling down of a GPIO pin then jump to the "UpdateHandler" at 0x2C in bootloader to invoke the new update. It work OK also.

    But I am trying to place the bootloader at the bottom partition of flash memory, says 0x30000 instead of 0x0 (for 3FFFF  - 256KB flash), then I can put my application at 0x0 and no need to change the APP_BASE. After reset, the app run OK, but when I pulling down the  GPIO pin, PC hangup at FaultISR, actually I jumped the PC "UpdateHandler" by this code: (*((void (*)(void))(*(unsigned long *)0x3002C)))(); <== I changed from 0x2C to 0x3002C since bootloader place at 0x30000.

    I have a few questions:

    1. Is it possible to place the bootloader at another address other than 0x0? If so, what need to modify?

    2. It it possible to shift the APP_BASE for TIRTOS application to another address other than 0x0?

    Please help me clarify these points?

    Thaanks,

    Tin

  • 1) The bootloader must be located at 0x0.  The hardware reset vector always looks there for the first instruction.

    I'm currently researching an answer for your second question and will update this post as soon as possible.

    -Joel

  • I am also looking to see if this can still be done under TiRTOS.

    Previously under stellarisware I was able to move the vectors for the SysBios application by doing the following:

    // The starting address of the application. Normally the interrupt vectors

    // must be located at the beginning of the application.

    #define APP_BASE 0x00004000

    #define RAM_BASE 0x20000000

    --retain=g_pfnVectors

    MEMORY

    {

    // This is where our application can start

    FLASH_BT(RX) : origin = 0x00000000, length = 0x00004000

    FLASH (RX) : origin = 0x00004000, length = 0x000FC000

    SRAM (RWX) : origin = 0x20000000, length = 0x00040000

    }

    /* Section allocation in memory */

    SECTIONS

    {

    // Vectors are at start of FLASH after bootloader

    .resetVecs: > APP_BASE

    .text : > FLASH

    .const : > FLASH

    .cinit : > FLASH

    .pinit : > FLASH

    .init_array : > FLASH

    .vecs : > RAM_BASE

    .data : > SRAM

    .bss : > SRAM

    .sysmem : > SRAM

    .stack : > SRAM

    }

    __STACK_TOP = __stack + __STACK_SIZE;

     

    However I have now found with TiRTOS this doesn't work anymore.

    The linker still puts the vector table at 0 even though I have asked it to move it.

    I basically wind up with only the vector table in my reserved bootloader block and all the rest of my code where I want it to be.  Like the original poster I would like to install a custom bootloader which needs to run our protocol and also display a boot message on the LCD.

  • I found I can move the reset vectors location by the following:

    Changed the cfg file to include a section for the vectors

    MEMORY
    {
    
    
       // This is where our application can start
       FLASH_BT (RX) : origin = 0x00000000, length = 0x00004000
       FLASH_VEC (RX) : origin = 0x00004000, length = 0x00000400
       FLASH (RX) : origin = 0x00004400, length = 0x000FCC00
       SRAM (RWX) : origin = 0x20000000, length = 0x00040000
    }

    Then added the following into the project CFG file

    Program.sectMap[".resetVecs"] = "FLASH_VEC";

    The map file now correctly shows resetvecs located at 0x00004000 and my code at 0x00004400

  • Hi Barry,

       Were you able to get this working for you?  I am trying something similar for my project but not having success:

    This is my TM4C1294NCPDT.cmd file:

    --retain=g_pfnVectors
    
    #define BL_BASE  0x00000000
    #define APP_BASE 0x00040000
    #define APP_BASE_PLUS_RSTVECS 0x00040400
    #define RAM_BASE 0x20000000
    
    MEMORY
    {
    	FLASH_BL (RX) : origin = BL_BASE, length = APP_BASE
    	FLASH_VEC (RX) : origin = APP_BASE, length = 0x00000400
            FLASH (RX) : origin = APP_BASE_PLUS_RSTVECS, length = 0x000BFC00
            SRAM (RWX) : origin = RAM_BASE, length = 0x00040000
    }
    
    
    /* Section allocation in memory */
    SECTIONS
    {
        .intvecs:   > APP_BASE
        .text   :   > FLASH
        .const  :   > FLASH
        .cinit  :   > FLASH
        .pinit  :   > FLASH
        .init_array : > FLASH
    
        .vtable :   > RAM_BASE
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM
    }
    
    __STACK_TOP = __stack + 512;

    I also added this to my app.cfg file

    Program.sectMap[".resetVecs"] = new Program.SectionSpec();
    Program.sectMap[".resetVecs"] = "FLASH_VEC";

    but if i check my .map file i still see the .resetVecs in the wrong section:

    MEMORY CONFIGURATION
    
             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
      FLASH_BL              00000000   00040000  0000003c  0003ffc4  R  X
      FLASH_VEC             00040000   00000400  00000000  00000400  R  X
      FLASH                 00040400   000bfc00  00017a50  000a81b0  R  X
      SRAM                  20000000   00040000  000152ac  0002ad54  RW X
    
    
    SEGMENT ALLOCATION MAP
    
    run origin  load origin   length   init length attrs members
    ----------  ----------- ---------- ----------- ----- -------
    00000000    00000000    0000003c   0000003c    r--
      00000000    00000000    0000003c   0000003c    r-- .resetVecs

    Any idea what I am missing? 

  • For the latest tivaware you need to add the following to the cfg script file

    // Import the device specific Hwi module
    var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
    m3Hwi.resetVectorAddress = 0x8000;
    

    Where 0x8000 is the address you want the new code to start at,