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.

Application code won't start after "USB Stick Update" based Firmware Update of TM4C1294NCPDT

Other Parts Discussed in Thread: EK-TM4C1294XL, LMFLASHPROGRAMMER, SYSBIOS

MCU: TM4C1294NCPDT

CCS: v6.0.1.0040

-

Hi,

    I have loaded the example code USB_stick_update for the EK-TM4C1294XL in the eval board. In a USB thumb drive, I have loaded the .bin file as FIRMWARE.BIN & inserted the thumb drive on the USB Host port of the Eval Kit. I find (by debugging) that even after the loading is over, the application program won't start!! I even restarted the eval kit with the thumb drive removed & making sure that the statement "CallApplication(APP_START_ADDRESS);" executes. Even then, the app code won't run!!

    Can anyone suggest me how to proceed to debug the issue. Since, the debugger is running, the application code (USB_stick_update) which is loaded from the thumb drive cannot be debugged!! Only a few assembly code can be seen....

-

PLEASE NOTE: That the .bin is generated from .out file using command line program(s) provided in "C:\ti\ccsv6\utils\tiobj2bin". The original .out file is running fine on Tiva C MCU. Don't know whether the memory storage location shifting from 0x0000 to 0x8000 is making any difference or NOT!!

-

Thanks

-

Regards

