mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
Blinky works
This commit is contained in:
1 parent
d6852f5e74
commit
c44549bfa5
8 files changed
+109
-111
No files matched your search
+32
-18
@@ -2,44 +2,58 @@
|
||||
PROG = firmware
|
||||
ARCH ?= stm32f1
|
||||
ROOT = $(realpath $(CURDIR)/../..)
|
||||
ENV ?= docker run -it --rm -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/armgcc
|
||||
MFLAGS = -DMG_ENABLE_LINES=1 -DMG_ARCH=MG_ARCH_FREERTOS_TCP -DMG_ENABLE_FS=0
|
||||
DOCKER ?= docker run -it --rm -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/armgcc
|
||||
MONGOOSE_OPTS = -DMG_ENABLE_LINES=1 -DMG_ARCH=MG_ARCH_FREERTOS_TCP -DMG_ENABLE_FS=0
|
||||
ifeq "$(ARCH)" "stm32f1"
|
||||
MCU = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
else ifeq "$(ARCH)" "stm32f7"
|
||||
MCU = -mcpu=cortex-m7 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard
|
||||
endif
|
||||
INCS = -I$(ARCH) -I. -I../.. -Ifreertos-kernel/include -Ifreertos-tcp/include -Ifreertos-tcp/portable/Compiler/GCC
|
||||
CFLAGS = -W -Wall -Og $(MCU) -fdata-sections -ffunction-sections $(INCS) $(MFLAGS) $(EXTRA)
|
||||
AFLAGS = --warn --fatal-warnings $(MCU)
|
||||
LDFLAGS = $(MCU) -specs=nano.specs -T$(ARCH)/link.ld -nostartfiles -nostdlib -lc -lm -lnosys -lgcc #-Wl,-Map=obj/$(PROG).map,--cref -Wl,--gc-sections
|
||||
A_SRC = $(ARCH)/boot.s
|
||||
C_SRC = main.c # $(wildcard freertos-tcp/*.c)
|
||||
C_SRC += freertos-kernel/portable/MemMang/heap_4.c $(ARCH)/port.c
|
||||
C_SRC += freertos-kernel/list.c freertos-kernel/tasks.c freertos-kernel/queue.c
|
||||
OBJS := $(C_SRC:%.c=obj/%.o) $(A_SRC:%.s=obj/%.o) #obj/mongoose.o
|
||||
CFLAGS = -W -Wall -Os -g $(MCU) -fdata-sections -ffunction-sections $(INCS) $(MONGOOSE_OPTS) $(EXTRA)
|
||||
LDFLAGS = $(MCU) -specs=nano.specs -Tobj/link.ld -nostartfiles -nostdlib -lc -lm -lnosys -lgcc #-Wl,-Map=obj/$(PROG).map,--cref -Wl,--gc-sections
|
||||
SRCS = main.c # $(wildcard freertos-tcp/*.c)
|
||||
# SRCS += freertos-kernel/portable/MemMang/heap_4.c $(ARCH)/port.c
|
||||
# SRCS += freertos-kernel/list.c freertos-kernel/tasks.c freertos-kernel/queue.c
|
||||
OBJS = obj/boot.o $(SRCS:%.c=obj/%.o) #obj/mongoose.o # ORDER MATTERS - boot (vector table) first!
|
||||
|
||||
all: $(PROG).hex
|
||||
|
||||
$(PROG).bin: $(PROG).elf
|
||||
$(ENV) arm-none-eabi-objcopy -O binary $< $@
|
||||
$(DOCKER) arm-none-eabi-objcopy -O binary $< $@
|
||||
|
||||
$(PROG).hex: $(PROG).bin
|
||||
$(ENV) arm-none-eabi-objcopy -I binary -O ihex --change-address 0x8000000 $< $@
|
||||
$(DOCKER) arm-none-eabi-objcopy -I binary -O ihex --change-address 0x8000000 $< $@
|
||||
|
||||
$(PROG).elf: $(OBJS)
|
||||
$(ENV) arm-none-eabi-gcc $^ $(LDFLAGS) -o $@
|
||||
obj/link.ld: $(ARCH)/link.ld
|
||||
$(DOCKER) arm-none-eabi-cpp -P -imacros $(ARCH)/device.h $< > $@
|
||||
|
||||
$(PROG).elf: $(OBJS) obj/link.ld
|
||||
$(DOCKER) arm-none-eabi-gcc $(OBJS) $(LDFLAGS) -o $@
|
||||
|
||||
obj/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(ENV) arm-none-eabi-gcc $(CFLAGS) -c $< -o $@
|
||||
$(DOCKER) arm-none-eabi-gcc $(CFLAGS) -c $< -o $@
|
||||
|
||||
obj/%.o: %.s
|
||||
obj/boot.o:
|
||||
@mkdir -p $(dir $@)
|
||||
$(ENV) arm-none-eabi-as $(AFLAGS) $< -o $@
|
||||
$(DOCKER) arm-none-eabi-as --warn --fatal-warnings $(MCU) $(ARCH)/boot.s -o $@
|
||||
|
||||
obj/mongoose.o:
|
||||
$(ENV) arm-none-eabi-gcc $(CFLAGS) -c ../../mongoose.c -o $@
|
||||
$(DOCKER) arm-none-eabi-gcc $(CFLAGS) -c ../../mongoose.c -o $@
|
||||
|
||||
flash: $(PROG).bin
|
||||
st-flash write $< 0x8000000
|
||||
|
||||
gdb: $(PROG).elf
|
||||
arm-none-eabi-gdb \
|
||||
-ex 'set confirm off' \
|
||||
-ex 'target extended-remote :4242' \
|
||||
-ex 'monitor reset halt' \
|
||||
-ex 'monitor reset init' \
|
||||
-ex 'b main' \
|
||||
-ex 'r' \
|
||||
$<
|
||||
|
||||
clean:
|
||||
@rm -rf *.{bin,elf,map,lst,tgz,zip,hex} obj
|
||||
Reference in new issue
Block a user