1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/stm32: handle generated irqs.h in build system

This commit is contained in:
Alexandre Abadie 2020-07-24 15:04:53 +02:00
parent 39d95b1950
commit 0da196d98d
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 37 additions and 20 deletions

View File

@ -43,24 +43,45 @@ ifneq (,$(CCMRAM_LEN))
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ccmram_length=$(CCMRAM_LEN)
endif
ifneq (,$(filter STM32F030x4,$(CPU_LINE)))
VECTORS_O ?= $(BINDIR)/stm32_vectors/$(CPU_LINE).o
else
VECTORS_O ?= $(BINDIR)/stm32_vectors/gen_$(CPU_LINE).o
VECTORS_FILE = $(RIOTCPU)/stm32/vectors/gen_$(CPU_LINE).c
BUILDDEPS += $(VECTORS_FILE)
VECTORS_O ?= $(BINDIR)/stm32_vectors/$(CPU_LINE).o
VECTORS_FILE = $(RIOTCPU)/stm32/vectors/$(CPU_LINE).c
BUILDDEPS += $(VECTORS_FILE)
# Add this define to skip the inclusion of the system_stm32xxxx.h header files
# which are only used for STM32 system includes and not of interest for RIOT.
CFLAGS += -D__SYSTEM_STM32$(call uppercase,$(CPU_FAM))XX_H
# CPU_LINE must be exported only when building the vectors object file since
# the source filename to be built is built from the CPU_LINE content.
$(call target-export-variables,$(VECTORS_O),CPU_LINE)
STM32CMSIS_INCLUDE_DIR = $(RIOTBASE)/cpu/stm32/include/vendor/cmsis/$(CPU_FAM)/Include
# Add this define to skip the inclusion of the system_stm32xxxx.h header files
# which are only used for STM32 system includes and not of interest for RIOT.
CFLAGS += -D__SYSTEM_STM32$(call uppercase,$(CPU_FAM))XX_H
INCLUDES += -I$(STM32CMSIS_INCLUDE_DIR)
STM32CMSIS_INCLUDE_DIR = $(RIOTCPU)/stm32/include/vendor/cmsis/$(CPU_FAM)/Include
STM32FAM_INCLUDE_FILE = $(STM32CMSIS_INCLUDE_DIR)/stm32$(CPU_FAM)xx.h
INCLUDES += -I$(STM32CMSIS_INCLUDE_DIR)
$(VECTORS_FILE):
$(Q)make -C $(RIOTPKG)/stm32cmsis
$(Q)$(RIOTTOOLS)/stm32_gen_vectors/stm32_gen_vectors.py $(CPU_LINE)
# Fetch all CMSIS headers using the package mechanism. This rule is called all
# the time to ensure it's correctly updated when versions in the packages are
# updated.
$(STM32FAM_INCLUDE_FILE): FORCE
$(Q)make -C $(RIOTCPU)/stm32/include/vendor
# The vectors source file requires the family headers to be fetched before since
# it's generated from the CMSIS content
$(VECTORS_FILE): $(STM32FAM_INCLUDE_FILE)
$(Q)$(RIOTBASE)/cpu/stm32/dist/irqs/gen_vectors.py $(CPU_LINE)
ifneq (STM32F030x4,$(CPU_LINE))
# IRQs of STM32F030x4 family are not available in the CMSIS package so they
# are hardcoded in RIOTs codebase.
# For other lines, the IRQs are automatically generated once from the whole
# list of CMSIS headers available in a given family
STM32IRQS_INCLUDE_FILE = $(RIOTCPU)/stm32/include/irqs/$(CPU_FAM)/irqs.h
BUILDDEPS += $(STM32IRQS_INCLUDE_FILE)
# The IRQ header for a given family requires the family headers to be fetched
# before since it's generated from all CMSIS content of that family
$(STM32IRQS_INCLUDE_FILE): $(STM32FAM_INCLUDE_FILE)
$(Q)$(RIOTBASE)/cpu/stm32/dist/irqs/gen_irqs.py $(CPU_FAM)
endif
include $(RIOTMAKE)/arch/cortexm.inc.mk

View File

@ -2,13 +2,9 @@ MODULE = stm32_vectors
NO_AUTO_SRC = 1
ifneq (,$(filter STM32F030x4,$(CPU_LINE)))
SRC_FILE = $(CPU_LINE).c
else
SRC_FILE = gen_$(CPU_LINE).c
endif
SRC_FILE = $(CPU_LINE).c
SRCS = $(SRC_FILE)
SRCS += $(SRC_FILE)
# (file triggers compiler bug. see #5775)
SRC_NOLTO += $(SRC_FILE)