gcc ARM : section .text make region `FLASH' overflowed (around 14ko) [message #1822248] |
Mon, 02 March 2020 09:22 |
Eclipse User |
|
|
|
Hello all,
I try to import Keil project (nRF52832) 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++ :
Define : BOARD_PCA10040 NRF52 NRF52832_XXAA NRF52_PAN_74 NRF_SD_BLE_API_VERSION=5 S132 SOFTDEVICE_PRESENT SWI_DISABLE0
Compiler control string (include paths not shown) : --c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O2 --apcs=interwork --split_sections
includes paths
-D__UVISION_VERSION="526" -D_RTE_ -DNRF52 -DBOARD_PCA10040 -DNRF52 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF_SD_BLE_API_VERSION="5" -DS132 -DSOFTDEVICE_PRESENT -DSWI_DISABLE0
-o .\_build\*.o --omf_browse .\_build\*.crf --depend .\_build\*.d
Asm :
Define : BOARD_CUSTOM CONFIG_GPIO_AS_PINRESET NRF52 NRF52832_XXAA NRF52_PAN_74 NRF_SD_BLE_API_VERSION=5 S132 SOFTDEVICE_PRESENT SWI_DISABLE0
Assembler control string (include paths not shown) :
--cpu Cortex-M4.fp -g --apcs=interwork --pd "__MICROLIB SETA 1"
include paths
--pd "__UVISION_VERSION SETA 526" --pd "_RTE_ SETA 1" --pd "NRF52 SETA 1" --pd "BOARD_CUSTOM SETA 1" --pd "CONFIG_GPIO_AS_PINRESET SETA 1" --pd "NRF52 SETA 1" --pd "NRF52832_XXAA SETA 1" --pd "NRF52_PAN_74 SETA 1" --pd "NRF_SD_BLE_API_VERSION SETA 5" --pd "S132 SETA 1" --pd "SOFTDEVICE_PRESENT SETA 1" --pd "SWI_DISABLE0 SETA 1" --list ".\_build\*.lst" --xref -o "*.o" --depend "*.d"
Linker control string :
--cpu Cortex-M4.fp *.o
--library_type=microlib --strict --scatter ".\_build\nrf52832_xxaa.sct"
--diag_suppress 6330 --summary_stderr --info summarysizes --map --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers
--list ".\_build\nrf52832_xxaa.map"
-o .\_build\nrf52832_xxaa.axf
And here is my Makefile I use on Eclipse : I tried to report 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
|
|
|
Powered by
FUDForum. Page generated in 0.04770 seconds