SPI Flash bootloader files for Rock 3C

My new Rock3c (v.1.31) didn’t have soldered SPI memory. I bought a chip (25LQ128EWIG) and soldered it. Now I need the Rock3C specific bootloader files (the Rock3A files seem to be not working, bootloader stops and doesn’t boot from NVME). Where to get them from? What is the correct procedure to install the bootloader in 3C? Same as in 3A?

If you are using the “Image” presented in “[230428] System Release Notice for ROCK 3C”,
Please refer to the following directory.


# ls -l /usr/lib/u-boot/rock-3c/
-rw-r--r-- 1 root root  348160 Apr 24 13:53 idbloader-spi.img
-rw-r--r-- 1 root root  174080 Apr 24 13:53 idbloader.img
-rw-r--r-- 1 root root  461248 Apr 24 13:53 rkboot.bin
-rwxr-xr-x 1 root root    3061 Apr 24 13:53 setup.sh
-rw-r--r-- 1 root root 1120768 Apr 24 13:53 u-boot.itb

For subsequent operations,
It seems that you have already tried it, so I won’t dare touch it.

I haven’t checked if this set of files works properly.
The reason is that the “header pin” necessary for recovery when it does not work properly is not implemented.


“SPI-Flash” has a higher boot priority, so without prior preparation,
if it fails, the board itself becomes “bricked”.

The work of implementing a “header pin” itself is a relatively easy task,
but I have great doubts about treating this kind of important item as an option.

Thanks for tip. Using files from /usr/lib/u-boot/rock-3c/ (rock-3c_debian_bullseye_cli_b33.img) I’ve created spi_image.img and flashed to SPI as described here: https://wiki.radxa.com/Rock3/install/spi. Now it doesn’t boot either from NVME nor SD (I must erase SPI to boot from SD again). Console shows only:

U-Boot SPL latest-2023.04-2-fd4ed6b7-00055-g834d4e9a (Apr 24 2023 - 04:53:06 +0000)
Trying to boot from MMC2
spl: mmc init failed with error: -110
Trying to boot from MMC1
Card did not respond to voltage select! : -110
spl: mmc init failed with error: -95
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Any ideas where spi_image.img (16MB file) working on Rock3C get from? Here https://dl.radxa.com/rock3/images/loader/ is available only for Rock3A…


DDR Version V1.13 20220218
ln
ddrconfig:0
LP4 MR14:0x4d
LPDDR4, 324MHz
BW=32 Col=10 Bk=8 CS0 Row=17 CS=1 Die BW=16 Size=4096MB
tdqss: cs0 dqs0: 361ps, dqs1: 289ps, dqs2: 337ps, dqs3: 217ps,

change to: 324MHz
PHY drv:clk:38,ca:38,DQ:30,odt:0
vrefinner:41%, vrefout:41%
dram drv:40,odt:0
clk skew:0x58

change to: 528MHz
PHY drv:clk:38,ca:38,DQ:30,odt:0
vrefinner:41%, vrefout:41%
dram drv:40,odt:0
clk skew:0x78

change to: 780MHz
PHY drv:clk:38,ca:38,DQ:30,odt:0
vrefinner:41%, vrefout:41%
dram drv:40,odt:0
clk skew:0x5c

change to: 1056MHz(final freq)
PHY drv:clk:38,ca:38,DQ:30,odt:60
vrefinner:16%, vrefout:29%
dram drv:40,odt:80
vref_ca:00000068
clk skew:0x3f
cs 0:
the read training result:
DQS0:0x3d, DQS1:0x40, DQS2:0x41, DQS3:0x3c,
min  : 0xa  0xa  0xd  0xa  0x2  0x3  0x6  0x3 , 0x9  0x8  0x4  0x2  0xd  0xc  0xf  0xa ,
       0xe  0xd  0xc  0xa  0x4  0x1  0x5  0x6 , 0xb  0x6  0x6  0x1  0xe  0xd  0xc  0xd ,
mid  :0x2a 0x2b 0x2d 0x29 0x21 0x22 0x26 0x22 ,0x28 0x28 0x25 0x22 0x2c 0x2c 0x2e 0x2a ,
      0x2e 0x2e 0x2b 0x29 0x24 0x21 0x23 0x25 ,0x2a 0x26 0x25 0x21 0x2d 0x2d 0x2c 0x2d ,
max  :0x4b 0x4c 0x4d 0x49 0x40 0x42 0x46 0x42 ,0x48 0x49 0x46 0x43 0x4c 0x4c 0x4e 0x4b ,
      0x4f 0x4f 0x4a 0x48 0x45 0x42 0x42 0x45 ,0x4a 0x46 0x44 0x41 0x4d 0x4d 0x4c 0x4e ,
