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.

TM4C1290NCPDT: updating the flash leading to hang . Tiva C Series - Tm4c129NCPDT

Part Number: TM4C1290NCPDT
Other Parts Discussed in Thread: UNIFLASH

Hi.

Context:  I have divided the flash into 3 parts :  0x000 -> flash bootloader start address.  0x4000 -> tiva application and 0x82000 -> tiva application

This is done for fail-safe upgrade of tiva.

Now, the issue is : I am updating the tiva's flash with the application , it is hanging. I am using the

I am using the code :

BL_FLASH_PROGRAM_FN_HOOK(g_ui32TransferAddress,
(uint8_t *) &g_pui32DataBuffer[1],
((ui32Size + 3) & ~3));

to write the flash on the fly. the application data is send over uart to tiva, and tiva write the application on the fly using above api.

If the tiva is booted from 0x4000, it writes the data  from 0x82000 and if the tiva is booted from 0x82000, it writes on 1st partition -> 0x4000. 

this code was working fine, now it has started giving problem, 

The flash is unable to get updated fully. It hangs in between.

Is this API works with all level of optimisations ?

Thanks,

Sanchit Mehra

  • Dear Sanchit hello.
    How do you manage to have selective bootloading? MyApp_copy_A at 0x4000 updates MyApp_copy_B at 0x82000 and vise versa. O.K. with this. But after the reset how to you direct your module to start with either A or B apps? How bootloader decides with which application' copy to start? You said that was working but now it hangs. Might be the case that when it was working the firmware updates at 0x4000 and 0x82000 were happening with the use of the LM Flash Programmer or UniFlash? I'm asking because I have something in mind to say if this is the case.
    John
  • I have not heard any reports of the boot loader not working with different levels of optimization. You say it used to work, but now hangs. What did you change? Have you looked at the code with CCS after it hangs? In what function (or at what address) was the program counter?
  • Hi Sanchit ,

    The reason why I pointed optimisation is : when I enable the global optimisation , it works , it did not hang, but hangs with optimisation level as 0.

    Secondly, this is not boot loader , but an appllcation updating another application in different flash address .

    0x4000 updates 0x82000 and 0x82000 updates 0x4000 flash areas.

    Firstly, are these starting flash address correct ? for both the applications ?

    Secondly, is it possible to debug the application using CCS when the flash bootloader boots the application ox4000 ? As first the flash bootloader comes up and then loads the application from 0x4000 OR 0x82000 depending upon the information about the current partition.

    Thanks for the help

  • Hi Sanchit.
    Your initial post does not imply two different apps but two copies of the same app. Anyway, after reset/boot, how boot loader decides which app to jump into and start? Push_Button? Other mean?
    John
  • Hi,

    yeah, they are same apps with different linker files. I set the current app loaded flash address in the eeprom to decide, which area of flash must be updated .

    Thanks,
    Sanchit
  • Sanchit Mehra said:
    Secondly, is it possible to debug the application using CCS when the flash bootloader boots the application ox4000 ?

    Yes, I am suggesting that when the bootloader hangs, you connect with CCS and then determine the location of the program counter. (I would do View->Disassembly). Based on the address of the PC, you can load the symbols of the boot loader or the application, or you might see that the PC is pointing into the ROM. It also might be stuck in a fault ISR. This information may help you to understand what is happening.

    Sanchit Mehra said:
    The reason why I pointed optimisation is : when I enable the global optimisation , it works , it did not hang, but hangs with optimisation level as 0.

    If you restore the optimization level to -O2, does it work again?

  • Hi Bob,

    Yes it works again with O2.
    But Is the choosen flash address are correct for second application : 0x82000 ?

    Thanks,
    Sanchit Mehra
  • I am not sure I understand your question. Yes, address 0x82000 is a valid flash address for this part. Is 0x82000 not the address that you chose? Did you not configure the link command file to link the second application into flash at that address? When you connect with CCS, do you see the code for the second application programmed into that address space?
  • Hi Bob,

    The reason I asked about address is , I have read somewhere that the address must be in multiple of 16k / 0x4000 .
    It was just a concern,
    Yes, linker commands are all fine.

    Secondly there is no issue in bootloader. it works fine by loading an application on system boot up.

    Thirdly, I have to see , how to debug my application , if it is booted/loaded by custom made flash bootloader.
    because, I think, CCS would not get control of the application ,as, flash bootloader at 0x000 would be loading my application inspite of CCS.

    Thanks,
    Sanchit
  • Oh, now I understand about the address. The flash is erased by 16KB sector, so the address from 0x80000 to 0x81FFF will also be erased. If the previous data in that range was to be preserved, that might be the problem.
  • Hi Bob,

    Well, my both of the application size of 100 KB Max.
    and the flash is erased till the size of the binary by LM Flash pro. and sflash utility , and then the upgrade starts

    Had it been a problem, it would have come in every upgrade.

    Thanks,
    Sanchit Mehra