From 66638dcee05114335a9d7060380664dc6ad5abe5 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 15 Sep 2017 15:19:48 +0200 Subject: [PATCH] Improve picosoc firmware build process --- picosoc/.gitignore | 1 - picosoc/Makefile | 16 ++++++++-------- picosoc/sections.lds | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/picosoc/.gitignore b/picosoc/.gitignore index ab0e16e..9ec714d 100644 --- a/picosoc/.gitignore +++ b/picosoc/.gitignore @@ -3,7 +3,6 @@ /spiflash_tb.vcd /spiflash_tb.vvp /firmware.elf -/firmware_up.elf /firmware.hex /firmware.bin /hx8kdemo.asc diff --git a/picosoc/Makefile b/picosoc/Makefile index 49dc126..93d5c20 100644 --- a/picosoc/Makefile +++ b/picosoc/Makefile @@ -19,6 +19,9 @@ hx8kprog: hx8kdemo.bin firmware.bin iceprog hx8kdemo.bin iceprog -o 1M firmware.bin +hx8kprog_fw: firmware.bin + iceprog -o 1M firmware.bin + hx8ksim: hx8kdemo_tb.vvp firmware.hex vvp -N $< @@ -49,22 +52,19 @@ hx8kdemo.bin: hx8kdemo.asc firmware.elf: sections.lds firmware.S riscv32-unknown-elf-gcc -Wl,-Bstatic,-T,sections.lds,--strip-debug -ffreestanding -nostdlib -o firmware.elf firmware.S -firmware_up.elf: firmware.elf - riscv32-unknown-elf-objcopy --change-addresses 0x100000 firmware.elf firmware_up.elf - -firmware.hex: firmware_up.elf - riscv32-unknown-elf-objcopy -O verilog firmware_up.elf firmware.hex +firmware.hex: firmware.elf + riscv32-unknown-elf-objcopy -O verilog firmware.elf /dev/stdout | sed -e '2,65537 d;' > firmware.hex firmware.bin: firmware.elf - riscv32-unknown-elf-objcopy -O binary firmware.elf firmware.bin + riscv32-unknown-elf-objcopy -O binary firmware.elf /dev/stdout | tail -c +1048577 > firmware.bin # ---- Clean ---- clean: rm -f testbench.vvp testbench.vcd spiflash_tb.vvp spiflash_tb.vcd - rm -f firmware.elf firmware_up.elf firmware.hex firmware.bin + rm -f firmware.elf firmware.hex firmware.bin rm -f hx8kdemo.blif hx8kdemo.log hx8kdemo.asc hx8kdemo.rpt hx8kdemo.bin rm -f hx8kdemo_syn.v hx8kdemo_syn_tb.vvp hx8kdemo_tb.vvp -.PHONY: testbench spiflash_tb hx8kprog hx8ksim hx8ksynsim clean +.PHONY: testbench spiflash_tb hx8kprog hx8kprog_fw hx8ksim hx8ksynsim clean diff --git a/picosoc/sections.lds b/picosoc/sections.lds index 5c92529..1fe7919 100644 --- a/picosoc/sections.lds +++ b/picosoc/sections.lds @@ -1,6 +1,6 @@ SECTIONS { .memory : { - . = 0x000000; + . = 0x100000; start*(.text); *(.text); *(*);