mongoose/examples/wch/ch32v307-make-baremetal-builtin/Makefile

33 lines
944 B
Makefile
Raw Normal View History

2023-11-22 12:23:34 +08:00
CFLAGS = -W -Wall -Wextra -Wno-error -Wundef -Wshadow -Wdouble-promotion
CFLAGS += -Wformat-truncation -fno-common -Wconversion -Wno-sign-conversion
2023-11-27 10:50:46 +08:00
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -march=rv32imafc -mabi=ilp32f
2023-11-22 12:23:34 +08:00
CFLAGS += -DSYSCLK_FREQ_144MHz_HSE -I. -Ivendor -g3 -Os $(CFLAGS_EXTRA)
2023-11-27 10:50:46 +08:00
LDFLAGS = -T vendor/link.ld -nostartfiles --specs=nano.specs
LDFLAGS += -lc -lgcc -Wl,--gc-sections
2023-11-22 12:23:34 +08:00
2023-11-27 10:50:46 +08:00
SOURCES = main.c mongoose.c net.c packed_fs.c vendor/system_ch32v30x.c vendor/startup_ch32v30x_D8C.S
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\" -DHTTPS_URL=\"https://0.0.0.0/\"
2023-11-22 12:23:34 +08:00
ifeq ($(OS),Windows_NT)
RM = cmd /C del /Q /F /S
else
RM = rm -rf
endif
all: firmware.bin
firmware.bin: firmware.elf
riscv64-unknown-elf-objcopy -O binary $< $@
ls -l firmware.*
firmware.elf: $(SOURCES) hal.h Makefile
riscv64-unknown-elf-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
flash: firmware.bin
wchisp flash $<
clean:
$(RM) firmware.* *.su