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 problem

Other Parts Discussed in Thread: EK-TM4C123GXL, LMFLASHPROGRAMMER, TMS570LS3137

Hi,

I am using TiVa C series Launchpad..  I am using the Flash UART bootloader to download my code to the MCu

But I'm facing a problem right now

I successfully downloaded the code to the board using LM flash programmer through UART .. The MCU restarts but the program won't run

I'm using the Boot_serial example under the board TM4C123G I made no changes to the code except change the UART Baud rate


Please Help!!!

Thanks

  • Hello Sivaram,

    Let me get it correct.

    1. You have have downloaded the Flash based boot loader to location 0x0
    2. You have used the flash based boot loader to then download an application code to another offset (at the boundary of a sector outside the boot loader's space)
    3. The application does not run?

    If that is the case, can you connect the debugger w/o downloading the application code and see where the PC is looping and check the fault registers. More details on how to check for faults

    e2e.ti.com/.../374640

    Regardsm
    Amit
  • sorry for not stating the problem properly

    The flash is loaded in the address 0x0

    the program is loaded in 0x2800

    the program downloads to the Mcu via LM flash programmer

    It is stuck is some delay loop

    Delay: .asmfunc
    subs r0, #1
    bne Delay
    bx lr
    .endasmfunc

  • Hello Sivaram,

    That is a delay function in the boot loader. You mat want to step out of the function to reach the calling function in execution stack. Once we know what the calling function is, it can be a step forward in debugging.

    Regards
    Amit
  • Iam using ek-TM4C123GXL board

    Turns out it was GPIO update check the code was caught up there so now I disabled that update option
    now the code gets stuck in another place 0x486

    here are the fault info
    NVIC_FAULT_ADDR 0x4000C018 Bus Fault Address [Memory Mapped]

    NVIC_FAULT_STAT
    bus fault address register valid
    precise data bus error
  • Hello Sivaram,

    The location is UART0 Address Space. It seems that the UART0 has not been enabled by setting Bit-0 of RCGCUART peripheral Module

    Regards
    Amit
  • Thanks Amit

    But why is UART used in the first place The code has been uploaded so the bootloader should transfer the control to the application isn't it..
  • Hello Sivaram,

    Yes, it would transfer if the Application Code address has a valid SP and PC value associated at address 0x2800 and 0x2804 respectively. On the other hand since the code is faulted and looping at 0x486, it would mean that the boot loader did not successfully start. You would have to debug the same.

    BTW, what is the application code being used. The default demo code of boot_demo1 jumps back to the boot loader.

    Regards
    Amit
  • I am using boot_serial..

    how can I fix this...? pls help

    thanks
  • Hello Siva

    boot_serial is the boot loader. But what is the application code?

    Regards
    Amit
  • Hello Siva,

    Can you check if the Application Address Space is correctly relocated to 0x2800 and that the Boot Loader is actually looking at 0x2800 for application. Why not use the boot_demo1 for the application code which is the packaged solution before adding other codes?

    Regards
    Amit
  • The start of the application is at 0x2800

    Still I have the problem

    Okk I will try boot_demo1

  • Sivaram SR said:
    The start of the application is at 0x2800

    We suspect that Amit was (additionally) seeking, "How you've determined that the app starts @ 0x2800?"  

    Simply stating that it does fails to describe, "If and how" you've made such confirmation.

    Detail is (everything) where bootloaders are concerned.     And - we've long noted - never is the "overwhelming need" for the bootloader described...   (Agony far more noted!)

  • Hello Siva,

    The boot_demo1 and boot_demo2 are the correct code to first experiment with the boot_serial example. Only after understanding how the code behaves, should you make changes to other examples. The cmd file of the example is the main change.

    Regards
    Amit
  • Both the example code runs fine with the Boot_serial code
    But other code such as blinky fails to run

  • Hello Sivaram

    Can you please attach your blinky project?

    Regards
    Amit
  • Hello Sivaram

    As cb1 and myself stated the application start address needs to be corrected. In the project file you sent the APP_BASE in cmd file (the linker command file) is still pointing to 0x0. This has to be corrected to 0x2800 and the length then adjusted to be 0x40000-0x2800

    Regards
    Amit
  • Sorry, I misunderstood that post

    Thank you very Much :-)

    I will change that and test it

  • boot_serial.rarblinky.rar

    still not working

    here are both of my codes

  • Hello Sivaram,

    I am not able to gather the meaning of the following?

    /* Application stored in and executes from internal flash */
    FLASH (RX) : origin = APP_BASE, length = 0x00040000
    /* Application uses internal RAM for data */
    SRAM (RWX) : origin = 0x20000000, length = 0x40000-0x2800

    Isn't it simpler copying the contents of the cmd file of a project like boot_demo1 and use it in blinky? Also as you said it does not work. Did you attempt to connect a debugger and try to see where execution is? Also snapshot of the LMFlashProgrammer Screen would be useful to see if there is a configuration issue.

    I can get the project to work (and as you have demonstrated with boot_demo1 and 2 code), but then there is no learning for you.

    Regards
    Amit
  • Is it possible to feel both Amit's & poster's pain?

    As stated - making (any) change to a bootloader carries great risk - always (and only) attempt to make your (most necessary) changes only after everything is working really well.

    Substantial time/effort has been invested here - and the cruel reality - "odds are high that the program (which so vitally needs this bootload)" is unlikely to, "see the light of day."

    Could the use & ease of implementing the "bootloader" have (perhaps) been oversold?      The (always unexplained) need for the bootloader too often overwhelms the (new) user's attention to the required detail - and adoption of a systematic approach.     Perhaps (some) alert, "Great Attention to detail required!" would limit such attempts to only those with (real) (i.e. explainable) needs for this capability.

    Clearly there's a "mismatch" between most, "user skill, experience, real need" and the bootload implementation's published guidance/content.     Pretending otherwise fails to solve this (on-going) problem...

  • I have been working days on this yes i tried what amit said also in fact that's what i tried first but it didnt work so as a last ditch effort i tried the boot demo code cmd file

  • Hello Sivaram,

    So did it succeed? If yes, then what was the issue. If not then why has my answer been marked verified?

    Regards
    Amit
  • As (one) here has stated - does not such, "Inattention to "nagging" detail" stand as "prime suspect" to this "never to end" thread?

    Clearly user frustration - delay - and loss of your time/effort are clearly verifiable - but surely no "bootload" success!

    And - mais certainement - not one word as to WHY any bootloader is needed!    Should not this (always unjustified need) receive (some) examination?

    Seeing a bootloader succeed (maybe) - once - on youtube - stands as "likely suspect."    Yet the growing "pile" of "bootload crash/burn victims" signals a change of methods - and greater user alerting to the, "exacting attention to detail" - are required.

  • I want to program my micro controller using another micro controller I am not asking these details just for fun I need it for my project....

    It's been only a couple of months since I started using a Microcontroller so yes everything is new for me

  • Is that "want" sufficient to, "delay & grind to a halt" ALL of your other (necessary) MCU experimentation & learning?

    Your "method" violates "KISS" which states short, tightly defined, easily reachable goals! (none of which exists w/most any bootloader)

    Is it ever "wise" to start with the most complex?    (especially when you're so new - and so much (easier & instructive) learning is bypassed)

    In years past we programmed FPGAs & MCUs via simple JTAG - originating from an 8 bit MCU - w/out any need/use of bootloader...

  • I cant use JTAG i am planning to use I2C

  • You are good at creating "roadblocks" - not so much at producing "solutions."
  • Hi Amit,

    hope I'm not disturbing But the problem is still there.... can u explain me about the .cmd file ...



  • Hello Sivaram,

    No, you aren't. For CMD file You must refer to the CCS wiki on descriptions of the files. It is good read.

    processors.wiki.ti.com/.../Files_in_CCS_Projects

    Just to add to the post, can you describe in steps 1-2-...-N (remember N can be 1000) what are the exact steps you do from a brand new LaunchPad to get to the non-working scenario. Note that something as "trivial" as connecting USB cable must be one of the N steps.

    Regards
    Amit
  • 1) I programmed The Boot_serial Code into the TIVa launchpad(TM4C123GXL) using CCS I used the Option to erase the entire flash in the debugger options I didn't change the code at all

    2) Now the TivA board is connected Through UART to PC using a USB to UART device (silicon labs CP210X USB To UART) These are connected to the RXD and TxD pins near the reset button 

    3)now in the boot demo1 code I erased the whole code in Boot demo1.c and replaced it with the Blinky code and built the program copied the .bin file to My desktop

    4)Now I configured the LM Flash programmer to program through UART and and Checked the disable AutoBaud function loaded the code entered the address as 0X2800 and checked restart after program and then I clicked program

    5) The LM flash programmer says that the programming is successful but the LED won't blink

    While Using the debugger We can observe that  it is stuck at 0x00000288

    New update now even the Boot demo1 won't work

  • The Suggestion Amit Gave works It started working when I switched the workspace in CCS it's weird But I dunno If I Use My old workspace the code does not work

    Thank you Very Much I know I asked Some Stupid Questions But Thanks For solving the Issue

    And Amit I still Have some Doubts In the CMD file

    can the file length be larger than the actuall file length
  • Hello Sivaram

    Sorry my naiveness on the convention but Which file length can be larger than what "actual" file length.

    Regards
    Amit
  • Hi Amit Ashara,
    I download the UART Bootloader code mentioned in the sheet《UART Bootloader for Hercules TMS570LS31x MCU》 to TMS570ls3137 HDK.Run the bootloader I can get the main menu mentioned in the sheet.After pressing 1 I can download the app to the HDK though Hyper Terminal .Then I Press 3 But the app can't run and the led D1 on the HDK lighted out.I changed the APP_START_ADDRESS to 0x00020000 and changed the app_link_cmd to the same address.But It still can't run.Could you please help me ?My app is can moudle communicate and then light an led on the HDK.
    Below is the bl_link_cmd,I didn't change it

    --retain="*(.intvecs)"
    MEMORY
    {
    VECTORS (X) : origin=0x00000000 length=0x00000020
    FLASH_API (RX) : origin=0x00000020 length=0x000014E0
    FLASH0 (RX) : origin=0x00001500 length=0x002FEB00 //LS31x and RM48 Flash size is 0x300000
    SRAM (RW) : origin=0x08002000 length=0x0002D000
    STACK (RW) : origin=0x08000000 length=0x00002000
    }
    SECTIONS
    {
    .intvecs : {} > VECTORS
    flashAPI :
    {
    Fapi_UserDefinedFunctions.obj (.text)
    bl_flash.obj (.text)
    --library= ..\lib\F021_API_CortexR4_BE.lib (.text)
    } load = FLASH_API, run = SRAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

    .text > FLASH0
    .const > FLASH0
    .cinit > FLASH0
    .pinit > FLASH0
    .data > SRAM
    .bss > SRAM
    }
    Below is the app_link_cmd,I only changed the start sddress.

    MEMORY
    {
    VECTORS (X) : origin=0x00020000 length=0x00000020
    FLASH0 (RX) : origin=0x00020020 length=0x0017FFE0
    FLASH1 (RX) : origin=0x001A0000 length=0x00180000
    STACKS (RW) : origin=0x08000000 length=0x00001500
    RAM (RW) : origin=0x08001500 length=0x0003EB00

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

    /* USER CODE BEGIN (3) */
    /* USER CODE END */


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

    SECTIONS
    {
    .intvecs : {} > VECTORS
    .text : {} > FLASH0
    .const : {} > FLASH0
    .cinit : {} > FLASH0
    .pinit : {} > FLASH0
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM


    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    Below is the unchanged app_link_cmd:
    /* Memory Map */

    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=0x0003EB00

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

    /* USER CODE BEGIN (3) */
    /* USER CODE END */


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

    SECTIONS
    {
    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM


    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    Below is the main file of the app,the driver of the can and het is generated by HalCoGen04.06.01
    #include "sys_common.h"

    /* USER CODE BEGIN (1) */
    #include "sys_common.h"
    #include "can.h"
    #include "het.h"
    /* Include ESM header file - types, definitions and function declarations for system driver */
    #include "esm.h"

    #define D_SIZE 9

    uint8 tx_data[D_SIZE] = {'H','E','R','C','U','L','E','S','\0'};
    uint8 rx_data[D_SIZE] = {0};
    uint32 error = 0;

    uint32 checkPackets(uint8 *src_packet,uint8 *dst_packet,uint32 psize);
    /* USER CODE END */

    /** @fn void main(void)
    * @brief Application main function
    * @note This function is empty by default.
    *
    * This function is called after startup.
    * The user can use this function to implement the application.
    */

    /* USER CODE BEGIN (2) */
    /* USER CODE END */


    int main(void)
    {
    /* USER CODE BEGIN (3) */

    /* initialize can 1 and 2 */
    canInit(); /* can1 -> can2 */

    /* transmit on can1 */
    while(!canTransmit(canREG1, canMESSAGE_BOX1, tx_data));

    /*... wait until message receive on can2 */
    while(!canIsRxMessageArrived(canREG2, canMESSAGE_BOX1));
    canGetData(canREG2, canMESSAGE_BOX1, rx_data); /* receive on can2 */
    hetInit();

    /* check received data patterns */
    error = checkPackets(&tx_data[0],&rx_data[0],D_SIZE);

    /* ... run forever */
    while(1)
    return 0;
    /* USER CODE END */

    return 0;
    }

    uint32 checkPackets(uint8 *src_packet,uint8 *dst_packet,uint32 psize)
    {
    uint32 err=0;
    uint32 cnt=psize;

    while(cnt--)
    {
    if((*src_packet++) != (*dst_packet++))
    {
    err++; /* data error */
    }
    }
    return (err);
    }
  • Hello user4136848

    Please post the question on TMS570 forum. This is different from TM4C forum
  • Sorry to post the question to the wrong forum,but I have solved it.