I use the executable file demo.axf of the project in STM32F4xx_DFP.2.15.0, execute readelf -S demo.axf on the command line and find that the debug version has not .debug.str, while the release version has not .debug.str, two condition all use compiler5(agmcc) and other configuration is same.
My development environment is: keil5.36 MDK, my goal is to extract variable names from .debug.str.
--------------------
debug version print
---------------------
C:\Users\10004265\Desktop\Demo_compiler5_YES_debugstr\Debug>readelf -S Demo.axfThere are 17 section headers, starting at offset 0x1438ac:Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] ER_IROM1 PROGBITS 08000000 000034 016f88 00 AX 0 0 4 [ 2] RW_IRAM1 PROGBITS 20000000 016fbc 0001f8 00 WA 0 0 8 [ 3] RW_IRAM1 NOBITS 20008900 0171b4 000c80 00 WA 0 0 8 [ 4] RW_IRAM2 NOBITS 10000000 0171b4 0004a4 00 WA 0 0 64 [ 5] .debug_abbrev PROGBITS 00000000 0171b4 0005c4 00 0 0 1 [ 6] .debug_frame PROGBITS 00000000 017778 005080 00 0 0 1 [ 7] .debug_info PROGBITS 00000000 01c7f8 028358 00 0 0 1 [ 8] .debug_line PROGBITS 00000000 044b50 0123bc 00 0 0 1 [ 9] .debug_loc PROGBITS 00000000 056f0c 00f378 00 0 0 1 [10] .debug_macinfo PROGBITS 00000000 066284 0b6d5c 00 0 0 1 [11] .debug_pubnames PROGBITS 00000000 11cfe0 003b5e 00 0 0 1 [12] .symtab SYMTAB 00000000 120b40 005d60 10 13 710 4 [13] .strtab STRTAB 00000000 1268a0 008238 00 0 0 1 [14] .note NOTE 00000000 12ead8 000020 00 0 0 4 [15] .comment PROGBITS 00000000 12eaf8 014cf0 00 0 0 1 [16] .shstrtab STRTAB 00000000 1437e8 0000a4 00 0 0 1Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific)
------------------
release version print
-------------------
C:\Users\10004265\Desktop\Demo_compiler5_YES_debugstr\Release>readelf -S Demo.axfThere are 19 section headers, starting at offset 0x11ce48:Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] ER_IROM1 PROGBITS 08000000 000034 012b7c 00 AX 0 0 4 [ 2] RW_IRAM1 PROGBITS 20000000 012bb0 0001f8 00 WA 0 0 8 [ 3] RW_IRAM1 NOBITS 200088fc 012da8 000c84 00 WA 0 0 8 [ 4] .debug_abbrev PROGBITS 00000000 012da8 001ad4 00 0 0 1 [ 5] .debug_aranges PROGBITS 00000000 01487c 000020 00 0 0 1 [ 6] .debug_frame PROGBITS 00000000 01489c 003178 00 0 0 1 [ 7] .debug_info PROGBITS 00000000 017a14 01f54c 00 0 0 1 [ 8] .debug_line PROGBITS 00000000 036f60 00f621 00 0 0 1 [ 9] .debug_loc PROGBITS 00000000 046581 00ba18 00 0 0 1 [10] .debug_macinfo PROGBITS 00000000 051f99 0abe34 00 0 0 1 [11] .debug_pubnames PROGBITS 00000000 0fddcd 001c0f 00 0 0 1 [12] .debug_str PROGBITS 00000000 0ff9dc 0045b9 00 0 0 1 [13] .debug_ranges PROGBITS 00000000 103f95 000740 00 0 0 1 [14] .symtab SYMTAB 00000000 1046d8 004ad0 10 15 713 4 [15] .strtab STRTAB 00000000 1091a8 0055f4 00 0 0 1 [16] .note NOTE 00000000 10e79c 00001c 00 0 0 4 [17] .comment PROGBITS 00000000 10e7b8 00e5ac 00 0 0 1 [18] .shstrtab STRTAB 00000000 11cd64 0000c4 00 0 0 1Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific)