From 96746b2de00f4ac647afb6eed6286792a76969b1 Mon Sep 17 00:00:00 2001 From: Daniel Lublin Date: Tue, 11 Oct 2022 17:25:00 +0200 Subject: [PATCH 1/3] Clarify BRAM_FW_SIZE --- doc/system_description/software.md | 4 ++-- hw/application_fpga/Makefile | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/system_description/software.md b/doc/system_description/software.md index f8690c2..5356835 100644 --- a/doc/system_description/software.md +++ b/doc/system_description/software.md @@ -26,8 +26,8 @@ specifications: should be the target. * 4 SPRAM x 32 KB => 128 KB RAM for application/software -[^1]: Embedded Block RAM residing in the FPGA, can configured as RAM - or ROM. +[^1]: Embedded Block RAM (also BRAM) residing in the FPGA, can + configured as RAM or ROM. ## Introduction diff --git a/hw/application_fpga/Makefile b/hw/application_fpga/Makefile index f653e1a..b49b550 100644 --- a/hw/application_fpga/Makefile +++ b/hw/application_fpga/Makefile @@ -22,7 +22,8 @@ YOSYS_PATH ?= NEXTPNR_PATH ?= ICESTORM_PATH ?= -# Size in 32-bit words +# Size in 32-bit words, must be divisible by 256 (pairs of EBRs, because 16 +# bits wide; an EBR is 128 32-bits words) BRAM_FW_SIZE ?= 1536 PIN_FILE ?= application_fpga_mta1_usb_v1.pcf From 4d927ce42687bc7ac02f532e2770777c4bf19f88 Mon Sep 17 00:00:00 2001 From: Daniel Lublin Date: Tue, 11 Oct 2022 17:25:19 +0200 Subject: [PATCH 2/3] Fix size_mismatch for testfw --- hw/application_fpga/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/application_fpga/Makefile b/hw/application_fpga/Makefile index b49b550..f74c1dd 100644 --- a/hw/application_fpga/Makefile +++ b/hw/application_fpga/Makefile @@ -95,11 +95,13 @@ all: application_fpga.bin # The size_mismatch target make sure that we don't end up with an # incorrect BRAM_FW_SIZE # ------------------------------------------------------------------- -size_mismatch: firmware.elf +%_size_mismatch: %.elf phony_explicit @test $$($(SIZE) $< | awk 'NR==2{print $$4}') -le $$(( 32 / 8 * $(BRAM_FW_SIZE) )) || \ (echo "The 'BRAM_FW_SIZE' variable needs to be increased" && false) -.PHONY: size_mismatch +# can't make implicit rule .PHONY +phone_explicit: +.PHONY: phony_explicit #------------------------------------------------------------------- # Firmware generation. @@ -120,9 +122,9 @@ testfw.elf: $(TESTFW_OBJS) $(P)/fw/mta1_mkdf/firmware.lds bram_fw.hex: $(ICESTORM_PATH)icebram -v -g 32 $(BRAM_FW_SIZE) > $@ -firmware.hex: firmware.bin size_mismatch +firmware.hex: firmware.bin firmware_size_mismatch python3 $(P)/tools/makehex/makehex.py $< $(BRAM_FW_SIZE) > $@ -testfw.hex: testfw.bin size_mismatch +testfw.hex: testfw.bin testfw_size_mismatch python3 $(P)/tools/makehex/makehex.py $< $(BRAM_FW_SIZE) > $@ %.bin: %.elf From 200ef26f360d19041f5148e75e1f7be0f2c1c30e Mon Sep 17 00:00:00 2001 From: Daniel Lublin Date: Tue, 11 Oct 2022 20:46:21 +0200 Subject: [PATCH 3/3] Correct --- hw/application_fpga/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/application_fpga/Makefile b/hw/application_fpga/Makefile index f74c1dd..112c0a1 100644 --- a/hw/application_fpga/Makefile +++ b/hw/application_fpga/Makefile @@ -100,7 +100,7 @@ all: application_fpga.bin (echo "The 'BRAM_FW_SIZE' variable needs to be increased" && false) # can't make implicit rule .PHONY -phone_explicit: +phony_explicit: .PHONY: phony_explicit #-------------------------------------------------------------------