range:0x41 0x42 0x40 0x3f 0x3e 0x3f 0x40 0x3f ,0x3f 0x41 0x42 0x41 0x3f 0x40 0x3f 0x41 ,
      0x41 0x42 0x3e 0x3e 0x41 0x41 0x3d 0x3f ,0x3f 0x40 0x3e 0x40 0x3f 0x40 0x40 0x41 ,
the write training result:
DQS0:0x6f, DQS1:0x66, DQS2:0x6c, DQS3:0x5c,
min  :0x96 0x97 0x99 0x97 0x8e 0x90 0x93 0x92 0x92 ,0x88 0x88 0x86 0x83 0x8d 0x8e 0x8f 0x8d 0x88 ,
      0x91 0x90 0x8f 0x8f 0x89 0x86 0x89 0x8e 0x8d ,0x84 0x81 0x7f 0x7d 0x88 0x87 0x86 0x88 0x82 ,
mid  :0xb3 0xb4 0xb6 0xb4 0xaa 0xac 0xaf 0xad 0xae ,0xa6 0xa5 0xa1 0x9f 0xaa 0xaa 0xaa 0xa9 0xa5 ,
      0xaf 0xae 0xab 0xac 0xa6 0xa1 0xa3 0xa9 0xa9 ,0xa1 0x9d 0x9c 0x99 0xa4 0xa4 0xa1 0xa5 0x9e ,
max  :0xd1 0xd1 0xd3 0xd1 0xc7 0xc9 0xcc 0xc9 0xca ,0xc4 0xc3 0xbc 0xbb 0xc7 0xc7 0xc5 0xc5 0xc2 ,
      0xce 0xcd 0xc8 0xc9 0xc3 0xbc 0xbd 0xc4 0xc6 ,0xbe 0xba 0xb9 0xb6 0xc1 0xc2 0xbc 0xc3 0xbb ,
range:0x3b 0x3a 0x3a 0x3a 0x39 0x39 0x39 0x37 0x38 ,0x3c 0x3b 0x36 0x38 0x3a 0x39 0x36 0x38 0x3a ,
      0x3d 0x3d 0x39 0x3a 0x3a 0x36 0x34 0x36 0x39 ,0x3a 0x39 0x3a 0x39 0x39 0x3b 0x36 0x3b 0x39 ,
CA Training result:
cs:0 min  :0x3d 0x37 0x36 0x2d 0x36 0x2c 0x3a ,0x3d 0x34 0x34 0x2d 0x35 0x2a 0x37 ,
cs:0 mid  :0x79 0x7a 0x71 0x70 0x71 0x70 0x66 ,0x78 0x76 0x6f 0x6f 0x70 0x6c 0x64 ,
cs:0 max  :0xb5 0xbe 0xad 0xb3 0xac 0xb4 0x93 ,0xb3 0xb9 0xaa 0xb2 0xac 0xaf 0x91 ,
cs:0 range:0x78 0x87 0x77 0x86 0x76 0x88 0x59 ,0x76 0x85 0x76 0x85 0x77 0x85 0x5a ,
out
U-Boot SPL board init
U-Boot SPL 2017.09 (May 07 2023 - 08:03:11)
Trying to boot from SPI
Trying fit image at 0x300 sector
## Verified-boot: 0
## Checking atf-1 0x00040000 ... sha256(2f01bd8955...) + OK
## Checking uboot 0x00a00000 ... sha256(f3018a55e6...) + OK
## Checking fdt 0x00b2cd50 ... sha256(dabc862417...) + OK
## Checking atf-2 0xfdcc9000 ... sha256(f1fecab971...) + OK
## Checking atf-3 0xfdcd0000 ... sha256(d7aa45eb18...) + OK
Jumping to U-Boot(0x00a00000) via ARM Trusted Firmware(0x00040000)
Total: 561.835 ms

INFO:    Preloader serial: 2
NOTICE:  BL31: v2.3():v2.3-152-g4e725b15f:cl
NOTICE:  BL31: Built : 10:51:13, Jul 15 2021
INFO:    GICv3 without legacy support detected.
INFO:    ARM GICv3 driver initialized in EL3
INFO:    pmu v1 is valid
INFO:    dfs DDR fsp_param[0].freq_mhz= 1056MHz
INFO:    dfs DDR fsp_param[1].freq_mhz= 324MHz
INFO:    dfs DDR fsp_param[2].freq_mhz= 528MHz
INFO:    dfs DDR fsp_param[3].freq_mhz= 780MHz
INFO:    Using opteed sec cpu_context!
INFO:    boot cpu mask: 0
INFO:    BL31: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK
ERROR:   Error initializing runtime service opteed_fast
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0xa00000
INFO:    SPSR = 0x3c9


