News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Main Menu

can bt815 detect versioning of flash image?

Started by Elmryn, February 10, 2025, 04:03:53 PM

Previous topic - Next topic

Elmryn

Hello,

I want to know, if it is in any way possible to put a custom defined variable into the flash-image, so that when BT815 starts, it can detect, which version of flash image is running and thus can decide if it will update the flash or not?

Example:
1. MCU-Firmware has the bt815-flash image included version 01.
2. We make an OTA update with a new bt815-flash image -> version 02.
3. on startup bt815 reads out version-number of bt815-flash image. If version == 01 -> updates the flash-image. If version == 02 -> nothing to do here.

Can we put the version-number or some other custom information with the EAB into the flash-image?

Best

BRT Community

Hello,

One way to do this would be to include a small file of your own in the flash build bin file when creating in EAB. The BT815 can read data from flash into RAM_G, which your MCU can then read via SPI and so you could check the value that has been read from Flash.

You can make the file a fixed size and allow space for other data if needed so that changes in it don't affect the addresses of other assets at later addresses.

For CMD_FLASHREAD the address is 64-byte aligned and so it is worth making your own version-info file to be aligned to 64 bytes.

Best Regards, BRT Community


Elmryn

Hi,

Thanks for that idea. Am I correct that this will only work, if I do not insert the EDF block? (Because the EDF block size varies according to the number of assets, right?)

Best

BRT Community

Hi,
If you add a text file this will also be listed in the EDF and so you can look up the address of your version file.

As you said, the EDF will cause items to move as it can vary in size but you will be able to read the EDF and then find the location of your user file.

Best Regards, BRT Community

Elmryn

Hi,

Thank you so far! That helps a lot.
Is there an example code, to see how to read the EDF part correctly?
To get it to RAMG is not the problem, but how to format or parse it into usable variables?

Best

BRT Community

Hi,

We'll check if we have some examples, in the meantime we have a structure declared in our user guide which may be helpful,


struct EDF {
uint32_t block_length; // the length of this EDF
EVE_Flash_Asset_Info assets[0...n-1]; // the information of n assets
};

struct EVE_Flash_Asset_Info {
uint16_t assetID; // the sequential ID of the asset
uint32_t startAddress; // the offset of the asset
uint32_t size; // the size of the asset, in byte
uint8_t compressionMethod; // 0 = no compression, 1 = compressed
uint8_t type; // the type of the asset, see below
uint16_t subType; // the subtype of the asset, see below
uint16_t width; // the width of bitmap/video/animation
uint16_t height; // the height of bitmap/video/animation
};

Best Regards, BRT Community

vdc

The best way is do the checksum. Copy 1MB from Flash to RAM_G and get the CRC32. repeat this depending on the size of the flash memory you use. This will ensure you have correct flash images every time you boot.

ex: I only use 3MB of external flash to store all the assets I need. Everytime I boot up, I only do the CRC of first 3MB. Ignore the rest. This should be quick.

Elmryn

Thanks for the ideas!

I also thought about the CRC too, but decided to just write my own version number directly after the blob. Works like a charm!

Thank you guys.