mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 00:35:34 +03:00
Merge pull request #278 from martinbudden/inav_target_mk
Converted to using target.mk files
This commit is contained in:
commit
bb7314b83c
30 changed files with 6052 additions and 466 deletions
708
Makefile
Executable file → Normal file
708
Makefile
Executable file → Normal file
|
@ -5,7 +5,7 @@
|
|||
# this stuff is worth it, you can buy me a beer in return
|
||||
###############################################################################
|
||||
#
|
||||
# Makefile for building the cleanflight firmware.
|
||||
# Makefile for building the iNav firmware.
|
||||
#
|
||||
# Invoke this with 'make help' to see the list of supported targets.
|
||||
#
|
||||
|
@ -43,48 +43,70 @@ FLASH_SIZE ?=
|
|||
|
||||
FORKNAME = inav
|
||||
|
||||
CC3D_TARGETS = CC3D CC3D_OPBL CC3D_PPM1
|
||||
NAZE_TARGETS = ALIENFLIGHTF1
|
||||
SPRACINGF3_TARGETS = IRCFUSIONF3 RMDO
|
||||
# Working directories
|
||||
ROOT := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
|
||||
SRC_DIR = $(ROOT)/src/main
|
||||
OBJECT_DIR = $(ROOT)/obj/main
|
||||
BIN_DIR = $(ROOT)/obj
|
||||
CMSIS_DIR = $(ROOT)/lib/main/CMSIS
|
||||
INCLUDE_DIRS = $(SRC_DIR) \
|
||||
$(ROOT)/src/main/target
|
||||
LINKER_DIR = $(ROOT)/src/main/target
|
||||
|
||||
SDCARD_TARGETS =
|
||||
SERIAL_USB_TARGETS = IRCFUSIONF3 SPRACINGF3
|
||||
# default xtal value for F4 targets
|
||||
HSE_VALUE = 8000000
|
||||
|
||||
# Valid targets for STM VCP support
|
||||
VCP_TARGETS = $(CC3D_TARGETS) ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE LUX_RACE MOTOLAB SPARKY STM32F3DISCOVERY
|
||||
# used for turning on features like VCP and SDCARD
|
||||
FEATURES =
|
||||
|
||||
# Valid targets for OP BootLoader support
|
||||
OPBL_TARGETS = CC3D_OPBL
|
||||
ALT_TARGETS = $(sort $(filter-out target, $(basename $(notdir $(wildcard $(ROOT)/src/main/target/*/*.mk)))))
|
||||
OPBL_TARGETS = $(filter %_OPBL, $(ALT_TARGETS))
|
||||
|
||||
#VALID_TARGETS = $(F1_TARGETS) $(F3_TARGETS) $(F4_TARGETS)
|
||||
VALID_TARGETS = $(dir $(wildcard $(ROOT)/src/main/target/*/target.mk))
|
||||
VALID_TARGETS := $(subst /,, $(subst ./src/main/target/,, $(VALID_TARGETS)))
|
||||
VALID_TARGETS := $(VALID_TARGETS) $(ALT_TARGETS)
|
||||
VALID_TARGETS := $(sort $(VALID_TARGETS))
|
||||
|
||||
F405_TARGETS =
|
||||
F405_TARGETS_16 =
|
||||
F411_TARGETS =
|
||||
ifeq ($(filter $(TARGET),$(ALT_TARGETS)), $(TARGET))
|
||||
BASE_TARGET := $(firstword $(subst /,, $(subst ./src/main/target/,, $(dir $(wildcard $(ROOT)/src/main/target/*/$(TARGET).mk)))))
|
||||
-include $(ROOT)/src/main/target/$(BASE_TARGET)/$(TARGET).mk
|
||||
else
|
||||
BASE_TARGET := $(TARGET)
|
||||
endif
|
||||
|
||||
F1_TARGETS = $(CC3D_TARGETS) ALIENFLIGHTF1 CJMCU EUSTM32F103RC NAZE OLIMEXINO PORT103R
|
||||
F3_TARGETS = ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE LUX_RACE MOTOLAB RMDO SPARKY SPRACINGF3 STM32F3DISCOVERY
|
||||
F4_TARGETS = $(F405_TARGETS) $(F405_TARGETS_16) $(F411_TARGETS)
|
||||
VALID_TARGETS = $(F1_TARGETS) $(F3_TARGETS) $(F4_TARGETS)
|
||||
ifeq ($(filter $(TARGET),$(OPBL_TARGETS)), $(TARGET))
|
||||
OPBL = yes
|
||||
endif
|
||||
|
||||
# silently ignore if the file is not present. Allows for target specific.
|
||||
-include $(ROOT)/src/main/target/$(BASE_TARGET)/target.mk
|
||||
|
||||
64K_TARGETS = CJMCU
|
||||
128K_TARGETS = $(CC3D_TARGETS) ALIENFLIGHTF1 NAZE OLIMEXINO RMDO
|
||||
256K_TARGETS = ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE EUSTM32F103RC LUX_RACE MOTOLAB PORT103R SPARKY SPRACINGF3 STM32F3DISCOVERY
|
||||
F4_TARGETS = $(F405_TARGETS) $(F411_TARGETS)
|
||||
|
||||
ifeq ($(filter $(TARGET),$(VALID_TARGETS)),)
|
||||
$(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS). Have you prepared a valid target.mk?)
|
||||
endif
|
||||
|
||||
ifeq ($(filter $(TARGET),$(F1_TARGETS) $(F3_TARGETS) $(F4_TARGETS)),)
|
||||
$(error Target '$(TARGET)' has not specified a valid STM group, must be one of F1, F3, F405, or F411. Have you prepared a valid target.mk?)
|
||||
endif
|
||||
|
||||
128K_TARGETS = $(F1_TARGETS)
|
||||
256K_TARGETS = $(F3_TARGETS)
|
||||
512K_TARGETS = $(F411_TARGETS)
|
||||
1024K_TARGETS = $(F405_TARGETS) $(F405_TARGETS_16)
|
||||
1024K_TARGETS = $(F405_TARGETS)
|
||||
|
||||
# Configure default flash sizes for the targets
|
||||
# Configure default flash sizes for the targets (largest size specified gets hit first) if flash not specified already.
|
||||
ifeq ($(FLASH_SIZE),)
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(64K_TARGETS)))
|
||||
FLASH_SIZE = 64
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(128K_TARGETS)))
|
||||
FLASH_SIZE = 128
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(256K_TARGETS)))
|
||||
FLASH_SIZE = 256
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(1024K_TARGETS)))
|
||||
FLASH_SIZE = 1024
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(512K_TARGETS)))
|
||||
FLASH_SIZE = 512
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(1024K_TARGETS)))
|
||||
FLASH_SIZE = 1024
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(256K_TARGETS)))
|
||||
FLASH_SIZE = 256
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(128K_TARGETS)))
|
||||
FLASH_SIZE = 128
|
||||
else
|
||||
$(error FLASH_SIZE not configured for target $(TARGET))
|
||||
endif
|
||||
|
@ -98,7 +120,7 @@ else
|
|||
STM32F30x_COMMON_SRC = startup_stm32f30x_md_gcc.S
|
||||
endif
|
||||
|
||||
REVISION := $(shell git log -1 --format="%h")
|
||||
REVISION = $(shell git log -1 --format="%h")
|
||||
|
||||
FC_VER_MAJOR := $(shell grep " FC_VERSION_MAJOR" src/main/version.h | awk '{print $$3}' )
|
||||
FC_VER_MINOR := $(shell grep " FC_VERSION_MINOR" src/main/version.h | awk '{print $$3}' )
|
||||
|
@ -106,24 +128,15 @@ FC_VER_PATCH := $(shell grep " FC_VERSION_PATCH" src/main/version.h | awk '{prin
|
|||
|
||||
FC_VER := $(FC_VER_MAJOR).$(FC_VER_MINOR).$(FC_VER_PATCH)
|
||||
|
||||
# Working directories
|
||||
ROOT := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
|
||||
SRC_DIR = $(ROOT)/src/main
|
||||
OBJECT_DIR = $(ROOT)/obj/main
|
||||
BIN_DIR = $(ROOT)/obj
|
||||
CMSIS_DIR = $(ROOT)/lib/main/CMSIS
|
||||
INCLUDE_DIRS = $(SRC_DIR) \
|
||||
$(ROOT)/src/main/target
|
||||
LINKER_DIR = $(ROOT)/src/main/target
|
||||
|
||||
# Search path for sources
|
||||
VPATH := $(SRC_DIR):$(SRC_DIR)/startup
|
||||
USBFS_DIR = $(ROOT)/lib/main/STM32_USB-FS-Device_Driver
|
||||
USBPERIPH_SRC = $(notdir $(wildcard $(USBFS_DIR)/src/*.c))
|
||||
FATFS_DIR = $(ROOT)/lib/main/FatFS
|
||||
FATFS_SRC = $(notdir $(wildcard $(FATFS_DIR)/*.c))
|
||||
|
||||
CSOURCES := $(shell find $(SRC_DIR) -name '*.c')
|
||||
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(F3_TARGETS)))
|
||||
# F3 TARGETS
|
||||
|
||||
|
@ -144,7 +157,7 @@ INCLUDE_DIRS := $(INCLUDE_DIRS) \
|
|||
$(CMSIS_DIR)/CM1/CoreSupport \
|
||||
$(CMSIS_DIR)/CM1/DeviceSupport/ST/STM32F30x
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(VCP_TARGETS)))
|
||||
ifneq ($(filter VCP, $(FEATURES)),)
|
||||
INCLUDE_DIRS := $(INCLUDE_DIRS) \
|
||||
$(USBFS_DIR)/inc \
|
||||
$(ROOT)/src/main/vcp
|
||||
|
@ -153,7 +166,13 @@ VPATH := $(VPATH):$(USBFS_DIR)/src
|
|||
|
||||
DEVICE_STDPERIPH_SRC := $(DEVICE_STDPERIPH_SRC)\
|
||||
$(USBPERIPH_SRC)
|
||||
endif
|
||||
|
||||
ifneq ($(filter SDCARD, $(FEATURES)),)
|
||||
INCLUDE_DIRS := $(INCLUDE_DIRS) \
|
||||
$(FATFS_DIR) \
|
||||
|
||||
VPATH := $(VPATH):$(FATFS_DIR)
|
||||
endif
|
||||
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f303_$(FLASH_SIZE)k.ld
|
||||
|
@ -161,43 +180,103 @@ LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f303_$(FLASH_SIZE)k.ld
|
|||
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion
|
||||
DEVICE_FLAGS = -DSTM32F303xC -DSTM32F303
|
||||
TARGET_FLAGS = -D$(TARGET)
|
||||
## End F3 targets
|
||||
##
|
||||
## Start F4 targets
|
||||
# End F3 targets
|
||||
#
|
||||
# Start F4 targets
|
||||
else ifeq ($(TARGET),$(filter $(TARGET), $(F4_TARGETS)))
|
||||
## End F4 targets
|
||||
##
|
||||
## Start EUSTM32F103RC PORT103R targets
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),EUSTM32F103RC PORT103R))
|
||||
|
||||
STDPERIPH_DIR = $(ROOT)/lib/main/STM32F10x_StdPeriph_Driver
|
||||
#STDPERIPH
|
||||
STDPERIPH_DIR = $(ROOT)/lib/main/STM32F4xx_StdPeriph_Driver
|
||||
STDPERIPH_SRC = $(notdir $(wildcard $(STDPERIPH_DIR)/src/*.c))
|
||||
EXCLUDES = stm32f10x_crc.c \
|
||||
stm32f10x_cec.c \
|
||||
stm32f10x_can.c
|
||||
EXCLUDES = stm32f4xx_crc.c \
|
||||
stm32f4xx_can.c \
|
||||
stm32f4xx_fmc.c \
|
||||
stm32f4xx_sai.c \
|
||||
stm32f4xx_cec.c \
|
||||
stm32f4xx_dsi.c \
|
||||
stm32f4xx_flash_ramfunc.c \
|
||||
stm32f4xx_fmpi2c.c \
|
||||
stm32f4xx_lptim.c \
|
||||
stm32f4xx_qspi.c \
|
||||
stm32f4xx_spdifrx.c \
|
||||
stm32f4xx_cryp.c \
|
||||
stm32f4xx_cryp_aes.c \
|
||||
stm32f4xx_hash_md5.c \
|
||||
stm32f4xx_cryp_des.c \
|
||||
stm32f4xx_rtc.c \
|
||||
stm32f4xx_hash.c \
|
||||
stm32f4xx_dbgmcu.c \
|
||||
stm32f4xx_cryp_tdes.c \
|
||||
stm32f4xx_hash_sha1.c
|
||||
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET), $(F411_TARGETS)))
|
||||
EXCLUDES += stm32f4xx_fsmc.c
|
||||
endif
|
||||
|
||||
STDPERIPH_SRC := $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC))
|
||||
|
||||
# Search path and source files for the CMSIS sources
|
||||
VPATH := $(VPATH):$(CMSIS_DIR)/CM3/CoreSupport:$(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x
|
||||
CMSIS_SRC = $(notdir $(wildcard $(CMSIS_DIR)/CM3/CoreSupport/*.c \
|
||||
$(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x/*.c))
|
||||
#USB
|
||||
USBCORE_DIR = $(ROOT)/lib/main/STM32_USB_Device_Library/Core
|
||||
USBCORE_SRC = $(notdir $(wildcard $(USBCORE_DIR)/src/*.c))
|
||||
USBOTG_DIR = $(ROOT)/lib/main/STM32_USB_OTG_Driver
|
||||
USBOTG_SRC = $(notdir $(wildcard $(USBOTG_DIR)/src/*.c))
|
||||
EXCLUDES = usb_bsp_template.c \
|
||||
usb_conf_template.c \
|
||||
usb_hcd_int.c \
|
||||
usb_hcd.c \
|
||||
usb_otg.c
|
||||
|
||||
USBOTG_SRC := $(filter-out ${EXCLUDES}, $(USBOTG_SRC))
|
||||
USBCDC_DIR = $(ROOT)/lib/main/STM32_USB_Device_Library/Class/cdc
|
||||
USBCDC_SRC = $(notdir $(wildcard $(USBCDC_DIR)/src/*.c))
|
||||
EXCLUDES = usbd_cdc_if_template.c
|
||||
USBCDC_SRC := $(filter-out ${EXCLUDES}, $(USBCDC_SRC))
|
||||
VPATH := $(VPATH):$(USBOTG_DIR)/src:$(USBCORE_DIR)/src:$(USBCDC_DIR)/src
|
||||
|
||||
DEVICE_STDPERIPH_SRC := $(STDPERIPH_SRC) \
|
||||
$(USBOTG_SRC) \
|
||||
$(USBCORE_SRC) \
|
||||
$(USBCDC_SRC)
|
||||
|
||||
#CMSIS
|
||||
VPATH := $(VPATH):$(CMSIS_DIR)/CM4/CoreSupport:$(CMSIS_DIR)/CM4/DeviceSupport/ST/STM32F4xx
|
||||
CMSIS_SRC = $(notdir $(wildcard $(CMSIS_DIR)/CM4/CoreSupport/*.c \
|
||||
$(CMSIS_DIR)/CM4/DeviceSupport/ST/STM32F4xx/*.c))
|
||||
INCLUDE_DIRS := $(INCLUDE_DIRS) \
|
||||
$(STDPERIPH_DIR)/inc \
|
||||
$(CMSIS_DIR)/CM3/CoreSupport \
|
||||
$(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x \
|
||||
$(USBOTG_DIR)/inc \
|
||||
$(USBCORE_DIR)/inc \
|
||||
$(USBCDC_DIR)/inc \
|
||||
$(USBFS_DIR)/inc \
|
||||
$(CMSIS_DIR)/CM4/CoreSupport \
|
||||
$(CMSIS_DIR)/CM4/DeviceSupport/ST/STM32F4xx \
|
||||
$(ROOT)/src/main/vcpf4
|
||||
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_$(FLASH_SIZE)k.ld
|
||||
ifneq ($(filter SDCARD,$(FEATURES)),)
|
||||
INCLUDE_DIRS := $(INCLUDE_DIRS) \
|
||||
$(FATFS_DIR)
|
||||
VPATH := $(VPATH):$(FATFS_DIR)
|
||||
endif
|
||||
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m3
|
||||
TARGET_FLAGS = -D$(TARGET) -pedantic
|
||||
DEVICE_FLAGS = -DSTM32F10X_HD -DSTM32F10X
|
||||
#Flags
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion
|
||||
|
||||
DEVICE_STDPERIPH_SRC = $(STDPERIPH_SRC)
|
||||
## End EUSTM32F103RC PORT103R targets
|
||||
##
|
||||
## Start F1 targets
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(F411_TARGETS)))
|
||||
DEVICE_FLAGS = -DSTM32F411xE
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f411.ld
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(F405_TARGETS)))
|
||||
DEVICE_FLAGS = -DSTM32F40_41xxx
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f405.ld
|
||||
else
|
||||
$(error Unknown MCU for F4 target)
|
||||
endif
|
||||
DEVICE_FLAGS += -DHSE_VALUE=$(HSE_VALUE)
|
||||
|
||||
TARGET_FLAGS = -D$(TARGET)
|
||||
# End F4 targets
|
||||
#
|
||||
# Start F1 targets
|
||||
else
|
||||
|
||||
STDPERIPH_DIR = $(ROOT)/lib/main/STM32F10x_StdPeriph_Driver
|
||||
|
@ -220,7 +299,7 @@ INCLUDE_DIRS := $(INCLUDE_DIRS) \
|
|||
|
||||
DEVICE_STDPERIPH_SRC = $(STDPERIPH_SRC)
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET), $(VCP_TARGETS)))
|
||||
ifneq ($(filter VCP, $(FEATURES)),)
|
||||
INCLUDE_DIRS := $(INCLUDE_DIRS) \
|
||||
$(USBFS_DIR)/inc \
|
||||
$(ROOT)/src/main/vcp
|
||||
|
@ -234,64 +313,42 @@ endif
|
|||
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_$(FLASH_SIZE)k.ld
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m3
|
||||
TARGET_FLAGS = -D$(TARGET) -pedantic
|
||||
DEVICE_FLAGS = -DSTM32F10X_MD -DSTM32F10X
|
||||
TARGET_FLAGS := -D$(TARGET) -pedantic $(TARGET_FLAGS)
|
||||
|
||||
ifeq ($(DEVICE_FLAGS),)
|
||||
DEVICE_FLAGS = -DSTM32F10X_MD
|
||||
endif
|
||||
DEVICE_FLAGS += -DSTM32F10X
|
||||
|
||||
endif
|
||||
##
|
||||
## End F1 targets
|
||||
##
|
||||
#
|
||||
# End F1 targets
|
||||
#
|
||||
ifneq ($(BASE_TARGET), $(TARGET))
|
||||
TARGET_FLAGS := $(TARGET_FLAGS) -D$(BASE_TARGET)
|
||||
endif
|
||||
|
||||
ifneq ($(FLASH_SIZE),)
|
||||
DEVICE_FLAGS := $(DEVICE_FLAGS) -DFLASH_SIZE=$(FLASH_SIZE)
|
||||
endif
|
||||
|
||||
TARGET_DIR = $(ROOT)/src/main/target/$(TARGET)
|
||||
TARGET_SRC = $(notdir $(wildcard $(TARGET_DIR)/*.c))
|
||||
|
||||
# VARIANTS
|
||||
|
||||
ifeq ($(TARGET),CHEBUZZF3)
|
||||
# CHEBUZZ is a VARIANT of STM32F3DISCOVERY
|
||||
TARGET_FLAGS := $(TARGET_FLAGS) -DSTM32F3DISCOVERY
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(SPRACINGF3_TARGETS)))
|
||||
# VARIANTS of SPRACINGF3
|
||||
TARGET_FLAGS := $(TARGET_FLAGS) -DSPRACINGF3
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET), $(NAZE_TARGETS)))
|
||||
# VARIANTS of NAZE
|
||||
TARGET_FLAGS := $(TARGET_FLAGS) -DNAZE -D$(TARGET)
|
||||
TARGET_DIR = $(ROOT)/src/main/target/NAZE
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET), $(CC3D_TARGETS)))
|
||||
TARGET_FLAGS := $(TARGET_FLAGS) -DCC3D
|
||||
ifeq ($(TARGET),CC3D_OPBL)
|
||||
TARGET_FLAGS := $(TARGET_FLAGS) -DCC3D_OPBL
|
||||
CC3D_OPBL_SRC = $(CC3D_SRC)
|
||||
endif
|
||||
ifeq ($(TARGET),CC3D_PPM1)
|
||||
TARGET_FLAGS := $(TARGET_FLAGS) -DCC3D_PPM1
|
||||
CC3D_PPM1_SRC = $(CC3D_SRC)
|
||||
endif
|
||||
TARGET_DIR = $(ROOT)/src/main/target/CC3D
|
||||
endif
|
||||
|
||||
ifneq ($(filter $(TARGET),$(OPBL_TARGETS)),)
|
||||
OPBL=yes
|
||||
endif
|
||||
TARGET_DIR = $(ROOT)/src/main/target/$(BASE_TARGET)
|
||||
TARGET_DIR_SRC = $(notdir $(wildcard $(TARGET_DIR)/*.c))
|
||||
|
||||
ifeq ($(OPBL),yes)
|
||||
ifneq ($(filter $(TARGET),$(OPBL_TARGETS)),)
|
||||
TARGET_FLAGS := -DOPBL $(TARGET_FLAGS)
|
||||
ifeq ($(TARGET), $(filter $(TARGET),$(F405_TARGETS)))
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f405_opbl.ld
|
||||
else ifeq ($(TARGET), $(filter $(TARGET),$(F411_TARGETS)))
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f411_opbl.ld
|
||||
else ifeq ($(TARGET), $(filter $(TARGET),$(F3_TARGETS)))
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f303_$(FLASH_SIZE)k_opbl.ld
|
||||
else ifeq ($(TARGET), $(filter $(TARGET),$(F1_TARGETS)))
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_$(FLASH_SIZE)k_opbl.ld
|
||||
endif
|
||||
.DEFAULT_GOAL := binary
|
||||
else
|
||||
$(error OPBL specified with a unsupported target)
|
||||
endif
|
||||
.DEFAULT_GOAL := hex
|
||||
endif
|
||||
|
||||
INCLUDE_DIRS := $(INCLUDE_DIRS) \
|
||||
|
@ -303,7 +360,7 @@ COMMON_SRC = \
|
|||
build_config.c \
|
||||
debug.c \
|
||||
version.c \
|
||||
$(TARGET_SRC) \
|
||||
$(TARGET_DIR_SRC) \
|
||||
main.c \
|
||||
mw.c \
|
||||
scheduler/scheduler.c \
|
||||
|
@ -388,6 +445,15 @@ HIGHEND_SRC = \
|
|||
telemetry/smartport.c \
|
||||
telemetry/ltm.c
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(F4_TARGETS)))
|
||||
VCP_SRC = \
|
||||
vcpf4/stm32f4xx_it.c \
|
||||
vcpf4/usb_bsp.c \
|
||||
vcpf4/usbd_desc.c \
|
||||
vcpf4/usbd_usr.c \
|
||||
vcpf4/usbd_cdc_vcp.c \
|
||||
drivers/serial_usb_vcp.c
|
||||
else
|
||||
VCP_SRC = \
|
||||
vcp/hw_config.c \
|
||||
vcp/stm32_it.c \
|
||||
|
@ -397,6 +463,7 @@ VCP_SRC = \
|
|||
vcp/usb_prop.c \
|
||||
vcp/usb_pwr.c \
|
||||
drivers/serial_usb_vcp.c
|
||||
endif
|
||||
|
||||
STM32F10x_COMMON_SRC = \
|
||||
startup_stm32f10x_md_gcc.S \
|
||||
|
@ -425,237 +492,57 @@ STM32F30x_COMMON_SRC = \
|
|||
drivers/system_stm32f30x.c \
|
||||
drivers/timer_stm32f30x.c
|
||||
|
||||
NAZE_SRC = \
|
||||
$(STM32F10x_COMMON_SRC) \
|
||||
drivers/accgyro_adxl345.c \
|
||||
drivers/accgyro_bma280.c \
|
||||
drivers/accgyro_l3g4200d.c \
|
||||
drivers/accgyro_mma845x.c \
|
||||
STM32F4xx_COMMON_SRC = \
|
||||
startup_stm32f40xx.s \
|
||||
target/system_stm32f4xx.c \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu3050.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_mpu6500.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
io/flashfs.c \
|
||||
hardware_revision.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC)
|
||||
|
||||
ALIENFLIGHTF1_SRC = $(NAZE_SRC)
|
||||
|
||||
EUSTM32F103RC_SRC = \
|
||||
$(STM32F10x_COMMON_SRC) \
|
||||
drivers/accgyro_adxl345.c \
|
||||
drivers/accgyro_bma280.c \
|
||||
drivers/accgyro_l3g4200d.c \
|
||||
drivers/accgyro_mma845x.c \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu3050.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_spi_mpu6000.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
io/flashfs.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC)
|
||||
|
||||
PORT103R_SRC = $(EUSTM32F103RC_SRC)
|
||||
|
||||
OLIMEXINO_SRC = \
|
||||
$(STM32F10x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC)
|
||||
|
||||
CJMCU_SRC = \
|
||||
$(STM32F10x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
hardware_revision.c \
|
||||
blackbox/blackbox.c \
|
||||
blackbox/blackbox_io.c \
|
||||
$(COMMON_SRC)
|
||||
|
||||
CC3D_SRC = \
|
||||
$(STM32F10x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_spi_mpu6000.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
io/flashfs.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC) \
|
||||
$(VCP_SRC)
|
||||
|
||||
STM32F3DISCOVERY_COMMON_SRC = \
|
||||
$(STM32F30x_COMMON_SRC) \
|
||||
drivers/accgyro_l3gd20.c \
|
||||
drivers/accgyro_l3gd20.c \
|
||||
drivers/accgyro_lsm303dlhc.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
$(VCP_SRC)
|
||||
|
||||
STM32F3DISCOVERY_SRC = \
|
||||
$(STM32F3DISCOVERY_COMMON_SRC) \
|
||||
drivers/accgyro_adxl345.c \
|
||||
drivers/accgyro_bma280.c \
|
||||
drivers/accgyro_mma845x.c \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu3050.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_l3g4200d.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC)
|
||||
|
||||
CHEBUZZF3_SRC = \
|
||||
$(STM32F3DISCOVERY_SRC) \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC)
|
||||
|
||||
COLIBRI_RACE_SRC = \
|
||||
$(STM32F30x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6500.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/accgyro_mpu6500.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/serial_usb_vcp.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC) \
|
||||
$(VCP_SRC)
|
||||
|
||||
LUX_RACE_SRC = \
|
||||
$(STM32F30x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6500.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/accgyro_mpu6500.c \
|
||||
drivers/serial_usb_vcp.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC) \
|
||||
$(VCP_SRC)
|
||||
|
||||
SPARKY_SRC = \
|
||||
$(STM32F30x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/serial_usb_vcp.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC) \
|
||||
$(VCP_SRC)
|
||||
|
||||
ALIENFLIGHTF3_SRC = \
|
||||
$(SPARKY_SRC)
|
||||
|
||||
RMDO_SRC = \
|
||||
$(STM32F30x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/adc_stm32f4xx.c \
|
||||
drivers/adc_stm32f4xx.c \
|
||||
drivers/bus_i2c_stm32f10x.c \
|
||||
drivers/gpio_stm32f4xx.c \
|
||||
drivers/inverter.c \
|
||||
drivers/serial_softserial.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
io/flashfs.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC)
|
||||
drivers/serial_uart_stm32f4xx.c \
|
||||
drivers/system_stm32f4xx.c \
|
||||
drivers/timer_stm32f4xx.c \
|
||||
drivers/dma_stm32f4xx.c
|
||||
|
||||
SPRACINGF3_SRC = \
|
||||
$(STM32F30x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/serial_softserial.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
io/flashfs.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC)
|
||||
# check if target.mk supplied
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(F4_TARGETS)))
|
||||
TARGET_SRC := $(STM32F4xx_COMMON_SRC) $(TARGET_SRC)
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(F3_TARGETS)))
|
||||
TARGET_SRC := $(STM32F30x_COMMON_SRC) $(TARGET_SRC)
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(F1_TARGETS)))
|
||||
TARGET_SRC := $(STM32F10x_COMMON_SRC) $(TARGET_SRC)
|
||||
endif
|
||||
|
||||
MOTOLAB_SRC = \
|
||||
$(STM32F30x_COMMON_SRC) \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/serial_usb_vcp.c \
|
||||
ifneq ($(filter ONBOARDFLASH,$(FEATURES)),)
|
||||
TARGET_SRC += \
|
||||
drivers/flash_m25p16.c \
|
||||
io/flashfs.c \
|
||||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC) \
|
||||
$(VCP_SRC)
|
||||
io/flashfs.c
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(F4_TARGETS) $(F3_TARGETS)))
|
||||
TARGET_SRC += $(HIGHEND_SRC)
|
||||
else ifneq ($(filter HIGHEND,$(FEATURES)),)
|
||||
TARGET_SRC += $(HIGHEND_SRC)
|
||||
endif
|
||||
|
||||
TARGET_SRC += $(COMMON_SRC)
|
||||
|
||||
ifneq ($(filter SDCARD,$(FEATURES)),)
|
||||
TARGET_SRC += \
|
||||
drivers/sdcard.c \
|
||||
drivers/sdcard_standard.c \
|
||||
io/asyncfatfs/asyncfatfs.c \
|
||||
io/asyncfatfs/fat_standard.c
|
||||
endif
|
||||
|
||||
ifneq ($(filter VCP,$(FEATURES)),)
|
||||
TARGET_SRC += $(VCP_SRC)
|
||||
endif
|
||||
# end target specific make file checks
|
||||
|
||||
|
||||
# Search path and source files for the ST stdperiph library
|
||||
VPATH := $(VPATH):$(STDPERIPH_DIR)/src
|
||||
|
@ -683,7 +570,7 @@ endif
|
|||
|
||||
DEBUG_FLAGS = -ggdb3 -DDEBUG
|
||||
|
||||
CFLAGS = $(ARCH_FLAGS) \
|
||||
CFLAGS += $(ARCH_FLAGS) \
|
||||
$(LTO_FLAGS) \
|
||||
$(addprefix -D,$(OPTIONS)) \
|
||||
$(addprefix -I,$(INCLUDE_DIRS)) \
|
||||
|
@ -732,61 +619,78 @@ CPPCHECK = cppcheck $(CSOURCES) --enable=all --platform=unix64 \
|
|||
#
|
||||
# Things we will build
|
||||
#
|
||||
ifeq ($(filter $(TARGET),$(VALID_TARGETS)),)
|
||||
$(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS))
|
||||
endif
|
||||
|
||||
TARGET_BIN = $(BIN_DIR)/$(FORKNAME)_$(TARGET).bin
|
||||
TARGET_HEX = $(BIN_DIR)/$(FORKNAME)_$(TARGET).hex
|
||||
TARGET_BIN = $(BIN_DIR)/$(FORKNAME)_$(FC_VER)_$(TARGET).bin
|
||||
TARGET_HEX = $(BIN_DIR)/$(FORKNAME)_$(FC_VER)_$(TARGET).hex
|
||||
TARGET_ELF = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).elf
|
||||
TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $($(TARGET)_SRC))))
|
||||
TARGET_DEPS = $(addsuffix .d,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $($(TARGET)_SRC))))
|
||||
TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $(TARGET_SRC))))
|
||||
TARGET_DEPS = $(addsuffix .d,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $(TARGET_SRC))))
|
||||
TARGET_MAP = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).map
|
||||
|
||||
|
||||
## Default make goal:
|
||||
## hex : Make filetype hex only
|
||||
.DEFAULT_GOAL := hex
|
||||
CLEAN_ARTIFACTS := $(TARGET_BIN)
|
||||
CLEAN_ARTIFACTS += $(TARGET_HEX)
|
||||
CLEAN_ARTIFACTS += $(TARGET_ELF) $(TARGET_OBJS) $(TARGET_MAP)
|
||||
|
||||
ifeq ($(OPBL),yes)
|
||||
ifneq ($(filter $(TARGET),$(OPBL_TARGETS)),)
|
||||
TARGET_FLAGS := -DOPBL $(TARGET_FLAGS)
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_$(FLASH_SIZE)k_opbl.ld
|
||||
.DEFAULT_GOAL := binary
|
||||
else
|
||||
$(error OPBL specified with an unsupported target)
|
||||
endif
|
||||
endif
|
||||
# List of buildable ELF files and their object dependencies.
|
||||
# It would be nice to compute these lists, but that seems to be just beyond make.
|
||||
|
||||
## Optional make goals:
|
||||
## all : Make all filetypes, binary and hex
|
||||
all: hex bin
|
||||
$(TARGET_HEX): $(TARGET_ELF)
|
||||
$(OBJCOPY) -O ihex --set-start 0x8000000 $< $@
|
||||
|
||||
## binary : Make binary filetype
|
||||
## bin : Alias of 'binary'
|
||||
## hex : Make hex filetype
|
||||
bin: $(TARGET_BIN)
|
||||
binary: $(TARGET_BIN)
|
||||
hex: $(TARGET_HEX)
|
||||
$(TARGET_BIN): $(TARGET_ELF)
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
|
||||
# rule to reinvoke make with TARGET= parameter
|
||||
# rules that should be handled in toplevel Makefile, not dependent on TARGET
|
||||
GLOBAL_GOALS = all_targets cppcheck test
|
||||
$(TARGET_ELF): $(TARGET_OBJS)
|
||||
@echo LD $(notdir $@)
|
||||
@$(CC) -o $@ $^ $(LDFLAGS)
|
||||
$(SIZE) $(TARGET_ELF)
|
||||
|
||||
# Compile
|
||||
$(OBJECT_DIR)/$(TARGET)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
@echo %% $(notdir $<)
|
||||
@$(CC) -c -o $@ $(CFLAGS) $<
|
||||
|
||||
# Assemble
|
||||
$(OBJECT_DIR)/$(TARGET)/%.o: %.s
|
||||
@mkdir -p $(dir $@)
|
||||
@echo %% $(notdir $<)
|
||||
@$(CC) -c -o $@ $(ASFLAGS) $<
|
||||
|
||||
$(OBJECT_DIR)/$(TARGET)/%.o: %.S
|
||||
@mkdir -p $(dir $@)
|
||||
@echo %% $(notdir $<)
|
||||
@$(CC) -c -o $@ $(ASFLAGS) $<
|
||||
|
||||
|
||||
## all : Build all valid targets
|
||||
all: $(VALID_TARGETS)
|
||||
|
||||
.PHONY: $(VALID_TARGETS)
|
||||
$(VALID_TARGETS):
|
||||
$(MAKE) TARGET=$@ $(filter-out $(VALID_TARGETS) $(GLOBAL_GOALS), $(MAKECMDGOALS))
|
||||
|
||||
## all_targets : Make all TARGETs
|
||||
.PHONY: all_targets
|
||||
all_targets : $(VALID_TARGETS)
|
||||
echo "" && \
|
||||
echo "Building $@" && \
|
||||
$(MAKE) -j binary hex TARGET=$@ && \
|
||||
echo "Building $@ succeeded."
|
||||
|
||||
## clean : clean up all temporary / machine-generated files
|
||||
clean:
|
||||
rm -f $(TARGET_BIN) $(TARGET_HEX) $(TARGET_ELF) $(TARGET_OBJS) $(TARGET_MAP)
|
||||
rm -f $(CLEAN_ARTIFACTS)
|
||||
rm -rf $(OBJECT_DIR)/$(TARGET)
|
||||
|
||||
## clean_test : clean up all temporary / machine-generated files (tests)
|
||||
clean_test:
|
||||
cd src/test && $(MAKE) clean || true
|
||||
|
||||
## clean_all_targets : clean all valid target platforms
|
||||
clean_all:
|
||||
for clean_target in $(VALID_TARGETS); do \
|
||||
echo "" && \
|
||||
echo "Cleaning $$clean_target" && \
|
||||
$(MAKE) -j TARGET=$$clean_target clean || \
|
||||
break; \
|
||||
echo "Cleaning $$clean_target succeeded."; \
|
||||
done
|
||||
|
||||
flash_$(TARGET): $(TARGET_HEX)
|
||||
stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
|
||||
echo -n 'R' >$(SERIAL_DEVICE)
|
||||
|
@ -801,6 +705,9 @@ st-flash_$(TARGET): $(TARGET_BIN)
|
|||
## st-flash : flash firmware (.bin) onto flight controller
|
||||
st-flash: st-flash_$(TARGET)
|
||||
|
||||
binary: $(TARGET_BIN)
|
||||
hex: $(TARGET_HEX)
|
||||
|
||||
unbrick_$(TARGET): $(TARGET_HEX)
|
||||
stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
|
||||
stm32flash -w $(TARGET_HEX) -v -g 0x0 -b 115200 $(SERIAL_DEVICE)
|
||||
|
@ -822,11 +729,19 @@ help: Makefile
|
|||
@echo ""
|
||||
@echo "Usage:"
|
||||
@echo " make [TARGET=<target>] [OPTIONS=\"<options>\"]"
|
||||
@echo "Or:"
|
||||
@echo " make <target> [OPTIONS=\"<options>\"]"
|
||||
@echo ""
|
||||
@echo "Valid TARGET values are: $(VALID_TARGETS)"
|
||||
@echo ""
|
||||
@sed -n 's/^## //p' $<
|
||||
|
||||
## targets : print a list of all valid target platforms (for consumption by scripts)
|
||||
targets:
|
||||
@echo "Valid targets: $(VALID_TARGETS)"
|
||||
@echo "Target: $(TARGET)"
|
||||
@echo "Base target: $(BASE_TARGET)"
|
||||
|
||||
## test : run the cleanflight test suite
|
||||
test:
|
||||
cd src/test && $(MAKE) test || true
|
||||
|
@ -834,36 +749,5 @@ test:
|
|||
# rebuild everything when makefile changes
|
||||
$(TARGET_OBJS) : Makefile
|
||||
|
||||
# List of buildable ELF files and their object dependencies.
|
||||
# It would be nice to compute these lists, but that seems to be just beyond make.
|
||||
|
||||
$(TARGET_HEX): $(TARGET_ELF)
|
||||
$(OBJCOPY) -O ihex --set-start 0x8000000 $< $@
|
||||
|
||||
$(TARGET_BIN): $(TARGET_ELF)
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
|
||||
$(TARGET_ELF): $(TARGET_OBJS)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
$(SIZE) $(TARGET_ELF)
|
||||
|
||||
# Compile
|
||||
$(OBJECT_DIR)/$(TARGET)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
@echo %% $(notdir $<)
|
||||
@$(CC) -c -o $@ $(CFLAGS) $<
|
||||
|
||||
# Assemble
|
||||
$(OBJECT_DIR)/$(TARGET)/%.o: %.s
|
||||
@mkdir -p $(dir $@)
|
||||
@echo %% $(notdir $<)
|
||||
@$(CC) -c -o $@ $(ASFLAGS) $<
|
||||
|
||||
$(OBJECT_DIR)/$(TARGET)/%.o: %.S
|
||||
@mkdir -p $(dir $@)
|
||||
@echo %% $(notdir $<)
|
||||
@$(CC) -c -o $@ $(ASFLAGS) $<
|
||||
|
||||
|
||||
# include auto-generated dependencies
|
||||
-include $(TARGET_DEPS)
|
||||
|
|
1068
src/main/drivers/sdcard.c
Normal file
1068
src/main/drivers/sdcard.c
Normal file
File diff suppressed because it is too large
Load diff
73
src/main/drivers/sdcard.h
Normal file
73
src/main/drivers/sdcard.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct sdcardMetadata_t {
|
||||
uint8_t manufacturerID;
|
||||
uint16_t oemID;
|
||||
|
||||
char productName[5];
|
||||
|
||||
uint8_t productRevisionMajor;
|
||||
uint8_t productRevisionMinor;
|
||||
uint32_t productSerial;
|
||||
|
||||
uint16_t productionYear;
|
||||
uint8_t productionMonth;
|
||||
|
||||
uint32_t numBlocks; /* Card capacity in 512-byte blocks*/
|
||||
} sdcardMetadata_t;
|
||||
|
||||
typedef enum {
|
||||
SDCARD_BLOCK_OPERATION_READ,
|
||||
SDCARD_BLOCK_OPERATION_WRITE,
|
||||
SDCARD_BLOCK_OPERATION_ERASE,
|
||||
} sdcardBlockOperation_e;
|
||||
|
||||
typedef enum {
|
||||
SDCARD_OPERATION_IN_PROGRESS,
|
||||
SDCARD_OPERATION_BUSY,
|
||||
SDCARD_OPERATION_SUCCESS,
|
||||
SDCARD_OPERATION_FAILURE
|
||||
} sdcardOperationStatus_e;
|
||||
|
||||
typedef void(*sdcard_operationCompleteCallback_c)(sdcardBlockOperation_e operation, uint32_t blockIndex, uint8_t *buffer, uint32_t callbackData);
|
||||
|
||||
typedef void(*sdcard_profilerCallback_c)(sdcardBlockOperation_e operation, uint32_t blockIndex, uint32_t duration);
|
||||
|
||||
void sdcard_init(bool useDMA);
|
||||
|
||||
bool sdcard_readBlock(uint32_t blockIndex, uint8_t *buffer, sdcard_operationCompleteCallback_c callback, uint32_t callbackData);
|
||||
|
||||
sdcardOperationStatus_e sdcard_beginWriteBlocks(uint32_t blockIndex, uint32_t blockCount);
|
||||
sdcardOperationStatus_e sdcard_writeBlock(uint32_t blockIndex, uint8_t *buffer, sdcard_operationCompleteCallback_c callback, uint32_t callbackData);
|
||||
|
||||
void sdcardInsertionDetectDeinit(void);
|
||||
void sdcardInsertionDetectInit(void);
|
||||
|
||||
bool sdcard_isInserted();
|
||||
bool sdcard_isInitialized();
|
||||
bool sdcard_isFunctional();
|
||||
|
||||
bool sdcard_poll();
|
||||
const sdcardMetadata_t* sdcard_getMetadata();
|
||||
|
||||
void sdcard_setProfilerCallback(sdcard_profilerCallback_c callback);
|
35
src/main/drivers/sdcard_standard.c
Normal file
35
src/main/drivers/sdcard_standard.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "sdcard_standard.h"
|
||||
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
/**
|
||||
* Read a bitfield from an array of bits (the bit at index 0 being the most-significant bit of the first byte in
|
||||
* the buffer).
|
||||
*/
|
||||
uint32_t readBitfield(uint8_t *buffer, unsigned bitIndex, unsigned bitLen)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
unsigned bitInByteOffset = bitIndex % 8;
|
||||
uint8_t bufferByte;
|
||||
|
||||
buffer += bitIndex / 8;
|
||||
|
||||
// Align the bitfield to be read to the top of the buffer
|
||||
bufferByte = *buffer << bitInByteOffset;
|
||||
|
||||
while (bitLen > 0) {
|
||||
unsigned bitsThisLoop = MIN(8 - bitInByteOffset, bitLen);
|
||||
|
||||
result = (result << bitsThisLoop) | (bufferByte >> (8 - bitsThisLoop));
|
||||
|
||||
buffer++;
|
||||
bufferByte = *buffer;
|
||||
|
||||
bitLen -= bitsThisLoop;
|
||||
bitInByteOffset = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
240
src/main/drivers/sdcard_standard.h
Normal file
240
src/main/drivers/sdcard_standard.h
Normal file
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct sdcardCSD_t {
|
||||
uint8_t data[16];
|
||||
} sdcardCSD_t;
|
||||
|
||||
#define SDCARD_GET_CSD_FIELD(csd, version, fieldname) \
|
||||
readBitfield(csd.data, SDCARD_CSD_V ## version ## _ ## fieldname ## _OFFSET, SDCARD_CSD_V ## version ## _ ## fieldname ## _LEN)
|
||||
|
||||
// For v1 and Standard Capacity cards
|
||||
#define SDCARD_CSD_V1_CSD_STRUCTURE_VER_OFFSET 0
|
||||
#define SDCARD_CSD_V1_CSD_STRUCTURE_VER_LEN 2
|
||||
|
||||
#define SDCARD_CSD_V1_TAAC_OFFSET 8
|
||||
#define SDCARD_CSD_V1_TAAC_LEN 8
|
||||
|
||||
#define SDCARD_CSD_V1_NSAC_OFFSET 16
|
||||
#define SDCARD_CSD_V1_NSAC_LEN 8
|
||||
|
||||
#define SDCARD_CSD_V1_TRAN_SPEED_OFFSET 24
|
||||
#define SDCARD_CSD_V1_TRAN_SPEED_LEN 8
|
||||
|
||||
#define SDCARD_CSD_V1_CCC_OFFSET 32
|
||||
#define SDCARD_CSD_V1_CCC_LEN 12
|
||||
|
||||
#define SDCARD_CSD_V1_READ_BLOCK_LEN_OFFSET 44
|
||||
#define SDCARD_CSD_V1_READ_BLOCK_LEN_LEN 4
|
||||
|
||||
#define SDCARD_CSD_V1_READ_BLOCK_PARTIAL_ALLOWED_OFFSET 48
|
||||
#define SDCARD_CSD_V1_READ_BLOCK_PARTIAL_ALLOWED_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_WRITE_BLOCK_MISALIGN_OFFSET 49
|
||||
#define SDCARD_CSD_V1_WRITE_BLOCK_MISALIGN_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_READ_BLOCK_MISALIGN_OFFSET 50
|
||||
#define SDCARD_CSD_V1_READ_BLOCK_MISALIGN_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_DSR_IMPLEMENTED_OFFSET 51
|
||||
#define SDCARD_CSD_V1_DSR_IMPLEMENTED_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_CSIZE_OFFSET 54
|
||||
#define SDCARD_CSD_V1_CSIZE_LEN 12
|
||||
|
||||
#define SDCARD_CSD_V1_VDD_READ_CURR_MIN_OFFSET 66
|
||||
#define SDCARD_CSD_V1_VDD_READ_CURR_MIN_LEN 3
|
||||
|
||||
#define SDCARD_CSD_V1_VDD_READ_CURR_MAX_OFFSET 69
|
||||
#define SDCARD_CSD_V1_VDD_READ_CURR_MAX_LEN 3
|
||||
|
||||
#define SDCARD_CSD_V1_VDD_WRITE_CURR_MIN_OFFSET 72
|
||||
#define SDCARD_CSD_V1_VDD_WRITE_CURR_MIN_LEN 3
|
||||
|
||||
#define SDCARD_CSD_V1_VDD_WRITE_CURR_MAX_OFFSET 75
|
||||
#define SDCARD_CSD_V1_VDD_WRITE_CURR_MAX_LEN 3
|
||||
|
||||
#define SDCARD_CSD_V1_CSIZE_MULT_OFFSET 78
|
||||
#define SDCARD_CSD_V1_CSIZE_MULT_LEN 3
|
||||
|
||||
#define SDCARD_CSD_V1_ERASE_SINGLE_BLOCK_ALLOWED_OFFSET 81
|
||||
#define SDCARD_CSD_V1_ERASE_SINGLE_BLOCK_ALLOWED_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_SECTOR_SIZE_OFFSET 82
|
||||
#define SDCARD_CSD_V1_SECTOR_SIZE_LEN 7
|
||||
|
||||
#define SDCARD_CSD_V1_WRITE_PROTECT_GROUP_SIZE_OFFSET 89
|
||||
#define SDCARD_CSD_V1_WRITE_PROTECT_GROUP_SIZE_LEN 7
|
||||
|
||||
#define SDCARD_CSD_V1_WRITE_PROTECT_GROUP_ENABLE_OFFSET 96
|
||||
#define SDCARD_CSD_V1_WRITE_PROTECT_GROUP_ENABLE_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_R2W_FACTOR_OFFSET 99
|
||||
#define SDCARD_CSD_V1_R2W_FACTOR_LEN 3
|
||||
|
||||
#define SDCARD_CSD_V1_WRITE_BLOCK_LEN_OFFSET 102
|
||||
#define SDCARD_CSD_V1_WRITE_BLOCK_LEN_LEN 4
|
||||
|
||||
#define SDCARD_CSD_V1_WRITE_BLOCK_PARTIAL_ALLOWED_OFFSET 106
|
||||
#define SDCARD_CSD_V1_WRITE_BLOCK_PARTIAL_ALLOWED_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_FILE_FORMAT_GROUP_OFFSET 112
|
||||
#define SDCARD_CSD_V1_FILE_FORMAT_GROUP_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_COPY_OFFSET 113
|
||||
#define SDCARD_CSD_V1_COPY_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_PERMANENT_WRITE_PROTECT_OFFSET 114
|
||||
#define SDCARD_CSD_V1_PERMANENT_WRITE_PROTECT_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_TEMPORARY_WRITE_PROTECT_OFFSET 115
|
||||
#define SDCARD_CSD_V1_TEMPORARY_WRITE_PROTECT_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V1_FILE_FORMAT_OFFSET 116
|
||||
#define SDCARD_CSD_V1_FILE_FORMAT_LEN 2
|
||||
|
||||
#define SDCARD_CSD_V1_CRC_OFFSET 120
|
||||
#define SDCARD_CSD_V1_CRC_LEN 7
|
||||
|
||||
#define SDCARD_CSD_V1_TRAILER_OFFSET 127
|
||||
#define SDCARD_CSD_V1_TRAILER_LEN 1
|
||||
|
||||
// For v2 High Capacity cards
|
||||
#define SDCARD_CSD_V2_CSD_STRUCTURE_VER_OFFSET 0
|
||||
#define SDCARD_CSD_V2_CSD_STRUCTURE_VER_LEN 2
|
||||
|
||||
#define SDCARD_CSD_V2_TAAC_OFFSET 8
|
||||
#define SDCARD_CSD_V2_TAAC_LEN 8
|
||||
|
||||
#define SDCARD_CSD_V2_NSAC_OFFSET 16
|
||||
#define SDCARD_CSD_V2_NSAC_LEN 8
|
||||
|
||||
#define SDCARD_CSD_V2_TRAN_SPEED_OFFSET 24
|
||||
#define SDCARD_CSD_V2_TRAN_SPEED_LEN 8
|
||||
|
||||
#define SDCARD_CSD_V2_CCC_OFFSET 32
|
||||
#define SDCARD_CSD_V2_CCC_LEN 12
|
||||
|
||||
#define SDCARD_CSD_V2_READ_BLOCK_LEN_OFFSET 44
|
||||
#define SDCARD_CSD_V2_READ_BLOCK_LEN_LEN 4
|
||||
|
||||
#define SDCARD_CSD_V2_READ_BLOCK_PARTIAL_ALLOWED_OFFSET 48
|
||||
#define SDCARD_CSD_V2_READ_BLOCK_PARTIAL_ALLOWED_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_WRITE_BLOCK_MISALIGN_OFFSET 49
|
||||
#define SDCARD_CSD_V2_WRITE_BLOCK_MISALIGN_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_READ_BLOCK_MISALIGN_OFFSET 50
|
||||
#define SDCARD_CSD_V2_READ_BLOCK_MISALIGN_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_DSR_IMPLEMENTED_OFFSET 51
|
||||
#define SDCARD_CSD_V2_DSR_IMPLEMENTED_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_CSIZE_OFFSET 58
|
||||
#define SDCARD_CSD_V2_CSIZE_LEN 22
|
||||
|
||||
#define SDCARD_CSD_V2_ERASE_SINGLE_BLOCK_ALLOWED_OFFSET 81
|
||||
#define SDCARD_CSD_V2_ERASE_SINGLE_BLOCK_ALLOWED_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_SECTOR_SIZE_OFFSET 82
|
||||
#define SDCARD_CSD_V2_SECTOR_SIZE_LEN 7
|
||||
|
||||
#define SDCARD_CSD_V2_WRITE_PROTECT_GROUP_SIZE_OFFSET 89
|
||||
#define SDCARD_CSD_V2_WRITE_PROTECT_GROUP_SIZE_LEN 7
|
||||
|
||||
#define SDCARD_CSD_V2_WRITE_PROTECT_GROUP_ENABLE_OFFSET 96
|
||||
#define SDCARD_CSD_V2_WRITE_PROTECT_GROUP_ENABLE_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_R2W_FACTOR_OFFSET 99
|
||||
#define SDCARD_CSD_V2_R2W_FACTOR_LEN 3
|
||||
|
||||
#define SDCARD_CSD_V2_WRITE_BLOCK_LEN_OFFSET 102
|
||||
#define SDCARD_CSD_V2_WRITE_BLOCK_LEN_LEN 4
|
||||
|
||||
#define SDCARD_CSD_V2_WRITE_BLOCK_PARTIAL_ALLOWED_OFFSET 106
|
||||
#define SDCARD_CSD_V2_WRITE_BLOCK_PARTIAL_ALLOWED_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_FILE_FORMAT_GROUP_OFFSET 112
|
||||
#define SDCARD_CSD_V2_FILE_FORMAT_GROUP_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_COPY_OFFSET 113
|
||||
#define SDCARD_CSD_V2_COPY_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_PERMANENT_WRITE_PROTECT_OFFSET 114
|
||||
#define SDCARD_CSD_V2_PERMANENT_WRITE_PROTECT_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_TEMPORARY_WRITE_PROTECT_OFFSET 115
|
||||
#define SDCARD_CSD_V2_TEMPORARY_WRITE_PROTECT_LEN 1
|
||||
|
||||
#define SDCARD_CSD_V2_FILE_FORMAT_OFFSET 116
|
||||
#define SDCARD_CSD_V2_FILE_FORMAT_LEN 2
|
||||
|
||||
#define SDCARD_CSD_V2_CRC_OFFSET 120
|
||||
#define SDCARD_CSD_V2_CRC_LEN 7
|
||||
|
||||
#define SDCARD_CSD_V2_TRAILER_OFFSET 127
|
||||
#define SDCARD_CSD_V2_TRAILER_LEN 1
|
||||
|
||||
#define SDCARD_SINGLE_BLOCK_READ_START_TOKEN 0xFE
|
||||
#define SDCARD_SINGLE_BLOCK_WRITE_START_TOKEN 0xFE
|
||||
#define SDCARD_MULTIPLE_BLOCK_WRITE_START_TOKEN 0xFC
|
||||
#define SDCARD_MULTIPLE_BLOCK_WRITE_STOP_TOKEN 0xFD
|
||||
|
||||
#define SDCARD_BLOCK_SIZE 512
|
||||
|
||||
// Idle bit is set to 1 only when idle during intialization phase:
|
||||
#define SDCARD_R1_STATUS_BIT_IDLE 1
|
||||
#define SDCARD_R1_STATUS_BIT_ERASE_RESET 2
|
||||
#define SDCARD_R1_STATUS_BIT_ILLEGAL_COMMAND 4
|
||||
#define SDCARD_R1_STATUS_BIT_COM_CRC_ERROR 8
|
||||
#define SDCARD_R1_STATUS_BIT_ERASE_SEQUENCE_ERROR 16
|
||||
#define SDCARD_R1_STATUS_BIT_ADDRESS_ERROR 32
|
||||
#define SDCARD_R1_STATUS_BIT_PARAMETER_ERROR 64
|
||||
|
||||
#define SDCARD_CSD_STRUCTURE_VERSION_1 0
|
||||
#define SDCARD_CSD_STRUCTURE_VERSION_2 1
|
||||
|
||||
#define SDCARD_VOLTAGE_ACCEPTED_2_7_to_3_6 0x01
|
||||
#define SDCARD_VOLTAGE_ACCEPTED_LVR 0x02
|
||||
|
||||
#define SDCARD_COMMAND_GO_IDLE_STATE 0
|
||||
#define SDCARD_COMMAND_SEND_OP_COND 1
|
||||
#define SDCARD_COMMAND_SEND_IF_COND 8
|
||||
#define SDCARD_COMMAND_SEND_CSD 9
|
||||
#define SDCARD_COMMAND_SEND_CID 10
|
||||
#define SDCARD_COMMAND_STOP_TRANSMISSION 12
|
||||
#define SDCARD_COMMAND_SEND_STATUS 13
|
||||
#define SDCARD_COMMAND_SET_BLOCKLEN 16
|
||||
#define SDCARD_COMMAND_READ_SINGLE_BLOCK 17
|
||||
#define SDCARD_COMMAND_READ_MULTIPLE_BLOCK 18
|
||||
#define SDCARD_COMMAND_WRITE_BLOCK 24
|
||||
#define SDCARD_COMMAND_WRITE_MULTIPLE_BLOCK 25
|
||||
#define SDCARD_COMMAND_APP_CMD 55
|
||||
#define SDCARD_COMMAND_READ_OCR 58
|
||||
|
||||
#define SDCARD_ACOMMAND_SEND_OP_COND 41
|
||||
#define SDCARD_ACOMMAND_SET_WR_BLOCK_ERASE_COUNT 23
|
||||
|
||||
// These are worst-case timeouts defined for High Speed cards
|
||||
#define SDCARD_TIMEOUT_READ_MSEC 100
|
||||
#define SDCARD_TIMEOUT_WRITE_MSEC 250
|
||||
|
||||
uint32_t readBitfield(uint8_t *buffer, unsigned bitIndex, unsigned bitLen);
|
3660
src/main/io/asyncfatfs/asyncfatfs.c
Normal file
3660
src/main/io/asyncfatfs/asyncfatfs.c
Normal file
File diff suppressed because it is too large
Load diff
92
src/main/io/asyncfatfs/asyncfatfs.h
Normal file
92
src/main/io/asyncfatfs/asyncfatfs.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "fat_standard.h"
|
||||
|
||||
typedef struct afatfsFile_t *afatfsFilePtr_t;
|
||||
|
||||
typedef enum {
|
||||
AFATFS_FILESYSTEM_STATE_UNKNOWN,
|
||||
AFATFS_FILESYSTEM_STATE_FATAL,
|
||||
AFATFS_FILESYSTEM_STATE_INITIALIZATION,
|
||||
AFATFS_FILESYSTEM_STATE_READY,
|
||||
} afatfsFilesystemState_e;
|
||||
|
||||
typedef enum {
|
||||
AFATFS_OPERATION_IN_PROGRESS,
|
||||
AFATFS_OPERATION_SUCCESS,
|
||||
AFATFS_OPERATION_FAILURE,
|
||||
} afatfsOperationStatus_e;
|
||||
|
||||
typedef enum {
|
||||
AFATFS_ERROR_NONE = 0,
|
||||
AFATFS_ERROR_GENERIC = 1,
|
||||
AFATFS_ERROR_BAD_MBR = 2,
|
||||
AFATFS_ERROR_BAD_FILESYSTEM_HEADER = 3
|
||||
} afatfsError_e;
|
||||
|
||||
typedef struct afatfsDirEntryPointer_t {
|
||||
uint32_t sectorNumberPhysical;
|
||||
int16_t entryIndex;
|
||||
} afatfsDirEntryPointer_t;
|
||||
|
||||
typedef afatfsDirEntryPointer_t afatfsFinder_t;
|
||||
|
||||
typedef enum {
|
||||
AFATFS_SEEK_SET,
|
||||
AFATFS_SEEK_CUR,
|
||||
AFATFS_SEEK_END,
|
||||
} afatfsSeek_e;
|
||||
|
||||
typedef void (*afatfsFileCallback_t)(afatfsFilePtr_t file);
|
||||
typedef void (*afatfsCallback_t)();
|
||||
|
||||
bool afatfs_fopen(const char *filename, const char *mode, afatfsFileCallback_t complete);
|
||||
bool afatfs_ftruncate(afatfsFilePtr_t file, afatfsFileCallback_t callback);
|
||||
bool afatfs_fclose(afatfsFilePtr_t file, afatfsCallback_t callback);
|
||||
bool afatfs_funlink(afatfsFilePtr_t file, afatfsCallback_t callback);
|
||||
|
||||
bool afatfs_feof(afatfsFilePtr_t file);
|
||||
void afatfs_fputc(afatfsFilePtr_t file, uint8_t c);
|
||||
uint32_t afatfs_fwrite(afatfsFilePtr_t file, const uint8_t *buffer, uint32_t len);
|
||||
uint32_t afatfs_fread(afatfsFilePtr_t file, uint8_t *buffer, uint32_t len);
|
||||
afatfsOperationStatus_e afatfs_fseek(afatfsFilePtr_t file, int32_t offset, afatfsSeek_e whence);
|
||||
bool afatfs_ftell(afatfsFilePtr_t file, uint32_t *position);
|
||||
|
||||
bool afatfs_mkdir(const char *filename, afatfsFileCallback_t complete);
|
||||
bool afatfs_chdir(afatfsFilePtr_t dirHandle);
|
||||
|
||||
void afatfs_findFirst(afatfsFilePtr_t directory, afatfsFinder_t *finder);
|
||||
afatfsOperationStatus_e afatfs_findNext(afatfsFilePtr_t directory, afatfsFinder_t *finder, fatDirectoryEntry_t **dirEntry);
|
||||
void afatfs_findLast(afatfsFilePtr_t directory);
|
||||
|
||||
bool afatfs_flush();
|
||||
void afatfs_init();
|
||||
bool afatfs_destroy(bool dirty);
|
||||
void afatfs_poll();
|
||||
|
||||
uint32_t afatfs_getFreeBufferSpace();
|
||||
uint32_t afatfs_getContiguousFreeSpace();
|
||||
bool afatfs_isFull();
|
||||
|
||||
afatfsFilesystemState_e afatfs_getFilesystemState();
|
||||
afatfsError_e afatfs_getLastError();
|
89
src/main/io/asyncfatfs/fat_standard.c
Normal file
89
src/main/io/asyncfatfs/fat_standard.c
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "fat_standard.h"
|
||||
|
||||
bool fat16_isEndOfChainMarker(uint16_t clusterNumber)
|
||||
{
|
||||
return clusterNumber >= 0xFFF8;
|
||||
}
|
||||
|
||||
// Pass the cluster number after fat32_decodeClusterNumber().
|
||||
bool fat32_isEndOfChainMarker(uint32_t clusterNumber)
|
||||
{
|
||||
return clusterNumber >= 0x0FFFFFF8;
|
||||
}
|
||||
|
||||
/**
|
||||
* FAT32 cluster numbers are really only 28 bits, and the top 4 bits must be left alone and not treated as part of the
|
||||
* cluster number (so various FAT drivers can use those bits for their own purposes, or they can be used in later
|
||||
* extensions)
|
||||
*/
|
||||
uint32_t fat32_decodeClusterNumber(uint32_t clusterNumber)
|
||||
{
|
||||
return clusterNumber & 0x0FFFFFFF;
|
||||
}
|
||||
|
||||
// fat32 needs fat32_decodeClusterNumber() applied first.
|
||||
bool fat_isFreeSpace(uint32_t clusterNumber)
|
||||
{
|
||||
return clusterNumber == 0;
|
||||
}
|
||||
|
||||
bool fat_isDirectoryEntryTerminator(fatDirectoryEntry_t *entry)
|
||||
{
|
||||
return entry->filename[0] == 0x00;
|
||||
}
|
||||
|
||||
bool fat_isDirectoryEntryEmpty(fatDirectoryEntry_t *entry)
|
||||
{
|
||||
return (unsigned char) entry->filename[0] == FAT_DELETED_FILE_MARKER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given "prefix.ext" style filename to the FAT format to be stored on disk.
|
||||
*
|
||||
* fatFilename must point to a buffer which is FAT_FILENAME_LENGTH bytes long. The buffer is not null-terminated.
|
||||
*/
|
||||
void fat_convertFilenameToFATStyle(const char *filename, uint8_t *fatFilename)
|
||||
{
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (*filename == '\0' || *filename == '.') {
|
||||
*fatFilename = ' ';
|
||||
} else {
|
||||
*fatFilename = toupper((unsigned char)*filename);
|
||||
filename++;
|
||||
}
|
||||
fatFilename++;
|
||||
}
|
||||
|
||||
if (*filename == '.') {
|
||||
filename++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (*filename == '\0') {
|
||||
*fatFilename = ' ';
|
||||
} else {
|
||||
*fatFilename = toupper((unsigned char)*filename);
|
||||
filename++;
|
||||
}
|
||||
fatFilename++;
|
||||
}
|
||||
}
|
140
src/main/io/asyncfatfs/fat_standard.h
Normal file
140
src/main/io/asyncfatfs/fat_standard.h
Normal file
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define MBR_PARTITION_TYPE_FAT16 0x06
|
||||
#define MBR_PARTITION_TYPE_FAT32 0x0B
|
||||
#define MBR_PARTITION_TYPE_FAT32_LBA 0x0C
|
||||
#define MBR_PARTITION_TYPE_FAT16_LBA 0x0E
|
||||
|
||||
// Signature bytes found at index 510 and 511 in the volume ID sector
|
||||
#define FAT_VOLUME_ID_SIGNATURE_1 0x55
|
||||
#define FAT_VOLUME_ID_SIGNATURE_2 0xAA
|
||||
|
||||
#define FAT_DIRECTORY_ENTRY_SIZE 32
|
||||
#define FAT_SMALLEST_LEGAL_CLUSTER_NUMBER 2
|
||||
|
||||
#define FAT_MAXIMUM_FILESIZE 0xFFFFFFFF
|
||||
|
||||
#define FAT12_MAX_CLUSTERS 4084
|
||||
#define FAT16_MAX_CLUSTERS 65524
|
||||
|
||||
#define FAT_FILE_ATTRIBUTE_READ_ONLY 0x01
|
||||
#define FAT_FILE_ATTRIBUTE_HIDDEN 0x02
|
||||
#define FAT_FILE_ATTRIBUTE_SYSTEM 0x04
|
||||
#define FAT_FILE_ATTRIBUTE_VOLUME_ID 0x08
|
||||
#define FAT_FILE_ATTRIBUTE_DIRECTORY 0x10
|
||||
#define FAT_FILE_ATTRIBUTE_ARCHIVE 0x20
|
||||
|
||||
#define FAT_FILENAME_LENGTH 11
|
||||
#define FAT_DELETED_FILE_MARKER 0xE5
|
||||
|
||||
#define FAT_MAKE_DATE(year, month, day) (day | (month << 5) | ((year - 1980) << 9))
|
||||
#define FAT_MAKE_TIME(hour, minute, second) ((second / 2) | (minute << 5) | (hour << 11))
|
||||
|
||||
typedef enum {
|
||||
FAT_FILESYSTEM_TYPE_INVALID,
|
||||
FAT_FILESYSTEM_TYPE_FAT12,
|
||||
FAT_FILESYSTEM_TYPE_FAT16,
|
||||
FAT_FILESYSTEM_TYPE_FAT32,
|
||||
} fatFilesystemType_e;
|
||||
|
||||
typedef struct mbrPartitionEntry_t {
|
||||
uint8_t bootFlag;
|
||||
uint8_t chsBegin[3];
|
||||
uint8_t type;
|
||||
uint8_t chsEnd[3];
|
||||
uint32_t lbaBegin;
|
||||
uint32_t numSectors;
|
||||
} __attribute__((packed)) mbrPartitionEntry_t;
|
||||
|
||||
typedef struct fat16Descriptor_t {
|
||||
uint8_t driveNumber;
|
||||
uint8_t reserved1;
|
||||
uint8_t bootSignature;
|
||||
uint32_t volumeID;
|
||||
char volumeLabel[11];
|
||||
char fileSystemType[8];
|
||||
} __attribute__((packed)) fat16Descriptor_t;
|
||||
|
||||
typedef struct fat32Descriptor_t {
|
||||
uint32_t FATSize32;
|
||||
uint16_t extFlags;
|
||||
uint16_t fsVer;
|
||||
uint32_t rootCluster;
|
||||
uint16_t fsInfo;
|
||||
uint16_t backupBootSector;
|
||||
uint8_t reserved[12];
|
||||
uint8_t driveNumber;
|
||||
uint8_t reserved1;
|
||||
uint8_t bootSignature;
|
||||
uint32_t volumeID;
|
||||
char volumeLabel[11];
|
||||
char fileSystemType[8];
|
||||
} __attribute__((packed)) fat32Descriptor_t;
|
||||
|
||||
typedef struct fatVolumeID_t {
|
||||
uint8_t jmpBoot[3];
|
||||
char oemName[8];
|
||||
uint16_t bytesPerSector;
|
||||
uint8_t sectorsPerCluster;
|
||||
uint16_t reservedSectorCount;
|
||||
uint8_t numFATs;
|
||||
uint16_t rootEntryCount;
|
||||
uint16_t totalSectors16;
|
||||
uint8_t media;
|
||||
uint16_t FATSize16;
|
||||
uint16_t sectorsPerTrack;
|
||||
uint16_t numHeads;
|
||||
uint32_t hiddenSectors;
|
||||
uint32_t totalSectors32;
|
||||
union {
|
||||
fat16Descriptor_t fat16;
|
||||
fat32Descriptor_t fat32;
|
||||
} fatDescriptor;
|
||||
} __attribute__((packed)) fatVolumeID_t;
|
||||
|
||||
typedef struct fatDirectoryEntry_t {
|
||||
char filename[FAT_FILENAME_LENGTH];
|
||||
uint8_t attrib;
|
||||
uint8_t ntReserved;
|
||||
uint8_t creationTimeTenths;
|
||||
uint16_t creationTime;
|
||||
uint16_t creationDate;
|
||||
uint16_t lastAccessDate;
|
||||
uint16_t firstClusterHigh;
|
||||
uint16_t lastWriteTime;
|
||||
uint16_t lastWriteDate;
|
||||
uint16_t firstClusterLow;
|
||||
uint32_t fileSize;
|
||||
} __attribute__((packed)) fatDirectoryEntry_t;
|
||||
|
||||
uint32_t fat32_decodeClusterNumber(uint32_t clusterNumber);
|
||||
|
||||
bool fat32_isEndOfChainMarker(uint32_t clusterNumber);
|
||||
bool fat16_isEndOfChainMarker(uint16_t clusterNumber);
|
||||
|
||||
bool fat_isFreeSpace(uint32_t clusterNumber);
|
||||
|
||||
bool fat_isDirectoryEntryTerminator(fatDirectoryEntry_t *entry);
|
||||
bool fat_isDirectoryEntryEmpty(fatDirectoryEntry_t *entry);
|
||||
|
||||
void fat_convertFilenameToFATStyle(const char *filename, uint8_t *fatFilename);
|
|
@ -99,6 +99,24 @@
|
|||
#define I2C2_SDA_PIN_SOURCE GPIO_PinSource10
|
||||
#define I2C2_SDA_CLK_SOURCE RCC_AHBPeriph_GPIOA
|
||||
|
||||
// SPI3
|
||||
// PA15 38 SPI3_NSS
|
||||
// PB3 39 SPI3_SCK
|
||||
// PB4 40 SPI3_MISO
|
||||
// PB5 41 SPI3_MOSI
|
||||
|
||||
#define USE_SPI
|
||||
#define USE_SPI_DEVICE_3
|
||||
|
||||
#define M25P16_CS_GPIO GPIOA
|
||||
#define M25P16_CS_PIN GPIO_Pin_15
|
||||
#define M25P16_SPI_INSTANCE SPI3
|
||||
|
||||
#define MPU6500_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOA
|
||||
#define MPU6500_CS_GPIO GPIOA
|
||||
#define MPU6500_CS_PIN GPIO_Pin_15
|
||||
#define MPU6500_SPI_INSTANCE SPI3
|
||||
|
||||
#define USE_ADC
|
||||
|
||||
#define ADC_INSTANCE ADC2
|
||||
|
|
16
src/main/target/ALIENFLIGHTF3/target.mk
Normal file
16
src/main/target/ALIENFLIGHTF3/target.mk
Normal file
|
@ -0,0 +1,16 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/serial_usb_vcp.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c
|
||||
|
0
src/main/target/CC3D/CC3D_OPBL.mk
Normal file
0
src/main/target/CC3D/CC3D_OPBL.mk
Normal file
0
src/main/target/CC3D/CC3D_PPM1.mk
Normal file
0
src/main/target/CC3D/CC3D_PPM1.mk
Normal file
19
src/main/target/CC3D/target.mk
Normal file
19
src/main/target/CC3D/target.mk
Normal file
|
@ -0,0 +1,19 @@
|
|||
F1_TARGETS += $(TARGET)
|
||||
FEATURES = ONBOARDFLASH HIGHEND VCP
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_spi_mpu6000.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
io/flashfs.c
|
||||
|
20
src/main/target/CHEBUZZF3/target.mk
Normal file
20
src/main/target/CHEBUZZF3/target.mk
Normal file
|
@ -0,0 +1,20 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP SDCARD
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_adxl345.c \
|
||||
drivers/accgyro_bma280.c \
|
||||
drivers/accgyro_mma845x.c \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu3050.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_l3g4200d.c \
|
||||
drivers/accgyro_l3gd20.c \
|
||||
drivers/accgyro_lsm303dlhc.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/light_ws2811strip.c
|
||||
|
11
src/main/target/CJMCU/target.mk
Normal file
11
src/main/target/CJMCU/target.mk
Normal file
|
@ -0,0 +1,11 @@
|
|||
F1_TARGETS += $(TARGET)
|
||||
FLASH_SIZE = 64
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
hardware_revision.c \
|
||||
blackbox/blackbox.c \
|
||||
blackbox/blackbox_io.c
|
||||
|
|
@ -45,6 +45,10 @@
|
|||
#define MPU6500_CS_PIN GPIO_Pin_4
|
||||
#define MPU6500_SPI_INSTANCE SPI1
|
||||
|
||||
#define MPU6000_CS_GPIO GPIOA
|
||||
#define MPU6000_CS_PIN GPIO_Pin_4
|
||||
#define MPU6000_SPI_INSTANCE SPI1
|
||||
|
||||
#define USE_SPI
|
||||
#define USE_SPI_DEVICE_1
|
||||
|
||||
|
|
15
src/main/target/COLIBRI_RACE/target.mk
Normal file
15
src/main/target/COLIBRI_RACE/target.mk
Normal file
|
@ -0,0 +1,15 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6500.c \
|
||||
drivers/accgyro_spi_mpu6000.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f30x.c
|
||||
|
27
src/main/target/EUSTM32F103RC/target.mk
Normal file
27
src/main/target/EUSTM32F103RC/target.mk
Normal file
|
@ -0,0 +1,27 @@
|
|||
F1_TARGETS += $(TARGET)
|
||||
FEATURES = ONBOARDFLASH HIGHEND
|
||||
|
||||
DEVICE_FLAGS = -DSTM32F10X_HD
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_adxl345.c \
|
||||
drivers/accgyro_bma280.c \
|
||||
drivers/accgyro_l3g4200d.c \
|
||||
drivers/accgyro_mma845x.c \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu3050.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_spi_mpu6000.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c
|
||||
|
11
src/main/target/LUX_RACE/target.mk
Normal file
11
src/main/target/LUX_RACE/target.mk
Normal file
|
@ -0,0 +1,11 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6500.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f30x.c \
|
||||
drivers/serial_usb_vcp.c \
|
||||
|
|
@ -106,6 +106,10 @@
|
|||
#define M25P16_CS_PIN GPIO_Pin_12
|
||||
#define M25P16_SPI_INSTANCE SPI2
|
||||
|
||||
#define MPU6000_CS_GPIO GPIOB
|
||||
#define MPU6000_CS_PIN GPIO_Pin_12
|
||||
#define MPU6000_SPI_INSTANCE SPI2
|
||||
|
||||
//#define SENSORS_SET (SENSOR_ACC | SENSOR_BARO | SENSOR_GPS | SENSOR_MAG)
|
||||
#define SENSORS_SET (SENSOR_ACC)
|
||||
|
||||
|
|
15
src/main/target/MOTOLAB/target.mk
Normal file
15
src/main/target/MOTOLAB/target.mk
Normal file
|
@ -0,0 +1,15 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP ONBOARDFLASH
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_spi_mpu6000.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f30x.c \
|
||||
drivers/serial_softserial.c
|
||||
|
0
src/main/target/NAZE/ALIENFLIGHTF1.mk
Normal file
0
src/main/target/NAZE/ALIENFLIGHTF1.mk
Normal file
27
src/main/target/NAZE/target.mk
Normal file
27
src/main/target/NAZE/target.mk
Normal file
|
@ -0,0 +1,27 @@
|
|||
F1_TARGETS += $(TARGET)
|
||||
FEATURES = ONBOARDFLASH HIGHEND
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_adxl345.c \
|
||||
drivers/accgyro_bma280.c \
|
||||
drivers/accgyro_l3g4200d.c \
|
||||
drivers/accgyro_mma845x.c \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu3050.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_mpu6500.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c \
|
||||
io/flashfs.c \
|
||||
hardware_revision.c
|
||||
|
16
src/main/target/OLIMEXINO/target.mk
Normal file
16
src/main/target/OLIMEXINO/target.mk
Normal file
|
@ -0,0 +1,16 @@
|
|||
F1_TARGETS += $(TARGET)
|
||||
FEATURES = HIGHEND
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c
|
||||
|
27
src/main/target/PORT103R/target.mk
Normal file
27
src/main/target/PORT103R/target.mk
Normal file
|
@ -0,0 +1,27 @@
|
|||
F1_TARGETS += $(TARGET)
|
||||
FEATURES = ONBOARDFLASH HIGHEND
|
||||
|
||||
DEVICE_FLAGS = -DSTM32F10X_HD
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_adxl345.c \
|
||||
drivers/accgyro_bma280.c \
|
||||
drivers/accgyro_l3g4200d.c \
|
||||
drivers/accgyro_mma845x.c \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu3050.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_spi_mpu6000.c \
|
||||
drivers/accgyro_spi_mpu6500.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c
|
||||
|
20
src/main/target/RMDO/target.mk
Normal file
20
src/main/target/RMDO/target.mk
Normal file
|
@ -0,0 +1,20 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP ONBOARDFLASH
|
||||
TARGET_FLAGS = -DSPRACINGF3
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/flash_m25p16.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f30x.c \
|
||||
drivers/serial_softserial.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c
|
||||
|
17
src/main/target/SPARKY/target.mk
Normal file
17
src/main/target/SPARKY/target.mk
Normal file
|
@ -0,0 +1,17 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f30x.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c
|
||||
|
18
src/main/target/SPRACINGF3/target.mk
Normal file
18
src/main/target/SPRACINGF3/target.mk
Normal file
|
@ -0,0 +1,18 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP ONBOARDFLASH
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/barometer_bmp085.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f30x.c \
|
||||
drivers/serial_softserial.c \
|
||||
drivers/sonar_hcsr04.c \
|
||||
drivers/sonar_srf10.c
|
||||
|
20
src/main/target/STM32F3DISCOVERY/target.mk
Normal file
20
src/main/target/STM32F3DISCOVERY/target.mk
Normal file
|
@ -0,0 +1,20 @@
|
|||
F3_TARGETS += $(TARGET)
|
||||
FEATURES = VCP SDCARD
|
||||
|
||||
TARGET_SRC = \
|
||||
drivers/accgyro_adxl345.c \
|
||||
drivers/accgyro_bma280.c \
|
||||
drivers/accgyro_l3gd20.c \
|
||||
drivers/accgyro_lsm303dlhc.c \
|
||||
drivers/accgyro_mma845x.c \
|
||||
drivers/accgyro_mpu.c \
|
||||
drivers/accgyro_mpu3050.c \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/accgyro_l3g4200d.c \
|
||||
drivers/barometer_bmp280.c \
|
||||
drivers/barometer_ms5611.c \
|
||||
drivers/compass_ak8975.c \
|
||||
drivers/compass_hmc5883l.c \
|
||||
drivers/compass_mag3110.c \
|
||||
drivers/light_ws2811strip.c
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue