I am trying to better understand how the firmware downloading works with the bootloader.
Our current product uses NetOS 6.3
put rom.bin loads a new bootloader
put image.bin loads a new application
On the WiFi version we load in addition a backup.bin which is a backup application.
How does the bootloader ftp app know which is which?
Merely by the file name or is the header in the .bin file indicate where in flash to save the .bin?
Which source code file contains the code for saving the .bin files in flash?
I also read in a post about a utility the combines rom.bin and image.bin into one rom.bin file.
How does this work?
Not too sure quite how the file is detected in NetOS 6.3
In 7.4 the http upload siomply uses the name of the file, and is done in the file “firmware.c”.
The merge images utility, requiress the rom.bin file, the image.bin file and a maximum bootloader size, which is a multiple of 64K. The utility generates a single file that first contains the bootloader, and ten space up to the defined size, and then the image.
This file is saved as rom.bin, so that whwen it is downloaded the bootloader is put at the normal start address, and then the space is used to get the image at the correct address.
If the bootloader gets too big then when it is downloaded it can overwrite part of the application so once you download the bootloader the application cannot start unless it is downloaded via jtag. This MergeImages utility is then the only way to do things.
Thanks. Thats helpful. I would guess that in 6.3 its also the file name so I have something to look for.
For the example application used to download firmware
The code for determining “rom.bin” vs “image.bin” is in
naftpapp.c in function ftp_flash_stor()
If its named “rom.bin” (or spi_rom.bin or romzip.bin) it stores in in sector 0
If its named " image.bin" the code skips ahead to a different sector
I don’t understand the logic but I assume in a sector after the end of the bootloader.
What is still not clear is what the bootloader does with regards to filenames.
Could somebody please confirm.
src/bsp/platforms/“platform”/blmain.c and following calls into various bootloader related dhcp
functions in src/bsp/bootloader/
It does not appear that the bootloader will do anything but download a new image.bin file
on tftp recovery
and it does not check the filename to make sure its named image.bin so any file could be
downloaded. Also there is not way with the tftp recovery to reload the bootloader itself.
So the procedure as I understand it is, to first download naftpapp using the tftp reoveryand then when reboot so that you run
naftpapp which can reload the bootloader as rom.bin