Skip to content

Commit

Permalink
Start working on ECP5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
cibomahto committed Feb 23, 2025
1 parent b3a565e commit 4e4f753
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ First, add a UDEV rule so that the device can be accessed by anyone:
sudo cp 99-iceflasher.rules /etc/udev/rules.d/
```

Then, set up the python environment and test that the device can be loaded:

```
cd python_example
python3 -m venv .venv
Expand Down
15 changes: 2 additions & 13 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ docker-image:
${TARGET}:
docker ${COMMON} \
-it ${DOCKER_IMAGE_NAME} \
/usr/bin/bash -c "mkdir -p build; cd build; cmake ../; make -j12"
/usr/bin/bash -c "mkdir -p build; cd build; cmake ../ -DPICO_BOARD=pico2; make -j12"

build: ${TARGET}

Expand All @@ -51,7 +51,7 @@ flash: ${TARGET}
-f interface/cmsis-dap.cfg \
-f target/rp2350.cfg \
-c "adapter speed 5000" \
-c "program main.elf verify ; reset ; exit"
-c "program build/main.elf verify ; reset ; exit"

# This should work without --net=host ?
debug-server:
Expand All @@ -75,14 +75,3 @@ debug-client:
/usr//bin/gdb-multiarch \
--se=main.elf \
-ex "target extended-remote localhost:3333"

# --se=arm-bootrom.elf \
debug-client2:
docker ${COMMON} \
--mount type=bind,source=`pwd`/../pico-bootrom-rp2350,target=/home/graham/dev/amy/amy-bootrom/ \
--net=host \
-it ${DOCKER_IMAGE_NAME} \
/usr//bin/gdb-multiarch \
--se=arm-bootrom.elf \
-ex "target extended-remote localhost:3334"
22 changes: 22 additions & 0 deletions python_example/ecp5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import ice_flasher

flasher = ice_flasher.IceFlasher()

pins = {
'sck':10,
'mosi':11,
'cs':12,
'miso':13,
}

flasher.spi_configure(pins['sck'], pins['cs'], pins['mosi'],pins['miso'], 1)
flasher.gpio_set_direction(pins['cs'], True)
flasher.gpio_put(pins['cs'], True)

cmd = bytearray(8)
cmd[0] = 0b11100000 # read_id

# From ECP5 and ECP5-5G sysCONFIG User Guide, Table B.5. ECP5 and ECP5-5G Device ID:
# IDCODE for LFE5U-85 should be 0x41113043
ret = flasher.spi_rxtx(cmd)
print(ret)
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
out_buffer[2], // mosi
out_buffer[3] // miso
);
// TODO: Configure CS Pin?
spi.cs_pin = out_buffer[1]; // cs

return true;
Expand Down

0 comments on commit 4e4f753

Please sign in to comment.