summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2017-05-12 17:32:00 -0700
committerStefan Agner <stefan.agner@toradex.com>2017-05-16 12:34:26 -0700
commite5ee7247b636ae13cbe231306070108d1672b4bb (patch)
tree82ed0244c6fe80253dc0e4f35eeeec5266e91ded
parentcc59882c7f0efe34baecd6ff68e1b2053a492112 (diff)
force program header alignment to be smaller than 32kbytes
GCC 5 and newer seem to choose higher alignment values in elf program headers than older versions. This causes issues when doing address translations with areas which have lower alignment: It moves the base address outside of memory base addresse (e.g. TCML memory base address is aligned to 32kiB). With 4K we use a safe and sensible value for alignment. With that all elf program headers are aligned with 0x1000. $ readelf -l debug/hello_world.elf Elf file type is EXEC (Executable file) Entry point 0x1fff8311 There are 3 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x001000 0x1fff8000 0x1fff8000 0x00240 0x00240 R 0x1000 LOAD 0x001240 0x1fff8240 0x1fff8240 0x03904 0x03904 RWE 0x1000 LOAD 0x005000 0x20000000 0x1fffbb44 0x00070 0x059b0 RW 0x1000 Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
-rw-r--r--examples/imx7_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/imx7_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt b/examples/imx7_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt
index 3942552..9dc58b4 100644
--- a/examples/imx7_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt
+++ b/examples/imx7_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt
@@ -36,7 +36,7 @@ SET(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -std=gnu99")
# DEFAULT LD FLAGS
-SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nano.specs -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nano.specs -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -z max-page-size=4096 -Xlinker muldefs")
# DEBUG ASM FLAGS
SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -g")