请问在我读取ELF文件时各节区字段信息

wangshuoran
Posts: 37
Joined: Fri Dec 24, 2021 12:40 pm

请问在我读取ELF文件时各节区字段信息

Postby wangshuoran » Fri Apr 15, 2022 10:52 am

在ESP32-C3编译完成的ELF中,我们可以用readelf.exe -S .\xxx.elf来看有什么节区:
void app_main(void) {
char buf[256] = "你";
}
那么上面的代码也应该会编译到一个节区中,但是https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-guides/memory-types.html在文档中我找到会对应readelf.exe -x.flash.text .\smart_remind_drinking_pad.elf区,那么我打印出来的时候,没有任何和utf8有关的“你”这个数据,请问我的操作有误吗?

我这里打印了这个程序所有的ELF区:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .rtc.text PROGBITS 50000000 03c010 000000 00 W 0 0 1
[ 2] .rtc.dummy PROGBITS 50000000 03c010 000000 00 W 0 0 1
[ 3] .rtc.force_fast PROGBITS 50000000 03c010 000000 00 W 0 0 1
[ 4] .rtc.data PROGBITS 50000000 03c000 000010 00 WA 0 0 8
[ 5] .rtc_noinit PROGBITS 50000010 03c010 000000 00 W 0 0 1
[ 6] .rtc.force_slow PROGBITS 50000010 03c010 000000 00 W 0 0 1
[ 7] .iram0.text PROGBITS 40380000 023000 0096ce 00 AX 0 0 256
[ 8] .dram0.dummy NOBITS 3fc80000 017000 009800 00 WA 0 0 1
[ 9] .dram0.data PROGBITS 3fc89800 020800 001a18 00 WA 0 0 8
[10] .noinit PROGBITS 3fc8b218 03c010 000000 00 W 0 0 1
[11] .dram0.bss NOBITS 3fc8b220 022218 000e48 00 WA 0 0 16
[12] .flash.text PROGBITS 42000020 02d020 00ecd0 00 AX 0 0 2
[13] .flash_rodata_dum NOBITS 3c000020 001020 010000 00 WA 0 0 1
[14] .flash.appdesc PROGBITS 3c010020 011020 000100 00 A 0 0 16
[15] .flash.rodata PROGBITS 3c010120 011120 005918 00 WA 0 0 16
[16] .flash.rodata_nol PROGBITS 3c015a38 03c010 000000 00 W 0 0 1
[17] .iram0.text_end NOBITS 403896ce 02c6ce 000132 00 WA 0 0 1
[18] .iram0.data PROGBITS 40389800 03c010 000000 00 W 0 0 1
[19] .iram0.bss PROGBITS 40389800 03c010 000000 00 W 0 0 1
[20] .dram0.heap_start NOBITS 3fc8c068 022218 000008 00 WA 0 0 1
[21] .debug_info PROGBITS 00000000 03c010 124942 00 0 0 1
[22] .debug_abbrev PROGBITS 00000000 160952 01aeec 00 0 0 1
[23] .debug_loc PROGBITS 00000000 17b83e 040aa3 00 0 0 1
[24] .debug_aranges PROGBITS 00000000 1bc2e8 0032a8 00 0 0 8
[25] .debug_ranges PROGBITS 00000000 1bf590 006110 00 0 0 1
[26] .debug_line PROGBITS 00000000 1c56a0 07b301 00 0 0 1
[27] .debug_str PROGBITS 00000000 2409a1 01e55e 01 MS 0 0 1
[28] .comment PROGBITS 00000000 25eeff 000025 01 MS 0 0 1
[29] .riscv.attributes LOPROC+0x3 00000000 25ef24 000028 00 0 0 1
[30] .debug_frame PROGBITS 00000000 25ef4c 00aa48 00 0 0 4
[31] .symtab SYMTAB 00000000 269994 00c4a0 10 32 631 4
[32] .strtab STRTAB 00000000 275e34 00ea66 00 0 0 1
[33] .shstrtab STRTAB 00000000 28489a 0001aa 00 0 0 1

请问,如果我操作有误的话,那么存放数据的扇区应该在哪里?

Who is online

Users browsing this forum: No registered users and 83 guests