From e63f008003ee950bc40e23144b6dd94404885bae Mon Sep 17 00:00:00 2001 From: Shengwen Cheng Date: Tue, 21 May 2024 21:46:57 +0800 Subject: [PATCH] Adjust makefiles --- Makefile | 222 +----------------- makefiles/common.mk | 216 +++++++++++++++++ {platform => makefiles}/dynamics_wizard.mk | 14 +- {platform => makefiles}/qemu.mk | 22 +- {platform => makefiles}/stm32f429disc.mk | 22 +- {platform => makefiles}/stm32f4disc.mk | 24 +- .../{tasks/examples => quadrotor}/quadrotor.c | 0 user/tasks/tasks.mk | 26 -- 8 files changed, 289 insertions(+), 257 deletions(-) create mode 100644 makefiles/common.mk rename {platform => makefiles}/dynamics_wizard.mk (72%) rename {platform => makefiles}/qemu.mk (52%) rename {platform => makefiles}/stm32f429disc.mk (63%) rename {platform => makefiles}/stm32f4disc.mk (52%) rename user/{tasks/examples => quadrotor}/quadrotor.c (100%) delete mode 100644 user/tasks/tasks.mk diff --git a/Makefile b/Makefile index 390a737..35c294d 100644 --- a/Makefile +++ b/Makefile @@ -1,218 +1,6 @@ -include config.mk +PLATFORM=qemu +#PLATFORM=stm32f4disc +#PLATFORM=stm32f429disc +#PLATFORM=dynamics_wizard -.DEFAULT_GOAL := all - -LDFLAGS := -CFLAGS := -SRC := -LD_SCRIPT := -LD_GENERATED := generated.ld - -ST_LIB := ./lib/STM32F4xx_StdPeriph_Driver - -# Board selection -include platform/qemu.mk -#include platform/stm32f4disc.mk -#include platform/stm32f429disc.mk -#include platform/dynamics_wizard.mk - -MSG_DIR := ./msg -MSG_BUILD := ./build/msg - -LDFLAGS += -Wl,--no-warn-rwx-segments -LDFLAGS += -lm - -CFLAGS += -O2 -g -mlittle-endian -mthumb \ - -fcommon \ - -mcpu=cortex-m4 \ - -mfpu=fpv4-sp-d16 -mfloat-abi=hard \ - --specs=nano.specs \ - --specs=nosys.specs -CFLAGS += -Wall \ - -Werror=undef \ - -Wno-unused-function \ - -Wno-format-truncation \ - -Wno-address-of-packed-member \ - -Wno-array-bounds # FIXME -CFLAGS += -D USE_STDPERIPH_DRIVER -CFLAGS += -D STM32F4xx -CFLAGS += -D ARM_MATH_CM4 \ - -D __FPU_PRESENT=1 \ - -D __FPU_USED=1 -CFLAGS += -Wl,-T,$(LD_GENERATED) - -USER = $(shell whoami) -CFLAGS += -D__USER_NAME__=\"$(USER)\" - -REVISION = $(shell git rev-parse --short=10 HEAD) -CFLAGS += -D__REVISION__=\"$(REVISION)\" - -CFLAGS += -I ./lib/CMSIS/ST/STM32F4xx/Include -CFLAGS += -I ./lib/CMSIS/Include -CFLAGS += -I $(ST_LIB)/inc - -CFLAGS += -I ./lib/mavlink -CFLAGS += -I ./lib/mavlink/common - -CFLAGS += -I ./ -CFLAGS += -I ./platform -CFLAGS += -I ./include -CFLAGS += -I ./include/common -CFLAGS += -I ./include/tenok -CFLAGS += -I ./include/tenok/sys -CFLAGS += -I ./include/kernel -CFLAGS += -I ./include/kernel/arch -CFLAGS += -I ./include/kernel/fs -CFLAGS += -I ./include/filters -CFLAGS += -I ./user -CFLAGS += -I ./user/debug-link -CFLAGS += -I ./build/msg - -SRC += lib/CMSIS/DSP_Lib/Source/CommonTables/arm_common_tables.c \ - lib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_f32.c \ - lib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_f32.c \ - lib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_f32.c \ - lib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_f32.c \ - lib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c \ - lib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c \ - lib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_f32.c \ - lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c \ - lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_f32.c \ - lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_f32.c \ - lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_f32.c \ - lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_f32.c \ - lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_f32.c \ - lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f32.c - -SRC += ./lib/CMSIS/system_stm32f4xx.c - -SRC += $(ST_LIB)/src/misc.c \ - $(ST_LIB)/src/stm32f4xx_rcc.c \ - $(ST_LIB)/src/stm32f4xx_dma.c \ - $(ST_LIB)/src/stm32f4xx_flash.c \ - $(ST_LIB)/src/stm32f4xx_gpio.c \ - $(ST_LIB)/src/stm32f4xx_usart.c \ - $(ST_LIB)/src/stm32f4xx_tim.c \ - $(ST_LIB)/src/stm32f4xx_spi.c \ - $(ST_LIB)/src/stm32f4xx_i2c.c \ - $(ST_LIB)/src/stm32f4xx_syscfg.c \ - $(ST_LIB)/src/stm32f4xx_exti.c - -SRC += ./kernel/arch/v7m_port.c \ - ./kernel/fs/fs.c \ - ./kernel/fs/wrapper.c \ - ./kernel/fs/reg_file.c \ - ./kernel/fs/rom_dev.c \ - ./kernel/fs/null_dev.c \ - ./kernel/mm/mpool.c \ - ./kernel/mm/mm.c \ - ./kernel/mm/page.c \ - ./kernel/mm/slab.c \ - ./kernel/kfifo.c \ - ./kernel/kernel.c \ - ./kernel/task.c \ - ./kernel/sched.c \ - ./kernel/file.c \ - ./kernel/pipe.c \ - ./kernel/mqueue.c \ - ./kernel/mutex.c \ - ./kernel/semaphore.c \ - ./kernel/pthread.c \ - ./kernel/signal.c \ - ./kernel/time.c \ - ./kernel/printf.c \ - ./kernel/printk.c \ - ./kernel/softirq.c \ - ./main.c - -SRC += ./user/debug-link/debug_link.c - --include ./drivers/drivers.mk --include ./user/shell/shell.mk --include ./user/tasks/tasks.mk --include ./user/mavlink/mavlink.mk --include ./user/benchmarks/benchmarks.mk - -OBJS := $(SRC:.c=.o) -OBJS += ./tools/mkromfs/romfs.o - -DEPEND = $(SRC:.c=.d) - -ASM := ./kernel/arch/v7m_entry.S \ - ./platform/startup_stm32f4xx.s - -all: gen_syscalls msggen $(LD_GENERATED) $(ELF) - @$(MAKE) -C ./tools/mkromfs/ -f Makefile - -$(ELF): $(ASM) $(OBJS) - @echo "LD" $@ - @$(CC) $(CFLAGS) $(OBJS) $(ASM) $(LDFLAGS) -o $@ - @rm $(LD_GENERATED) - -$(BIN): $(ELF) - @echo "OBJCPY" $@ - @$(OBJCOPY) -O binary $(PROJECT).elf $(PROJECT).bin - -gen_syscalls: - ./scripts/gen-syscalls.py > include/kernel/syscall.h - --include $(DEPEND) - -tools/mkromfs/romfs.o: - @$(MAKE) -C ./tools/mkromfs/ -f Makefile - -$(LD_GENERATED): $(LD_SCRIPT) - @echo "CC" $< ">" $@ - @$(CC) -E -P -x c $(CFLAGS) $<>$@ - -%.o: %.s - @echo "CC" $@ - @$(CC) $(CFLAGS) $^ $(LDFLAGS) -c $< - -%.o: %.c - @echo "CC" $@ - @$(CC) $(CFLAGS) -MMD -MP -c $< $(LDFLAGS) -o $@ - -check: - $(CPPCHECK) . -i lib/ - -clean: - rm -rf $(LD_GENERATED) - rm -rf $(ELF) - rm -rf $(OBJS) - rm -rf $(DEPEND) - rm -rf *.orig - @$(MAKE) -C ./tools/mkromfs -f Makefile clean - -msggen: - @$(MAKE) -C ./tools/msggen/ -f Makefile - rm -rf $(MSG_BUILD) - mkdir -p $(MSG_BUILD) - @echo "msggen" $(MSG_DIR) $(MSG_BUILD) - @./tools/msggen/msggen $(MSG_DIR) $(MSG_BUILD) - -gdbauto: - cgdb -d $(GDB) -x ./gdb/openocd_gdb.gdb - -FORMAT_EXCLUDE = -path ./lib -o -path ./platform -FORMAT_FILES = ".*\.\(c\|h\)" - -format: - @echo "Execute clang-format" - @find . -type d \( $(FORMAT_EXCLUDE) \) -prune -o \ - -regex $(FORMAT_FILES) -print \ - -exec clang-format -style=file -i {} \; - -size: - $(SIZE) $(ELF) - -objdump: - $(OBJDUMP) -d $(ELF) > $(ELF).asm - -doxygen: - @tail -n +4 README.md > main_page.md - @doxygen docs/Doxyfile - @rm -rf main_page.md - @echo "doxygen docs/Doxyfile" - -.PHONY: all check clean gdbauto format size objdump msggen gen_syscalls doxygen +include makefiles/common.mk diff --git a/makefiles/common.mk b/makefiles/common.mk new file mode 100644 index 0000000..e93a736 --- /dev/null +++ b/makefiles/common.mk @@ -0,0 +1,216 @@ +include config.mk + +.DEFAULT_GOAL := all + +LDFLAGS := +CFLAGS := +SRC := +LD_SCRIPT := +LD_GENERATED := generated.ld + +ST_LIB := ./lib/STM32F4xx_StdPeriph_Driver + +include ./makefiles/$(PLATFORM).mk + +MSG_DIR := ./msg +MSG_BUILD := ./build/msg + +LDFLAGS += -Wl,--no-warn-rwx-segments +LDFLAGS += -lm + +CFLAGS += -O2 -g -mlittle-endian -mthumb \ + -fcommon \ + -mcpu=cortex-m4 \ + -mfpu=fpv4-sp-d16 -mfloat-abi=hard \ + --specs=nano.specs \ + --specs=nosys.specs + +CFLAGS += -Wall \ + -Werror=undef \ + -Wno-unused-function \ + -Wno-format-truncation \ + -Wno-address-of-packed-member \ + -Wno-array-bounds # FIXME + +CFLAGS += -D USE_STDPERIPH_DRIVER \ + -D STM32F4xx \ + -D ARM_MATH_CM4 \ + -D __FPU_PRESENT=1 \ + -D __FPU_USED=1 + +CFLAGS += -Wl,-T,$(LD_GENERATED) + +USER = $(shell whoami) +CFLAGS += -D__USER_NAME__=\"$(USER)\" + +REVISION = $(shell git rev-parse --short=10 HEAD) +CFLAGS += -D__REVISION__=\"$(REVISION)\" + +CFLAGS += -I ./lib/CMSIS/ST/STM32F4xx/Include +CFLAGS += -I ./lib/CMSIS/Include +CFLAGS += -I $(ST_LIB)/inc + +CFLAGS += -I ./lib/mavlink +CFLAGS += -I ./lib/mavlink/common + +CFLAGS += -I ./ +CFLAGS += -I ./platform +CFLAGS += -I ./include +CFLAGS += -I ./include/common +CFLAGS += -I ./include/tenok +CFLAGS += -I ./include/tenok/sys +CFLAGS += -I ./include/kernel +CFLAGS += -I ./include/kernel/arch +CFLAGS += -I ./include/kernel/fs +CFLAGS += -I ./include/filters +CFLAGS += -I ./user +CFLAGS += -I ./user/debug-link +CFLAGS += -I ./build/msg + +SRC += lib/CMSIS/DSP_Lib/Source/CommonTables/arm_common_tables.c \ + lib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_f32.c \ + lib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_f32.c \ + lib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_f32.c \ + lib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_f32.c \ + lib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c \ + lib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c \ + lib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_f32.c \ + lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c \ + lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_f32.c \ + lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_f32.c \ + lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_f32.c \ + lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_f32.c \ + lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_f32.c \ + lib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f32.c + +SRC += ./lib/CMSIS/system_stm32f4xx.c + +SRC += $(ST_LIB)/src/misc.c \ + $(ST_LIB)/src/stm32f4xx_rcc.c \ + $(ST_LIB)/src/stm32f4xx_dma.c \ + $(ST_LIB)/src/stm32f4xx_flash.c \ + $(ST_LIB)/src/stm32f4xx_gpio.c \ + $(ST_LIB)/src/stm32f4xx_usart.c \ + $(ST_LIB)/src/stm32f4xx_tim.c \ + $(ST_LIB)/src/stm32f4xx_spi.c \ + $(ST_LIB)/src/stm32f4xx_i2c.c \ + $(ST_LIB)/src/stm32f4xx_syscfg.c \ + $(ST_LIB)/src/stm32f4xx_exti.c + +SRC += ./kernel/arch/v7m_port.c \ + ./kernel/fs/fs.c \ + ./kernel/fs/wrapper.c \ + ./kernel/fs/reg_file.c \ + ./kernel/fs/rom_dev.c \ + ./kernel/fs/null_dev.c \ + ./kernel/mm/mpool.c \ + ./kernel/mm/mm.c \ + ./kernel/mm/page.c \ + ./kernel/mm/slab.c \ + ./kernel/kfifo.c \ + ./kernel/kernel.c \ + ./kernel/task.c \ + ./kernel/sched.c \ + ./kernel/file.c \ + ./kernel/pipe.c \ + ./kernel/mqueue.c \ + ./kernel/mutex.c \ + ./kernel/semaphore.c \ + ./kernel/pthread.c \ + ./kernel/signal.c \ + ./kernel/time.c \ + ./kernel/printf.c \ + ./kernel/printk.c \ + ./kernel/softirq.c \ + ./main.c + +SRC += ./user/debug-link/debug_link.c + +-include ./drivers/drivers.mk +-include ./user/shell/shell.mk +-include ./user/mavlink/mavlink.mk +-include ./user/benchmarks/benchmarks.mk + +OBJS := $(SRC:.c=.o) +OBJS += ./tools/mkromfs/romfs.o + +DEPEND = $(SRC:.c=.d) + +ASM := ./kernel/arch/v7m_entry.S \ + ./platform/startup_stm32f4xx.s + +all: gen_syscalls msggen $(LD_GENERATED) $(ELF) + @$(MAKE) -C ./tools/mkromfs/ -f Makefile + +$(ELF): $(ASM) $(OBJS) + @echo "LD" $@ + @$(CC) $(CFLAGS) $(OBJS) $(ASM) $(LDFLAGS) -o $@ + @rm $(LD_GENERATED) + +$(BIN): $(ELF) + @echo "OBJCPY" $@ + @$(OBJCOPY) -O binary $(PROJECT).elf $(PROJECT).bin + +gen_syscalls: + ./scripts/gen-syscalls.py > include/kernel/syscall.h + +-include $(DEPEND) + +tools/mkromfs/romfs.o: + @$(MAKE) -C ./tools/mkromfs/ -f Makefile + +$(LD_GENERATED): $(LD_SCRIPT) + @echo "CC" $< ">" $@ + @$(CC) -E -P -x c $(CFLAGS) $<>$@ + +%.o: %.s + @echo "CC" $@ + @$(CC) $(CFLAGS) $^ $(LDFLAGS) -c $< + +%.o: %.c + @echo "CC" $@ + @$(CC) $(CFLAGS) -MMD -MP -c $< $(LDFLAGS) -o $@ + +check: + $(CPPCHECK) . -i lib/ + +clean: + rm -rf $(LD_GENERATED) + rm -rf $(ELF) + rm -rf $(OBJS) + rm -rf $(DEPEND) + rm -rf *.orig + @$(MAKE) -C ./tools/mkromfs -f Makefile clean + +msggen: + @$(MAKE) -C ./tools/msggen/ -f Makefile + rm -rf $(MSG_BUILD) + mkdir -p $(MSG_BUILD) + @echo "msggen" $(MSG_DIR) $(MSG_BUILD) + @./tools/msggen/msggen $(MSG_DIR) $(MSG_BUILD) + +gdbauto: + cgdb -d $(GDB) -x ./gdb/openocd_gdb.gdb + +FORMAT_EXCLUDE = -path ./lib -o -path ./platform +FORMAT_FILES = ".*\.\(c\|h\)" + +format: + @echo "Execute clang-format" + @find . -type d \( $(FORMAT_EXCLUDE) \) -prune -o \ + -regex $(FORMAT_FILES) -print \ + -exec clang-format -style=file -i {} \; + +size: + $(SIZE) $(ELF) + +objdump: + $(OBJDUMP) -d $(ELF) > $(ELF).asm + +doxygen: + @tail -n +4 README.md > main_page.md + @doxygen docs/Doxyfile + @rm -rf main_page.md + @echo "doxygen docs/Doxyfile" + +.PHONY: all check clean gdbauto format size objdump msggen gen_syscalls doxygen diff --git a/platform/dynamics_wizard.mk b/makefiles/dynamics_wizard.mk similarity index 72% rename from platform/dynamics_wizard.mk rename to makefiles/dynamics_wizard.mk index 9d927a6..08b0993 100644 --- a/platform/dynamics_wizard.mk +++ b/makefiles/dynamics_wizard.mk @@ -10,14 +10,22 @@ CFLAGS += -D STM32F427_437xx \ -D ENABLE_UART1_DMA=1 \ -D ENABLE_UART3_DMA=1 \ -D __ARCH__=\"armv7m\" \ - -D DYNAMICS_WIZARD_F4 - -CFLAGS += -D__BOARD_NAME__=\"stm32f427\" + -D DYNAMICS_WIZARD_F4 \ + -D __BOARD_NAME__=\"stm32f427\" CFLAGS += -I ./drivers/boards +CFLAGS += -I./user/tasks +# Board specific driver SRC += ./drivers/boards/dynamics_wizard.c +# Tasks +SRC += ./user/tasks/shell_task.c +SRC += ./user/tasks/mavlink_task.c +SRC += ./user/quadrotor/quadrotor.c + +include ./user/navigation/navigation.mk + flash: openocd -f interface/stlink.cfg \ -f target/stm32f4x.cfg \ diff --git a/platform/qemu.mk b/makefiles/qemu.mk similarity index 52% rename from platform/qemu.mk rename to makefiles/qemu.mk index ae07902..f7a1610 100644 --- a/platform/qemu.mk +++ b/makefiles/qemu.mk @@ -12,14 +12,30 @@ CFLAGS += -D STM32F40_41xxx \ -D ENABLE_UART1_DMA=0 \ -D ENABLE_UART3_DMA=0 \ -D BUILD_QEMU \ - -D __ARCH__=\"armv7m\" - -CFLAGS += -D__BOARD_NAME__=\"stm32f407\" + -D __ARCH__=\"armv7m\" \ + -D __BOARD_NAME__=\"stm32f407\" CFLAGS += -I./drivers/boards +CFLAGS += -I./user/tasks +# Board specific driver SRC += ./drivers/boards/stm32f4disc.c +# Example tasks +SRC += ./user/tasks/led_task.c +SRC += ./user/tasks/shell_task.c +#SRC += ./user/tasks/debug_task.c # Run `scripts/download-examples.sh` first +SRC += ./user/tasks/mavlink_task.c +#SRC += ./user/tasks/examples/fifo-ex.c +#SRC += ./user/tasks/examples/mqueue-ex.c +#SRC += ./user/tasks/examples/semaphore.c +#SRC += ./user/tasks/examples/mutex-ex.c +#SRC += ./user/tasks/examples/priority-inversion.c +#SRC += ./user/tasks/examples/signal-ex.c +#SRC += ./user/tasks/examples/timer-ex.c +#SRC += ./user/tasks/examples/poll-ex.c +#SRC += ./user/tasks/examples/pthread-ex.c + # Some useful qemu debug options. # Type `$(QEMU) -d help` for more information. # QEMU_DEBUG = -d in_asm diff --git a/platform/stm32f429disc.mk b/makefiles/stm32f429disc.mk similarity index 63% rename from platform/stm32f429disc.mk rename to makefiles/stm32f429disc.mk index 68b9477..dbe0827 100644 --- a/platform/stm32f429disc.mk +++ b/makefiles/stm32f429disc.mk @@ -11,14 +11,14 @@ CFLAGS += -D STM32F429_439xx \ -D PLL_Q=7 \ -D ENABLE_UART1_DMA=1 \ -D ENABLE_UART3_DMA=1 \ - -D __ARCH__=\"armv7m\" - -CFLAGS += -D__BOARD_NAME__=\"stm32f429\" + -D __ARCH__=\"armv7m\" \ + -D __BOARD_NAME__=\"stm32f429\" CFLAGS += -I ./lib/STM32F429I-Discovery CFLAGS += -I ./lib/STM32F429I-Discovery/Common CFLAGS += -I ./drivers/boards +CFLAGS += -I./user/tasks SRC += $(ST_LIB)/src/stm32f4xx_fmc.c \ $(ST_LIB)/src/stm32f4xx_ltdc.c \ @@ -29,8 +29,24 @@ SRC += ./lib/STM32F429I-Discovery/stm32f429i_discovery.c \ ./lib/STM32F429I-Discovery/stm32f429i_discovery_ioe.c \ ./lib/STM32F429I-Discovery/stm32f429i_discovery_sdram.c +# Board specific driver SRC += ./drivers/boards/stm32f429disc.c +# Example tasks +SRC += ./user/tasks/led_task.c +SRC += ./user/tasks/shell_task.c +#SRC += ./user/tasks/debug_task.c # Run `scripts/download-examples.sh` first +SRC += ./user/tasks/mavlink_task.c +#SRC += ./user/tasks/examples/fifo-ex.c +#SRC += ./user/tasks/examples/mqueue-ex.c +#SRC += ./user/tasks/examples/semaphore.c +#SRC += ./user/tasks/examples/mutex-ex.c +#SRC += ./user/tasks/examples/priority-inversion.c +#SRC += ./user/tasks/examples/signal-ex.c +#SRC += ./user/tasks/examples/timer-ex.c +#SRC += ./user/tasks/examples/poll-ex.c +#SRC += ./user/tasks/examples/pthread-ex.c + flash: openocd -f interface/stlink.cfg \ -f target/stm32f4x.cfg \ diff --git a/platform/stm32f4disc.mk b/makefiles/stm32f4disc.mk similarity index 52% rename from platform/stm32f4disc.mk rename to makefiles/stm32f4disc.mk index 7a633a3..9eec673 100644 --- a/platform/stm32f4disc.mk +++ b/makefiles/stm32f4disc.mk @@ -11,16 +11,30 @@ CFLAGS += -D STM32F40_41xxx \ -D PLL_Q=7 \ -D ENABLE_UART1_DMA=1 \ -D ENABLE_UART3_DMA=1 \ - -D __ARCH__=\"armv7m\" - -CFLAGS += -Wl,-T,platform/stm32f407.ld - -CFLAGS += -D__BOARD_NAME__=\"stm32f407\" + -D __ARCH__=\"armv7m\" \ + -D __BOARD_NAME__=\"stm32f407\" CFLAGS += -I./drivers/boards +CFLAGS += -I./user/tasks +# Board specific driver SRC += ./drivers/boards/stm32f4disc.c +# Example tasks +SRC += ./user/tasks/led_task.c +SRC += ./user/tasks/shell_task.c +#SRC += ./user/tasks/debug_task.c # Run `scripts/download-examples.sh` first +SRC += ./user/tasks/mavlink_task.c +#SRC += ./user/tasks/examples/fifo-ex.c +#SRC += ./user/tasks/examples/mqueue-ex.c +#SRC += ./user/tasks/examples/semaphore.c +#SRC += ./user/tasks/examples/mutex-ex.c +#SRC += ./user/tasks/examples/priority-inversion.c +#SRC += ./user/tasks/examples/signal-ex.c +#SRC += ./user/tasks/examples/timer-ex.c +#SRC += ./user/tasks/examples/poll-ex.c +#SRC += ./user/tasks/examples/pthread-ex.c + flash: openocd -f interface/stlink.cfg \ -f target/stm32f4x.cfg \ diff --git a/user/tasks/examples/quadrotor.c b/user/quadrotor/quadrotor.c similarity index 100% rename from user/tasks/examples/quadrotor.c rename to user/quadrotor/quadrotor.c diff --git a/user/tasks/tasks.mk b/user/tasks/tasks.mk deleted file mode 100644 index 026891c..0000000 --- a/user/tasks/tasks.mk +++ /dev/null @@ -1,26 +0,0 @@ -PROJ_ROOT := $(dir $(lastword $(MAKEFILE_LIST)))/../.. - -include $(PROJ_ROOT)/user/navigation/navigation.mk - -CFLAGS += -I $(PROJ_ROOT)/user/tasks - -# By deleting the source file you can disable -# the unwanted features -SRC += $(PROJ_ROOT)/user/tasks/led_task.c -SRC += $(PROJ_ROOT)/user/tasks/shell_task.c -#SRC += $(PROJ_ROOT)/user/tasks/debug_task.c # Run `scripts/download-examples.sh` first -SRC += $(PROJ_ROOT)/user/tasks/mavlink_task.c - -# Demo projects -SRC += $(PROJ_ROOT)/user/tasks/examples/quadrotor.c - -# Examples -#SRC += $(PROJ_ROOT)/user/tasks/examples/fifo-ex.c -#SRC += $(PROJ_ROOT)/user/tasks/examples/mqueue-ex.c -#SRC += $(PROJ_ROOT)/user/tasks/examples/semaphore.c -#SRC += $(PROJ_ROOT)/user/tasks/examples/mutex-ex.c -#SRC += $(PROJ_ROOT)/user/tasks/examples/priority-inversion.c -#SRC += $(PROJ_ROOT)/user/tasks/examples/signal-ex.c -#SRC += $(PROJ_ROOT)/user/tasks/examples/timer-ex.c -#SRC += $(PROJ_ROOT)/user/tasks/examples/poll-ex.c -#SRC += $(PROJ_ROOT)/user/tasks/examples/pthread-ex.c