Hi,
The esp8266 SDK build doesn’t work for me any more, so I try to support it with platformio. It requires building all or a subset of the components that make up the SDK.
How do I enumerate these, and the include directories in there ?
doesn’t look right. I looked at the platformio-espressif32 but it appears to rely on cmake/the esp-idf to do that. I don’t find much platformio documentation at all (for a platformio user there’s stuff but I don’t find anything related to what I’m asking), is the standard approach “look for existing examples” ?
So thanks to earlier help I was able to get things going a bit but the above is meant to get me further than :
victus: {333} pio run
Processing esp8266-d1mini (platform: esp8266rtos; framework: esp8266rtos; board: d1_mini)
------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/esp8266rtos/d1_mini.html
PLATFORM: Espressif 8266 - RTOS v3.4 (4.2.1) > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
- esp8266rtos @ 0.1.0
- tool-esptool @ 1.413.0 (4.13)
- tool-esptoolpy @ 1.30000.201119 (3.0.0)
- toolchain-xtensa @ 1.40802.0 (4.8.2)
FRAMEWORK_DIR /home/danny/.platformio/packages/esp8266rtos
env.GetLibBuilders() []
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/esp8266-d1mini/src/main.o
Compiling .pio/build/esp8266-d1mini/src/startup.o
src/main.c:2:31: fatal error: freertos/FreeRTOS.h: No such file or directory
#include "freertos/FreeRTOS.h"
^
compilation terminated.
*** [.pio/build/esp8266-d1mini/src/main.o] Error 1
src/startup.c:22:23: fatal error: nvs_flash.h: No such file or directory
*******************************************************************
* Looking for nvs_flash.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:nvs_flash.h"
* Web > https://registry.platformio.org/search?q=header:nvs_flash.h
*
*******************************************************************
#include "nvs_flash.h"
^
compilation terminated.
*** [.pio/build/esp8266-d1mini/src/startup.o] Error 1
============================================== [FAILED] Took 0.42 seconds ==============================================
so building the list of includes from a script, and then obviously generating the libraries to avoid the subsequent linker errors.
Going on a bit - I added some code I just wrote but I’m new to python.So the include string I build gets inserted between quotes, meaning it won’t work.
def component_includes(c):
r = ''
if c.name == "freertos":
r = r + " -I" + str(c) + "/port/esp8266/include"
inc = c / "include"
if inc.exists():
r = r + " -I" + str(inc)
privinc = c / "priv_include"
if privinc.exists():
r = r + " -I" + str(privinc)
return r
def list_includes(p):
path = Path(p)
r = ''
for item in path.iterdir():
s = str(item.name)
if item.is_dir():
i = component_includes(item)
r = r + i
return r
def build_includes(p):
# esp8266rtos/include
r = " -I" + p + "/include"
# Get list of component includes
components = str(p) + "/components"
r = r + list_includes(components)
return r
See last piece I included (the gcc command), there are a couple of quotes that prevent the list from working. They’re at the second -I option and almost of the end of the (lengthy) line.
I can hardcode all that but that’s a list of 50+ directories that need to be included.
And after that, I have to build code to compile some 800 source files that are in the SDK, they’re needed for building applications.
Are you sure you’re using the proper join(path1, path2, path3, ..) syntax to concatena paths instead of a pure += "string constant"? If in doubt, print the whole list that you’re setting CPPPATH equal to and inspect it that each entry is a proper path.
That looks like it literally included the string join(...) instead of calling it as a function – huh?
No if build.includes() already returns a list[str] then you need to just CPPPATH=esp8266builder.build_includes(FRAMEWORK_DIR), that was already correct.
It didn’t work with the commas so I removed those.
Added a print statement at the end.
My code :
import os
from pathlib import Path
victus: {689} svn commit
X11 forwarding request failed on channel 0
Adding README.md
Sending builder/frameworks/esp8266builder.py
Transmitting file data ..done
Committing transaction...
if c.name == 'esp8266':
r = r + ' ' + str(c) + '/include/driver'
if c.name == 'lwip':
r = r + ' ' + str(c) + '/lwip/src/include'
r = r + ' ' + str(c) + '/port/esp8266/include'
r = r + ' ' + str(c) + '/include/apps'
r = r + ' ' + str(c) + '/include/apps/dhcpserver'
r = r + ' ' + str(c) + '/include/apps/sntp'
r = r + ' ' + str(c) + '/include/apps/ping'
if c.name == 'freertos':
r = r + ' ' + str(c) + '/port/esp8266/include'
r = r + ' ' + str(c) + '/port/esp8266/include/freertos'
r = r + ' ' + str(c) + '/include/freertos'
r = r + ' ' + str(c) + '/include/freertos/private'
if c.name == 'heap':
r = r + ' ' + str(c) + '/port/esp8266/include'
# only for newlib
platfinc = c / 'platform_include'
if platfinc.exists():
r = r + ' ' + str(c) + '/platform_include'
return r
def list_includes(p):
path = Path(p)
r = ''
for item in path.iterdir():
s = str(item.name)
if item.is_dir():
i = component_includes(item)
r = r + i
return r
def build_includes(p):
r = ''
# Get list of component includes
components = str(p) + "/components"
r = r + list_includes(components)
# esp8266rtos/include, put at the end to avoid trailing comma
r = r + ' ' + p + '/include'
print("build_includes -> " + r)
return r