-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Description
- Type: Bug | Question
- Priority: Major
Bug / Question
Target
LPC176X
Toolchain:
GCC_ARM (GNUARM)
Expected behavior
Custom ".isr" section shall be present in output .hex file
Actual behavior
Custom ".isr" section is missing in output .hex file
Steps to reproduce
0. Compile and link the project with an unmodified .ld file from /targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_GCC_ARM/LPC1768.ld
-
Modify the linker file to place the ".isr_vector" into a custom ".isr" section (LPC1768_isr.ld)
-
Compile and link the project with modified LPC1768_isr.ld file
-
List and compare the section headers of both .elf files with: arm-eabi-readelf -S .elf
Relevant entry of unmodified sections:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 010000 00f530 00 AX 0 0 8
Relevant entry of modified sections:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .isr PROGBITS 00000000 0202e4 0000cc 00 0 0 4
[ 2] .text PROGBITS 00002000 002000 00f460 00 AX 0 0 8
.hex file content:
Block 0 Starts at: 0x2000 Ends at: 0x11683 (Length: 0xF684=63108)
00002000: 10 B5 05 4C 23 78 33 B9 04 4B 13 B1 04 48 AF F3 ...L#x3..K...H..
00002010: 00 80 01 23 23 70 10 BD E8 02 00 10 00 00 00 00 ...##p..........
00002020: 5C 14 01 00 08 4B 10 B5 1B B1 08 49 08 48 AF F3 \....K.....I.H..
00002030: 00 80 08 48 03 68 03 B9 10 BD 07 4B 00 2B FB D0 ...H.h.....K.+..
00002040: BD E8 10 40 18 47 00 BF 00 00 00 00 EC 02 00 10 [email protected]..........
00002050: 5C 14 01 00 E4 02 00 10 00 00 00 00 15 4B 00 2B \............K.+
- Patch the startup file and assign the ".isr_vector" the section attribute "allocated" in file /targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_GCC_ARM/startup_LPC17xx.S
63c63
< .section .isr_vector
---
> .section .isr_vector,"a"
- List the section headers of the patched version with the modified LPC1768_isr.ld file
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .isr PROGBITS 00000000 010000 0000cc 00 A 0 0 4
[ 2] .text PROGBITS 00002000 012000 00f460 00 AX 0 0 8
.hex file content:
Block 0 Starts at: 0x 0 Ends at: 0x CB (Length: 0xCC=204)
Block 1 Starts at: 0x2000 Ends at: 0x11683 (Length: 0xF684=63108)
00000000: E0 7F 00 10 55 A6 00 00 85 A6 00 00 87 A6 00 00 . ..U...........
00000010: 89 A6 00 00 8B A6 00 00 8D A6 00 00 00 00 00 00 ................
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 45 C5 00 00 ............E...
00000030: 91 A6 00 00 00 00 00 00 AF C5 00 00 E5 C5 00 00 ................
00000040: 97 A6 00 00 97 A6 00 00 97 A6 00 00 97 A6 00 00 ................
00000050: 97 A6 00 00 97 A6 00 00 97 A6 00 00 97 A6 00 00 ................
00000060: 97 A6 00 00 97 A6 00 00 97 A6 00 00 97 A6 00 00 ................
00000070: 97 A6 00 00 97 A6 00 00 97 A6 00 00 97 A6 00 00 ................
00000080: 97 A6 00 00 97 A6 00 00 97 A6 00 00 97 A6 00 00 ................
00000090: 97 A6 00 00 97 A6 00 00 97 A6 00 00 97 A6 00 00 ................
000000A0: 97 A6 00 00 97 A6 00 00 97 A6 00 00 97 A6 00 00 ................
000000B0: 97 A6 00 00 97 A6 00 00 97 A6 00 00 97 A6 00 00 ................
000000C0: 97 A6 00 00 97 A6 00 00 97 A6 00 00 ............
00002000: 10 B5 05 4C 23 78 33 B9 04 4B 13 B1 04 48 AF F3 ...L#x3..K...H..
00002010: 00 80 01 23 23 70 10 BD E8 02 00 10 00 00 00 00 ...##p..........
00002020: 5C 14 01 00 08 4B 10 B5 1B B1 08 49 08 48 AF F3 \....K.....I.H..
00002030: 00 80 08 48 03 68 03 B9 10 BD 07 4B 00 2B FB D0 ...H.h.....K.+..
00002040: BD E8 10 40 18 47 00 BF 00 00 00 00 EC 02 00 10 [email protected]..........
00002050: 5C 14 01 00 E4 02 00 10 00 00 00 00 15 4B 00 2B \............K.+
Question
- Is there a way to define the "allocated" section attribute in the linker file?
- Is it a suitable way to extend mbed-os LPC17xx.S startup file to avoid this bug?
Metadata
Metadata
Assignees
Labels
No labels