Skip to content

Conversation

@piso77
Copy link

@piso77 piso77 commented Dec 22, 2021

The Icesugar board is a close relative (clone?) of the Icebreaker board: iCE40UP5K, 12Mhz clock, 3 PMODS (well, technically four if you solder one header), 8MB SPI flash, etc and while it was already mentioned in FemtoRV, the target didn't build.

This pull request is a WIP (aka builds but don't run) and reviews/comments/ pointers are welcome: i went with the FEMTORV32_QUARK (since GRACILIS didn't fit, werird since sugar and breaker share the same exact fpga chip - BTW, is FEMTO good enough to run code from flash?) and had to execute code from SPI flash (since firmware.hex was ~45KB and blew past the available 12KB BRAM), on top of that SPI flash is only 8MB (vs 16MB in Icebreaker - see also NRV_RESET_ADDR) and i still have to figure out FemtoRV/FIRMWARE/CRT/spiflash*.ld blackmagic.

I already checked the pcf against the schematics (so that part should be correct), while i'm a bit worried about code execution from flash/linker script errors and wouldn't be surprised if i overlooked something there.

Let me know.

@dkilfoyle
Copy link

Hi. I stumbled across this comment in https://github.com/wuxx/icesugar/blob/master/src/basic/verilog/flash/top.v

//from ice40 ultraplus datasheet, the miso/mosi are inverted in the ice40 when in flash-prog mode

Invert the relevant pin definitions in BOARDS/icesugar.pcf to:

set_io spi_miso 17 set_io spi_mosi 14

...and it seems to work fine - firmware can be flashed at 0x20000 and Femtosoc will execute the program from flash.

PS: I'm compiling firmware on WSL2 and then executing icesprog in windows to do the uploading as WSL doesn't support USB devices on Windows host. To flash the firmware (eg hello.c) I use

icesprog -o 0x20000 hello.spiflash.bin

...because icesprog doesn't seem to support text offsets as used in the FIRMWARE/makefile.inc (iceprog -o 128k ....)

@piso77
Copy link
Author

piso77 commented Apr 30, 2022

Hi. I stumbled across this comment in https://github.com/wuxx/icesugar/blob/master/src/basic/verilog/flash/top.v

//from ice40 ultraplus datasheet, the miso/mosi are inverted in the ice40 when in flash-prog mode

Invert the relevant pin definitions in BOARDS/icesugar.pcf to:

set_io spi_miso 17 set_io spi_mosi 14

...and it seems to work fine - firmware can be flashed at 0x20000 and Femtosoc will execute the program from flash.

PS: I'm compiling firmware on WSL2 and then executing icesprog in windows to do the uploading as WSL doesn't support USB devices on Windows host. To flash the firmware (eg hello.c) I use

icesprog -o 0x20000 hello.spiflash.bin

...because icesprog doesn't seem to support text offsets as used in the FIRMWARE/makefile.inc (iceprog -o 128k ....)

Somehow i completely missed your comment - thanks, i'll give it a shot later today, or tomorrow.

@piso77
Copy link
Author

piso77 commented May 11, 2022

Indeed, after inverting spi MISO/MOSI, i successfully flashed hello world and see it execute from flash.

piso77 added 12 commits July 13, 2022 17:52
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
…disable old and lex matrix pmods

Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
…mory mapped @ 0x800000

Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants