Skip to content

Commit

Permalink
Free some esp8266 RAM (#2752)
Browse files Browse the repository at this point in the history
This PR frees some esp8266 RAM consumed by the `.rodata` segment. This can be examined with `objdump -s -j .rodata out/Esp8266/debug/build/app_0.out`

**Store `http-parser` method strings in flash**

Also remove unused `http_status_str()` function, consumes RAM even though it's never called.
Saves 1100 bytes RAM.

**More http-parser strings into flash**

No need for these to be in RAM.

**Update `http-parser` lib to final version**

**Put WS parser error strings in flash**

**Remove `EspDigitalPin`**

Only MUX addresses are required, and that only needs 1 byte.
Saves up to 196 byte RAM.

**Optimise rapidxml lookup tables**

Saves 2020 bytes RAM

**Add python script to scan/compare CI build logs**

Savings:

```
samples/Basic_Blink
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        58    712     1336  7265  55932       2106            79814     25521    
  log-9c72d313-flashstrings.txt  58    536     1336  7269  55932       1930            79990     25517    
  Difference                           -176          +4                -176            +176      -4       

samples/Basic_Capsense
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1316  916     25416  25570  209856      27648           54272     7216     
  log-9c72d313-flashstrings.txt  1316  740     25416  25574  209856      27472           54448     7212     
  Difference                           -176           +4                 -176            +176      -4       

samples/Basic_HwPWM
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1329  924     25760  26122  219520      28013           53907     6664     
  log-9c72d313-flashstrings.txt  1329  764     25760  26122  219636      27853           54067     6664     
  Difference                           -160                  +116        -160            +160               

samples/Basic_IFS
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1952  2616    25984  26453  399202      30552           51368     6333     
  log-9c72d313-flashstrings.txt  1952  1248    25976  26453  399834      29176           52744     6333     
  Difference                           -1368   -8            +632        -1376           +1376              

samples/Basic_Interrupts
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    720     1712  7977  62256       2496            79424     24809    
  log-9c72d313-flashstrings.txt  64    544     1712  7981  62256       2320            79600     24805    
  Difference                           -176          +4                -176            +176      -4       

samples/Basic_NFC
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        66    728     1536  8077  66232       2330            79590     24709    
  log-9c72d313-flashstrings.txt  66    552     1536  8081  66232       2154            79766     24705    
  Difference                           -176          +4                -176            +176      -4       

samples/Basic_Neopixel
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1320  960     25696  26838  222488      27976           53944     5948     
  log-9c72d313-flashstrings.txt  1320  784     25696  26842  222488      27800           54120     5944     
  Difference                           -176           +4                 -176            +176      -4       

samples/Basic_Ota
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1608  2408    25584  26110  314125      29600           52320     6676     
  log-9c72d313-flashstrings.txt  1608  1016    25584  26110  314817      28208           53712     6676     
  Difference                           -1392                 +692        -1392           +1392              

samples/Basic_Servo
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    812     1888  8457  65064       2764            79156     24329    
  log-9c72d313-flashstrings.txt  64    636     1888  8461  65064       2588            79332     24325    
  Difference                           -176          +4                -176            +176      -4       

samples/Basic_Ssl
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1948  3020    25856  26122  332594      30824           51096     6664     
  log-9c72d313-flashstrings.txt  1948  1632    25856  26122  333286      29436           52484     6664     
  Difference                           -1388                 +692        -1388           +1388              

samples/Basic_WebSkeletonApp
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1644  2468    25816  26106  331133      29928           51992     6680     
  log-9c72d313-flashstrings.txt  1644  1084    25808  26106  331765      28536           53384     6680     
  Difference                           -1384   -8            +632        -1392           +1392              

samples/Basic_WebSkeletonApp_LTS
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1644  2456    25856  26106  326425      29956           51964     6680     
  log-9c72d313-flashstrings.txt  1644  1072    25848  26106  327049      28564           53356     6680     
  Difference                           -1384   -8            +624        -1392           +1392              

samples/CanBus
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1336  1000    25488  26286  217156      27824           54096     6500     
  log-9c72d313-flashstrings.txt  1336  824     25488  26290  217156      27648           54272     6496     
  Difference                           -176           +4                 -176            +176      -4       

samples/DFPlayerMini
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        65    732     1544  8353  62536       2341            79579     24433    
  log-9c72d313-flashstrings.txt  65    556     1544  8357  62536       2165            79755     24429    
  Difference                           -176          +4                -176            +176      -4       

samples/Display_TM1637
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        57    748     1288  7089  56900       2093            79827     25697    
  log-9c72d313-flashstrings.txt  57    572     1288  7093  56900       1917            80003     25693    
  Difference                           -176          +4                -176            +176      -4       

samples/DnsCaptivePortal
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1572  2232    25664  25966  271856      29468           52452     6820     
  log-9c72d313-flashstrings.txt  1572  848     25656  25966  272488      28076           53844     6820     
  Difference                           -1384   -8            +632        -1392           +1392              

samples/HttpClient
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1584  2564    25536  26039  407804      29684           52236     6747     
  log-9c72d313-flashstrings.txt  1584  1172    25536  26039  408504      28292           53628     6747     
  Difference                           -1392                 +700        -1392           +1392              

samples/HttpClient_Instapush
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1644  2388    25632  26014  268429      29664           52256     6772     
  log-9c72d313-flashstrings.txt  1644  996     25632  26014  269121      28272           53648     6772     
  Difference                           -1392                 +692        -1392           +1392              

samples/HttpClient_ThingSpeak
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1576  2268    25592  26014  265477      29436           52484     6772     
  log-9c72d313-flashstrings.txt  1576  876     25592  26014  266169      28044           53876     6772     
  Difference                           -1392                 +692        -1392           +1392              

samples/HttpServer_AJAX
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1652  2444    25920  25986  332858      30016           51904     6800     
  log-9c72d313-flashstrings.txt  1652  1060    25928  25986  333490      28640           53280     6800     
  Difference                           -1384   +8            +632        -1376           +1376              

samples/HttpServer_Bootstrap
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1576  2620    25824  26334  327765      30020           51900     6452     
  log-9c72d313-flashstrings.txt  1576  1060    25832  26338  328457      28468           53452     6448     
  Difference                           -1560   +8     +4     +692        -1552           +1552     -4       

samples/HttpServer_ConfigNetwork
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1644  2664    26016  26106  341734      30324           51596     6680     
  log-9c72d313-flashstrings.txt  1644  1288    26016  26106  342366      28948           52972     6680     
  Difference                           -1376                 +632        -1376           +1376              

samples/HttpServer_FirmwareUpload
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1600  2288    25592  26106  348349      29480           52440     6680     
  log-9c72d313-flashstrings.txt  1600  920     25600  26106  348973      28120           53800     6680     
  Difference                           -1368   +8            +624        -1360           +1360              

samples/HttpServer_Plugins
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1572  2392    25504  25938  274500      29468           52452     6848     
  log-9c72d313-flashstrings.txt  1572  1008    25496  25938  275132      28076           53844     6848     
  Difference                           -1384   -8            +632        -1392           +1392              

samples/HttpServer_WebSockets
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1572  2504    25920  26222  330085      29996           51924     6564     
  log-9c72d313-flashstrings.txt  1572  988     25912  26222  330861      28472           53448     6564     
  Difference                           -1516   -8            +776        -1524           +1524              

samples/Humidity_AM2321
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    732     1552  7949  65937       2348            79572     24837    
  log-9c72d313-flashstrings.txt  64    556     1552  7953  65937       2172            79748     24833    
  Difference                           -176          +4                -176            +176      -4       

samples/Humidity_BME280
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        308   796     1624  8073  74220       2728            79192     24713    
  log-9c72d313-flashstrings.txt  308   620     1624  8077  74220       2552            79368     24709    
  Difference                           -176          +4                -176            +176      -4       

samples/Humidity_DHT22
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        308   792     1512  7997  74528       2612            79308     24789    
  log-9c72d313-flashstrings.txt  308   616     1512  8001  74528       2436            79484     24785    
  Difference                           -176          +4                -176            +176      -4       

samples/IR_lib
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    2552    1824  8951  107664      4440            77480     23835    
  log-9c72d313-flashstrings.txt  64    2376    1824  8955  107664      4264            77656     23831    
  Difference                           -176          +4                -176            +176      -4       

samples/LED_WS2812
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        68    724     1272  7041  55876       2064            79856     25745    
  log-9c72d313-flashstrings.txt  68    548     1272  7045  55876       1888            80032     25741    
  Difference                           -176          +4                -176            +176      -4       

samples/LiveDebug
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        316   2672    3000  10101  97068       5988            75932     22685    
  log-9c72d313-flashstrings.txt  316   2496    3000  10105  97068       5812            76108     22681    
  Difference                           -176          +4                 -176            +176      -4       

samples/MeteoControl
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        2080  3280    26248  27049  361489      31608           50312     5737     
  log-9c72d313-flashstrings.txt  2080  1716    26256  27053  362189      30052           51868     5733     
  Difference                           -1564   +8     +4     +700        -1556           +1556     -4       

samples/Nextion_Button
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        76    796     1504  7949  62336       2376            79544     24837    
  log-9c72d313-flashstrings.txt  76    620     1504  7953  62336       2200            79720     24833    
  Difference                           -176          +4                -176            +176      -4       

samples/Radio_RCSwitch
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        68    812     2184  8913  63160       3064            78856     23873    
  log-9c72d313-flashstrings.txt  68    636     2184  8917  63160       2888            79032     23869    
  Difference                           -176          +4                -176            +176      -4       

samples/Radio_nRF24L01
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    732     1488  7949  67900       2284            79636     24837    
  log-9c72d313-flashstrings.txt  64    556     1488  7953  67900       2108            79812     24833    
  Difference                           -176          +4                -176            +176      -4       

samples/Radio_si4432
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        100   760     1448  7997  67468       2308            79612     24789    
  log-9c72d313-flashstrings.txt  100   584     1448  8001  67468       2132            79788     24785    
  Difference                           -176          +4                -176            +176      -4       

samples/SDCard
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        65    792     1424  7725  76596       2281            79639     25061    
  log-9c72d313-flashstrings.txt  65    616     1424  7729  76596       2105            79815     25057    
  Difference                           -176          +4                -176            +176      -4       

samples/ScreenLCD_5110
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        568   732     1432  7725  67512       2732            79188     25061    
  log-9c72d313-flashstrings.txt  568   556     1432  7729  67512       2556            79364     25057    
  Difference                           -176          +4                -176            +176      -4       

samples/ScreenOLED_SSD1306
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    736     1640  8277  74684       2440            79480     24509    
  log-9c72d313-flashstrings.txt  64    560     1640  8281  74684       2264            79656     24505    
  Difference                           -176          +4                -176            +176      -4       

samples/ScreenTFT_ILI9163C
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    732     1472  7725  69540       2268            79652     25061    
  log-9c72d313-flashstrings.txt  64    556     1472  7729  69540       2092            79828     25057    
  Difference                           -176          +4                -176            +176      -4       

samples/ScreenTFT_ILI9340-ILI9341
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        88    788     1640  8077  112385      2516            79404     24709    
  log-9c72d313-flashstrings.txt  88    612     1640  8081  112385      2340            79580     24705    
  Difference                           -176          +4                -176            +176      -4       

samples/ScreenTFT_ST7735
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        68    1200    1568  8293  120205      2836            79084     24493    
  log-9c72d313-flashstrings.txt  68    1024    1568  8297  120205      2660            79260     24489    
  Difference                           -176          +4                -176            +176      -4       

samples/Temperature_DS1820
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    736     1632  8025  67700       2432            79488     24761    
  log-9c72d313-flashstrings.txt  64    560     1632  8029  67700       2256            79664     24757    
  Difference                           -176          +4                -176            +176      -4       

samples/UdpServer_mDNS
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1580  2332    25824  25938  326909      29736           52184     6848     
  log-9c72d313-flashstrings.txt  1580  952     25832  25938  327533      28364           53556     6848     
  Difference                           -1380   +8            +624        -1372           +1372              

samples/Ultrasonic_HCSR04
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    720     1472  7949  62208       2256            79664     24837    
  log-9c72d313-flashstrings.txt  64    544     1472  7953  62208       2080            79840     24833    
  Difference                           -176          +4                -176            +176      -4       

samples/WebcamServer
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1936  2324    25616  25966  316965      29876           52044     6820     
  log-9c72d313-flashstrings.txt  1936  940     25608  25966  317589      28484           53436     6820     
  Difference                           -1384   -8            +624        -1392           +1392              

samples/Websocket_Client
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1572  2448    25912  26126  273761      29932           51988     6660     
  log-9c72d313-flashstrings.txt  1572  924     25912  26126  274597      28408           53512     6660     
  Difference                           -1524                 +836        -1524           +1524              

samples/Basic_Blink
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        58    596     1232  7685  55964       1886            80034     25101    
  log-9c72d313-flashstrings.txt  58    420     1232  7689  55964       1710            80210     25097    
  Difference                           -176          +4                -176            +176      -4       

samples/HttpServer_ConfigNetwork
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1640  4044    26360  27558  345208      32044           49876     5228     
  log-9c72d313-flashstrings.txt  1640  2672    26360  27558  345840      30672           51248     5228     
  Difference                           -1372                 +632        -1372           +1372              

Components/Hosted/samples/serial
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    728     1480  7773  80500       2272            79648     25013    
  log-9c72d313-flashstrings.txt  64    552     1480  7777  80500       2096            79824     25009    
  Difference                           -176          +4                -176            +176      -4       

Components/Hosted/samples/tcp
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1324  1052    25344  26146  232324      27720           54200     6640     
  log-9c72d313-flashstrings.txt  1324  876     25344  26150  232324      27544           54376     6636     
  Difference                           -176           +4                 -176            +176      -4       

Libraries/AnimatedGIF/samples/Basic_AnimatedGIF
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    936     2096  11069  106647      3096            78824     21717    
  log-9c72d313-flashstrings.txt  64    760     2096  11069  106647      2920            79000     21717    
  Difference                           -176                             -176            +176               

Libraries/CS5460/samples/generic
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1320  1020    25448  26238  214396      27788           54132     6548     
  log-9c72d313-flashstrings.txt  1320  844     25448  26242  214396      27612           54308     6544     
  Difference                           -176           +4                 -176            +176      -4       

Libraries/CommandProcessing/samples/Arducam
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1572  3104    26160  26194  338417      30836           51084     6592     
  log-9c72d313-flashstrings.txt  1572  1548    26160  26198  339049      29280           52640     6588     
  Difference                           -1556          +4     +632        -1556           +1556     -4       

Libraries/DIAL/samples/DIAL_Client
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1576  4760    25824  26138  320971      32160           49760     6648     
  log-9c72d313-flashstrings.txt  1576  1072    25816  26138  322119      28464           53456     6648     
  Difference                           -3688   -8            +1148       -3696           +3696              

Libraries/Graphics/samples/Advanced_Animation
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    936     2936  11125  93719       3936            77984     21661    
  log-9c72d313-flashstrings.txt  64    760     2936  11125  93719       3760            78160     21661    
  Difference                           -176                             -176            +176               

Libraries/Graphics/samples/Basic_Animation
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    1056    2984  11185  105707      4104            77816     21601    
  log-9c72d313-flashstrings.txt  64    880     2984  11185  105707      3928            77992     21601    
  Difference                           -176                             -176            +176               

Libraries/Graphics/samples/Basic_Graphics
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1556  4400    2464  11461  301788      8420            73500     21325    
  log-9c72d313-flashstrings.txt  1556  1920    2464  11461  302248      5940            75980     21325    
  Difference                           -2480                +460        -2480           +2480              

Libraries/Graphics/samples/Basic_Touch
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        72    1168    2304  11185  141239      3544            78376     21601    
  log-9c72d313-flashstrings.txt  72    992     2304  11185  141239      3368            78552     21601    
  Difference                           -176                             -176            +176               

Libraries/Graphics/samples/Bresenham
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        308   1668    2232  11193  176901      4208            77712     21593    
  log-9c72d313-flashstrings.txt  308   1492    2232  11193  176901      4032            77888     21593    
  Difference                           -176                             -176            +176               

Libraries/Graphics/samples/Color_Test
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        64    1080    2160  11185  104647      3304            78616     21601    
  log-9c72d313-flashstrings.txt  64    904     2160  11185  104647      3128            78792     21601    
  Difference                           -176                             -176            +176               

Libraries/Graphics/samples/Custom_Object
  log                            data  rodata  bss   text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        68    1156    2240  11241  108263      3464            78456     21545    
  log-9c72d313-flashstrings.txt  68    980     2240  11241  108263      3288            78632     21545    
  Difference                           -176                             -176            +176               

Libraries/HueEmulator/samples/Basic_Alexa
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1644  2820    26208  26574  333055      30672           51248     6212     
  log-9c72d313-flashstrings.txt  1644  1256    26208  26578  333855      29108           52812     6208     
  Difference                           -1564          +4     +800        -1564           +1564     -4       

Libraries/IOControl/samples/Basic_RS485
  log                            data  rodata  bss   text  irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  ----  ----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        152   924     1648  8217  100833      2724            79196     24569    
  log-9c72d313-flashstrings.txt  152   748     1648  8221  100833      2548            79372     24565    
  Difference                           -176          +4                -176            +176      -4       

Libraries/ModbusMaster/samples/generic
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1320  1012    25840  26238  214772      28172           53748     6548     
  log-9c72d313-flashstrings.txt  1320  836     25840  26242  214772      27996           53924     6544     
  Difference                           -176           +4                 -176            +176      -4       

Libraries/MultipartParser/samples/Conditional_Upload
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1600  2348    25600  25966  314529      29548           52372     6820     
  log-9c72d313-flashstrings.txt  1600  972     25600  25966  315153      28172           53748     6820     
  Difference                           -1376                 +624        -1376           +1376              

Libraries/RingTone/samples/RingTonePlayer
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        2016  2872    26200  27361  355532      31088           50832     5425     
  log-9c72d313-flashstrings.txt  2016  1356    26192  27361  356308      29564           52356     5425     
  Difference                           -1516   -8            +776        -1524           +1524              

Libraries/UPnP/samples/Basic_ControlPoint
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1576  4852    25864  26194  409155      32292           49628     6592     
  log-9c72d313-flashstrings.txt  1576  1164    25856  26194  410323      28596           53324     6592     
  Difference                           -3688   -8            +1168       -3696           +3696              

Libraries/UPnP/samples/Basic_UPnP
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1940  5260    26192  26430  361963      33392           48528     6356     
  log-9c72d313-flashstrings.txt  1940  1396    26200  26434  363127      29536           52384     6352     
  Difference                           -3864   +8     +4     +1164       -3856           +3856     -4       

Libraries/jerryscript/samples/Advanced_Jsvm
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1964  5168    26848  26155  382821      33980           47940     6631     
  log-9c72d313-flashstrings.txt  1964  3800    26856  26155  383453      32620           49300     6631     
  Difference                           -1368   +8            +632        -1360           +1360              

Libraries/modbusino/samples/generic
  log                            data  rodata  bss    text   irom0_text  Total Used RAM  Free RAM  Free IRam
  -----------------------------  ----  ------  -----  -----  ----------  --------------  --------  ---------
  log-0e46891-develop.txt        1320  1020    25736  26238  214080      28076           53844     6548     
  log-9c72d313-flashstrings.txt  1320  844     25736  26242  214080      27900           54020     6544     
  Difference                           -176           +4                 -176            +176      -4       

```
  • Loading branch information
mikee47 authored Apr 3, 2024
1 parent 0e46891 commit 7f3eba5
Show file tree
Hide file tree
Showing 10 changed files with 449 additions and 149 deletions.
63 changes: 40 additions & 23 deletions Sming/Arch/Esp8266/Core/Digital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,42 @@
****/

#include <Digital.h>
#include "ESP8266EX.h"
#include <espinc/eagle_soc.h>
#include <espinc/gpio_register.h>
#include <espinc/pin_mux_register.h>
#include <Platform/Timers.h>

#define TOTAL_PINS 16

#define PINMUX_OFFSET(addr) uint8_t((addr)-PERIPHS_IO_MUX)

// Used for pullup/noPullup
extern const uint8_t esp8266_pinmuxOffset[] = {
PINMUX_OFFSET(PERIPHS_IO_MUX_GPIO0_U), // 0 FLASH
PINMUX_OFFSET(PERIPHS_IO_MUX_U0TXD_U), // 1 TXD0
PINMUX_OFFSET(PERIPHS_IO_MUX_GPIO2_U), // 2 TXD1
PINMUX_OFFSET(PERIPHS_IO_MUX_U0RXD_U), // 3 RXD0
PINMUX_OFFSET(PERIPHS_IO_MUX_GPIO4_U), // 4
PINMUX_OFFSET(PERIPHS_IO_MUX_GPIO5_U), // 5
PINMUX_OFFSET(PERIPHS_IO_MUX_SD_CLK_U), // 6 SD_CLK_U
PINMUX_OFFSET(PERIPHS_IO_MUX_SD_DATA0_U), // 7 SD_DATA0_U
PINMUX_OFFSET(PERIPHS_IO_MUX_SD_DATA1_U), // 8 SD_DATA1_U
PINMUX_OFFSET(PERIPHS_IO_MUX_SD_DATA2_U), // 9
PINMUX_OFFSET(PERIPHS_IO_MUX_SD_DATA3_U), // 10
PINMUX_OFFSET(PERIPHS_IO_MUX_SD_CMD_U), // 11 SD_CMD_U
PINMUX_OFFSET(PERIPHS_IO_MUX_MTDI_U), // 12 HSPIQ
PINMUX_OFFSET(PERIPHS_IO_MUX_MTCK_U), // 13 HSPID
PINMUX_OFFSET(PERIPHS_IO_MUX_MTMS_U), // 14 HSPICLK
PINMUX_OFFSET(PERIPHS_IO_MUX_MTDO_U), // 15 HSPICS
};

// Prototype declared in esp8266-peri.h
const uint8_t esp8266_gpioToFn[16] = {0x34, 0x18, 0x38, 0x14, 0x3C, 0x40, 0x1C, 0x20,
0x24, 0x28, 0x2C, 0x30, 0x04, 0x08, 0x0C, 0x10};
const uint8_t esp8266_gpioToFn[TOTAL_PINS] = {0x34, 0x18, 0x38, 0x14, 0x3C, 0x40, 0x1C, 0x20,
0x24, 0x28, 0x2C, 0x30, 0x04, 0x08, 0x0C, 0x10};

void pinMode(uint16_t pin, uint8_t mode)
{
if(pin < 16) {
if(pin < TOTAL_PINS) {
if(mode == SPECIAL) {
GPC(pin) = (GPC(pin) &
(0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
Expand Down Expand Up @@ -100,38 +123,32 @@ void digitalWrite(uint16_t pin, uint8_t val)
pullup(pin);
else
noPullup(pin);
} else {
if(pin != 16)
GPIO_REG_WRITE((((val != LOW) ? GPIO_OUT_W1TS_ADDRESS : GPIO_OUT_W1TC_ADDRESS)), (1 << pin));
else
WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32_t)0xfffffffe) | (uint32_t)(val & 1));

//GPIO_OUTPUT_SET(pin, (val ? 0xFF : 00));
}
} else if(pin != 16)
GPIO_REG_WRITE((((val != LOW) ? GPIO_OUT_W1TS_ADDRESS : GPIO_OUT_W1TC_ADDRESS)), (1 << pin));
else
WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32_t)0xfffffffe) | (uint32_t)(val & 1));
}

