Makefile.f4 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # PX4 bootloader build rules for STM32F4 targets.
  3. #
  4. ARCH=stm32
  5. OPENOCD ?= openocd
  6. JTAGCONFIG ?= interface/olimex-jtag-tiny.cfg
  7. #JTAGCONFIG ?= interface/jtagkey-tiny.cfg
  8. # 5 seconds / 5000 ms default delay
  9. PX4_BOOTLOADER_DELAY ?= 5000
  10. SRCS = $(COMMON_SRCS) $(addprefix $(ARCH)/,$(ARCH_SRCS)) main_f4.c
  11. OBJS := $(patsubst %.c,%.o,$(SRCS))
  12. DEPS := $(OBJS:.o=.d)
  13. FLAGS += -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
  14. -DTARGET_HW_$(TARGET_HW) \
  15. -DSTM32F4 \
  16. -T$(LINKER_FILE) \
  17. -L$(LIBOPENCM3)/lib \
  18. -lopencm3_stm32f4 \
  19. $(EXTRAFLAGS)
  20. #
  21. # General rules for making dependency and object files
  22. # This is where the compiler is called
  23. #
  24. include rules.mk
  25. #upload: all flash flash-bootloader
  26. upload: all flash-bootloader
  27. flash-bootloader:
  28. $(OPENOCD) --search ../px4_bootloader -f $(JTAGCONFIG) -f stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase $(BINARY) 0x08000000" -c "reset run" -c shutdown
  29. # Use to upload to a stm32f4-discovery devboard, requires the latest version of openocd (from git)
  30. # build openocd with "cd openocd; ./bootstrap; ./configure --enable-maintainer-mode --enable-stlink"
  31. upload-discovery:
  32. $(OPENOCD) --search ../px4_bootloader -f board/stm32f4discovery.cfg -c init -c "reset halt" -c "flash probe 0" -c "stm32f2x mass_erase 0" -c "flash write_image erase $(BINARY) 0x08000000" -c "reset" -c shutdown