startup code etc.

This commit is contained in:
tkl
2016-08-21 13:12:03 +02:00
parent c67250b793
commit eaef0cfffa
24 changed files with 2284 additions and 412 deletions

View File

@@ -12,18 +12,6 @@ LIB_DIR += $(SRC_DIR)/os/$(DBG_REL_DIR)
OS_LIB = kosmos-$(ARCH)-$(BOARD)$(DBG_EXT)
LIBS += $(OS_LIB)
CFLAGS += \
-O$(OPTIM) \
$(addprefix -I, $(INCLUDES)) \
-Wall
CPPCHECK_FLAGS += \
--template=gcc \
--error-exitcode=1 \
--enable=warning,performance,information,style \
--inline-suppr \
$(addprefix -I, $(INCLUDES))
include $(ROOT_DIR)/config/make/tools.mk
SRC_DIR = $(ROOT_DIR)/source
@@ -48,23 +36,15 @@ HEX_EXT = .hex
LIB_EXT = .a
SIZE_EXT = .size
TEST_EXT =
MAP_EXT = .map
DOXYFILE=$(ROOT_DIR)/config/doxygen/Doxyfile
define makedep
$(CC) -MM \
-MF $3 \
-MP \
-MT $2 \
$(CFLAGS) \
$1
endef
define maketestdep
$(NATIVE_CC) -MM \
-MF $3 \
-MP \
-MT $2 \
$(TEST_CFLAGS) \
$(CC) -MM \
-MF $3 \
-MP \
-MT $2 \
$4 \
$1
endef

View File

@@ -6,53 +6,81 @@ endif
ifeq ($(BOARD), stm32f4-discovery)
CFLAGS += -DBOARD_STM32F4_DISCOVERY
endif
CROSS_COMPILE=arm-none-eabi-
CROSS_COMPILE ?= arm-none-eabi-
INCLUDES += source/system/stm32f4xx
SUB_FOLDER += source/system/stm32f4xx
INCLUDES += \
/opt/arm-2011.09/arm-none-eabi/include \
/opt/arm-2011.09/lib/gcc/arm-none-eabi/4.6.1/include
/opt/gcc-arm-none-eabi-5_4-2016q2/arm-none-eabi/include \
/opt/gcc-arm-none-eabi-5_4-2016q2/lib/gcc/arm-none-eabi/5.4.1/include
GEN_FLAGS += \
-mcpu=cortex-m4 \
-mthumb \
-mfloat-abi=hard \
-mfpu=fpv4-sp-d16 \
-O$(OPTIM) \
-fmessage-length=0 \
-fsigned-char \
-ffunction-sections \
-fdata-sections \
-ffreestanding \
-fno-move-loop-invariants \
-Werror \
-Wunused \
-Wuninitialized \
-Wall \
-Wextra \
-Wmissing-declarations \
-Wconversion \
-Wpointer-arith \
-Wpadded \
-Wshadow \
-Wlogical-op \
-Waggregate-return \
-Wfloat-equal
C_FLAGS += \
-DDEBUG \
-DUSE_FULL_ASSERT \
-DTRACE \
-DOS_USE_TRACE_SEMIHOSTING_DEBUG \
-DSTM32F407xx \
-DUSE_HAL_DRIVER \
-DHSE_VALUE=8000000 \
$(addprefix -I, $(INCLUDES)) \
-std=gnu11 \
-Wmissing-prototypes \
-Wstrict-prototypes \
-Wbad-function-cast \
-Wno-bad-function-cast \
-Wno-conversion \
-Wno-sign-conversion \
-Wno-unused-parameter \
-Wno-sign-compare \
-Wno-missing-prototypes \
-Wno-missing-declarations
L_FLAGS := \
-T mem.ld \
-T libs.ld \
-T sections.ld \
-nostartfiles \
-Xlinker --gc-sections \
-L"config/linker" \
--specs=nano.specs
# --specs=nosys.specs
ifeq ($(DEBUG),y)
OPTIM = 0
CFLAGS += -g
OPTIM = g
GEN_FLAGS += -g3
DBG_EXT = -dbg
else
OPTIM = s
LDFLAGS += -s
DBG_EXT =
endif
CFLAGS += \
-mthumb \
-T $(ROOT_DIR)/config/linker/stm32_flash.ld \
-D USE_STDPERIPH_DRIVER\
-D VECT_TAB_FLASH\
-D GCC_ARMCM4\
-D THUMB_INTERWORK\
-D PACK_STRUCT_END=__attribute\(\(packed\)\)\
-D ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)\
-mcpu=cortex-m4 \
-mfpu=fpv4-sp-d16 \
-mfloat-abi=softfp \
-fdata-sections \
-ffunction-sections
# -D inline= -mthumb\
CPPCHECK_FLAGS += \
-D USE_STDPERIPH_DRIVER\
-D VECT_TAB_FLASH\
-D GCC_ARMCM4\
-D THUMB_INTERWORK\
-D PACK_STRUCT_END=__attribute\(\(packed\)\)\
-D ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)\
-D __thumb__ \
--check-config
LDFLAGS=\
-Wl,--gc-sections \
-Xlinker -M > $(MAP_DIR)/$(APP).map
ASFLAGS=-mapcs-32 -g
ARFLAGS=rcs
OOCD_IMAGE=$(BINFILE)