uint8_t digitalRead(uint16_t pin)
{
if(pin != 16)
if(pin != 16) {
return ((GPIO_REG_READ(GPIO_IN_ADDRESS) >> pin) & 1);
else
return (uint8_t)(READ_PERI_REG(RTC_GPIO_IN_DATA) & 1);

//return GPIO_INPUT_GET(pin);
}
return (uint8_t)(READ_PERI_REG(RTC_GPIO_IN_DATA) & 1);
}

void pullup(uint16_t pin)
{
if(pin >= 16)
return;
PIN_PULLUP_EN((EspDigitalPins[pin].mux));
if(pin < TOTAL_PINS) {
PIN_PULLUP_EN(PERIPHS_IO_MUX + esp8266_pinmuxOffset[pin]);
}
}

void noPullup(uint16_t pin)
{
if(pin >= 16)
return;
PIN_PULLUP_DIS((EspDigitalPins[pin].mux));
if(pin < TOTAL_PINS) {
PIN_PULLUP_DIS(PERIPHS_IO_MUX + esp8266_pinmuxOffset[pin]);
}
}

/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH
Expand Down
48 changes: 0 additions & 48 deletions Sming/Arch/Esp8266/Core/ESP8266EX.cpp

This file was deleted.

38 changes: 0 additions & 38 deletions Sming/Arch/Esp8266/Core/ESP8266EX.h

