I would like to be able to drag and drop multiple *.sb files on to the USB Mass Storage Device. Currently, I can drop firmware.sb files (linked to address 0xA000) as much as I want but I also need to pre-configure my SPI Flash with LCD Splash Screen (75 Kbytes each), other binary files (40 KBytes each), etc. and these may need to update in the field. Sure, I can link them directly in my code but eat up valuable main flash space.
So, In production, I would like to install MCU Boot (my modified one of course) with Kinetis Flash tool or whatever.
Then, drag and drop SPI Flash *.sb files and load up my SPI flash. Then lastly, drag and drop the firmware.sb file and reset the device and DONE.
In the field, a customer can hold down the power button (only button I have) for two seconds and the devices will stay in bootloader and mount the USB mass storage (FSL Loader). (This has been modified and works). Then drag and drop update files supplied.
I only have USB exposed in the bootloader (HID and MSC) because all other pins are busy running peripherals in my application. The LCD on the Flex Bus consumed a lot of pins and I am using LPUART.
Anyone try this or have a gut feeling whether it will work? The trick is understanding how the bootloader parses the SB files in real time and redirect the writes from main flash to SPI flash. (I am using MK22FN512 CPU with 16M SPI Flash.
Thanks
So, Essentially, I am trying to program my internal flash and external SPI Flash on SPI1-CS0 using an SB file. There is some code regarding the QSPI that may work but I am still mining through it.
My SD file could look like this:
sources {
FIRMWARE = "frdmk22f_led_demo_freedom_a000.bin";
LCDSPLASH= "splash.bin";
EXTRA= "seq20.bin";
}
section (0) {
#1 Erase the LCD Splash Space (64 KByte Blocks 0 & 1) on SPI1-CS0
erase SPI1-CS0 Block 0..1
#2 Load the Splash Screen
load LCDSPLASH > SPI1-CS0 Block 0
#3 Erase the Extra Bin Space (64 KByte Blocks 2 & 3) on SPI1-CS0
erase SPI1-CS0 Block 2..3
#4 Load the Extra Data
load EXTRA > SPI1-CS0 Block 2 & 3
#5 Erase the internal flash
erase 0x0000a000..0x0010000;
#6 Load BIN File to internal flash
load FIRMWARE > 0xa000;
#7 Reset target.
reset;
}
Hi Jorge,
Yes, a single SB file would be fine and a good idea.
The file would contain for example three files:
1) firmware to be programmed into the main internal flash at address 0xa000 (just above the bootloader)
2) 320 x 240 8 bit color LCD Splash BMP to be programmed into Serial Flash at say address 0 .. (BMP file Size)
3) My External IC firmware to be programmed into Serial Flash at say address 131,072 .. (about 40 KBytes)
Sure, I can add serial flash spi code to bootloader (fairly easy) but should I just pick some random address space for the .sd config file and then add code in the sbloader source to watch for that address space?
Thanks, Gary
Hi Gary Sinde
Could you clarify more about the implementation that you need? so, would you like to be able to load data directly to the external memory SPI using .sb files? you could use the .bd file to define memory sectors to load your SPI external and in the startup of the bootloader initialize the SPI, so you create a single .sb file.
Best regards
Jorge Alcala