Use libflash in the bootloader

Technical questions regarding the XTC tools and programming with XMOS.
maxter
Member++
Posts: 28
Joined: Fri Jun 14, 2024 9:55 am

Use libflash in the bootloader

Post by maxter »

I am trying to use the libflash (or better libquadflash) from inside the bootloader; I have seen there are a number of past threads about accessing the data partition (using the readFlashDataPage function) from the bootloader but none about accessing the image partition; is it possible?

My aim is to create a failsafe mechanism that on boot if the user presses a button long enough it deletes the update images and restarts with the factory image.
User avatar
andrewxcav
Verified
Experienced Member
Posts: 69
Joined: Wed Feb 17, 2016 5:10 pm

Post by andrewxcav »

It may be possible to do this using a generated bootloader from xflash:
https://www.xmos.com/download/AN00109:- ... .1rc1).pdf
maxter
Member++
Posts: 28
Joined: Fri Jun 14, 2024 9:55 am

Post by maxter »

andrewxcav wrote: Thu Jan 02, 2025 4:25 pm It may be possible to do this using a generated bootloader from xflash:
https://www.xmos.com/download/AN00109:- ... .1rc1).pdf
Thanks for the reply, andrewxcav.
I am aware of that AN and I actually used it to read the IO in order to indicate the boot partition to the bootloader.

What I am looking for is a method to interact with the boot partition of the Flash, which doesn't seem possible at the moment.
In the end I decided to add to the factory image a clean-up function that erases all other boot images so that when I start the system in factory mode via button press, it cleans the other images and let the be replaced by new ones (via DFU).
User avatar
andrewxcav
Verified
Experienced Member
Posts: 69
Joined: Wed Feb 17, 2016 5:10 pm

Post by andrewxcav »

Ah that is a good idea. I am sure you can manipulate the boot partition, but it might require using low level flash commands vs. the flash lib.
maxter
Member++
Posts: 28
Joined: Fri Jun 14, 2024 9:55 am

Post by maxter »

andrewxcav wrote: Mon Jan 06, 2025 5:21 pm Ah that is a good idea. I am sure you can manipulate the boot partition, but it might require using low level flash commands vs. the flash lib.
That's an interesting idea, though it would tie the bootloader to the Flash model, which I want avoid if possible (hence the ideal usage of the flash libraries).