This file was deleted.

24 changes: 17 additions & 7 deletions Sming/Arch/Esp8266/Core/HardwarePWM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@

#include <HardwarePWM.h>
#include <Clock.h>
#include "ESP8266EX.h"
#include <debug_progmem.h>
#include "pins_arduino.h"
#include <espinc/pin_mux_register.h>

#define PERIOD_TO_MAX_DUTY(x) (x * 25)

extern const uint8_t esp8266_pinmuxOffset[];

HardwarePWM::HardwarePWM(uint8_t* pins, uint8_t noOfPins) : channel_count(noOfPins)
{
if(noOfPins == 0) {
Expand All @@ -38,15 +41,22 @@ HardwarePWM::HardwarePWM(uint8_t* pins, uint8_t noOfPins) : channel_count(noOfPi

uint32_t ioInfo[PWM_CHANNEL_NUM_MAX][3]; // pin information
uint32_t pwmDutyInit[PWM_CHANNEL_NUM_MAX]; // pwm duty
unsigned pinCount = 0;
for(uint8_t i = 0; i < noOfPins; i++) {
ioInfo[i][0] = EspDigitalPins[pins[i]].mux;
ioInfo[i][1] = EspDigitalPins[pins[i]].gpioFunc;
ioInfo[i][2] = EspDigitalPins[pins[i]].id;
pwmDutyInit[i] = 0; // Start with zero output
channels[i] = pins[i];
auto pin = pins[i];
assert(pin < 16);
if(pin >= 16) {
continue;
}
ioInfo[pinCount][0] = PERIPHS_IO_MUX + esp8266_pinmuxOffset[pin];
ioInfo[pinCount][1] = esp8266_gpioToFn[pin];
ioInfo[pinCount][2] = pin;
pwmDutyInit[pinCount] = 0; // Start with zero output
channels[pinCount] = pin;
++pinCount;
}
const int initialPeriod = 1000;
pwm_init(initialPeriod, pwmDutyInit, noOfPins, ioInfo);
pwm_init(initialPeriod, pwmDutyInit, pinCount, ioInfo);
update();
maxduty = PERIOD_TO_MAX_DUTY(initialPeriod); // for period of 1000
}
Expand Down
Loading

0 comments on commit 7f3eba5

Please sign in to comment.