Soumyajit

  • Hello Soumyajit,

    Is there a boot loader at 0x0 which is fetching the data from the USB device? When a change of the address is made for the application image to 0x8000, do note that the Vector Table content also needs to be changed.
    When the Call Application is executed, what is the content of the AOO_START_ADDRESS

    Regards
    Amit
  • Hi Amit,

    Thanks for putting in your valuable time in assisting me. I have straight forward copied the bootloader example provided in the example codes section of EK-TM4C1294XL known as USB Stick Update. As far as my understanding goes, this code is approx. 17KB in size & it will load the binary image provided in a USB Thumb Drive (as a file named FIRMWARE.BIN) in the MCU's FLASH memory location starting from 0x8000. Since my binary file (FIRMWARE.BIN) is of size 234KB, it will fit in the memory easily.

     What is AOO_START_ADDRESS? Did you mean APP_START_ADDRESS? If so, then the APP START ADDRESS is 0x8000 (as provided in the provided example code of USB Stick Update).

     Regarding shifting/moving of the vector table, there is a function that gets called "CallApplication(APP_START_ADDRESS);". In this function, I believe, the vector table is moved accordingly by the statement "HWREG(NVIC_VTABLE) = ui32StartAddr;". After the vector table is moved, a few assembly code is executed as shown below:

    //
    // Load the stack pointer from the application's vector table.
    //
    __asm(" ldr r1, [r0]\n"
    " mov sp, r1\n");

    //
    // Load the initial PC from the application's vector table and branch to
    // the application's entry point.
    //
    __asm(" ldr r0, [r0, #4]\n"
    " bx r0\n");

    I think this code segment will transfer control of the CPU to the APP_START_ADDRESS contents.

    -

    Thanks

    -

    Regards

    Soumyajit

  • Hello Soumyajit

    The steps illustrated are correct. Just to confirm,

    1. The application image (FIRMWARE.bin) is compiled with APP_START_ADDRESS as 0x8000?
    2. The application image is in the root directory of the USB Stick
    3. The application image is copied correctly into 0x8000 location onwards? You can use LMFlashProgrammer to check the contents of 0x8000 against the application image bin file on your PC (LMFlashProgrammer -> Flash utilities -> Verify Flash Contens -> Against .bin file)
    4. If still after 1-2-3 the code does not execute, check where the SP and PC are now pointing to?

    Regards
    Amit
  • Hi Amit,
    Thanks for the reply. We here used to program Stellaris MCU using LMFlash, will LMFlash also support Tiva C MCU?

    I have checked using the CCSv6 debugger that after the firmware file is loaded into the MCU's FLASH, the PC does become 0x00008000 & the SP becomes 0x2000XXXX (somewhere after 0x2000000). So, I conclude that the bootloader may be working fine!! But when I find that the PC = 0x00008000 the program (application code) won't get executed!!
    I will try to compile a small led blink code then try to load the same using the bootloader & see whether the led blink works correctly or NOT!
    Will update you about this soon...
    -
    Thanks
    -
    Regards
    Soumyajit
  • Hello Soumyajit

    Any updates since then?

    Regards
    Amit
  • Hi Amit,
    Today, I tested with a sample LED blink program to check whether the bootloader is able to load the FIRMWARE.BIN file from the Thumb Drive to the MCU's FLASH or NOT. Unfortunately, the firmware.bin image is not running on the MCU. When I am loading this file directly from the CCSv6 IDE, the LED blinking is happening perfectly!!
    Can you suggest a possible fix or further diagnosis procedure?
    Is it possible for you to check the USB_STICK_UPDATE program at your side/place on EK-TM4C1294XL eval board?
    -
    Thanks
    -
    Regards
    Soumyajit
  • Hello Soumyajit,

    You confirm that FIRMWARE.BIN file has been load from the Thumb, but the firmware.bin image processing didn't run.
    Maybe you should check the APP_Base of FIRMWARE.BIN.
    In your FIRMWARE.BIN project,you can find XXX_ccs.cmd file.Check #define APP_BASE 0x00008000 or not.
    You should set the address(APP_BASE ) same as APP_START_ADDRESS in USB_stick_update.c


    Regards
    Arthur
  • Hi Arthur,

       Thanks for helping me, at least now I know the real cause of the issue. I initially had a project (TI-RTOS based) which I was unable to load using the said bootloader. To test the situation from a much basic point of view, I created a sample LED blink program (Non RTOS based) for testing purpose.

       As you mentioned, I opened the XXX_ccs.cmd file & found the #define APP_BASE 0x00000000, so I modified it to 0x00008000 & the LED blink program loaded from the Thumb Drive & is running successfully.

       Thinking that the issue is resolved, I opened my TI-RTOS based project to make similar modification of the XXX_css.cmd file, but there is no #define APP_BASE defined at all!!! How can I instruct the compiler to put the APP codes starting at FLASH location 0x00008000 in a TI-RTOS based project?

       PLEASE HELP!!

    In the meanwhile, I'll try to rip the bootloader code to start copying FIRMWARE.BIN file from its starting location (0x00000000) to MCU FLASH starting location (0x00008000). In my opinion, it should work!

    -

    Thanks

    -

    Regards

    Soumyajit

  • Hi Arthur,

       A detailed study of the XXX_ccs.cmd of the NON RTOS project showed that the APP_BASE declaration basically changes the following (highlighted in yellow):

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

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

    #define APP_BASE 0x00008000

    #define RAM_BASE 0x20000000

    /* System memory map */

    MEMORY

    {

       /* Application stored in and executes from internal flash */

       FLASH (RX) : origin = APP_BASE, length = 0x00100000

       /* Application uses internal RAM for data */

       SRAM (RWX) : origin = 0x20000000, 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;

    -

        So, I decided to make the changes in the TI-RTOS XXX_ccs.cmd file but making the changes there is causing errors as follows:

    #10264 DEFAULT memory range overlaps existing memory range FLASH
    #10264 DEFAULT memory range overlaps existing memory range SRAM

    & warning:

    Warning points to linker.cmd file
    #10096-D specified address lies outside memory map

    linker.cmd contains a section which is pointed out by the warning link (highlighted in yellow):

    SECTIONS
    {
    .bootVecs: type = DSECT
    .vecs: load > 0x20000000
    .resetVecs: load > 0x0

    xdc.meta: type = COPY
    }

      The changed section of the XXX_ccs.cmd file (highlighted in yellow) follows:

    MEMORY
    {
    FLASH (RX) : origin = 0x00008000, length = 0x00100000
    SRAM (RWX) : origin = 0x20000000, length = 0x00040000
    }

    /* The following command line options are set as part of the CCS project. */
    /* If you are building using the command line, or for some reason want to */
    /* define them here, you can uncomment and modify these lines as needed. */
    /* If you are using CCS for building, it is probably better to make any such */
    /* modifications in your CCS project and leave this file alone. */
    /* */
    /* --heap_size=0 */
    /* --stack_size=256 */
    /* --library=rtsv7M4_T_le_eabi.lib */

    /* Section allocation in memory */

    SECTIONS
    {
    .intvecs: > 0x00008000
    .text : > FLASH
    .const : > FLASH
    .cinit : > FLASH
    .pinit : > FLASH
    .init_array : > FLASH

    .vtable : > 0x20000000
    .data : > SRAM
    .bss : > SRAM
    .sysmem : > SRAM
    .stack : > SRAM
    }

    __STACK_TOP = __stack + 512;

    -

    PLEASE HELP!!

    -

    Thanks

    -

    Regards

    Soumyajit

  • Hi Soumyajit,

    I think that you need to modify not only the define of address in TI-RTOS base.
    You can reference this post,it may help you.

    e2e.ti.com/.../1025584

    -
    Regards
    Arthur
  • Hi Arthur,

       Thanks for pointing out the details but inspite of adding the following lines

    -

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

    Program.sectMap[".resetVecs"].loadAddress = 0x00008000;

    m3Hwi.resetVectorAddress = 0x00008000;

    -

    to the .cfg file, the .map file shows the following:

    -

    MEMORY CONFIGURATION

            name            origin    length      used     unused   attr    fill

    ----------------------  --------  ---------  --------  --------  ----  --------

     FLASH                 00000000   00100000  0000ce30  000f31d0  R  X

     SRAM                  20000000   00040000  0000418d  0003be73  RW X

    SEGMENT ALLOCATION MAP

    run origin  load origin   length   init length attrs members

    ----------  ----------- ---------- ----------- ----- -------

    00000000    00000000    0000ce38   0000ce38    r-x

     00000000    00000000    0000003c   0000003c    r-- .resetVecs

     0000003c    0000003c    0000bfaa   0000bfaa    r-x .text

     0000bfe8    0000bfe8    00000b4a   00000b4a    r-- .const

     0000cb38    0000cb38    00000300   00000300    r-- .cinit

    20000000    20000000    00000360   00000000    rw-

     20000000    20000000    00000360   00000000    rw- .vecs

    20000400    20000400    00003e30   00000000    rw-

     20000400    20000400    0000351d   00000000    rw- .bss

     20003920    20003920    00000610   00000000    rw- .data

     20003f30    20003f30    00000300   00000000    rw- .stack

    SECTION ALLOCATION MAP

    output                                  attributes/

    section   page    origin      length       input sections

    --------  ----  ----------  ----------   ----------------

    .bootVecs

    *          0    00000000    00000008     DSECT

                     00000000    00000008     boot.aem4f : boot.oem4f (.bootVecs)

    .resetVecs

    *          0    00000000    0000003c    

                     00000000    0000003c     fatsdusbcopy_pem4f.oem4f (.resetVecs)

    xdc.meta   0    00000000    000000fe     COPY SECTION

                     00000000    000000fe     fatsdusbcopy_pem4f.oem4f (xdc.meta)

    xdc.noload

    *          0    00000000    00001574     COPY SECTION

                     00000000    00001574     fatsdusbcopy_pem4f.oem4f (xdc.noload)

    .init_array

    *          0    00000000    00000000     UNINITIALIZED

    -

        Am I missing something somewhere?

    -

    Thanks

    -

    Regards

    Soumyajit

  • Hi Soumyajit,

    I try with example project uartecho_TivaTM4C1294NCPDT and change the app_base
    And boot project is usb_stick_update(non-RTOS). Hope this can help you.

    In XXX.cmd I add #define APP_BASE 0x00008000
    and below code I place with APP_BASE.

    MEMORY
    {
    FLASH (RX) : origin = APP_BASE, length = 0x00100000
    SRAM (RWX) : origin = 0x20000000, length = 0x00040000
    }

    SECTIONS
    {
    .intvecs: > APP_BASE
    .text : > FLASH
    .const : > FLASH
    .cinit : > FLASH
    .pinit : > FLASH
    .init_array : > FLASH

    .vtable : > 0x20000000
    .data : > SRAM
    .bss : > SRAM
    .sysmem : > SRAM
    .stack : > SRAM
    }

    ***In XXX.cfg file I add below code,and then it works well in RTOS base
    -
    var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
    m3Hwi.resetVectorAddress = 0x8000; /* App base */
    -

    Regards
    Arthur
  • Hi Arthur,
    This really helped me, the solution worked.
    Thanks a lot.
    -
    Regards
    Soumyajit