This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

section .text make region `FLASH' overflowed (around 14ko)

Hello all,

I try to import Keil project into Eclipse with Makefile. I managed put all my source file to be compiled, and my include paths etc.. in my Makefile

In Keil, it compiles without any issue. But my code is too big when compiled through Eclipse, which causes flash overflowed by 14528 bytes.

I specified the FLASH settings I had on Keil to my .ld file (starts at 0x23000 and 0x15000 lenght). So it is not a size configuration issue. I assume gcc doesn't compile the same way Keil do.

Here are my build settings on Keil :

C/C++ :

Asm :

Linker :

And here is my Makefile I use on Eclipse : I tried to report all the settiings :

# Libraries common to all targets
LIB_FILES += \

# Optimization flags
OPT = -O2 -g3
# Uncomment the line below to enable link time optimization
#OPT += -flto



CPPFLAGS += BOARD_PCA10040
CPPFLAGS += NRF52 NRF52832_XXAA
CPPFLAGS += NRF52_PAN_74
CPPFLAGS += NRF_SD_BLE_API_VERSION=5
CPPFLAGS += S132
CPPFLAGS += SOFTDEVICE_PRESENT
CPPFLAGS += SWI_DISABLE0

# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBOARD_PCA10040
CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DNRF52
CFLAGS += -DNRF52832_XXAA
CFLAGS += -DNRF52_PAN_74
CFLAGS += -DNRF_SD_BLE_API_VERSION=5
CFLAGS += -DS132
CFLAGS += -DSOFTDEVICE_PRESENT
CFLAGS += -DSWI_DISABLE0
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS +=  -Wall
CFLAGS += -Werror=implicit-function-declaration
CFLAGS += -Wno-unused-function -Wno-comment -Wno-unused-variable
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
CFLAG += -split_sections
CFLAG += -apcs=interwork
CFLAG += --cpu Cortex-M4.fp
# keep every function in a separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin -fshort-enums
CFLAG += --library_type=microlib


# C++ flags common to all targets
CXXFLAGS += $(OPT)

# Assembler flags common to all targets
ASMFLAGS += -O2 -g3
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DBOARD_PCA10040
ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
ASMFLAGS += -DNRF52
ASMFLAGS += -DNRF52832_XXAA
ASMFLAGS += -DNRF52_PAN_74
ASMFLAGS += -DNRF_SD_BLE_API_VERSION=5
ASMFLAGS += -DS132
ASMFLAGS += -DSOFTDEVICE_PRESENT
ASMFLAGS += -DSWI_DISABLE0
ASMFLAGS += -D__MICROLIB

# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
LDFLAG += --library_type=microlib
# let linker dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += -specs=nano.specs -lc -lnosys -lm



# Add standard libraries at the very end of the linker input, after all objects
# that may need symbols provided by these libraries.
LIB_FILES += -lc -lnosys -lm

What could be the issue? I am struggling for several days on it...

Either I put LDFLAG += --library_type=standardlibrary or LDFLAG += --library_type=microlib, it doesn't change anything. How do I make gcc use microlib library like Keil seems to do ?

I'll take any advice!

Thank you very much for your help

Parents Reply Children
No Data
Related