Aucune description

makefile 793B

1234567891011121314151617181920212223242526272829
  1. default_target: bped
  2. .PHONY : default_target
  3. ifdef offset
  4. ORG := $(shell printf "%d" $(offset))
  5. ROMORIGIN := $(shell printf "%d" 0x8000000)
  6. INSERT := $(shell echo ${ORG}-${ROMORIGIN} | bc)
  7. COMPILE := $(shell echo "obase=16;"${ORG} | bc)
  8. else
  9. COMPILE := 8000000
  10. endif
  11. OPTS := -O3
  12. bped:
  13. arm-none-eabi-gcc ${OPTS} -mthumb -mthumb-interwork -T "bped.sym" -g -w -std=gnu99 -emain -nostdlib -Wl,--section-start=.text=${COMPILE} -o main.out main.c
  14. arm-none-eabi-objcopy -O binary main.out main.bin
  15. rm main.out
  16. ifdef fname
  17. ifdef INSERT
  18. dd if=main.bin of="$(fname)" conv=notrunc seek=$(INSERT) bs=1
  19. else
  20. @echo "Insertion location not found!"
  21. @echo "Did you forget to define 'offset'?"
  22. @echo "Ex: make [version] fname=<romfile name> offset=0x08/0x09<offset in hex>"
  23. endif
  24. endif
  25. .PHONY : bped