katapult/src/lpc176x/Makefile
Kevin O'Connor fb50570994 buildbinary: Add support for building lpc176x checksum
The lpc176x internal rom checks that the first 8 words of the flash
sum to zero.  Many flash writing tools for the lpc176x will
automatically add the appropriate checksum.  However, it can be useful
to build the checksum locally so that the image supports direct flash
writing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-07-29 12:20:00 -04:00

32 lines
1.1 KiB
Makefile

# lpc176x build rules
# Setup the toolchain
CROSS_PREFIX=arm-none-eabi-
dirs-y += src/lpc176x src/generic lib/lpc176x/device
CFLAGS += -mthumb -mcpu=cortex-m3 -Ilib/lpc176x/device -Ilib/cmsis-core
CFLAGS_canboot.elf += --specs=nano.specs --specs=nosys.specs
CFLAGS_canboot.elf += -T $(OUT)src/generic/armcm_link.ld
$(OUT)canboot.elf: $(OUT)src/generic/armcm_link.ld
# Add source files
src-y += lpc176x/main.c lpc176x/gpio.c lpc176x/flash.c
src-y += generic/armcm_canboot.c generic/armcm_irq.c
src-y += generic/armcm_timer.c generic/crc16_ccitt.c
src-y += ../lib/lpc176x/device/system_LPC17xx.c
src-$(CONFIG_USBSERIAL) += lpc176x/usbserial.c lpc176x/chipid.c
src-$(CONFIG_USBSERIAL) += generic/usb_cdc.c
src-$(CONFIG_SERIAL) += lpc176x/serial.c generic/serial_irq.c
# Build the additional bin output file
target-y += $(OUT)canboot.bin
$(OUT)canboot.bin: $(OUT)canboot.elf ./scripts/buildbinary.py
@echo " Creating hex file $@"
$(Q)$(OBJCOPY) -O binary $< $(OUT)canboot.work
$(Q)$(PYTHON) ./scripts/buildbinary.py -b $(CONFIG_FLASH_START) -s $(CONFIG_APPLICATION_START) -l $(OUT)canboot.work $@