diff --git a/makefile.armcc b/makefile.armcc index 0fe211b..aac8441 100644 --- a/makefile.armcc +++ b/makefile.armcc @@ -1,7 +1,7 @@ #**********************************************************# #file makefile #author Rajmund Szymanski -#date 10.01.2018 +#date 24.12.2018 #brief LM4F120H5QR makefile. #**********************************************************# @@ -15,10 +15,10 @@ QEMU := c:/sys/qemu-arm/bin/qemu-system-gnuarmeclipse -semihosting -board PROJECT ?= $(notdir $(CURDIR)) DEFS ?= __MICROLIB -LIBS ?= DIRS ?= -KEYS ?= INCS ?= . +LIBS ?= +KEYS ?= OPTF ?= 2 # space SCRIPT ?= @@ -95,6 +95,8 @@ TXTS := $(OBJS:.o=.txt) CORE_F := --cpu=cortex-m4 ifneq ($(MAKECMDGOALS),qemu) CORE_F += --fpu=fpv4-sp --apcs=/hardfp/interwork +else +DEFS += QEMU endif COMMON_F = --md --depend=$(@:.o=.d) # --feedback=$(FED) COMMON_F += # --debug diff --git a/makefile.clang b/makefile.clang index 396bab8..1754945 100644 --- a/makefile.clang +++ b/makefile.clang @@ -1,7 +1,7 @@ #**********************************************************# #file makefile #author Rajmund Szymanski -#date 10.01.2018 +#date 24.12.2018 #brief LM4F120H5QR makefile. #**********************************************************# @@ -15,10 +15,10 @@ QEMU := c:/sys/qemu-arm/bin/qemu-system-gnuarmeclipse -semihosting -board PROJECT ?= $(notdir $(CURDIR)) DEFS ?= __MICROLIB -LIBS ?= DIRS ?= -KEYS ?= INCS ?= . +LIBS ?= +KEYS ?= OPTF ?= 2 # z SCRIPT ?= @@ -93,6 +93,8 @@ TXTS := $(OBJS:.o=.txt) COMMON_F = --target=arm-arm-none-eabi -mthumb -mcpu=cortex-m4 ifneq ($(MAKECMDGOALS),qemu) COMMON_F += -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffast-math +else +DEFS += QEMU endif COMMON_F += -O$(OPTF) -ffunction-sections -fdata-sections ifneq ($(filter USE_LTO,$(DEFS)),) @@ -104,7 +106,7 @@ COMMON_F += # --debug AS_FLAGS = C_FLAGS = -std=gnu11 -CXX_FLAGS = -std=gnu++11 -fno-rtti -fno-exceptions # -fno-use-cxa-atexit +CXX_FLAGS = -std=gnu++14 -fno-rtti -fno-exceptions # -fno-use-cxa-atexit LD_FLAGS = --strict --scatter=$(SCRIPT) --symbols --list_mapping_symbols LD_FLAGS += --map --info common,sizes,summarysizes,totals,veneers,unused --list=$(MAP) # --callgraph ifneq ($(filter USE_LTO,$(DEFS)),) diff --git a/makefile.csmcc b/makefile.csmcc index 5283243..ab01b0d 100644 --- a/makefile.csmcc +++ b/makefile.csmcc @@ -1,7 +1,7 @@ #**********************************************************# #file makefile #author Rajmund Szymanski -#date 10.01.2018 +#date 24.12.2018 #brief LM4F120H5QR makefile. #**********************************************************# @@ -15,10 +15,10 @@ QEMU := c:/sys/qemu-arm/bin/qemu-system-gnuarmeclipse -semihosting -board PROJECT ?= $(notdir $(CURDIR)) DEFS ?= -LIBS ?= DIRS ?= -KEYS ?= INCS ?= . +LIBS ?= +KEYS ?= OPTF ?= SCRIPT ?= @@ -29,6 +29,7 @@ KEYS += .csmcc .cortexm .lm4f * ifneq ($(MAKECMDGOALS),qemu) LIBS += crtsi libfpulc libilc libm else +DEFS += QEMU LIBS += crtsi libflc libilc libm endif MODEL := modlc diff --git a/makefile.gnucc b/makefile.gnucc index 0172bf7..428823f 100644 --- a/makefile.gnucc +++ b/makefile.gnucc @@ -1,7 +1,7 @@ #**********************************************************# #file makefile #author Rajmund Szymanski -#date 10.01.2018 +#date 24.12.2018 #brief LM4F120H5QR makefile. #**********************************************************# @@ -14,10 +14,10 @@ QEMU := c:/sys/qemu-arm/bin/qemu-system-gnuarmeclipse -semihosting -board PROJECT ?= $(notdir $(CURDIR)) DEFS ?= USE_NANO -LIBS ?= DIRS ?= -KEYS ?= INCS ?= ./. +LIBS ?= +KEYS ?= OPTF ?= 2 # s SCRIPT ?= @@ -90,6 +90,8 @@ LSTS := $(OBJS:.o=.lst) COMMON_F = -mthumb -mcpu=cortex-m4 ifneq ($(MAKECMDGOALS),qemu) COMMON_F += -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffast-math +else +DEFS += QEMU endif COMMON_F += -O$(OPTF) -ffunction-sections -fdata-sections ifneq ($(filter USE_LTO,$(DEFS)),) @@ -102,7 +104,7 @@ COMMON_F += # -g -ggdb AS_FLAGS = C_FLAGS = -std=gnu11 -CXX_FLAGS = -std=gnu++11 -fno-rtti -fno-exceptions # -fno-use-cxa-atexit +CXX_FLAGS = -std=gnu++14 -fno-rtti -fno-exceptions -fno-use-cxa-atexit LD_FLAGS = -Wl,-T$(SCRIPT),-Map=$(MAP),--cref,--no-warn-mismatch,--gc-sections ifneq ($(filter main_stack_size%,$(DEFS)),) LD_FLAGS += -Wl,--defsym=$(filter main_stack_size%,$(DEFS)) diff --git a/makefile.iarcc b/makefile.iarcc index ccd0843..f0ccdfb 100644 --- a/makefile.iarcc +++ b/makefile.iarcc @@ -1,7 +1,7 @@ #**********************************************************# #file makefile #author Rajmund Szymanski -#date 10.01.2018 +#date 24.12.2018 #brief LM4F120H5QR makefile. #**********************************************************# @@ -14,11 +14,11 @@ QEMU := c:/sys/qemu-arm/bin/qemu-system-gnuarmeclipse -semihosting -board #----------------------------------------------------------# PROJECT ?= $(notdir $(CURDIR)) -DEFS ?= -LIBS ?= +DEFS ?= port_sys_init=__iar_init_core DIRS ?= -KEYS ?= INCS ?= ./. +LIBS ?= +KEYS ?= OPTF ?= h # hz SCRIPT ?= @@ -92,6 +92,8 @@ LSTS := $(OBJS:.o=.lst) CORE_F := --cpu Cortex-M4 ifneq ($(MAKECMDGOALS),qemu) CORE_F += --fpu VFPv4_sp +else +DEFS += QEMU endif COMMON_F = --thumb -O$(OPTF) -e --dependencies=m $*.d AS_FLAGS = -S -s+ -w+ diff --git a/startup/LM4F/ARMCC/script.sct b/startup/LM4F/.armcc/script.sct similarity index 100% rename from startup/LM4F/ARMCC/script.sct rename to startup/LM4F/.armcc/script.sct diff --git a/startup/LM4F/ARMCC/startup.h b/startup/LM4F/.armcc/startup.h similarity index 100% rename from startup/LM4F/ARMCC/startup.h rename to startup/LM4F/.armcc/startup.h diff --git a/startup/LM4F/CLANG/script.sct b/startup/LM4F/.clang/script.sct similarity index 100% rename from startup/LM4F/CLANG/script.sct rename to startup/LM4F/.clang/script.sct diff --git a/startup/LM4F/CLANG/startup.h b/startup/LM4F/.clang/startup.h similarity index 100% rename from startup/LM4F/CLANG/startup.h rename to startup/LM4F/.clang/startup.h diff --git a/startup/LM4F/CSMCC/script.lkf b/startup/LM4F/.csmcc/script.lkf similarity index 100% rename from startup/LM4F/CSMCC/script.lkf rename to startup/LM4F/.csmcc/script.lkf diff --git a/startup/LM4F/CSMCC/startup.h b/startup/LM4F/.csmcc/startup.h similarity index 100% rename from startup/LM4F/CSMCC/startup.h rename to startup/LM4F/.csmcc/startup.h diff --git a/startup/LM4F/CSMCC/vectors.cxm b/startup/LM4F/.csmcc/vectors.cxm similarity index 100% rename from startup/LM4F/CSMCC/vectors.cxm rename to startup/LM4F/.csmcc/vectors.cxm diff --git a/startup/LM4F/GNUCC/script.ld b/startup/LM4F/.gnucc/script.ld similarity index 100% rename from startup/LM4F/GNUCC/script.ld rename to startup/LM4F/.gnucc/script.ld diff --git a/startup/LM4F/GNUCC/startup.h b/startup/LM4F/.gnucc/startup.h similarity index 97% rename from startup/LM4F/GNUCC/startup.h rename to startup/LM4F/.gnucc/startup.h index 5bfd968..1234e3b 100644 --- a/startup/LM4F/GNUCC/startup.h +++ b/startup/LM4F/.gnucc/startup.h @@ -1,7 +1,7 @@ /******************************************************************************* @file startup.h @author Rajmund Szymanski -@date 21.11.2017 +@date 21.12.2018 @brief Startup file header for gcc compiler. *******************************************************************************/ @@ -30,8 +30,6 @@ __NO_RETURN void _start( void ); #endif//USE_CRT -__NO_RETURN __ALIAS(Fault_Handler) void _exit( int ); - /******************************************************************************* Symbols defined in linker script *******************************************************************************/ diff --git a/startup/LM4F/IARCC/script.icf b/startup/LM4F/.iarcc/script.icf similarity index 100% rename from startup/LM4F/IARCC/script.icf rename to startup/LM4F/.iarcc/script.icf diff --git a/startup/LM4F/IARCC/startup.h b/startup/LM4F/.iarcc/startup.h similarity index 90% rename from startup/LM4F/IARCC/startup.h rename to startup/LM4F/.iarcc/startup.h index e171b85..ee6bff1 100644 --- a/startup/LM4F/IARCC/startup.h +++ b/startup/LM4F/.iarcc/startup.h @@ -1,7 +1,7 @@ /******************************************************************************* @file startup.h @author Rajmund Szymanski -@date 14.11.2017 +@date 09.08.2018 @brief Startup file header for iar c compiler. *******************************************************************************/ @@ -18,7 +18,6 @@ Prototypes of external functions *******************************************************************************/ -__WEAK void port_sys_init( void ); __NO_RETURN void __iar_program_start( void ); /******************************************************************************* @@ -28,8 +27,6 @@ __NO_RETURN void __iar_program_start( void ); __STATIC_INLINE __NO_RETURN void __main( void ) { - /* Call the os initialization procedure */ - port_sys_init(); /* Call the application's entry point */ __iar_program_start(); } diff --git a/startup/LM4F/startup_lm4f.c b/startup/LM4F/startup_lm4f.c index 75441c9..a13d0ec 100644 --- a/startup/LM4F/startup_lm4f.c +++ b/startup/LM4F/startup_lm4f.c @@ -1,7 +1,7 @@ /******************************************************************************* @file startup.c @author Rajmund Szymanski -@date 19.07.2018 +@date 21.12.2018 @brief LM4F120H5QR startup file. After reset the Cortex-M4 processor is in thread mode, priority is privileged, and the stack is set to main. @@ -34,6 +34,18 @@ extern char __initial_msp[]; extern char __initial_sp []; +/******************************************************************************* + Default _exit handler +*******************************************************************************/ + +__WEAK __NO_RETURN +void _exit( int status ) +{ + (void) status; + /* Go into an infinite loop */ + for (;;); +} + /******************************************************************************* Default fault handler *******************************************************************************/ @@ -49,19 +61,7 @@ void Fault_Handler( void ) Specific definitions for the compiler *******************************************************************************/ -#if defined(__CC_ARM) -#include "ARMCC/startup.h" -#elif defined(__ARMCOMPILER_VERSION) -#include "CLANG/startup.h" -#elif defined(__GNUC__) -#include "GNUCC/startup.h" -#elif defined(__CSMC__) -#include "CSMCC/startup.h" -#elif defined(__ICCARM__) -#include "IARCC/startup.h" -#else -#error Unknown compiler! -#endif +#include "startup.h" /******************************************************************************* Default reset handler