#elf
elf文件来源是https://www.esp32.com/viewtopic.php?t=21331#
里的
https://dl.espressif.com/dl/esp32c3_rev3_rom.elf
通过readelf读出来的Program Headers如下:
```c
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x3fcca000 0x3fcca000 0x003b4 0x15664 RW 0x1000
LOAD 0x1168000 0x40000000 0x40000000 0x59590 0x59590 R E 0x1000
LOAD 0x000830 0x3fcdf830 0x40059590 0x00000 0x00004 RW 0x1000
LOAD 0x000834 0x3fcdf834 0x40059590 0x00000 0x00018 RW 0x1000
LOAD 0x00084c 0x3fcdf84c 0x40059590 0x00000 0x00024 RW 0x1000
LOAD 0x000870 0x3fcdf870 0x40059590 0x00000 0x000fc RW 0x1000
LOAD 0x11c196c 0x3fcdf96c 0x40059590 0x000bc 0x00664 RW 0x1000
LOAD 0x000fd0 0x3fcdffd0 0x4005964c 0x00000 0x00002 RW 0x1000
LOAD 0x11c1fd4 0x3fcdffd4 0x4005964c 0x00004 0x00008 RW 0x1000
LOAD 0x000fdc 0x3fcdffdc 0x40059650 0x00000 0x00008 RW 0x1000
LOAD 0x11c1fe4 0x3fcdffe4 0x40059650 0x00004 0x00008 RW 0x1000
LOAD 0x11c1fec 0x3fcdffec 0x40059654 0x0000c 0x00010 RW 0x1000
LOAD 0x11c1ffc 0x3fcdfffc 0x40059660 0x00004 0x00004 RW 0x1000
LOAD 0x11c2e00 0x3fccae00 0x40059664 0x00004 0x00004 RW 0x1000
LOAD 0x11c3710 0x3fcde710 0x40059668 0x00000 0x00000 RW 0x1000
LOAD 0x11c3f1c 0x3fcdef1c 0x40059668 0x00000 0x00000 RW 0x1000
LOAD 0x11c3f60 0x3fcdef60 0x40059668 0x00000 0x00000 RW 0x1000
LOAD 0x11c4060 0x3fcdf060 0x40059668 0x00004 0x00004 RW 0x1000
LOAD 0x11c409c 0x3fcdf09c 0x4005966c 0x0000c 0x0000c RW 0x1000
LOAD 0x0010d4 0x3fcdf0d4 0x3fcdf0d4 0x37a708 0x37a708 RW 0x1000
LOAD 0x37c5bc 0x3fcdf5bc 0x3fcdf5bc 0x37a4fc 0x37a4fc RW 0x1000
LOAD 0x6f7638 0x3fcdf638 0x3fcdf638 0x37a488 0x37a488 RW 0x1000
LOAD 0xa72650 0x3fcdf650 0x3fcdf650 0x37a474 0x37a474 RW 0x1000
LOAD 0x11c4654 0x3fcdf654 0x40059ac4 0x00000 0x00000 RW 0x1000
LOAD 0x11c465c 0x3fcdf65c 0x40059ac4 0x00000 0x00000 RW 0x1000
LOAD 0xded664 0x3fcdf664 0x3fcdf664 0x37a460 0x37a460 RW 0x1000
LOAD 0x11c4c00 0x3ff19c00 0x40059c00 0x04ec8 0x04ec8 R 0x1000
LOAD 0x11c9e3c 0x3ff1ee3c 0x4005ee3c 0x011c4 0x011c4 R 0x1000
```
我的疑惑是:
1.为啥有些项的MemSiz会为0,为0的为什么会产生(留着)
2.
```c
LOAD 0x0010d4 0x3fcdf0d4 0x3fcdf0d4 0x37a708 0x37a708 RW 0x1000
LOAD 0x37c5bc 0x3fcdf5bc 0x3fcdf5bc 0x37a4fc 0x37a4fc RW 0x1000
LOAD 0x6f7638 0x3fcdf638 0x3fcdf638 0x37a488 0x37a488 RW 0x1000
```
这段LOAD是有地址重叠的,例如第一行0x3fcdf0d4开始0x37a708与第二行的0x3fcdf5bc产生重叠,请问这是什么情况
说具体点,现在我有这个elf文件,我实际要的是ROM里的具体存放操作。
例如,
```
LOAD 0x1168000 0x40000000 0x40000000 0x59590 0x59590 R E 0x1000
```
我对此要的操作是elf文件0x1168000偏移量开始的0x59590字节读到模拟器虚地址0x40000000开始的地方。
而面对
```c
LOAD 0x0010d4 0x3fcdf0d4 0x3fcdf0d4 0x37a708 0x37a708 RW 0x1000
LOAD 0x37c5bc 0x3fcdf5bc 0x3fcdf5bc 0x37a4fc 0x37a4fc RW 0x1000
LOAD 0x6f7638 0x3fcdf638 0x3fcdf638 0x37a488 0x37a488 RW 0x1000
```
的时候,到底应该怎么搬运
例如
```c
LOAD 0x6f7638 0x3fcdf638 0x3fcdf638 0x37a488 0x37a488 RW 0x1000
```
0x3fcdf638开始放0x37a488字节会到0x4005 9AC0,而这和前面的0x40000000冲突。但是,0x40000000这段是确定有用的。
elf文件来源是https://www.esp32.com/viewtopic.php?t=21331#
里的
https://dl.espressif.com/dl/esp32c3_rev3_rom.elf
通过readelf读出来的Program Headers如下:
```c
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x3fcca000 0x3fcca000 0x003b4 0x15664 RW 0x1000
LOAD 0x1168000 0x40000000 0x40000000 0x59590 0x59590 R E 0x1000
LOAD 0x000830 0x3fcdf830 0x40059590 0x00000 0x00004 RW 0x1000
LOAD 0x000834 0x3fcdf834 0x40059590 0x00000 0x00018 RW 0x1000
LOAD 0x00084c 0x3fcdf84c 0x40059590 0x00000 0x00024 RW 0x1000
LOAD 0x000870 0x3fcdf870 0x40059590 0x00000 0x000fc RW 0x1000
LOAD 0x11c196c 0x3fcdf96c 0x40059590 0x000bc 0x00664 RW 0x1000
LOAD 0x000fd0 0x3fcdffd0 0x4005964c 0x00000 0x00002 RW 0x1000
LOAD 0x11c1fd4 0x3fcdffd4 0x4005964c 0x00004 0x00008 RW 0x1000
LOAD 0x000fdc 0x3fcdffdc 0x40059650 0x00000 0x00008 RW 0x1000
LOAD 0x11c1fe4 0x3fcdffe4 0x40059650 0x00004 0x00008 RW 0x1000
LOAD 0x11c1fec 0x3fcdffec 0x40059654 0x0000c 0x00010 RW 0x1000
LOAD 0x11c1ffc 0x3fcdfffc 0x40059660 0x00004 0x00004 RW 0x1000
LOAD 0x11c2e00 0x3fccae00 0x40059664 0x00004 0x00004 RW 0x1000
LOAD 0x11c3710 0x3fcde710 0x40059668 0x00000 0x00000 RW 0x1000
LOAD 0x11c3f1c 0x3fcdef1c 0x40059668 0x00000 0x00000 RW 0x1000
LOAD 0x11c3f60 0x3fcdef60 0x40059668 0x00000 0x00000 RW 0x1000
LOAD 0x11c4060 0x3fcdf060 0x40059668 0x00004 0x00004 RW 0x1000
LOAD 0x11c409c 0x3fcdf09c 0x4005966c 0x0000c 0x0000c RW 0x1000
LOAD 0x0010d4 0x3fcdf0d4 0x3fcdf0d4 0x37a708 0x37a708 RW 0x1000
LOAD 0x37c5bc 0x3fcdf5bc 0x3fcdf5bc 0x37a4fc 0x37a4fc RW 0x1000
LOAD 0x6f7638 0x3fcdf638 0x3fcdf638 0x37a488 0x37a488 RW 0x1000
LOAD 0xa72650 0x3fcdf650 0x3fcdf650 0x37a474 0x37a474 RW 0x1000
LOAD 0x11c4654 0x3fcdf654 0x40059ac4 0x00000 0x00000 RW 0x1000
LOAD 0x11c465c 0x3fcdf65c 0x40059ac4 0x00000 0x00000 RW 0x1000
LOAD 0xded664 0x3fcdf664 0x3fcdf664 0x37a460 0x37a460 RW 0x1000
LOAD 0x11c4c00 0x3ff19c00 0x40059c00 0x04ec8 0x04ec8 R 0x1000
LOAD 0x11c9e3c 0x3ff1ee3c 0x4005ee3c 0x011c4 0x011c4 R 0x1000
```
我的疑惑是:
1.为啥有些项的MemSiz会为0,为0的为什么会产生(留着)
2.
```c
LOAD 0x0010d4 0x3fcdf0d4 0x3fcdf0d4 0x37a708 0x37a708 RW 0x1000
LOAD 0x37c5bc 0x3fcdf5bc 0x3fcdf5bc 0x37a4fc 0x37a4fc RW 0x1000
LOAD 0x6f7638 0x3fcdf638 0x3fcdf638 0x37a488 0x37a488 RW 0x1000
```
这段LOAD是有地址重叠的,例如第一行0x3fcdf0d4开始0x37a708与第二行的0x3fcdf5bc产生重叠,请问这是什么情况
说具体点,现在我有这个elf文件,我实际要的是ROM里的具体存放操作。
例如,
```
LOAD 0x1168000 0x40000000 0x40000000 0x59590 0x59590 R E 0x1000
```
我对此要的操作是elf文件0x1168000偏移量开始的0x59590字节读到模拟器虚地址0x40000000开始的地方。
而面对
```c
LOAD 0x0010d4 0x3fcdf0d4 0x3fcdf0d4 0x37a708 0x37a708 RW 0x1000
LOAD 0x37c5bc 0x3fcdf5bc 0x3fcdf5bc 0x37a4fc 0x37a4fc RW 0x1000
LOAD 0x6f7638 0x3fcdf638 0x3fcdf638 0x37a488 0x37a488 RW 0x1000
```
的时候,到底应该怎么搬运
例如
```c
LOAD 0x6f7638 0x3fcdf638 0x3fcdf638 0x37a488 0x37a488 RW 0x1000
```
0x3fcdf638开始放0x37a488字节会到0x4005 9AC0,而这和前面的0x40000000冲突。但是,0x40000000这段是确定有用的。