Home · |
The serialflash applet drives any SPIx or FLEXCOMx_SPI controller to program an external SPI NOR flash memory embedded on the board and connected to the SAM MPU device.
The list of all SPI NOR flash memories supported by the serialflash applet is available here.
The list of parameters to initialize the serialflash applet can be displayed with the following command:
sam-ba -p <port> -d <device> -a serialflash:help $ sam-ba -p serial -d sama5d2 -a serialflash:help Syntax: serialflash:[<instance>]:[<ioset>]:[<npcs>]:[<frequency>] Parameters: instance SPI controller instance ioset I/O set npcs SPI chip select number frequency SPI clock frequency in MHz Examples: serialflash use default board settings serialflash:0:1:0:66 use fully custom settings (SPI0, IOSET1, NPCS0, 66MHz) serialflash::::20 use default board settings but force frequency to 20MHz
An instance parameter x tells the serialflash applet to use the SPIx or FLEXCOMx_SPI controller. The ioset parameter is an index that represents a group of I/O pins muxed to the SPI controller. The npcs parameter represents the chip-select line used by the SPI controller to enable the SPI NOR flash memory. The {Instance, I/O set, Chip-Select} triplets are device specific; please refer to the serialflash section of the device configuration:
The frequency parameter expresses the SPI bus clock frequency in MHz.
The list of commands supported by the serialflash applet can be displayed with the following commands:
sam-ba -p <port> -d <device> -a serialflash -c help $ sam-ba -p serial -d sama5d2 -a serialflash -c help
The erase command resets to 0xFF a range of erase blocks. The size of those erase blocks depends on the manufacturer and memory part. Typical erase block sizes are 8KiB, 32KiB or 64KiB of data.
$ sam-ba -p serial -b sam9x60-ek -a serialflash -c erase:help * erase - erase all or part of the memory Syntax: erase:[<addr>]:[<length>] Examples: erase erase all erase:4096 erase from 4096 to end erase:0x1000:0x10000 erase from 0x1000 to 0x11000 erase::0x1000 erase from 0 to 0x1000
The write and writeboot commands program data from a binary file into the SPI flash pages. The blocks containing the pages to be programmed should be erased first with the erase command. Padding bytes are added to align programmed data to the page boundary. The typical page size is 256 bytes. Prior to what both commands do, the writeboot command also modifies the relevant unused ARM exception vector to store the size of the bootstrap binary, as required by the ROM code during the boot process.
$ sam-ba -p serial -b sam9x60-ek -a serialflash -c write:help * write - write to memory from a file Syntax: write:<filename>:[<addr>] Examples: write:bootstrap.bin write bootstrap.bin to start of memory write:u-boot.bin:0x10000 write u-boot.bin at offset 0x10000 $ sam-ba -p serial -b sam9x60-ek -a serialflash -c writeboot:help Syntax: writeboot:<filename> Example: writeboot:bootstrap.bin write bootstrap.bin as boot program at start of memory
The read command loads data from the SPI flash into a binary file.
$ sam-ba -p serial -b sam9x60-ek -a serialflash -c read:help * read - read from memory to a file Syntax: read:<filename>:[<addr>]:[<length>] Examples: read:firmware.bin read all to firmware.bin read:firmware.bin:0x1000 read from 0x1000 to end into firmware.bin read:firmware.bin:0x1000:1024 read 1024 bytes from 0x1000 into firmware.bin read:firmware.bin::1024 read 1024 bytes from start of memory into firmware.bin
The verify and verifyboot compare the data programmed in the SPI flash with the content of a given binary file. Unlike the verify command, the verifyboot command ignores the actual value of the relevant unused ARM exception vector in the binary file and does as if the value were the size of the binary file.
$ sam-ba -p serial -b sam9x60-ek -a serialflash -c verify:help * verify - verify memory from a file Syntax: verify:<filename>:[<addr>] Examples: verify:firmware.bin verify that start of memory matches firmware.bin verify:firmware.bin:0x1000 verify that memory at offset 0x1000 matches firmware.bin $ sam-ba -p serial -b sam9x60-ek -a serialflash -c verifyboot:help * verifyboot - verify boot program from a file Syntax: verifyboot:<filename> Example: verifyboot:bootstrap.bin verify that start of memory matches boot program bootstrap.bin
Copyright © 2018 Microchip Technology | SAM-BA Documentation |