2018-12-15 21:55:03 -08:00
|
|
|
|
2024-01-15 16:25:02 -08:00
|
|
|
CHIBIOS_FILE=$(CHIBIOS)/os/readme.txt
|
|
|
|
ifeq ("$(wildcard $(CHIBIOS_FILE))","")
|
|
|
|
$(info $(CHIBIOS_FILE) not found. Chibios: Invoking "git submodule update --init")
|
2021-07-05 07:57:40 -07:00
|
|
|
$(shell git submodule update --init)
|
|
|
|
$(info Invoked "git submodule update --init")
|
|
|
|
# make is not happy about newly checked out module for some reason but next invocation would work
|
|
|
|
$(error Please run 'make' again. Please make sure you have 'git' command in PATH)
|
|
|
|
endif
|
|
|
|
|
2022-07-26 23:49:01 -07:00
|
|
|
CHIBIOS_CONTRIB_FILE=$(CHIBIOS_CONTRIB)/os/hal/hal.mk
|
|
|
|
ifeq ("$(wildcard $(CHIBIOS_CONTRIB_FILE))","")
|
|
|
|
$(info $(CHIBIOS_CONTRIB_FILE) not found. Contrib: Invoking "git submodule update --init")
|
2018-12-22 20:24:57 -08:00
|
|
|
$(shell git submodule update --init)
|
|
|
|
$(info Invoked "git submodule update --init")
|
|
|
|
# make is not happy about newly checked out module for some reason but next invocation would work
|
2019-07-13 11:22:59 -07:00
|
|
|
$(error Please run 'make' again. Please make sure you have 'git' command in PATH)
|
2018-12-15 21:55:03 -08:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(PROJECT_BOARD),)
|
2024-02-15 13:01:03 -08:00
|
|
|
ifneq ($(SHORT_BOARD_NAME),)
|
|
|
|
PROJECT_BOARD = $(SHORT_BOARD_NAME)
|
|
|
|
else
|
2022-01-31 20:17:13 -08:00
|
|
|
PROJECT_BOARD = f407-discovery
|
2018-12-15 21:55:03 -08:00
|
|
|
endif
|
2024-02-15 13:01:03 -08:00
|
|
|
endif
|
2018-12-15 21:55:03 -08:00
|
|
|
|
2023-02-01 11:41:27 -08:00
|
|
|
BOARDS_DIR = $(PROJECT_DIR)/config/boards
|
|
|
|
|
2024-03-16 17:46:25 -07:00
|
|
|
ifneq ($(META_OUTPUT_ROOT_FOLDER),)
|
2024-03-18 18:19:14 -07:00
|
|
|
ALLINC += $(PROJECT_DIR)/$(META_OUTPUT_ROOT_FOLDER)controllers/generated
|
2024-03-16 17:46:25 -07:00
|
|
|
endif
|
|
|
|
|
2023-02-01 11:41:27 -08:00
|
|
|
# allow passing a custom board dir, otherwise generate it based on the board name
|
|
|
|
ifeq ($(BOARD_DIR),)
|
|
|
|
BOARD_DIR = $(BOARDS_DIR)/$(PROJECT_BOARD)
|
2024-02-12 08:01:16 -08:00
|
|
|
-include $(BOARD_DIR)/meta-info.env
|
2023-02-01 11:41:27 -08:00
|
|
|
endif
|
|
|
|
|
2023-05-23 14:45:18 -07:00
|
|
|
ifeq ($(PROJECT_CPU),)
|
2023-05-23 14:58:47 -07:00
|
|
|
# while building PROJECT_CPU is provided as 'make' command line argument value and we do not seem to be able to change that value
|
|
|
|
# looks like 'make clean' is the only consumer of this value?!
|
|
|
|
PROJECT_CPU = ARCH_STM32F4
|
2023-05-23 14:45:18 -07:00
|
|
|
endif
|
|
|
|
|
2023-02-01 11:41:27 -08:00
|
|
|
-include $(BOARD_DIR)/config.mk
|
2019-03-29 07:29:01 -07:00
|
|
|
|
2023-02-01 11:41:27 -08:00
|
|
|
PIN_NAMES_FILE=$(BOARD_DIR)/connectors/generated_ts_name_by_pin.cpp
|
2022-02-03 11:27:47 -08:00
|
|
|
|
|
|
|
ifneq ("$(wildcard $(PIN_NAMES_FILE))","")
|
|
|
|
$(info found $(PIN_NAMES_FILE) )
|
|
|
|
ALLCPPSRC += $(PIN_NAMES_FILE)
|
|
|
|
endif
|
|
|
|
|
2018-12-15 21:55:03 -08:00
|
|
|
# CPU-dependent defs
|
2019-04-09 15:37:25 -07:00
|
|
|
ifeq ($(PROJECT_CPU),ARCH_STM32F7)
|
2023-07-05 06:09:08 -07:00
|
|
|
CPU_STARTUP = startup_stm32f7xx.mk
|
|
|
|
# next file is included through Contrib's platform.ml
|
|
|
|
#CPU_PLATFORM = $(CHIBIOS)/os/hal/ports/STM32/STM32F7xx/platform.mk
|
|
|
|
CPU_PLATFORM = ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/STM32F7xx/platform.mk
|
|
|
|
CPU_HWLAYER = ports/stm32/stm32f7
|
2021-02-05 17:00:44 -08:00
|
|
|
else ifeq ($(PROJECT_CPU),ARCH_STM32F4)
|
2023-07-05 06:09:08 -07:00
|
|
|
CPU_STARTUP = startup_stm32f4xx.mk
|
|
|
|
# next file is included through Contrib's platform.ml
|
|
|
|
#CPU_PLATFORM = $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
|
|
|
|
CPU_PLATFORM = ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/STM32F4xx/platform.mk
|
|
|
|
CPU_HWLAYER = ports/stm32/stm32f4
|
2021-02-05 17:14:29 -08:00
|
|
|
else ifeq ($(PROJECT_CPU),ARCH_STM32H7)
|
2023-07-05 06:09:08 -07:00
|
|
|
CPU_STARTUP = startup_stm32h7xx.mk
|
|
|
|
# next file is included through Contrib's platform.ml
|
|
|
|
#CPU_PLATFORM = $(CHIBIOS)/os/hal/ports/STM32/STM32H7xx/platform.mk
|
|
|
|
CPU_PLATFORM = ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/STM32H7xx/platform.mk
|
|
|
|
CPU_HWLAYER = ports/stm32/stm32h7
|
2023-07-04 20:01:04 -07:00
|
|
|
else ifeq ($(PROJECT_CPU),ARCH_AT32F4)
|
2023-07-05 06:09:08 -07:00
|
|
|
CPU_STARTUP = startup_at32f4xx.mk
|
|
|
|
CPU_PLATFORM = $(CHIBIOS)/os/hal/ports/AT32/AT32F4xx/platform.mk
|
|
|
|
# Reuse STM32F4 port
|
|
|
|
CPU_HWLAYER = ports/stm32/stm32f4
|
2023-05-23 14:08:18 -07:00
|
|
|
else ifeq ($(PROJECT_CPU),custom_platform)
|
2023-07-05 06:09:08 -07:00
|
|
|
include $(BOARD_DIR)/custom_platform.mk
|
|
|
|
$(info Using custom CPU_STARTUP_DIR $(CPU_STARTUP_DIR))
|
|
|
|
$(info Using custom CPU_PLATFORM $(CPU_PLATFORM))
|
|
|
|
$(info Using custom CPU_HWLAYER $(CPU_HWLAYER))
|
2021-02-08 05:52:31 -08:00
|
|
|
else ifeq ($(PROJECT_CPU),simulator)
|
2021-02-05 17:00:44 -08:00
|
|
|
else
|
2022-01-31 20:17:13 -08:00
|
|
|
$(error Unexpected PROJECT_CPU [$(PROJECT_CPU)])
|
2018-12-15 21:55:03 -08:00
|
|
|
endif
|
2018-12-26 19:43:52 -08:00
|
|
|
|
2019-03-29 07:29:01 -07:00
|
|
|
ifeq ($(CPU_STARTUP_DIR),)
|
|
|
|
CPU_STARTUP_DIR = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/$(CPU_STARTUP)
|
|
|
|
endif
|
|
|
|
|
2019-07-09 02:29:03 -07:00
|
|
|
ifeq ($(GENERATED_ENUMS_DIR),)
|
|
|
|
GENERATED_ENUMS_DIR = $(PROJECT_DIR)/controllers/algo
|
|
|
|
endif
|