The below steps are used to update composite firmware image in FlexSPI NOR flash and SD/eMMC card using an SD card.
NOTE: Examples shown below use the LX2160ARDB Rev 2 image names. The same examples are applicable for LX2160ARDB Rev 1 also by replacing the Rev 2 image name with the corresponding Rev 1 image name.
The below steps describe how to use an HxD editor on a Windows machine to program firmware image on SD card without partitioning the card.
NOTE: Use the following link to download the HxD editor for Windows: https://mh-nexus.de/en/hxd/.
NOTE: Uncheck the 'Open as Readonly' option while opening the disk.
For example: Load firmware_lx2160ardb_rev2_uboot_xspiboot.img image in SD card at block no. 150500 and firmware_lx2160ardb_rev2_uboot_emmcboot.img image in SD card at block no. 300500.
NOTE: Make sure that you load these images in SD blocks so that the images do not get overwrite.
NOTE: Since the updated composite firmware is now available at required block (SD start block no.
The board boots from updated composite firmware (SD boot) image loaded in the SD card. The U-Boot log displays:
Model: NXP Layerscape LX2160ARDB Board
Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from SD
=> mmc read 0xa0000000 <start_block_number> <block_count>
where, <start_block_number> - start block number in SD card where you have loaded the firmware. For example, if you have loaded firmware at SD card block 150500, start_block_number in hex is 24be4
<block_count> - number of blocks in SD card that needs to be read as per the file size. It is calculated as ‘file size /512’ + ‘few sectors for rounding up so that last block is not missed’. If firmware file size is 52158124 (31bdeac hex), block_count is 52158124/512 = 101871 (18DEF hex) + 10 (A hex) = 101881 (18DF9 hex).
For example: => mmc read 0xa0000000 24be4 18DF9
=>sf probe 0:0
=>sf update 0xa0000000 0x0 <firmware_lx2160ardb_rev2_uboot_xspiboot.img _filesize_in_hex>
For example: => sf update 0xa0000000 0x0 31BDEAC
=> sf probe 0:1
=> sf update 0xa0000000 0x0 <firmware_lx2160ardb_rev2_uboot_xspiboot.img _filesize_in_hex>
The U-Boot log shows the following message:
Model: NXP Layerscape LX2160ARDB Board
Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from FlexSPI DEV#0
The U-Boot log shows the following message:
Model: NXP Layerscape LX2160ARDB Board
Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from FlexSPI DEV#1
=> mmc dev 0; mmc read 0xa0000000 <start_block_number> <block_count>
where, <start_block_number> - start block number in SD card where you have loaded the firmware. For example, if you have loaded firmware at SD card block 300500, start_block_number in hex is 495D4
<block_count> - number of blocks in SD card that needs to be read as per the file size. It is calculated as ‘file size /512’ + ‘few sectors for rounding up so that last block is not missed’. If firmware file size is 52158124 (31bdeac hex), block_count is 52158124/512 = 101871 (18DEF hex) + 10 (A hex) = 101881 (18DF9 hex).
For example: => mmc read 0xa000000 495D4 18DF9
=> mmc dev 1; mmc write 0xa0000000 8 18DF9
Set switch settings to boot from eMMC card.
SW1[1:8] = 1001 1000
The U-Boot log shows the following message:
Model: NXP Layerscape LX2160ARDB Board
Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from eMMC
Hi Thanks a lot for all the explanation
Booting under SD works fine !
- I have used this link
wget https://www.nxp.com/lgfiles/sdk/lsdk2012/firmware_lx2160ardb_rev2_uboot_sdboot.img
- copy file under USB key
- format SD under FAT32
- copy Uboot binary under the SD card, from linux (under USB key device): first 8x512 bytes are skipped
dd if=firmware_lx2160ardb_rev2_uboot_sdboot.img of=/dev/sdb bs=512 seek=8
- put SD under board, boot from SD works fine !
I can see :
U-Boot 2020.04-gf46a944f71 (Dec 11 2020 - 04:35:59 +0800)
After that I have tried to update XSPI device :
so I have used the corresponding link :
wget https://www.nxp.com/lgfiles/sdk/lsdk2012/firmware_lx2160ardb_rev2_uboot_xspiboot.img
using same USB key device, from linux
copy the binary under SD card at an offset 150500 block of 512 bytes :
dd if=firmware_lx2160ardb_rev2_uboot_xspiboot.img of=/dev/sdb bs=512 seek=150500
I check the size of binary data (under USB key)
size memory of firmware_lx2160ardb_rev2_uboot_xspiboot.img = 52.531.420 bytes (=32190DC)
So I have then typed this command, from uboot (as well launched previously from SD card)
mmc read 0xa0000000 24be4 190d2
(offset of 150500 blocks of 512 octets -> 150500 => 0x24be4)
(190d2 as 52.531.420 bytes/512 = 102600 => 0x190C8, and I add 10 blocs (+0x0a) => 0x190d2
Outpu Results :
MMC read: dev # 0, block # 150500, count 102610 ... 102610 blocks read: OK
And Just to finish to write into the NorFlash "Bank 0"
=> sf probe 0:0
SF: Detected mt35xu512aba with page size 256 Bytes, erase size 128 KiB, total 64 MiB
=> sf erase 0 +32190DC
SF: 52559872 bytes @ 0x0 Erased: OK
=> sf write 0xa0000000 0x0 32190DC
device 0 offset 0x0, size 0x32190dc
SF: 52531420 bytes @ 0x0 Written: OK
So XSPI erase+write seems OK but when I try to boot on XSPI BANK 0
DEL 19 is lighed, FAN is running a lot ???? and nothing is written ou serial console : the Uboot is not correctly launched, why ?
If someone has an idea how to write correctly on XSPI BANK 0 from uboot shell ?
If I missed something ? I don't see a mistake ....
Thanks for any help
VBR
Thierry LOUSSOT