Programmatic firmware updates Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
lukehatpadl
Active Member
Posts: 50
Joined: Sat Jul 08, 2023 5:15 am

Programmatic firmware updates

Post by lukehatpadl »

I'm adding support to our XMOS application for updating the firmware over a UART, similar to how firmware updates are handled in lib_tsn.

A couple of quick questions.

The firmware image itself (written using fl_writeImagePage()) – presumably it's not the .xe file itself. Is it the output of xobjdump --strip or something else?

fl_endWriteImage() is called when the image has been uploaded; is there an API call to abort/rollback the in progress firmware update?

Thanks :)
View Solution
User avatar
Daz
Junior Member
Posts: 5
Joined: Wed Jul 24, 2024 12:05 pm

Post by Daz »

lukehatpadl wrote: Mon Mar 10, 2025 9:28 am The firmware image itself (written using fl_writeImagePage()) – presumably it's not the .xe file itself. Is it the output of xobjdump --strip or something else?
The API expects an upgrade image generated using XFLASH, from the documentation ("Design and manufacture systems with flash memory"):
$ xflash --upgrade <version-id> latest-release.xe  --factory-version <tools-version> -o upgrade-image
Where <tools-version> is the version used to create the original factory image. <version-id> by default is expected to be a monotonic version counter; the XFLASH bootloader will by default load the image with the highest version number assuming it's valid.
lukehatpadl wrote: Mon Mar 10, 2025 9:28 am fl_endWriteImage() is called when the image has been uploaded; is there an API call to abort/rollback the in progress firmware update?
If the update did not complete, the bootloader will not consider the image as valid and will fall back to another. Clean up can be done using `fl_deleteImage()` on the incomplete image which will free up the flash area for a new image.
User avatar
lukehatpadl
Active Member
Posts: 50
Joined: Sat Jul 08, 2023 5:15 am

Post by lukehatpadl »

Thanks Daz!
User avatar
lukehatpadl
Active Member
Posts: 50
Joined: Sat Jul 08, 2023 5:15 am

Post by lukehatpadl »

Fun fact: if the chip is not initially flashed with an upgrade image with xflash, it appears that fl_startImageAdd() returns 1 infinitely.
User avatar
Ross
Verified
XCore Legend
Posts: 1163
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

do you mean "factory image" rather than "upgrade image"?
Technical Director @ XMOS. Opinions expressed are my own
User avatar
lukehatpadl
Active Member
Posts: 50
Joined: Sat Jul 08, 2023 5:15 am

Post by lukehatpadl »

I meant it flashed with factory but no upgrade.

i.e.

xflash --spi-div=8 --factory bin/vestibule_xebra.xe

as opposed to

xflash --spi-div=8 --factory bin/vestibule_xebra.xe --upgrade 0 bin/vestibule_xebra.xe