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.

Starterware/TM4C1294NCPDT: OTA FW Update on Internal Flash

Part Number: TM4C1294NCPDT

Tool/software: Starterware

Hello,

I have an issue with updating the firmware on the internal flash. The code is port from stellaris controller. I am able to bring up tm4c129 controller, connect to cloud, initialize the file system and do some RF processing too.But now i have an issue while triggering an firmware update. I am downloading the new fw update to external flash file system. 

My linker script addressing is as follows :

BOOT (rx) : ORIGIN = 0x00000000, LENGTH = 0x00007FF0 /
BOOTINFO (rx) : ORIGIN = 0x00007FF0, LENGTH = 0x00000010 
FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 0x00073BC0 
FLASHINFO (rx) : ORIGIN = 0x0007BBC0, LENGTH = 0x00000040 
FACTORY (rx) : ORIGIN = 0x0007BC00, LENGTH = 0x00000400
CFG (rx) : ORIGIN = 0x0007C000, LENGTH = 0x00005000

I have a custom update code in the bootloader which will check on reboot and update if necessary.


 while (offset < fe->filesize) {
                FlashErase(start + offset); // start is app start address which is 0x8000 and offset is 0 initially
                offset += 1024; // 1kb size
        }

What i notice is that the data in 0x7bbc0 to 0x7bbf4 is there but the rest from 0x7bbf8 is erased and is -1 or ff including the Factory block and CFG block.

I have no idea what the issue is.

Also the same problem i notice when using openocd for flashing the code. So i need to fully erase entire flash and re flash. My openocd version is 

Open On-Chip Debugger 0.10.0-dev-00419-gbcaf775 (2016-11-23-16:36)
Licensed under GNU GPL v2

My .gdbinit has 

reset

monitor flash write_image erase firmware.axf

Any help will be be greatful.

Thank you

Kumar

  • Hello Kumar,
    Please note that the TM4C129's erasble sector size is 16k while the Stellaris's erasable block is 1k. Please change your offset at 16k increment first and try again.
  • Hello Charles,

    I tried that too yesterday, changing the offset to 16k instead of 1k.

    while (offset < fe->filesize) {
    FlashErase(start + offset); // start is app start address which is 0x8000 and offset is 0 initially
    offset += (16*1024); // 1kb size
    }

    I faced the same issue where firmware gets updated correctly but the data in 0x7bbc0 to 0x7bbf4 is there but the rest from 0x7bbf8 is erased and is -1 or ff including the Factory block and CFG block.

    Then I tried modify the address to match the 16kb block size in linker script

    FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 0x00074000
    FLASHINFO (rx) : ORIGIN = 0x00074000, LENGTH = 0x00000040
    FACTORY (rx) : ORIGIN = 0x00074040, LENGTH = 0x00000400
    CFG (rx) : ORIGIN = 0x00074440, LENGTH = 0x00004000

    Here while using openocd to flash initial image i noticed only Flash block at 0x8000 gets written , FlashInfo does not get written, same for Factory, only some bytes of CFG is written in the address 0x76440, the entire block from 0x74000 to 0x76440 is FF.

    Any ideas why or what i am doing wrong.

    Thank you
    Kumar
  • Hi Kumar,
    If FLASH origin starts at 0x8000 with a length of 0x74000 then it will end at 0x7C000. But the FLASHINFO origin starts at 0x74000 instead? Can you start the FLASHINFO origin at 0x7C000 and adjust the rest accordingly?
  • Hi Charles
    I completely forgot to update you on Friday, I used the following modifications and was to able to flash without any issues including the updating the SW from the bootloader.

    FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 0x00074000
    FLASHINFO (rx) : ORIGIN = 0x00074000, LENGTH = 0x00000040
    FACTORY (rx) : ORIGIN = 0x0007C000, LENGTH = 0x00000400
    CFG (rx) : ORIGIN = 0x00078000, LENGTH = 0x00004000

    Ofcourse even though i use only a few bytes, i had to allocate the entire 16kb block for each partition. If the two partitions ends up in the same block, it does not work. Not sure why though.

    Anyway since we have enough space available on the flash , we can afford to allocate the block.

    I have another issue with spi flash access issue from the bootloader when power supply is connected but works fine with debugger connected.
    Debugger used is mikroprog. The access fails while trying to do spi dummy read.
    I will post more details in a seperate post.

    I am closing this.

    Thank you
    Kumar