litex-hub / linux-on-litex-vexriscv

Linux on LiteX-VexRiscv
BSD 2-Clause "Simplified" License
593 stars 175 forks source link

SPI Boot fails on Arty7 #67

Closed ric96 closed 4 years ago

ric96 commented 4 years ago

I have a REVC Arty735T with a 25q125a Flash...

The flash process seems to proceed fine:

[sahaj@fedora-work linux-on-litex-vexriscv]$ ./make.py --board=arty --flash
make: Entering directory '/data/linux-on-litex-vexriscv/build/arty/software/libcompiler_rt'
make: Nothing to be done for 'all'.
make: Leaving directory '/data/linux-on-litex-vexriscv/build/arty/software/libcompiler_rt'
make: Entering directory '/data/linux-on-litex-vexriscv/build/arty/software/libbase'
 CC       exception.o
 CC       system.o
 CC       id.o
 CC       uart.o
 CC       time.o
 CC       spiflash.o
 CC       mdio.o
 AR       libbase.a
 AR       libbase-nofloat.a
make: Leaving directory '/data/linux-on-litex-vexriscv/build/arty/software/libbase'
make: Entering directory '/data/linux-on-litex-vexriscv/build/arty/software/libnet'
 CC       microudp.o
 AR       libnet.a
make: Leaving directory '/data/linux-on-litex-vexriscv/build/arty/software/libnet'
make: Entering directory '/data/linux-on-litex-vexriscv/build/arty/software/bios'
 CC       isr.o
 CC       sdram.o
 CC       main.o
 CC       boot.o
 LD       bios.elf
chmod -x bios.elf
 OBJCOPY  bios.bin
