mongoose/examples/stm32/nucleo-f429zi-baremetal/Makefile

36 lines
1.3 KiB
Makefile
Raw Normal View History

2022-08-30 02:15:48 +08:00
CFLAGS ?= -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion \
-Wformat-truncation -fno-common -Wconversion \
2023-01-20 05:42:06 +08:00
-g3 -Os -ffunction-sections -fdata-sections -I. \
2022-09-02 22:18:11 +08:00
-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 $(EXTRA_CFLAGS)
2022-08-30 02:15:48 +08:00
LDFLAGS ?= -Tlink.ld -nostartfiles -nostdlib --specs nano.specs -lc -lgcc -Wl,--gc-sections -Wl,-Map=$@.map
2023-01-20 05:42:06 +08:00
SOURCES = boot.c main.c syscalls.c
2022-08-30 02:15:48 +08:00
2023-01-20 05:42:06 +08:00
# Add Mongoose-specific flags and source files
CFLAGS += -I../../.. -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1 -DMG_ENABLE_MIP=1 -DMG_ENABLE_PACKED_FS=1
SOURCES += ../../../mongoose.c ../../device-dashboard/net.c ../../device-dashboard/packed_fs.c
2022-08-30 02:15:48 +08:00
2023-01-20 05:42:06 +08:00
all build example: firmware.bin
2022-08-30 02:15:48 +08:00
2023-01-20 05:42:06 +08:00
firmware.bin: firmware.elf
arm-none-eabi-objcopy -O binary $< $@
2022-08-30 02:15:48 +08:00
2023-01-20 05:42:06 +08:00
firmware.elf: $(SOURCES) mcu.h
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
2022-08-30 02:15:48 +08:00
# Note: on "unknown chip id" flash error, wire BOOT0 to VDD and st-flash erase
2023-01-20 05:42:06 +08:00
flash: firmware.bin
st-flash --reset write $< 0x8000000
# Requires env variable VCON_API_KEY set
DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/2
test: update
curl --fail -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
grep 'Ethernet: up' /tmp/output.txt
grep 'MQTT connected' /tmp/output.txt
update: firmware.bin
curl --fail -su :$(VCON_API_KEY) $(DEVICE_URL)/ota --data-binary @$<
2022-08-30 02:15:48 +08:00
clean:
2023-01-20 05:42:06 +08:00
@rm -rf firmware.* *.su