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.

Firmware upgrade in MSP430F5419A controller without using boot strap loader

Other Parts Discussed in Thread: MSP430F5419A

Hi,

We have a product using MSP430F5419A which is currently installed in the client location, the client requires a firmware upgrade of the product through UART, we would like to know if a firmware upgrade is possible in msp430F5419a controller using UART without using the boot strap loader,i.e. can we partition the flash and when an updated firmware is received through UART update the firmware to the second partition which is not being used and once the firmware is updated reset the code so that when the code is reset ted the  execution starts from beginning of the second partition. Please let me know if there are some better suggestions also.

Regards,

Jis

  • Yes. the scheme you described is possible. One thing you did not describe is how your proposed product decides which code of the two partitions to run after each reset. I assume that it should run the code in the Second Partition most of the time, but occasionally you want it to run the code in the First Partition. How do you make that distinction? If 1.8KB is enough for your First Partition, I suggest that you put that in the address range 0x1020 to 0x17EF. Doing so have some advantages. (a) You have the option to hardware protect the First Partition. (b) You do not need to do anything special to generate code for the Second Partition. It will automatically not overlap with your First Partition.

    TI's BSL baby has a software UART bathtub. But the bathtub can be Custom made.

  • Hi,

    The code size is 13KB, We want to swap the reset locations every time whenever a new firmware is updated to the selected partition. Please let us know if this is possible. Or can we write the updated firmware from UART to the second location always and copy it to the first location and reboot the system so that we don't have to change the reset locations.if the second approach is correct can we copy the data to a flash location form which the current code is being executed is present? Also please let us know if there are any supporting documents on the same.

  • "The code size is 13kB" What code? Your application or your loader?

    "We want to swap the reset location ..." You mean change the contents of location 0xFFFE and 0xFFFF? Yes, the same way you change the contents of other Flash memory locations.

    "can we write the updated firmware from UART to the second location ... " Yes, you can write anything to any location of the Flash.

    "can we copy the data to a flash location from which the current code is being executed is present?" You should not change the code you are currently executing.

    Most of the questions you asked can be answered by reading the Data-Sheet, the User's Guide, and various Application Notes.

  • JIS JOHN said:
    can we partition the flash and when an updated firmware is received through UART update the firmware to the second partition which is not being used and once the firmware is updated reset the code so that when the code is reset ted the  execution starts from beginning of the second partition.

    That's almsot exactly how I handled this:

    The area from 0xfc00 to 0xffff is occupied by a data-copy algorithm, a default vector table and a jumptable. This area is never overwritten and static, so it is always in working condition. The copy code checks the area from 0x10000 to 0x1ffff for a new firmware (including CRC etc.). If it is present, it erases the flash below 64k (without the topmost 1k) and copies from the extra flash to the lower flash. When this is done, the new firmware in upper flash is erased (the 5x family has  abank erase function that only erases one bank and not all main memory - convenient!).

    If the flashing failed (e.g. due to power failure), the new firmware is still in upper flash and copying begins anew, until it finally succeeds.

    The new firmware is received by the applciation through it snormal communication channels during normal operation (RF in most cases). Once the new firmware is received completely, the device makes a self-reset and the new firmware is copied. This keeps the device operational until the complete firmware update is received and checked, keeping the downtime low. And sinc ethe copy-code is never erased, you cannot brick the part by interruptint the update process.

    Note that I, for convenience, use the upper flash above 64k for storage. But on MSPs with lower flash, you can also define any other part of flash for storage. You only have to tell the linker to exclude it from the applciaiton flash.
    And ou have to tell the linekr that the interrupt vectors aren't at 0xFF80 anymore but somewhere else. (the copy code contains fixed interrupt vectors that point to a jumptable that is also part of this code, and the jumps utilize the new vector table location - except for the reset vector that of course points to the copy code).

  • Hello Jens,

    We have some queries regarding the implementation of the firmware upgrade, In the firmware upgrade are you using two separate projects i.e. one for the boot loader and the second one for the application, if no how the jumping of the programme counter to the main takes place once the firmware is upgraded or if a firmware upgrade is not required. Also please let me know how you we can relocate the interrupt vectors as we tried here and the system behavior on the interrupts were unexpected.

  • JIS JOHN said:
    In the firmware upgrade are you using two separate projects

    I have included the bootloader into the project itself. The bootloader won't update itself (jsu tignore the lasr 1kb of the image). The change in the linker script memory configuration ensures that applicaiton and loader are separated adn the loader always ends up at the same place.
    This way, I can use the same binary for direct uplao fwith JTAG or for online update.

    However, this is not a requirement. The loader contans an interrupt vector table that points to a table of indirect jumps within the loader area. The linke rhas been told to write the applciation interrupt vectors to 0xFBxx (right beneath the laoder area) instead of 0xFFxx. The jumps in the loader area indirectly jump through this moved vector table:
    MOV &0xFBxx, PC
    This way, the loader area can always stay the same, including the vector table and especially the reset vector (so there won't be a moment where the device wouldn't start due to erasure of the vector table) while all ISRs are properly jumped to (except the program entry, which is of course called by the loader after performing the update check, instead of directly through the reset vector)

    0xFB80-0xFBFF - applicaiton interrupt vector table adn end of updated area
    0xFC00-0xFCFF - jumps for the forwarded interrupts
    0xFD00-0xFF7F - loader code, ends with MOCE &0xFBFE, PC to start the applicaiton
    0xFF80-0xFFFD - real vector table, all vectors are pointing to their respective jumps the jumptable.
    0xFFFE-0xFFFF - real reset vector, pointing to the start of the loader.

  • Hello Jens,

     We have successfully implemented and tested firmware upgrade in MSP430F5419a, thanks for your support and guidence.

    Regards,

    Jis

**Attention** This is a public forum