U-Boot 2017.09 (May 07 2023 - 08:03:31 +0900)

Model: Radxa ROCK3 Model C
PreSerial: 2, raw, 0xfe660000
DRAM:  4 GiB
Sysmem: init
Relocation Offset: ed363000
Relocation fdt: eb9e4a10 - eb9fecc0
CR: M/C/I
I2c0 speed: 100000Hz
vdd_cpu init 900000 uV
PMIC:  RK8090 (on=0x02, off=0x04)
vdd_logic init 900000 uV
vdd_gpu init 900000 uV
vdd_npu init 900000 uV
io-domain: OK
SF: Detected mx25u12835f with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

MMC:   dwmmc@fe2b0000: 0, dwmmc@fe2c0000: 2, sdhci@fe310000: 1
Model: Radxa ROCK3 Model C
Bootdev(scan): mmc 0
MMC0: Legacy, 52Mhz
PartType: EFI
No misc partition
boot mode: None
CLK: (sync kernel. arm: enter 816000 KHz, init 816000 KHz, kernel 0N/A)
  apll 816000 KHz
  dpll 528000 KHz
  gpll 1188000 KHz
  cpll 1000000 KHz
  npll 1200000 KHz
  vpll 24000 KHz
  hpll 24000 KHz
  ppll 200000 KHz
  armclk 816000 KHz
  aclk_bus 150000 KHz
  pclk_bus 100000 KHz
  aclk_top_high 300000 KHz
  aclk_top_low 200000 KHz
  hclk_top 150000 KHz
  pclk_top 100000 KHz
  aclk_perimid 300000 KHz
  hclk_perimid 150000 KHz
  pclk_pmu 100000 KHz
Net:   eth1: ethernet@fe010000
Hit any key to stop autoboot:  0

pcie@fe260000: PCIe Linking... LTSSM is 0x0
pcie@fe260000: PCIe Linking... LTSSM is 0x1
pcie@fe260000: PCIe Link up, LTSSM is 0x130011
pcie@fe260000: PCIE-0: Link up (Gen2-x1, Bus0)
pcie@fe260000: invalid flags type!

Device 0: Vendor: 0x1e0f Rev: 10410105 Prod: 90LPHHFEQ2B1
            Type: Hard Disk
            Capacity: 122104.3 MB = 119.2 GB (250069680 x 512)
... is now current device
Scanning nvme 0:1...
Card did not respond to voltage select!
mmc_init: -95, time 13
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
3252 bytes read in 6 ms (529.3 KiB/s)
## Executing script at 0x00c00000
Boot script loaded from mmc 0
240 bytes read in 5 ms (46.9 KiB/s)
19279624 bytes read in 1617 ms (11.4 MiB/s)
29096448 bytes read in 2433 ms (11.4 MiB/s)
116603 bytes read in 26 ms (4.3 MiB/s)
** Unable to read file /dtb/rockchip/overlay/rk35xx-fixup.scr **
Unknown command 'kaslrseed' - try 'help'
Fdt Ramdisk skip relocation
No misc partition
   Moving Image from 0x280000 to 0x400000
## Loading init Ramdisk from Legacy Image at 0a200000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    19279560 Bytes = 18.4 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 0x08300000
   Booting using the fdt blob at 0x08300000
   reserving fdt memory region: addr=8300000 size=82000
   Using Device Tree in place at 0000000008300000, end 0000000008384fff
can't found rockchip,drm-logo, use rockchip,fb-logo
WARNING: could not set reg FDT_ERR_BADOFFSET.
failed to reserve fb-loader-logo memory
Adding bank: 0x00200000 - 0xf0000000 (size: 0xefe00000)
Adding bank: 0x1f0000000 - 0x200000000 (size: 0x10000000)
Total: 11513.858 ms

Starting kernel ...
...
Armbian 23.02.2 Bullseye ttyS2

rock-3a login: root
Password:


# uname -a
Linux rock-3a 6.1.11-rk35xx #23.02.2 SMP PREEMPT Sat Feb 18 00:05:58 UTC 2023 aarch64 GNU/Linux

