Merge branch 'master' into feature/ch32f20x
This commit is contained in:
@@ -34,6 +34,7 @@ def build_family(example, family, make_option):
|
||||
# sum all element of same index (column sum)
|
||||
return list(map(sum, list(zip(*result))))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# IAR CC
|
||||
if make_iar_option not in sys.argv:
|
||||
@@ -42,7 +43,7 @@ if __name__ == '__main__':
|
||||
# If examples are not specified in arguments, build all
|
||||
all_examples = []
|
||||
for d in os.scandir("examples"):
|
||||
if d.is_dir() and 'cmake' not in d.name:
|
||||
if d.is_dir() and 'cmake' not in d.name and 'build_system' not in d.name:
|
||||
for entry in os.scandir(d.path):
|
||||
if entry.is_dir() and 'cmake' not in entry.name:
|
||||
all_examples.append(d.name + '/' + entry.name)
|
@@ -1,17 +0,0 @@
|
||||
if (TOOLCHAIN STREQUAL "gcc")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
-mthumb
|
||||
-mcpu=cortex-m0plus
|
||||
-mfloat-abi=soft
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT GCC_ARM_CM0 CACHE INTERNAL "")
|
||||
|
||||
elseif (TOOLCHAIN STREQUAL "iar")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
--cpu cortex-m0
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT IAR_ARM_CM0 CACHE INTERNAL "")
|
||||
|
||||
endif ()
|
@@ -1,17 +0,0 @@
|
||||
if (TOOLCHAIN STREQUAL "gcc")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
-mthumb
|
||||
-mcpu=cortex-m0plus
|
||||
-mfloat-abi=soft
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT GCC_ARM_CM0 CACHE INTERNAL "")
|
||||
|
||||
elseif (TOOLCHAIN STREQUAL "iar")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
--cpu cortex-m0
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT IAR_ARM_CM0 CACHE INTERNAL "")
|
||||
|
||||
endif ()
|
@@ -1,16 +0,0 @@
|
||||
if (TOOLCHAIN STREQUAL "gcc")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
-mthumb
|
||||
-mcpu=cortex-m3
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT GCC_ARM_CM3 CACHE INTERNAL "")
|
||||
|
||||
elseif (TOOLCHAIN STREQUAL "iar")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
--cpu cortex-m3
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT IAR_ARM_CM3 CACHE INTERNAL "")
|
||||
|
||||
endif ()
|
@@ -1,19 +0,0 @@
|
||||
if (TOOLCHAIN STREQUAL "gcc")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
-mthumb
|
||||
-mcpu=cortex-m33
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv5-sp-d16
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT GCC_ARM_CM33_NTZ_NONSECURE CACHE INTERNAL "")
|
||||
|
||||
elseif (TOOLCHAIN STREQUAL "iar")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
--cpu cortex-m33
|
||||
--fpu VFPv5-SP
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT IAR_ARM_CM4F CACHE INTERNAL "")
|
||||
|
||||
endif ()
|
@@ -1,23 +0,0 @@
|
||||
if (TOOLCHAIN STREQUAL "gcc")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
-mthumb
|
||||
-mcpu=cortex-m4
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv4-sp-d16
|
||||
)
|
||||
|
||||
if (NOT DEFINED FREERTOS_PORT)
|
||||
set(FREERTOS_PORT GCC_ARM_CM4F CACHE INTERNAL "")
|
||||
endif ()
|
||||
|
||||
elseif (TOOLCHAIN STREQUAL "iar")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
--cpu cortex-m4
|
||||
--fpu VFPv4
|
||||
)
|
||||
|
||||
if (NOT DEFINED FREERTOS_PORT)
|
||||
set(FREERTOS_PORT IAR_ARM_CM4F CACHE INTERNAL "")
|
||||
endif ()
|
||||
|
||||
endif ()
|
@@ -1,19 +0,0 @@
|
||||
if (TOOLCHAIN STREQUAL "gcc")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
-mthumb
|
||||
-mcpu=cortex-m7
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv5-d16
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT GCC_ARM_CM7 CACHE INTERNAL "")
|
||||
|
||||
elseif (TOOLCHAIN STREQUAL "iar")
|
||||
set(TOOLCHAIN_COMMON_FLAGS
|
||||
--cpu cortex-m7
|
||||
--fpu VFPv5_D16
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT IAR_ARM_CM7 CACHE INTERNAL "")
|
||||
|
||||
endif ()
|
@@ -1,46 +0,0 @@
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
|
||||
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
|
||||
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
|
||||
set(CMAKE_ASM_COMPILER "arm-none-eabi-gcc")
|
||||
|
||||
set(CMAKE_SIZE "arm-none-eabi-size" CACHE FILEPATH "")
|
||||
set(CMAKE_OBJCOPY "arm-none-eabi-objcopy" CACHE FILEPATH "")
|
||||
set(CMAKE_OBJDUMP "arm-none-eabi-objdump" CACHE FILEPATH "")
|
||||
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
|
||||
# Look for includes and libraries only in the target system prefix.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# pass TOOLCHAIN_CPU to
|
||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_PROCESSOR}.cmake)
|
||||
|
||||
# enable all possible warnings for building examples
|
||||
list(APPEND TOOLCHAIN_COMMON_FLAGS
|
||||
-fdata-sections
|
||||
-ffunction-sections
|
||||
-fsingle-precision-constant
|
||||
-fno-strict-aliasing
|
||||
)
|
||||
|
||||
set(TOOLCHAIN_EXE_LINKER_FLAGS
|
||||
-Wl,--print-memory-usage
|
||||
-Wl,--gc-sections
|
||||
-Wl,--cref
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)
|
||||
|
||||
# try_compile is cmake test compiling its own example,
|
||||
# pass -nostdlib to skip stdlib linking
|
||||
get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
|
||||
if (IS_IN_TRY_COMPILE)
|
||||
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -nostdlib")
|
||||
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -nostdlib")
|
||||
endif ()
|
@@ -1,31 +0,0 @@
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
|
||||
set(CMAKE_C_COMPILER "iccarm")
|
||||
set(CMAKE_CXX_COMPILER "iccarm")
|
||||
set(CMAKE_ASM_COMPILER "iasmarm")
|
||||
|
||||
set(CMAKE_SIZE "size" CACHE FILEPATH "")
|
||||
set(CMAKE_OBJCOPY "ielftool" CACHE FILEPATH "")
|
||||
set(CMAKE_OBJDUMP "iefdumparm" CACHE FILEPATH "")
|
||||
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
|
||||
# Look for includes and libraries only in the target system prefix.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# pass TOOLCHAIN_CPU to
|
||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_PROCESSOR}.cmake)
|
||||
|
||||
# enable all possible warnings for building examples
|
||||
list(APPEND TOOLCHAIN_COMMON_FLAGS
|
||||
)
|
||||
|
||||
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)
|
@@ -1,17 +0,0 @@
|
||||
include(CMakePrintHelpers)
|
||||
|
||||
# join the toolchain flags into a single string
|
||||
list(JOIN TOOLCHAIN_COMMON_FLAGS " " TOOLCHAIN_COMMON_FLAGS)
|
||||
|
||||
foreach (LANG IN ITEMS C CXX ASM)
|
||||
set(CMAKE_${LANG}_FLAGS_INIT ${TOOLCHAIN_COMMON_FLAGS})
|
||||
|
||||
#cmake_print_variables(CMAKE_${LANG}_FLAGS_INIT)
|
||||
|
||||
# optimization flags for LOG, LOGGER ?
|
||||
#set(CMAKE_${LANG}_FLAGS_RELEASE_INIT "-Os")
|
||||
#set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
|
||||
endforeach ()
|
||||
|
||||
# Linker
|
||||
list(JOIN TOOLCHAIN_EXE_LINKER_FLAGS " " CMAKE_EXE_LINKER_FLAGS_INIT)
|
@@ -7,7 +7,7 @@ from multiprocessing import Pool
|
||||
# path, url, commit, family (Alphabet sorted by path)
|
||||
deps_mandatory = {
|
||||
'lib/FreeRTOS-Kernel': ['https://github.com/FreeRTOS/FreeRTOS-Kernel.git',
|
||||
'5f19e34f878af97810a7662a75eac59bd74d628b',
|
||||
'4ff01a7a4a51f53b44496aefee1e3c0071b7b173',
|
||||
'all'],
|
||||
'lib/lwip': ['https://github.com/lwip-tcpip/lwip.git',
|
||||
'159e31b689577dbf69cf0683bbaffbd71fa5ee10',
|
||||
@@ -108,7 +108,7 @@ deps_optional = {
|
||||
'd922865fc0326a102c26211c44b8e42f52c1e53d',
|
||||
'stm32l5'],
|
||||
'hw/mcu/st/cmsis_device_u5': ['https://github.com/STMicroelectronics/cmsis_device_u5.git',
|
||||
'bc00f3c9d8a4e25220f84c26d414902cc6bdf566',
|
||||
'06d7edade7167b0eafdd550bf77cfc4fa98eae2e',
|
||||
'stm32u5'],
|
||||
'hw/mcu/st/cmsis_device_wb': ['https://github.com/STMicroelectronics/cmsis_device_wb.git',
|
||||
'9c5d1920dd9fabbe2548e10561d63db829bb744f',
|
||||
@@ -153,7 +153,7 @@ deps_optional = {
|
||||
'675c32a75df37f39d50d61f51cb0dcf53f07e1cb',
|
||||
'stm32l5'],
|
||||
'hw/mcu/st/stm32u5xx_hal_driver': ['https://github.com/STMicroelectronics/stm32u5xx_hal_driver.git',
|
||||
'2e1d4cdb386e33391cb261dfff4fefa92e4aa35a',
|
||||
'4d93097a67928e9377e655ddd14622adc31b9770',
|
||||
'stm32u5'],
|
||||
'hw/mcu/st/stm32wbxx_hal_driver': ['https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git',
|
||||
'2c5f06638be516c1b772f768456ba637f077bac8',
|
||||
@@ -184,6 +184,10 @@ deps_all = {**deps_mandatory, **deps_optional}
|
||||
TOP = Path(__file__).parent.parent.resolve()
|
||||
|
||||
|
||||
def run_cmd(cmd):
|
||||
return subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
def get_a_dep(d):
|
||||
if d not in deps_all.keys():
|
||||
print('{} is not found in dependency list')
|
||||
@@ -192,25 +196,24 @@ def get_a_dep(d):
|
||||
commit = deps_all[d][1]
|
||||
families = deps_all[d][2]
|
||||
|
||||
print('cloning {} with {}'.format(d, url))
|
||||
print(f'cloning {d} with {url}')
|
||||
|
||||
p = Path(TOP / d)
|
||||
git_cmd = "git -C {}".format(p)
|
||||
git_cmd = f"git -C {p}"
|
||||
|
||||
# Init git deps if not existed
|
||||
if not p.exists():
|
||||
p.mkdir(parents=True)
|
||||
subprocess.run("{} init".format(git_cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
subprocess.run("{} remote add origin {}".format(git_cmd, url), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
run_cmd(f"git -C {p} init")
|
||||
run_cmd(f"git -C {p} remote add origin {url}")
|
||||
|
||||
# Check if commit is already fetched
|
||||
result = subprocess.run("{} rev-parse HEAD".format(git_cmd, commit), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
result = run_cmd(f"git -C {p} rev-parse HEAD")
|
||||
head = result.stdout.decode("utf-8").splitlines()[0]
|
||||
|
||||
run_cmd(f"git -C {p} reset --hard")
|
||||
if commit != head:
|
||||
subprocess.run("{} reset --hard".format(git_cmd, commit), shell=True)
|
||||
subprocess.run("{} fetch --depth 1 origin {}".format(git_cmd, commit), shell=True)
|
||||
subprocess.run("{} checkout FETCH_HEAD".format(git_cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
run_cmd(f"git -C {p} fetch --depth 1 origin {commit}")
|
||||
run_cmd(f"git -C {p} checkout FETCH_HEAD")
|
||||
|
||||
return 0
|
||||
|
||||
|
@@ -1,9 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mcpu=arm1176jzf-s \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
#CFLAGS += --cpu cortex-a53
|
||||
#ASFLAGS += --cpu cortex-a53
|
||||
|
||||
endif
|
@@ -1,12 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mcpu=cortex-a53 \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
CFLAGS += \
|
||||
--cpu cortex-a53 \
|
||||
|
||||
ASFLAGS += \
|
||||
--cpu cortex-a53 \
|
||||
|
||||
endif
|
@@ -1,12 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mcpu=cortex-a72 \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
CFLAGS += \
|
||||
--cpu cortex-a72 \
|
||||
|
||||
ASFLAGS += \
|
||||
--cpu cortex-a72 \
|
||||
|
||||
endif
|
@@ -1,14 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mthumb \
|
||||
-mcpu=cortex-m0 \
|
||||
-mfloat-abi=soft \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
# IAR Flags
|
||||
CFLAGS += --cpu cortex-m0
|
||||
ASFLAGS += --cpu cortex-m0
|
||||
endif
|
||||
|
||||
# For freeRTOS port source
|
||||
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
@@ -1,14 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mthumb \
|
||||
-mcpu=cortex-m0plus \
|
||||
-mfloat-abi=soft \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
# IAR Flags
|
||||
CFLAGS += --cpu cortex-m0+
|
||||
ASFLAGS += --cpu cortex-m0+
|
||||
endif
|
||||
|
||||
# For freeRTOS port source
|
||||
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
@@ -1,17 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mthumb \
|
||||
-mcpu=cortex-m3 \
|
||||
-mfloat-abi=soft \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
# IAR Flags
|
||||
CFLAGS += \
|
||||
--cpu cortex-m3 \
|
||||
|
||||
ASFLAGS += \
|
||||
--cpu cortex-m3
|
||||
endif
|
||||
|
||||
# For freeRTOS port source
|
||||
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM3
|
@@ -1,19 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mthumb \
|
||||
-mcpu=cortex-m33 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv5-sp-d16 \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
CFLAGS += \
|
||||
--cpu cortex-m33 \
|
||||
--fpu VFPv5-SP \
|
||||
|
||||
ASFLAGS += \
|
||||
--cpu cortex-m33 \
|
||||
--fpu VFPv5-SP \
|
||||
|
||||
endif
|
||||
|
||||
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM33_NTZ/non_secure
|
@@ -1,13 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mthumb \
|
||||
-mcpu=cortex-m4 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv4-sp-d16 \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
CFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
ASFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
endif
|
||||
|
||||
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM4F
|
@@ -1,19 +0,0 @@
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
CFLAGS += \
|
||||
-mthumb \
|
||||
-mcpu=cortex-m7 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv5-d16 \
|
||||
|
||||
else ifeq ($(TOOLCHAIN),iar)
|
||||
CFLAGS += \
|
||||
--cpu cortex-m7 \
|
||||
--fpu VFPv5_D16 \
|
||||
|
||||
ASFLAGS += \
|
||||
--cpu cortex-m7 \
|
||||
--fpu VFPv5_D16 \
|
||||
|
||||
endif
|
||||
|
||||
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM7/r0p1
|
@@ -1,71 +0,0 @@
|
||||
# makefile for arm gcc toolchain
|
||||
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CC) -x assembler-with-cpp
|
||||
LD = $(CC)
|
||||
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
|
||||
# ---------------------------------------
|
||||
# Compiler Flags
|
||||
# ---------------------------------------
|
||||
CFLAGS += \
|
||||
-MD \
|
||||
-ggdb \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-fsingle-precision-constant \
|
||||
-fno-strict-aliasing \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-Wfatal-errors \
|
||||
-Wdouble-promotion \
|
||||
-Wstrict-prototypes \
|
||||
-Wstrict-overflow \
|
||||
-Werror-implicit-function-declaration \
|
||||
-Wfloat-equal \
|
||||
-Wundef \
|
||||
-Wshadow \
|
||||
-Wwrite-strings \
|
||||
-Wsign-compare \
|
||||
-Wmissing-format-attribute \
|
||||
-Wunreachable-code \
|
||||
-Wcast-align \
|
||||
-Wcast-function-type \
|
||||
-Wcast-qual \
|
||||
-Wnull-dereference \
|
||||
-Wuninitialized \
|
||||
-Wunused \
|
||||
-Wreturn-type \
|
||||
-Wredundant-decls \
|
||||
|
||||
# conversion is too strict for most mcu driver, may be disable sign/int/arith-conversion
|
||||
# -Wconversion
|
||||
|
||||
# Size Optimization as default
|
||||
CFLAGS_OPTIMIZED ?= -Os
|
||||
|
||||
# Debugging/Optimization
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0
|
||||
NO_LTO = 1
|
||||
else
|
||||
CFLAGS += $(CFLAGS_OPTIMIZED)
|
||||
endif
|
||||
|
||||
# ---------------------------------------
|
||||
# Linker Flags
|
||||
# ---------------------------------------
|
||||
LDFLAGS += \
|
||||
-Wl,-Map=$@.map \
|
||||
-Wl,-cref \
|
||||
-Wl,-gc-sections \
|
||||
|
||||
# Some toolchain such as renesas rx does not support --print-memory-usage flags
|
||||
ifneq ($(FAMILY),rx)
|
||||
LDFLAGS += -Wl,--print-memory-usage
|
||||
endif
|
@@ -1,79 +0,0 @@
|
||||
SRC_S += $(SRC_S_GCC)
|
||||
|
||||
# Assembly files can be name with upper case .S, convert it to .s
|
||||
SRC_S := $(SRC_S:.S=.s)
|
||||
|
||||
# Due to GCC LTO bug https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
|
||||
# assembly file should be placed first in linking order
|
||||
# '_asm' suffix is added to object of assembly file
|
||||
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=_asm.o))
|
||||
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o))
|
||||
|
||||
CFLAGS += $(CFLAGS_GCC) -MD
|
||||
|
||||
# LTO makes it difficult to analyze map file for optimizing size purpose
|
||||
# We will run this option in ci
|
||||
ifeq ($(NO_LTO),1)
|
||||
CFLAGS := $(filter-out -flto,$(CFLAGS))
|
||||
endif
|
||||
|
||||
ifneq ($(CFLAGS_SKIP),)
|
||||
CFLAGS := $(filter-out $(CFLAGS_SKIP),$(CFLAGS))
|
||||
endif
|
||||
|
||||
LDFLAGS += $(CFLAGS) $(LDFLAGS_GCC)
|
||||
|
||||
ifdef LD_FILE
|
||||
LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE)
|
||||
endif
|
||||
|
||||
ifdef LD_FILE_GCC
|
||||
LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE_GCC)
|
||||
endif
|
||||
|
||||
ifneq ($(SKIP_NANOLIB), 1)
|
||||
LDFLAGS += --specs=nosys.specs --specs=nano.specs
|
||||
endif
|
||||
|
||||
ASFLAGS += $(CFLAGS)
|
||||
|
||||
LIBS_GCC ?= -lgcc -lm -lnosys
|
||||
|
||||
# libc
|
||||
LIBS += $(LIBS_GCC)
|
||||
|
||||
ifneq ($(BOARD), spresense)
|
||||
LIBS += -lc
|
||||
endif
|
||||
|
||||
# ---------------------------------------
|
||||
# Rules
|
||||
# ---------------------------------------
|
||||
|
||||
# Compile .c file
|
||||
$(BUILD)/obj/%.o: %.c
|
||||
@echo CC $(notdir $@)
|
||||
@$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
# ASM sources lower case .s
|
||||
$(BUILD)/obj/%_asm.o: %.s
|
||||
@echo AS $(notdir $@)
|
||||
@$(AS) $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
# ASM sources upper case .S
|
||||
$(BUILD)/obj/%_asm.o: %.S
|
||||
@echo AS $(notdir $@)
|
||||
@$(AS) $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
OBJCOPY_BIN_OPTION ?=
|
||||
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
|
||||
@echo CREATE $@
|
||||
$(OBJCOPY) -O binary $(OBJCOPY_BIN_OPTION) $^ $@
|
||||
|
||||
$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
|
||||
@echo CREATE $@
|
||||
@$(OBJCOPY) -O ihex $^ $@
|
||||
|
||||
$(BUILD)/$(PROJECT).elf: $(OBJ)
|
||||
@echo LINK $@
|
||||
@$(LD) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
|
@@ -1,11 +0,0 @@
|
||||
# makefile for arm iar toolchain
|
||||
AS = iasmarm
|
||||
LD = ilinkarm
|
||||
OBJCOPY = ielftool --silent
|
||||
SIZE = size
|
||||
|
||||
# Enable extension mode (gcc compatible)
|
||||
CFLAGS += -e --debug --silent
|
||||
|
||||
# silent mode
|
||||
ASFLAGS += -S $(addprefix -I,$(INC))
|
@@ -1,44 +0,0 @@
|
||||
SRC_S += $(SRC_S_IAR)
|
||||
|
||||
# Assembly files can be name with upper case .S, convert it to .s
|
||||
SRC_S := $(SRC_S:.S=.s)
|
||||
|
||||
# Due to GCC LTO bug https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
|
||||
# assembly file should be placed first in linking order
|
||||
# '_asm' suffix is added to object of assembly file
|
||||
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=_asm.o))
|
||||
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o))
|
||||
|
||||
# Linker script
|
||||
LDFLAGS += --config $(TOP)/$(LD_FILE_IAR)
|
||||
|
||||
# ---------------------------------------
|
||||
# Rules
|
||||
# ---------------------------------------
|
||||
|
||||
# Compile .c file
|
||||
$(BUILD)/obj/%.o: %.c
|
||||
@echo CC $(notdir $@)
|
||||
@$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
# ASM sources lower case .s
|
||||
$(BUILD)/obj/%_asm.o: %.s
|
||||
@echo AS $(notdir $@)
|
||||
@$(AS) $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
# ASM sources upper case .S
|
||||
$(BUILD)/obj/%_asm.o: %.S
|
||||
@echo AS $(notdir $@)
|
||||
@$(AS) $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
|
||||
@echo CREATE $@
|
||||
@$(OBJCOPY) --bin $^ $@
|
||||
|
||||
$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
|
||||
@echo CREATE $@
|
||||
@$(OBJCOPY) --ihex $^ $@
|
||||
|
||||
$(BUILD)/$(PROJECT).elf: $(OBJ)
|
||||
@echo LINK $@
|
||||
@$(LD) -o $@ $(LDFLAGS) $^
|
Reference in New Issue
Block a user