Skip to content

Commit

Permalink
Generate .hex.bin files directly
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasekstrom committed Sep 2, 2023
1 parent 0b520d1 commit 7f15970
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 36 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ The projects are compiled using a recent version of Efinity which is available f
[https://www.efinixinc.com/products-efinity.html](https://www.efinixinc.com/products-efinity.html).
The compiled binary files are available in the release for this repository.

The Python script [hextobin.py](hextobin.py) is used to convert the output from Efinity,
which is in hex format, to a binary format that is used by the programming software.

## Programming

The programming is done from the Raspberry Pi on the A314-1000 board.
Expand Down
6 changes: 3 additions & 3 deletions a314-1000/a314-1000.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
<efx:param name="jtag_usercode" value="0xFFFFFFFF" value_type="e_string"/>
<efx:param name="release_tri_then_reset" value="on" value_type="e_bool"/>
<efx:param name="four_byte_addressing" value="off" value_type="e_bool"/>
<efx:param name="generate_bit" value="on" value_type="e_bool"/>
<efx:param name="generate_bit" value="off" value_type="e_bool"/>
<efx:param name="generate_bitbin" value="off" value_type="e_bool"/>
<efx:param name="generate_hex" value="on" value_type="e_bool"/>
<efx:param name="generate_hexbin" value="off" value_type="e_bool"/>
<efx:param name="generate_hex" value="off" value_type="e_bool"/>
<efx:param name="generate_hexbin" value="on" value_type="e_bool"/>
<efx:param name="cold_boot" value="off" value_type="e_bool"/>
<efx:param name="cascade" value="off" value_type="e_option"/>
</efx:bitstream_generation>
Expand Down
6 changes: 3 additions & 3 deletions flash-connect/flash-connect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
<efx:param name="jtag_usercode" value="0xFFFFFFFF" value_type="e_string"/>
<efx:param name="release_tri_then_reset" value="on" value_type="e_bool"/>
<efx:param name="four_byte_addressing" value="off" value_type="e_bool"/>
<efx:param name="generate_bit" value="on" value_type="e_bool"/>
<efx:param name="generate_bit" value="off" value_type="e_bool"/>
<efx:param name="generate_bitbin" value="off" value_type="e_bool"/>
<efx:param name="generate_hex" value="on" value_type="e_bool"/>
<efx:param name="generate_hexbin" value="off" value_type="e_bool"/>
<efx:param name="generate_hex" value="off" value_type="e_bool"/>
<efx:param name="generate_hexbin" value="on" value_type="e_bool"/>
<efx:param name="cold_boot" value="off" value_type="e_bool"/>
<efx:param name="cascade" value="off" value_type="e_option"/>
</efx:bitstream_generation>
Expand Down
19 changes: 0 additions & 19 deletions hextobin.py

This file was deleted.

18 changes: 10 additions & 8 deletions program_flash.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/bin/bash

if [ ! -f "./openFPGALoader" ]; then
echo "The binary ./openFPGALoader does not exist"
OFL_BIN=./openFPGALoader`getconf LONG_BIT`

if [ ! -f ${OFL_BIN} ]; then
echo "The binary ${OFL_BIN} does not exist"
exit 1
fi

if [ ! -f "flash-connect.bin" ]; then
echo "File flash-connect.bin does not exist"
if [ ! -f "flash-connect.hex.bin" ]; then
echo "File flash-connect.hex.bin does not exist"
exit 1
fi

if [ ! -f "a314-1000.bin" ]; then
echo "File a314-1000.bin does not exist"
if [ ! -f "a314-1000.hex.bin" ]; then
echo "File a314-1000.hex.bin does not exist"
exit 1
fi

Expand All @@ -32,15 +34,15 @@ gpioget gpiochip0 19 8
# Write flash-connect configuration through JTAG interface.
gpioset gpiochip0 3=0
sleep 0.1
./openFPGALoader -v -c libgpiod --pins 12:16:5:7 -m flash-connect.bin
${OFL_BIN} -v -c libgpiod --pins 12:16:5:7 -m flash-connect.hex.bin
sleep 0.1
gpioget gpiochip0 3

# Write a314-1000 configuration to flash memory through SPI interface.
sleep 0.1
gpioset gpiochip0 17=1
sleep 0.1
./openFPGALoader -v -b a314-1000-spi a314-1000.bin
${OFL_BIN} -v -b a314-1000-spi a314-1000.hex.bin

# Restore all pins as inputs.
gpioget gpiochip0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Expand Down

0 comments on commit 7f15970

Please sign in to comment.