# dmesg # // Logs related to spi-flash.
[    3.895918] spi-nor spi4.0: mx25u12835f (16384 Kbytes)
[    3.910865] 3 fixed-partitions partitions found on MTD device spi4.0
[    3.910909] Creating 3 MTD partitions on "spi4.0":
[    3.910926] 0x000000000000-0x0000003f8000 : "loader"
[    3.916890] 0x0000003f8000-0x000000400000 : "env"
[    3.920104] 0x000000400000-0x000001000000 : "user"

# ls -l /dev/mtd*
crw------- 1 root root 90, 0 May  7 12:56 /dev/mtd0
crw------- 1 root root 90, 1 May  7 12:56 /dev/mtd0ro
crw------- 1 root root 90, 2 May  7 12:56 /dev/mtd1
crw------- 1 root root 90, 3 May  7 12:56 /dev/mtd1ro
crw------- 1 root root 90, 4 May  7 12:56 /dev/mtd2
crw------- 1 root root 90, 5 May  7 12:56 /dev/mtd2ro
brw-rw---- 1 root disk 31, 0 May  7 12:56 /dev/mtdblock0
brw-rw---- 1 root disk 31, 1 May  7 12:56 /dev/mtdblock1
brw-rw---- 1 root disk 31, 2 May  7 12:56 /dev/mtdblock2

# dmesg | grep -E 'pcie|nvme'
[    1.755852] rockchip-dw-pcie 3c0000000.pcie: host bridge /pcie@fe260000 ranges:
[    1.755939] rockchip-dw-pcie 3c0000000.pcie:       IO 0x00f4100000..0x00f41fffff -> 0x00f4100000
[    1.755983] rockchip-dw-pcie 3c0000000.pcie:      MEM 0x00f4200000..0x00f5ffffff -> 0x00f4200000
[    1.756009] rockchip-dw-pcie 3c0000000.pcie:      MEM 0x0400000000..0x04ffffffff -> 0x0000000000
[    1.756072] rockchip-dw-pcie 3c0000000.pcie: Memory resource size exceeds max for 32 bits
[    1.756296] rockchip-dw-pcie 3c0000000.pcie: iATU unroll: enabled
[    1.756311] rockchip-dw-pcie 3c0000000.pcie: iATU regions: 8 ob, 8 ib, align 64K, limit 8G
[    1.963770] rockchip-dw-pcie 3c0000000.pcie: PCIe Gen.2 x1 link up
[    1.963994] rockchip-dw-pcie 3c0000000.pcie: PCI host bridge to bus 0000:00
[    1.986696] pcieport 0000:00:00.0: PME: Signaling with IRQ 26
[    1.987261] pcieport 0000:00:00.0: AER: enabled with IRQ 26
[    2.044593] nvme nvme0: pci function 0000:01:00.0
[    2.044695] nvme 0000:01:00.0: enabling device (0000 -> 0002)
[    2.087850] nvme nvme0: allocated 61 MiB host memory buffer.
[    2.257548] nvme nvme0: 4/0/0 default/read/poll queues
[    2.263898]  nvme0n1: p1 p2 p3 p4

# fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk model: KBG40ZNS128G NVMe KIOXIA 128GB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1BB247C4-2E12-4464-88DF-9105C9432DC5

Device            Start      End  Sectors Size Type
/dev/nvme0n1p1    32768   163839   131072  64M Microsoft basic data
/dev/nvme0n1p2   163840 67272703 67108864  32G Linux filesystem
/dev/nvme0n1p3 67272704 67305471    32768  16M Microsoft basic data
/dev/nvme0n1p4 67305472 81985535 14680064   7G Linux filesystem

You went to the trouble of purchasing and soldering spi-flash components, but there is no way (file) to utilize them.
I understand your big disappointment.

The above log is a boot log from ‘ROCK-3C @ spi-flash’.
If you see this log and think it is worth a try, please let me know.
I will cooperate as much as I can.


In fact, I have already confirmed that ‘rock-3c_debian_bullseye_xfce_b31.img.xz’ is bootable from nvme via spi-flash.
The above logs are for a case where booting from ‘nvme’ was intentionally made disable and booted from ‘sd-card’.

Thanks t4_4t. I contacted Radxa tech support and got a working SPI bootloader files for Rock3C. So, problem (finally) solved.

Just want to leave a message that files listed under /usr/lib/u-boot/ are currently intended for internal usage only. They are normally invoked by either rbuild during image building stage, or rsetup which is intended to be the supported user interface. We only validated booting from SD and MMC with the included files, as that must work so rbuild image can boot. As such, rsetup only contains the update bootloader option on SD/MMC as well.

Currently I have fixed RK3399 and RK3588 SPI boot. Once I fix RK3566 SPI boot I’ll update the bootloader and rsetup to include update SPI bootloader option.

1 Like