These are chat archives for SmingHub/Sming

14th
Oct 2017
slaff
@slaff
Oct 14 2017 08:45
The next release 3.4.0 (#1195) is scheduled for the next week. Please, get the latest develop version and tell us if you experience some issues.
Érico GR
@ericogr
Oct 14 2017 13:22
Hi @slaff , I tried the latest c224962. When compile my current project, this message appears:
/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: out/build/app_0.out section .text' will not fit in regioniram1_0_seg'
/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: region `iram1_0_seg' overflowed by 24 bytes
collect2: error: ld returned 1 exit status
/opt/Sming/Sming/Makefile-rboot.mk:473: recipe for target 'out/build/app_0.out' failed
make: * [out/build/app_0.out] Error 1
Érico GR
@ericogr
Oct 14 2017 13:42

until a1ac636, build is ok:


  data|        Initialized Data (RAM)|    FFE8000|    FFE83A0|     928
rodata|           ReadOnly Data (RAM)|    FFE83A0|    FFEC574|   16852
   bss|      Uninitialized Data (RAM)|    FFEC578|    FFF3E38|   30912
  text|            Cached Code (IRAM)|    40100000|    0107F30|   32560

irom0_text| Uncached Code (SPI)| 40202010| 40269BCB| 424891
Total Used RAM : 48692
Free RAM : 33228
Free IRam : 226

slaff
@slaff
Oct 14 2017 19:05
@ericogr Can you paste here your rboot.ld file?
Érico GR
@ericogr
Oct 14 2017 19:29

../Sming/compiler/ld/rboot.rom0.ld
`
/ Linker Script for rboot /

MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40202010, len = (1M - 0x2010)
}

INCLUDE "common.ld"`

i didn't change any ld file
slaff
@slaff
Oct 14 2017 19:40
Hmm.. I don't think that we added any function or data object that goes into the IRAM, but I might be wrong.
slaff
@slaff
Oct 14 2017 19:55
As far as I can see before a1ac636 you had only 208 bytes left (0x8000 - 32560). Can you compare sym tables before a1ac636 and after for your application ?

What yo have to do is:

  1. Checkout to the version before a1ac636.
  2. cd $SMING_HOME; make dist-clean
  3. Go to your application. then make clean
  4. make
  5. dump the symbol table: xtensa-lx106-elf-readelf -s ./out/build/app_0.out > /tmp/app-symbols-before.csv

Then checkout to the latest version. And repeat the steps from 2 to 4. For 5 dump the symbol table to another file. And finally compare the two.

slaff
@slaff
Oct 14 2017 20:02

There is also room for improvement in the HttpConnection.h. The following methods declared to end in the IRAM:

private:
    static int IRAM_ATTR staticOnMessageBegin(http_parser* parser);
#ifndef COMPACT_MODE
    static int IRAM_ATTR staticOnStatus(http_parser *parser, const char *at, size_t length);
#endif
    static int IRAM_ATTR staticOnHeadersComplete(http_parser* parser);
    static int IRAM_ATTR staticOnHeaderField(http_parser *parser, const char *at, size_t length);
    static int IRAM_ATTR staticOnHeaderValue(http_parser *parser, const char *at, size_t length);
    static int IRAM_ATTR staticOnBody(http_parser *parser, const char *at, size_t length);
#ifndef COMPACT_MODE
    static int IRAM_ATTR staticOnChunkHeader(http_parser* parser);
    static int IRAM_ATTR staticOnChunkComplete(http_parser* parser);
#endif
    static int IRAM_ATTR staticOnMessageComplete(http_parser* parser);

can be moved out of there. Of course it will need good testing before such change is declared stable.

The same applies also for HttpServerConnection.h. That part

private:
    static int IRAM_ATTR staticOnMessageBegin(http_parser* parser);
    static int IRAM_ATTR staticOnPath(http_parser *parser, const char *at, size_t length);
    static int IRAM_ATTR staticOnHeadersComplete(http_parser* parser);
    static int IRAM_ATTR staticOnHeaderField(http_parser *parser, const char *at, size_t length);
    static int IRAM_ATTR staticOnHeaderValue(http_parser *parser, const char *at, size_t length);
    static int IRAM_ATTR staticOnBody(http_parser *parser, const char *at, size_t length);
    static int IRAM_ATTR staticOnMessageComplete(http_parser* parser);

can be moved out of the IRAM section.

@ericogr Try for yourself - just remove the IRAM_ATTR for the methods above in the two header files and recompile. That should give you back enough IRAM. If it works for you, please open an issue and I will take care to fix it in the develop branch.
slaff
@slaff
Oct 14 2017 20:24
@ericogr Check also this article if you need more free RAM: https://blog.attachix.com/get-extra-free-ram-in-esp8266/
Érico GR
@ericogr
Oct 14 2017 20:39
@slaff yea! after improvements in the HttpConnection and HttpServerConnection, I got "Free IRam : 3018" (with the latest version)
slaff
@slaff
Oct 14 2017 20:41
Ok, be nice and open an issue describing the problem. I will take care next week to make those changes be part of develop.
Érico GR
@ericogr
Oct 14 2017 21:12
Sure. Thank you! #1259