chmod -x bios.bin
python3 -m litex.soc.software.mkmscimg bios.bin --little
make: Leaving directory '/data/linux-on-litex-vexriscv/build/arty/software/bios'
build/arty/arty.dts:142.5-35: Warning (reg_format): /soc/spiflash@f0005000/flash@0:reg: property has invalid length (16 bytes) (#address-cells == 2, #size-cells == 1)
buildroot/rv32.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
buildroot/rv32.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
buildroot/rv32.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
buildroot/rv32.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
build/arty/arty.dts:116.29-134.8: Warning (spi_bus_bridge): /soc/spi@f0008000: incorrect #size-cells for SPI bus
buildroot/rv32.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
buildroot/rv32.dtb: Warning (spi_bus_reg): Failed prerequisite 'spi_bus_bridge'
build/arty/arty.dts:140.19-143.9: Warning (avoid_default_addr_size): /soc/spiflash@f0005000/flash@0: Relying on default #address-cells value
build/arty/arty.dts:140.19-143.9: Warning (avoid_default_addr_size): /soc/spiflash@f0005000/flash@0: Relying on default #size-cells value
buildroot/rv32.dtb: Warning (avoid_unnecessary_addr_size): Failed prerequisite 'avoid_default_addr_size'
buildroot/rv32.dtb: Warning (unique_unit_address): Failed prerequisite 'avoid_default_addr_size'
 CC       isr.o
 CC       framebuffer.o
 CC       main.o
 LD       emulator.elf
chmod -x emulator.elf
 OBJCOPY  emulator.bin
chmod -x emulator.bin
Flashing build/arty/gateware/top.bin at 0x00000000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 0 took 242 ms
Info : sector 1 took 238 ms
Info : sector 2 took 232 ms
Info : sector 3 took 236 ms
Info : sector 4 took 241 ms
Info : sector 5 took 238 ms
Info : sector 6 took 238 ms
Info : sector 7 took 238 ms
Info : sector 8 took 239 ms
Info : sector 9 took 234 ms
Info : sector 10 took 236 ms
Info : sector 11 took 231 ms
Info : sector 12 took 231 ms
Info : sector 13 took 232 ms
Info : sector 14 took 229 ms
Info : sector 15 took 232 ms
Info : sector 16 took 235 ms
Info : sector 17 took 234 ms
Info : sector 18 took 235 ms
Info : sector 19 took 245 ms
Info : sector 20 took 234 ms
Info : sector 21 took 248 ms
Info : sector 22 took 254 ms
Info : sector 23 took 264 ms
Info : sector 24 took 264 ms
Info : sector 25 took 262 ms
Info : sector 26 took 266 ms
Info : sector 27 took 233 ms
Info : sector 28 took 239 ms
Info : sector 29 took 240 ms
Info : sector 30 took 230 ms
Info : sector 31 took 237 ms
Info : sector 32 took 237 ms
Info : sector 33 took 257 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Flashing buildroot/Image at 0x00400000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 64 took 271 ms
Info : sector 65 took 260 ms
Info : sector 66 took 265 ms
Info : sector 67 took 270 ms
Info : sector 68 took 269 ms
Info : sector 69 took 269 ms
Info : sector 70 took 273 ms
Info : sector 71 took 265 ms
Info : sector 72 took 269 ms
Info : sector 73 took 267 ms
Info : sector 74 took 266 ms
Info : sector 75 took 274 ms
Info : sector 76 took 266 ms
Info : sector 77 took 265 ms
Info : sector 78 took 273 ms
Info : sector 79 took 267 ms
Info : sector 80 took 266 ms
Info : sector 81 took 270 ms
Info : sector 82 took 267 ms
Info : sector 83 took 270 ms
Info : sector 84 took 268 ms
Info : sector 85 took 267 ms
Info : sector 86 took 266 ms
Info : sector 87 took 266 ms
Info : sector 88 took 266 ms
Info : sector 89 took 266 ms
Info : sector 90 took 269 ms
Info : sector 91 took 268 ms
Info : sector 92 took 265 ms
Info : sector 93 took 268 ms
Info : sector 94 took 268 ms
Info : sector 95 took 269 ms
Info : sector 96 took 272 ms
Info : sector 97 took 264 ms
Info : sector 98 took 268 ms
Info : sector 99 took 268 ms
Info : sector 100 took 271 ms
Info : sector 101 took 268 ms
Info : sector 102 took 272 ms
Info : sector 103 took 271 ms
Info : sector 104 took 268 ms
Info : sector 105 took 268 ms
Info : sector 106 took 270 ms
Info : sector 107 took 264 ms
Info : sector 108 took 271 ms
Info : sector 109 took 269 ms
Info : sector 110 took 269 ms
Info : sector 111 took 269 ms
Info : sector 112 took 269 ms
Info : sector 113 took 269 ms
Info : sector 114 took 268 ms
Info : sector 115 took 268 ms
Info : sector 116 took 265 ms
Info : sector 117 took 264 ms
Info : sector 118 took 264 ms
Info : sector 119 took 257 ms
Info : sector 120 took 263 ms
Info : sector 121 took 264 ms
Info : sector 122 took 270 ms
Info : sector 123 took 263 ms
Info : sector 124 took 267 ms
Info : sector 125 took 271 ms
Info : sector 126 took 266 ms
Info : sector 127 took 254 ms
Info : sector 128 took 270 ms
Info : sector 129 took 269 ms
Info : sector 130 took 268 ms
Info : sector 131 took 268 ms
Info : sector 132 took 265 ms
Info : sector 133 took 270 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Flashing buildroot/rootfs.cpio at 0x00800000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 128 took 251 ms
Info : sector 129 took 253 ms
Info : sector 130 took 237 ms
Info : sector 131 took 234 ms
Info : sector 132 took 230 ms
Info : sector 133 took 261 ms
Info : sector 134 took 270 ms
Info : sector 135 took 274 ms
Info : sector 136 took 265 ms
Info : sector 137 took 263 ms
Info : sector 138 took 270 ms
Info : sector 139 took 269 ms
Info : sector 140 took 269 ms
Info : sector 141 took 265 ms
Info : sector 142 took 265 ms
Info : sector 143 took 264 ms
Info : sector 144 took 265 ms
Info : sector 145 took 269 ms
Info : sector 146 took 265 ms
Info : sector 147 took 264 ms
Info : sector 148 took 271 ms
Info : sector 149 took 266 ms
Info : sector 150 took 269 ms
Info : sector 151 took 269 ms
Info : sector 152 took 260 ms
Info : sector 153 took 260 ms
Info : sector 154 took 263 ms
Info : sector 155 took 262 ms
Info : sector 156 took 265 ms
Info : sector 157 took 268 ms
Info : sector 158 took 268 ms
Info : sector 159 took 271 ms
Info : sector 160 took 270 ms
Info : sector 161 took 267 ms
Info : sector 162 took 267 ms
Info : sector 163 took 264 ms
Info : sector 164 took 266 ms
Info : sector 165 took 274 ms
Info : sector 166 took 261 ms
Info : sector 167 took 269 ms
Info : sector 168 took 260 ms
Info : sector 169 took 269 ms
Info : sector 170 took 264 ms
Info : sector 171 took 263 ms
Info : sector 172 took 267 ms
Info : sector 173 took 268 ms
Info : sector 174 took 269 ms
Info : sector 175 took 266 ms
Info : sector 176 took 268 ms
Info : sector 177 took 268 ms
Info : sector 178 took 266 ms
Info : sector 179 took 254 ms
Info : sector 180 took 258 ms
Info : sector 181 took 266 ms
Info : sector 182 took 263 ms
Info : sector 183 took 268 ms
Info : sector 184 took 265 ms
Info : sector 185 took 268 ms
Info : sector 186 took 267 ms
Info : sector 187 took 262 ms
Info : sector 188 took 257 ms
Info : sector 189 took 260 ms
Info : sector 190 took 264 ms
Info : sector 191 took 264 ms
Info : sector 192 took 270 ms
Info : sector 193 took 265 ms
Info : sector 194 took 266 ms
Info : sector 195 took 269 ms
Info : sector 196 took 269 ms
Info : sector 197 took 267 ms
Info : sector 198 took 271 ms
Info : sector 199 took 267 ms
Info : sector 200 took 266 ms
Info : sector 201 took 266 ms
Info : sector 202 took 272 ms
Info : sector 203 took 267 ms
Info : sector 204 took 269 ms
Info : sector 205 took 265 ms
Info : sector 206 took 269 ms
Info : sector 207 took 266 ms
Info : sector 208 took 269 ms
Info : sector 209 took 265 ms
Info : sector 210 took 269 ms
Info : sector 211 took 265 ms
Info : sector 212 took 267 ms
Info : sector 213 took 267 ms
Info : sector 214 took 269 ms
Info : sector 215 took 263 ms
Info : sector 216 took 266 ms
Info : sector 217 took 264 ms
Info : sector 218 took 266 ms
Info : sector 219 took 267 ms
Info : sector 220 took 268 ms
Info : sector 221 took 267 ms
Info : sector 222 took 266 ms
Info : sector 223 took 267 ms
Info : sector 224 took 269 ms
Info : sector 225 took 272 ms
Info : sector 226 took 267 ms
Info : sector 227 took 267 ms
Info : sector 228 took 265 ms
Info : sector 229 took 266 ms
Info : sector 230 took 271 ms
Info : sector 231 took 271 ms
Info : sector 232 took 265 ms
Info : sector 233 took 269 ms
Info : sector 234 took 263 ms
Info : sector 235 took 267 ms
Info : sector 236 took 264 ms
Info : sector 237 took 264 ms
Info : sector 238 took 269 ms
Info : sector 239 took 264 ms
Info : sector 240 took 272 ms
Info : sector 241 took 265 ms
Info : sector 242 took 269 ms
Info : sector 243 took 264 ms
Info : sector 244 took 266 ms
Info : sector 245 took 266 ms
Info : sector 246 took 269 ms
Info : sector 247 took 265 ms
Info : sector 248 took 269 ms
Info : sector 249 took 267 ms
Info : sector 250 took 268 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Flashing buildroot/rv32.dtb at 0x00f00000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 240 took 271 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Flashing emulator/emulator.bin at 0x00f80000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 248 took 268 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
[sahaj@fedora-work linux-on-litex-vexriscv]$ 

But it fails to boot

Terminal ready

        __   _ __      _  __
       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|

 (c) Copyright 2012-2019 Enjoy-Digital
 (c) Copyright 2007-2015 M-Labs Ltd

 BIOS built on Sep 25 2019 08:12:42
 BIOS CRC passed (bc4f43e5)

 Migen git sha1: f4fcd10
 LiteX git sha1: 1425a68d

--============ SoC info ================--
CPU:       VexRiscv @ 100MHz
ROM:       32KB
SRAM:      32KB
L2:        8KB
MAIN-RAM:  262144KB

--========= Peripherals init ===========--
Initializing SDRAM...
SDRAM now under software control
Read leveling:
m0, b0: |11111000000000000000000000000000| delays: 02+-02
m0, b1: |00000000000011111111100000000000| delays: 16+-04
m0, b2: |00000000000000000000000000001111| delays: 30+-02
m0, b3: |00000000000000000000000000000000| delays: -
m0, b4: |00000000000000000000000000000000| delays: -
m0, b5: |00000000000000000000000000000000| delays: -
m0, b6: |00000000000000000000000000000000| delays: -
m0, b7: |00000000000000000000000000000000| delays: -
best: m0, b1 delays: 16+-04
m1, b0: |11111111100000000000000000000000| delays: 04+-04
m1, b1: |00000000000001111111111110000000| delays: 19+-06
m1, b2: |00000000000000000000000000000011| delays: 31+-01
m1, b3: |00000000000000000000000000000000| delays: -
m1, b4: |00000000000000000000000000000000| delays: -
m1, b5: |00000000000000000000000000000000| delays: -
m1, b6: |00000000000000000000000000000000| delays: -
m1, b7: |00000000000000000000000000000000| delays: -
best: m1, b1 delays: 19+-06
SDRAM now under hardware control
Memtest OK

--========== Boot sequence =============--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
             Timeout
Loading emulator.bin from flash...
Error: Invalid image length 0xffffffff
Booting from flash...
Error: Invalid image length 0xffffffff
Booting from network...
Local IP : 192.168.1.50
Remote IP: 192.168.1.100
Fetching from: UDP/69
Unable to download Image over TFTP
Network boot failed
Unable to download Linux images, falling back to boot.bin
Unable to download boot.bin over TFTP
Network boot failed
No boot medium found

--============= Console ================--
litex> 
enjoy-digital commented 4 years ago

Booting the kernel images from the SPI flash is indeed currently broken due to changes in flashboot in LiteX and needs to be fixed. Can you try booting using from Ethernet or UART while things are broken? I'll try to fix that soon.

ric96 commented 4 years ago

Serial works fine.

enjoy-digital commented 4 years ago

This has been fixed.