What I did was:
- generate ELF file
- create two binaries using esptool elf2image - it produced 0x00000 0x10000 bins
- flashed it to 0x00000 0x10000
I didn't flashed the RF cal 128 bytes sector, because if I do so, it produces completely different output (see below). It seems it doesn't work at all if I flash the RF cal sector.
The problem is that it "somehow" boots up, BUT it throws an exception and then WDT resets.
Please notice that I remapped my code (.text areas) to the flash by a linker script - I was lazy to put ICACHE_FLASH_ATTR to every single function in my code (a large project).
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40210000, len = 0xC0000
(…)
.irom0.text : ALIGN(4)
{
_irom0_text_start = ABSOLUTE(.);
---------------- SDK LIBS HERE -----------------------
/* Custom Mapping HERE --------- */
*liblibbacnet_demo_handler_esp8266_mstp.a:*(.text.*)
*liblibesp8266_mstp.a:*(.text.*)
*liblibbacnet_demo_object_mstp.a:*(.text.*)
*liblibbacnet_esp8266_mstp.a:*(.text.*)
*bootloader_impl.*(.text.*)
*bootloader_common.*(.text.*)
_irom0_text_end = ABSOLUTE(.);
} >irom0_0_seg :irom0_0_phdr
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x3ffe8000, len 884, room 16
tail 4
chksum 0xda
load 0x3ffe8380, len 744, room 4
tail 4
chksum 0xfb
load 0x40100000, len 24688, room 4
tail 12
chksum 0xd3
csum 0xd3
rf_cal[0] !=0x05,is 0xFF
rf cal sector: 1019
freq trace enable 0
rf[112] : ff
rf[113] : ff
rf[114] : ff
w_flash
SDK ver: 2.2.1(6ab97e9) compiled @ Jun 7 2018 13:59:14
phy ver: 3097_2, pp ver: 198.23
mode : softAP(5e:cf:7f:a4:54:be)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
Fatal exception 28(LoadProhibitedCause):
epc1=0x40101bbe, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000004, depc=0x0
0000000
The code is as simple as this:
void ICACHE_FLASH_ATTR
user_init(void)
{
system_init_done_cb(sdk_init_done_cb);
}
void ICACHE_FLASH_ATTR
sdk_init_done_cb(void) {
/* You app Initialization here */
// Config pin as GPIO16
//PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12);
//GPIO_OUTPUT_SET(12, 1);
while (1)
{
os_printf("test");
system_soft_wdt_feed();
}
}
Now if I flash the 128 B RF cal sector to 0x3FC000, I see basically no booting as I mentioned above:
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x3ffe8000, len 884, room 16
tail 4
chksum 0xda
load 0x3ffe8380, len 744, room 4
tail 4
chksum 0xfb
load 0x40100000, len 24688, room 4
tail 12
chksum 0xd3
csum 0xd3
mai 274