Refuse to produce a .bin if .elf has non-empty data or bss section

Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
Daniel Lublin 2023-03-07 14:17:23 +01:00
parent d77654bb8e
commit 3ddd6e83a3
No known key found for this signature in database
GPG Key ID: 75BD0FEB8D3E7830

View File

@ -144,6 +144,8 @@ testfw.hex: testfw.bin testfw_size_mismatch
%.bin: %.elf
$(SIZE) $<
@test "$$($(SIZE) $< | awk 'NR==2{print $$2, $$3}')" = "0 0" \
|| { printf "Non-empty data or bss section!\n"; false; }
$(OBJCOPY) --input-target=elf32-littleriscv --output-target=binary $< $@
chmod -x $@