Firmware upgrade via SPI Connect ME 9210

Hello All.
I have a Connect ME 9210 that is connected to its host via SPI.
The host has an SD card that can hold a new image for the 9210.
How do I go about loading a new image.bin “manually”
The SPI communications are working fine so getting the file from the host into the 9210 is easy.
I just need some direction on how to create the image.bin file locally.

I am sure that there is some example code, I just can not find it.

Thanks

There is no existing example. You’d have to combine SPI APIs and Filesystem APIs and create a file in the filesystem and write to it data in chunks as you get it from SPI

I guess I did not word that well.
I am looking for some examples on the filesystem and image.bin side of things.
I guess some pointer to the filesystem API doc’s

There are two sets of APIs and two examples coming with netos - standard C libary
C:\Netos75\src\examples
afileio\
nafileio: File IO Example Application

This application shows how to use c library file system functions to perform file I/O.
The application demostrate how to use mkdir(), open(), close(), write(), read(), fopen(), fclose(), fread(),
fwrite(), fseek() and remove().

nafilesys: File System Example Application

Netos APIs
C:\Netos75\src\examples
afilesys\
This application shows how to use native file system API functions to perform file
I/O. The BSP_INCLUDE_FILESYSTEM_FOR_CLIBRARY #define constant in bsp_fs.h must be set
to TRUE to have the BSP to mount the default RAM and Flash volumes.
If you turn on this flag you must also be sure to link the filesys library
in your application makefile by adding the line

Thank you very much. I will start this these examples.
Could you possibly point to some information on the image update process?
I believe that I just create a file in Flash0, Once it passes some verification I delete the old image.bin and rename my new file.
Is this correct? Can you point my to documentation.

Thank you very much. (Sorry to pester, there is a lot of documentation to dig through if you don’t know what your looking for! )

Please take a look at C:\Netos75\src\apps\DigiESPProject\sys\util\firmware.c

My image.bin file is now much larger than my available storage.
However I can still update the image via FTP.

Can you provide insight as to how the FTP update method works.
It would appear that the FTP routine does something special when the file is named image.bin. If I try to load image.NIB it runs out of storage space.

A pointer to the source of the ftp routine would suffice.

Thank you.

After doing some more reading, It may make more sense to follow the X-Modem approach that the boot loader uses.
Is that code available?
Implementing X-Modem via SPI should not be too difficult.

please take a look at C:\Netos75\src\bsp\fsintf\fwdl.c