stnolting / neorv32-setups

📁 NEORV32 projects and exemplary setups for various FPGAs, boards and (open-source) toolchains.
https://github.com/stnolting/neorv32
BSD 3-Clause "New" or "Revised" License
64 stars 17 forks source link

ERR_FLSH while booting from Flash in iCEBreaker #155

Closed lovelesh-mis closed 8 months ago

lovelesh-mis commented 8 months ago

Hi,

I am exploring iCEBreaker board to run various RISC-V CPUs. I am trying to run the UP5KDemo version of the processor. I am able to synthesize the processor and program the flash . I am able to send application files via Terminal programs and the application runs fine. However, if i try to save the executable to flash of boot from flash, I get ERR_FLSH error and the processor stops working. Am i missing something while synthesizing the code? I checked the jumpers on iCEBreaker board, they are in their default position. So It should be possible for iCEBreaker to access the flash. Looking forward to your support.

stnolting commented 8 months ago

I just updated the radiant project in this repository. The VHDL source paths were incorrect 🙈 And I just tested the bootloader upload + flash operations on my icebreaker board which seems to work fine:

<< NEORV32 Bootloader >>

BLDV: Feb 17 2024
HWV:  0x01090605
CLK:  0x016e3600
MISA: 0x40901101
XISA: 0x000000c3
SOC:  0x0007800d
IMEM: 0x00010000
DMEM: 0x00010000

Autoboot in 8s. Press any key to abort.
Aborted.

Available CMDs:
 h: Help
 r: Restart
 u: Upload
 s: Store to flash
 l: Load from flash
 x: Boot from flash (XIP)
 e: Execute
CMD:> u
Awaiting neorv32_exe.bin... OK
CMD:> s
Write 0x00001228 bytes to SPI flash @ 0x00400000? (y/n) y
Flashing... OK
CMD:> l
Loading (@0x00400000)...
OK
CMD:> e
Booting from 0x00000000...

                                                                                      ##        ##   ##   ##
 ##     ##   #########   ########    ########   ##      ##   ########    ########     ##      ################
####    ##  ##          ##      ##  ##      ##  ##      ##  ##      ##  ##      ##    ##    ####            ####
## ##   ##  ##          ##      ##  ##      ##  ##      ##          ##         ##     ##      ##   ######   ##
##  ##  ##  #########   ##      ##  #########   ##      ##      #####        ##       ##    ####   ######   ####
##   ## ##  ##          ##      ##  ##    ##     ##    ##           ##     ##         ##      ##   ######   ##
##    ####  ##          ##      ##  ##     ##     ##  ##    ##      ##   ##           ##    ####            ####
##     ##    #########   ########   ##      ##      ##       ########   ##########    ##      ################
                                                                                      ##        ##   ##   ##
Hello world! :)

However, could you post the bootloader terminal that emits this error message?

lovelesh-mis commented 8 months ago

I tried with a fresh cloning of the repo. I have found a few issues:

  1. If fresh synthesis is done using Radiant, then the bootloader does not work at all. However, if i flash the impl_1.bin directly from the repo, it works fine and saving to flash works as demonstrated in the previous chat. I feel it is configuration issue of some Radiant settings.
  2. Saving to flash still does not work while using the open-source toolchain. I get ERR_FLSH while saving to Flash. I am using the UP5KDemo made for iCEBreaker. Looks like it might be the same configuration issue with the iCEBreaker_UP5KDemo.

As your Radiant generated bitstream works without any errors, I am sure there are no jumper changes required on iCEBreaker board. So, it either be iCEBreaker_UP5KDemo or the 5KDemo processor template which is leading to this error.

stnolting commented 8 months ago

Which version of Radiant are you using?

We found out that the newest version Radiant has some issues... So we put a note regarding this to the README:

grafik

Maybe you could try that version?

Saving to flash still does not work while using the open-source toolchain.

Hmm that's strange. I'll have a look at this.

lovelesh-mis commented 8 months ago

You were right regarding the Lattice Radiant Version. I installed the 2022.1 and the flashing works very smoothly. Can you help me out with my 2nd question? Is there a specific version of the toolchain that needs to be installed?

Saving to flash still does not work while using the open-source toolchain. I get ERR_FLSH while saving to Flash. I am using the UP5KDemo made for iCEBreaker. Looks like it might be the same configuration issue with the iCEBreaker_UP5KDemo.

I am on the following versions:

lovelesh-mis commented 8 months ago

synthesis.mk needs some changes.

$(YOSYS) $(YOSYSFLAGS) \ -p \ should be changed to $(YOSYS) $(YOSYSFLAGS) \ -m ghdl -p \

lovelesh-mis commented 8 months ago

i fixed the bug with the open-source tool chain. Now it is possible to save executable to flash. (It seems someone forgot to connect SPI bus to the cpu). I can submit PR with the changes.

stnolting commented 8 months ago

i fixed the bug with the open-source tool chain. Now it is possible to save executable to flash. (It seems someone forgot to connect SPI bus to the cpu).

Great to hear! :)

I can submit PR with the changes.

That would be really great! :+1: