Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By kolban
#26723 Howdy folks,
I'm making slow (but I hope steady) growth on understanding memory. I am trying to port a large application to run on the ESP8266 and have started getting a new message that I haven't seen before. Here are the details. After flashing I get the following messages on boot:

Code: Select allload 0x40100000, len 28432, room 16
tail 0
chksum 0x1e
load 0x3ffe8000, len 2528, room 8
tail 8
chksum 0x09
load 0x3ffe89e0, len 19112, room 0
tail 8
chksum 0x38
load 0x40106f10, len 452, room 0
tail 4
chksum 0xcf
csum 0xcf
system param error
0c 0c 03 c5 a6 03 2d 0c 0c 03 c5 a6 03 4d 0d 28 0d 0c 60 0c 73 09 12 1c a2 01 8f c7 c0 00 00 c8
11 d8 21 08 01 12 c1 10 0d f0 00 00 12 c1 e0 52 61 ....


If I flash other applications they work. It almost "feels" like I might be trying to load too much and am spilling into some configuration memory.

Has anyone seen the message "system param error" before? Anyone seen the ESP produce a hex dump like this?

Perhaps my load addresses for segment and their lengths are off?

What does the "room" message at the end of the lines mean?

So many fun mysteries :-)

Neil
User avatar
By Barnabybear
#26732 Hi, is this any help https://github.com/esp8266/Arduino/issues/708.
Also, two pairs of the four blocks follow on from each other but there is a gap in the middle. Not sure if thats important.
0x3ffe8000 + len 2528 = 0x3ffe89e0
0x3ffe89e0 + len 19112 = 3ffed488
leaves a 1125240 (decimal) gap
0x40100000 + len 28432 = 0x40106f10
0x40106f10 + len 452 = last one, so guessing not important.
User avatar
By pvvx
#26741
Code: Select allReverse SDK

struct ets_store_wifi_hdr { // Sector flash addr flashchip->chip_size-0x1000  (0x07F000)
    uint8 bank;     // +00 = 0, 1 // WiFi config flash addr: 0 - flashchip->chip_size-0x3000 (0x7D000), 1 - flashchip->chip_size-0x2000
   uint32 flag;   // +04 = 0x55AA55AA
   uint32 x;       // +08
   uint32 xx[2];   // +12
   uint32 chk[2];   // +20
};



void SysParmErr(void)
{

   os_printf("system param error\n");
   ....
   print_hex_damp
}




void   startup(void)
{

   struct ets_store_wifi_hdr hbuf;   
   ....
   spi_flash_read(flashchip->chip_size - 0x1000,(uint32 *)(&hbuf), sizeof(hbuf));
   

   if(hbuf.flag != 0x55AA55AA || system_get_checksum((uint8 *)wifi_config, hbuf.xx[(hbuf.bank)? 1 : 0]) != hbuf.chk[(hbuf.bank)? 1 : 0]) {

      SysParmErr(void);
   };   
   ...
}   
User avatar
By kolban
#26744 @Barnabybear, @pvvx,
Many thanks for taking the time to respond. I think y'all are helping me to hone in on the issue. The ELF that I am uploading has sections that look as follows:

Code: Select allSections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         000009e0  3ffe8000  3ffe8000  000000e0  2**4
                  CONTENTS, ALLOC, LOAD, DATA
  1 .rodata       00004ab4  3ffe89e0  3ffe89e0  00000ac0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .bss          0000a1a8  3ffed498  3ffed498  00005578  2**4
                  ALLOC
  3 .text         00006f10  40100000  40100000  00005574  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  4 .iram0.text   00000263  40106f10  40106f10  0000c484  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  5 .irom0.text   0004ab78  40240000  40240000  0000c6f0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  6 .xtensa.info  00000038  00000000  00000000  00057268  2**0
                  CONTENTS, READONLY
  7 .xt.prop      0003edc0  00000000  00000000  000572a0  2**0
                  CONTENTS, READONLY
  8 .xt.lit       00001c88  00000000  00000000  00096060  2**0
                  CONTENTS, READONLY
  9 .comment      00001a18  00000000  00000000  00097ce8  2**0
                  CONTENTS, READONLY
 10 .debug_line   0000458e  00000000  00000000  00099700  2**0
                  CONTENTS, READONLY, DEBUGGING
 11 .debug_info   00003444  00000000  00000000  0009dc8e  2**0
                  CONTENTS, READONLY, DEBUGGING
 12 .debug_abbrev 00000b5d  00000000  00000000  000a10d2  2**0
                  CONTENTS, READONLY, DEBUGGING
 13 .debug_aranges 00000498  00000000  00000000  000a1c30  2**3
                  CONTENTS, READONLY, DEBUGGING
 14 .debug_frame  00000158  00000000  00000000  000a20c8  2**2
                  CONTENTS, READONLY, DEBUGGING
 15 .debug_loc    000016d0  00000000  00000000  000a2220  2**0
                  CONTENTS, READONLY, DEBUGGING
 16 .debug_str    000008cf  00000000  00000000  000a38f0  2**0
                  CONTENTS, READONLY, DEBUGGING
 17 .debug_ranges 000000e8  00000000  00000000  000a41bf  2**0
                  CONTENTS, READONLY, DEBUGGING


If we look at the .irom0.text section, we see that it is 306K. I am using esptool to upload the images and I am setting the "--flash-size=4m"for my ESP8266 .... now "4 megabits" = 512KBytes ... which matches what I think should be there for the ESP-12. Since ".irom0.text" is loading at 0x40240000 for a size of 0x4ab78 ... that should be an upper bound of 0x40244ab8. Now given that there is 512KB (0x80000) of flash with a starting address of 0x40200000 that should be an upper bound of 0x4028000. Based on the reverse engineered code, that should put the system area that is being checked at 0x40288000 - 0x1000 -> 0x40287000 which is well clear of the upper bound that is being written of 0x40244ab8.

However, to confuse things just a "little more" ... I read the IOT SDK User Manual which seems to show that the data is NOT partitioned the way the memory maps seem to show. It seems to show that if my .rom0.text is 306K (which is bigger that the listed max of 240KB). See the attached copy.

Again ... THANK you guys ... I'm gonna beat this to death one way or another and try and write it up. Any and all guidance is still appreciated.

Neil

2015-08-21_18-09-16.png
You do not have the required permissions to view the files attached to this post.