From 9c79869f8ac17b03a57c7cf352c126041e408ad6 Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Tue, 5 May 2015 12:27:09 -0500 Subject: [PATCH 1/4] Add the no-rtti compilation flag required for linking with precompiled libmbed. --- workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl | 2 +- workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl | 2 +- workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl | 2 +- workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl | 2 +- workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl | 2 +- workspace_tools/export/simplicityv3_slsproj.tmpl | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl b/workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl index d248ebfc81..7973f2716d 100644 --- a/workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl +++ b/workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl @@ -53,7 +53,7 @@ clean: $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< .cpp.o: - $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -fno-rtti -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< $(OBJ_FOLDER)$(PROJECT).axf: $(OBJECTS) $(SYS_OBJECTS) diff --git a/workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl b/workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl index 65d85dfd8a..c15810f75c 100644 --- a/workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl +++ b/workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl @@ -53,7 +53,7 @@ clean: $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< .cpp.o: - $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -fno-rtti -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< $(OBJ_FOLDER)$(PROJECT).axf: $(OBJECTS) $(SYS_OBJECTS) diff --git a/workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl b/workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl index d248ebfc81..7973f2716d 100644 --- a/workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl +++ b/workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl @@ -53,7 +53,7 @@ clean: $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< .cpp.o: - $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -fno-rtti -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< $(OBJ_FOLDER)$(PROJECT).axf: $(OBJECTS) $(SYS_OBJECTS) diff --git a/workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl b/workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl index d248ebfc81..7973f2716d 100644 --- a/workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl +++ b/workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl @@ -53,7 +53,7 @@ clean: $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< .cpp.o: - $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -fno-rtti -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< $(OBJ_FOLDER)$(PROJECT).axf: $(OBJECTS) $(SYS_OBJECTS) diff --git a/workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl b/workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl index 65d85dfd8a..c15810f75c 100644 --- a/workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl +++ b/workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl @@ -53,7 +53,7 @@ clean: $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< .cpp.o: - $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -fno-rtti -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< $(OBJ_FOLDER)$(PROJECT).axf: $(OBJECTS) $(SYS_OBJECTS) diff --git a/workspace_tools/export/simplicityv3_slsproj.tmpl b/workspace_tools/export/simplicityv3_slsproj.tmpl index 00535b5fa3..0e3109a157 100644 --- a/workspace_tools/export/simplicityv3_slsproj.tmpl +++ b/workspace_tools/export/simplicityv3_slsproj.tmpl @@ -63,7 +63,7 @@ {# For debug build, don't apply optimizations #} - + @@ -106,7 +106,7 @@ {# Use optimize for size on release build #} - + From 155a8971116d55bf2d4e96c024a6edee1d825f4f Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Tue, 5 May 2015 12:35:20 -0500 Subject: [PATCH 2/4] reduce stack size on Zero because of limited RAM --- .../TOOLCHAIN_ARM_MICRO/startup_efm32zg.s | 2 +- .../TARGET_EFM32ZG_STK3200/TOOLCHAIN_GCC_ARM/startup_efm32zg.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/mbed/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/TOOLCHAIN_ARM_MICRO/startup_efm32zg.s b/libraries/mbed/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/TOOLCHAIN_ARM_MICRO/startup_efm32zg.s index ede95180f5..8e32b53a73 100644 --- a/libraries/mbed/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/TOOLCHAIN_ARM_MICRO/startup_efm32zg.s +++ b/libraries/mbed/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/TOOLCHAIN_ARM_MICRO/startup_efm32zg.s @@ -29,7 +29,7 @@ ; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; -Stack_Size EQU 0x00000400 +Stack_Size EQU 0x00000200 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size diff --git a/libraries/mbed/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/TOOLCHAIN_GCC_ARM/startup_efm32zg.S b/libraries/mbed/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/TOOLCHAIN_GCC_ARM/startup_efm32zg.S index 2ae76f121c..466de1d800 100644 --- a/libraries/mbed/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/TOOLCHAIN_GCC_ARM/startup_efm32zg.S +++ b/libraries/mbed/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/TOOLCHAIN_GCC_ARM/startup_efm32zg.S @@ -37,7 +37,7 @@ #ifdef __STACK_SIZE .equ Stack_Size, __STACK_SIZE #else - .equ Stack_Size, 0x400 + .equ Stack_Size, 0x200 #endif .globl __StackTop .globl __StackLimit From 8fea0fdf8d5d4e9518c94d7fc786ab75646d66f4 Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Tue, 5 May 2015 15:35:10 -0500 Subject: [PATCH 3/4] redefine OPEN_MAX from sys_limits for ZG and HG because they are RAM-limited parts, and in doing so, we save about 200 bytes of RAM. --- .../TARGET_EFM32/TARGET_EFM32HG_STK3400/device.h | 5 +++++ .../TARGET_EFM32/TARGET_EFM32ZG_STK3200/device.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/device.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/device.h index 0ef7e6deb3..d1873076f9 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/device.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/device.h @@ -50,6 +50,11 @@ #define DEVICE_LOWPOWERTIMER 1 +// Redefine OPEN_MAX from sys_limits.h to save on RAM. +// Effect: maximum amount of file handlers = OPEN_MAX +// This is not going to have an impact, since this is a RAM-limited part anyway. +#define OPEN_MAX 24 + #include "objects.h" #include "Modules.h" #include "device_peripherals.h" diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/device.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/device.h index 0ef7e6deb3..d7b54e2aaf 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/device.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/device.h @@ -50,6 +50,11 @@ #define DEVICE_LOWPOWERTIMER 1 +// Redefine OPEN_MAX from sys_limits.h to save on RAM. +// Effect: maximum amount of file handlers = OPEN_MAX +// This is not going to have an impact, since this is a RAM-limited part anyway. +#define OPEN_MAX 8 + #include "objects.h" #include "Modules.h" #include "device_peripherals.h" From 74f1dc1cb672a8000fefacf5a2d134a5feb33100 Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Tue, 5 May 2015 15:40:42 -0500 Subject: [PATCH 4/4] Update exporter to optimize for size Set a few flags to reduce code size --- workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl | 2 +- workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl | 2 +- workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl | 2 +- workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl | 2 +- workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl | 2 +- workspace_tools/export/simplicityv3_slsproj.tmpl | 8 ++++++-- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl b/workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl index 7973f2716d..5a3920aabe 100644 --- a/workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl +++ b/workspace_tools/export/gcc_arm_efm32gg_stk3700.tmpl @@ -23,7 +23,7 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump SIZE = $(GCC_BIN)arm-none-eabi-size CPU = -mcpu=cortex-m3 -mthumb -CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections +CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fno-common -fomit-frame-pointer CC_FLAGS += -MMD -MP ifeq ($(DEBUG), 1) diff --git a/workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl b/workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl index c15810f75c..b45dc6469e 100644 --- a/workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl +++ b/workspace_tools/export/gcc_arm_efm32hg_stk3400.tmpl @@ -23,7 +23,7 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump SIZE = $(GCC_BIN)arm-none-eabi-size CPU = -mcpu=cortex-m0plus -mthumb -CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections +CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fno-common -fomit-frame-pointer CC_FLAGS += -MMD -MP ifeq ($(DEBUG), 1) diff --git a/workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl b/workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl index 7973f2716d..5a3920aabe 100644 --- a/workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl +++ b/workspace_tools/export/gcc_arm_efm32lg_stk3600.tmpl @@ -23,7 +23,7 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump SIZE = $(GCC_BIN)arm-none-eabi-size CPU = -mcpu=cortex-m3 -mthumb -CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections +CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fno-common -fomit-frame-pointer CC_FLAGS += -MMD -MP ifeq ($(DEBUG), 1) diff --git a/workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl b/workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl index 7973f2716d..5a3920aabe 100644 --- a/workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl +++ b/workspace_tools/export/gcc_arm_efm32wg_stk3800.tmpl @@ -23,7 +23,7 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump SIZE = $(GCC_BIN)arm-none-eabi-size CPU = -mcpu=cortex-m3 -mthumb -CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections +CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fno-common -fomit-frame-pointer CC_FLAGS += -MMD -MP ifeq ($(DEBUG), 1) diff --git a/workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl b/workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl index c15810f75c..b45dc6469e 100644 --- a/workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl +++ b/workspace_tools/export/gcc_arm_efm32zg_stk3200.tmpl @@ -23,7 +23,7 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump SIZE = $(GCC_BIN)arm-none-eabi-size CPU = -mcpu=cortex-m0plus -mthumb -CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections +CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fno-common -fomit-frame-pointer CC_FLAGS += -MMD -MP ifeq ($(DEBUG), 1) diff --git a/workspace_tools/export/simplicityv3_slsproj.tmpl b/workspace_tools/export/simplicityv3_slsproj.tmpl index 0e3109a157..ac4d35519f 100644 --- a/workspace_tools/export/simplicityv3_slsproj.tmpl +++ b/workspace_tools/export/simplicityv3_slsproj.tmpl @@ -62,8 +62,10 @@ {# For debug build, don't apply optimizations #} + + - + @@ -105,8 +107,10 @@ {# Use optimize for size on release build #} + + - +