platform-espressif8266 icon indicating copy to clipboard operation
platform-espressif8266 copied to clipboard

Support for ESP-IDF style ESP8266_RTOS_SDK

Open srini1948 opened this issue 6 years ago • 45 comments

The current ESP8266 on PlatformIO is very old. Could you please consider adding the new ESP-IDF style ESP8266_RTOS_SDK. The SDK structure is similar to that of ESP32-IDF.

srini1948 avatar Feb 18 '19 13:02 srini1948

@WallaceWilliam could you help us with PR? I see you are working on https://github.com/WallaceWilliam/framework-esp8266-rtos-sdk-idf-platformio

No need to rename framework to framework-esp8266-rtos-sdk-idf. We will use it instead of old implementation.

ivankravets avatar Mar 04 '19 11:03 ivankravets

this is my hobby. I am ready to do everything in my capabilities.

WallaceWilliam avatar Mar 04 '19 11:03 WallaceWilliam

Yes – it will be better to replace the old ESP8266_RTOS_SDK rather than have this custom version.

Thanks.

Sent from Mail for Windows 10

From: WallaceWilliam Sent: Monday, March 4, 2019 6:34 AM To: platformio/platform-espressif8266 Cc: srini1948; Author Subject: Re: [platformio/platform-espressif8266] Support for ESP-IDF styleESP8266_RTOS_SDK (#125)

this is my hobby. I am ready to do everything in my capabilities. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

srini1948 avatar Mar 04 '19 12:03 srini1948

version ESP8266_RTOS_SDK in https://github.com/platformio/platform-espressif8266 is 1.5.0-beta version ESP8266_RTOS_SDK in https://github.com/WallaceWilliam/framework-esp8266-rtos-sdk-idf-platformio is current branch (v3.2.dev-...) of https://github.com/espressif/ESP8266_RTOS_SDK These versions are not compatible. and all projects written on the old version (1.5.0) will not work. I have projects in both versions. for you I can make a separate branch where the framework version 3.2.0 will be framework-esp8266-rtos-sdk. not framework-esp8266-rtos-sdk-idf

WallaceWilliam avatar Mar 04 '19 12:03 WallaceWilliam

I am still having problems with the “custom8266” version – it already has the “option” true setting in platform.json.

Once I install this custom platform the new project Wizard of PlatformIO in Visual Studio Code shows Arduino as the only option for ESP8266 boards!

It seems to remove the three other options: Simba, RTOS and NORTOS

It does not show the newly installed Custom platform at all. I guess a fake Arduino project has to be created and its Platform.ini has to be manually edited.

I don’t need the 1.5 version. It will be great if as you suggest framework-esp8266-rtos-sdk will itself be replaced by the 3.2.0

Thanks.

Sent from Mail for Windows 10

From: WallaceWilliam Sent: Monday, March 4, 2019 7:21 AM To: platformio/platform-espressif8266 Cc: srini1948; Author Subject: Re: [platformio/platform-espressif8266] Support for ESP-IDF styleESP8266_RTOS_SDK (#125)

version ESP8266_RTOS_SDK in https://github.com/platformio/platform-espressif8266 is 1.5.0-beta version ESP8266_RTOS_SDK in https://github.com/WallaceWilliam/framework-esp8266-rtos-sdk-idf-platformio is current branch (v3.2.dev-...) of https://github.com/espressif/ESP8266_RTOS_SDK These versions are not compatible. and all projects written on the old version (1.5.0) will not work. I have projects in both versions. for you I can make a separate branch where the framework version 3.2.0 will be framework-esp8266-rtos-sdk. not framework-esp8266-rtos-sdk-idf — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

srini1948 avatar Mar 04 '19 12:03 srini1948

@WallaceWilliam

These versions are not compatible. and all projects written on the old version (1.5.0) will not work.

You can control the framework version using platform = [email protected].

ivankravets avatar Mar 04 '19 16:03 ivankravets

I rename framework from esp8266-rtos-sdk-idf to esp8266-rtos-sdk please test

WallaceWilliam avatar Mar 04 '19 17:03 WallaceWilliam

Could you provide PR => https://github.com/platformio/platform-espressif8266/pulls?

ivankravets avatar Mar 04 '19 18:03 ivankravets

While trying to install Wallace’s latest version I get an error saying unknown package “tool-esptoolpy”

Sent from Mail for Windows 10

From: Ivan Kravets Sent: Monday, March 4, 2019 1:25 PM To: platformio/platform-espressif8266 Cc: srini1948; Author Subject: Re: [platformio/platform-espressif8266] Support for ESP-IDF styleESP8266_RTOS_SDK (#125)

Could you provide PR => https://github.com/platformio/platform-espressif8266/pulls? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

srini1948 avatar Mar 04 '19 18:03 srini1948

While trying to install Wallace’s latest version I get an error saying unknown package “tool-esptoolpy” run platformio platform update and trying again to install

WallaceWilliam avatar Mar 04 '19 20:03 WallaceWilliam

Thanks – it worked finally!

Sent from Mail for Windows 10

From: WallaceWilliam Sent: Monday, March 4, 2019 3:53 PM To: platformio/platform-espressif8266 Cc: srini1948; Author Subject: Re: [platformio/platform-espressif8266] Support for ESP-IDF styleESP8266_RTOS_SDK (#125)

While trying to install Wallace’s latest version I get an error saying unknown package “tool-esptoolpy” run platformio platform update and trying again to install — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

srini1948 avatar Mar 04 '19 22:03 srini1948

I tried (because I really really want to develop something with FreeRTOS) to install per above notes with no success. I used the Master github from @WallaceWilliam , extracted into Platforms/custom8266, ran pio platforms install custom8266 and then pio run . Platform.ini has platform = custom8266 and framework = esp8266-rtos-sdk. The result is: (there were no other errors)

`Processing nodemcuv2 (framework: esp8266-rtos-sdk; platform: custom8266; board: nodemcuv2)

PackageManager: Installing framework-esp8266-rtos-sdk git version 2.20.1.windows.1 Cloning into 'C:\Users\Gerrit.platformio\packages_tmp_installing-9gfs6b-package'... remote: Enumerating objects: 3395, done. remote: Counting objects: 100% (3395/3395), done. remote: Compressing objects: 100% (2734/2734), done. remote: Total 3395 (delta 552), reused 2622 (delta 488), pack-reused 0 Receiving objects: 100% (3395/3395), 16.97 MiB | 1.12 MiB/s, done. Resolving deltas: 100% (552/552), done. Checking out files: 100% (2876/2876), done. Verbose mode can be enabled via -v, --verbose option CONFIGURATION: https://docs.platformio.org/page/boards/custom8266/nodemcuv2.html PLATFORM: custom Espressif 8266 > NodeMCU 1.0 (ESP-12E Module) HARDWARE: ESP8266 80MHz 80KB RAM (4MB Flash) TypeError: coercing to Unicode: need string or buffer, NoneType found: File "C:\python27\lib\site-packages\platformio\builder\main.py", line 169: env.SConscript("$BUILD_SCRIPT") File "C:\Users\Gerrit.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py", line 541: return _SConscript(self.fs, *files, **subst_kw) File "C:\Users\Gerrit.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py", line 250: exec file in call_stack[-1].globals File "C:\Users\Gerrit.platformio\platforms\custom8266\builder\main.py", line 226: target_elf = env.BuildProgram() File "C:\Users\Gerrit.platformio\packages\tool-scons\script..\engine\SCons\Environment.py", line 224: return self.method(*nargs, **kwargs) File "C:\python27\lib\site-packages\platformio\builder\tools\platformio.py", line 107: env.BuildFrameworks(env.get("PIOFRAMEWORK")) File "C:\Users\Gerrit.platformio\packages\tool-scons\script..\engine\SCons\Environment.py", line 224: return self.method(*nargs, **kwargs) File "C:\python27\lib\site-packages\platformio\builder\tools\platformio.py", line 319: SConscript(env.GetFrameworkScript(f), exports="env") File "C:\Users\Gerrit.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py", line 604: return method(*args, **kw) File "C:\Users\Gerrit.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py", line 541: return _SConscript(self.fs, *files, **subst_kw) File "C:\Users\Gerrit.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py", line 250: exec file in call_stack[-1].globals File "C:\Users\Gerrit.platformio\platforms\custom8266\builder\frameworks\esp8266-rtos-sdk.py", line 631: PARTITIONS_TABLE_CSV=full_partitions_csv if isfile(full_partitions_csv) else abspath(partitions_csv)) File "c:\python27\lib\genericpath.py", line 37: st = os.stat(path) `

gerritv avatar Mar 19 '19 18:03 gerritv

edit File "C:\Users\Gerrit.platformio\platforms\custom8266\builder\frameworks\esp8266-rtos-sdk.py" write before line 630 print('(full_partitions_csv=', full_partitions_csv) print('partitions_csv=', partitions_csv)

WallaceWilliam avatar Mar 20 '19 06:03 WallaceWilliam

That results in

('(full_partitions_csv=', None) ('partitions_csv=', 'partitions.csv) ('search_path ', ['C:\\Users\\Gerrit\\.platformio\\packages\\framework-esp8266-rtos-sdk\\components\\partition_table', 'C:\\Users\\Gerrit\\Documents\\My Projects\\UII Panel\\Controller\\src']) NameError: name 'CONFIG_PARTITION_TABLE_FILENAME' is not defined: I never reach a print placed after the env.Replace (I added a few other prints to give more information)

gerritv avatar Mar 20 '19 12:03 gerritv

in the file "C:\Users\Gerrit.platformio\platforms\custom8266\builder\frameworks\esp8266-rtos-sdk.py" line 628 partitions_csv = env.BoardConfig (). get ("build.partitions", partitions_csv) change to partitions_csv = 'partitions_singleapp.csv' This file must be in {framework path}/components/partition_table/

WallaceWilliam avatar Mar 20 '19 12:03 WallaceWilliam

That now gives: KeyError: 'LIB_IGNORE': File "C:\python27\lib\site-packages\platformio\builder\main.py", line 170: env.SConscript("$BUILD_SCRIPT") File "C:\Users\Gerrit\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 541: return _SConscript(self.fs, *files, **subst_kw) File "C:\Users\Gerrit\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 250: exec _file_ in call_stack[-1].globals File "C:\Users\Gerrit\.platformio\platforms\custom8266\builder\main.py", line 226: target_elf = env.BuildProgram() File "C:\Users\Gerrit\.platformio\packages\tool-scons\script\..\engine\SCons\Environment.py", line 224: return self.method(*nargs, **kwargs) File "C:\python27\lib\site-packages\platformio\builder\tools\platformio.py", line 107: env.BuildFrameworks(env.get("PIOFRAMEWORK")) File "C:\Users\Gerrit\.platformio\packages\tool-scons\script\..\engine\SCons\Environment.py", line 224: return self.method(*nargs, **kwargs) File "C:\python27\lib\site-packages\platformio\builder\tools\platformio.py", line 319: SConscript(env.GetFrameworkScript(f), exports="env") File "C:\Users\Gerrit\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 604: return method(*args, **kw) File "C:\Users\Gerrit\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 541: return _SConscript(self.fs, *files, **subst_kw) File "C:\Users\Gerrit\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 250: exec _file_ in call_stack[-1].globals File "C:\Users\Gerrit\.platformio\platforms\custom8266\builder\frameworks\esp8266-rtos-sdk.py", line 720: if d in env['LIB_IGNORE']: continue File "C:\Users\Gerrit\.platformio\packages\tool-scons\script\..\engine\SCons\Environment.py", line 410: return self._dict[key]

gerritv avatar Mar 20 '19 12:03 gerritv

If I delete the if d in env['LIB_IGNORE']: continue then build continues until I get xtensa-lx106-elf-gcc: error: Panel\Controller\.pioenvs\nodemcuv2\bootloader.map: No such file or directory

there is no bootloader.map file in the directories.

gerritv avatar Mar 20 '19 13:03 gerritv

please, update paltform: (in terminal) platformio platform update compile project. you will see an error 'Source `partitions.csv' not found, needed by target' because in sdkconfig.h set #define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" or #define CONFIG_PARTITION_TABLE_FILENAME "partitions.csv" fix on "partitions_singleapp.csv"

compile project again get your compilation error 'bootloader.map: No such file or directory' delete bootloader.elf in Panel\Controller.pioenvs\nodemcuv2
in terminal compile project again with command 'platformio.exe run -v' you should see a line like this xtensa-lx106-elf-gcc -nostdlib -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--start-group .....-Tesp8266.bootloader.rom.ld .pioenvs\d1_mini\bootloader\bootloader_start.o -lgcc -lstdc++ -lgcov -Wl,--end-group -Wl,-EL -o .pioenvs\d1_mini\bootloader.elf -Wl,-Map=.pioenvs\d1_mini\bootloader.map

put it here

WallaceWilliam avatar Mar 20 '19 16:03 WallaceWilliam

error in this "-Wl,-Map=$BUILD_DIR\bootloader.map" because there are spaces in the file path this command not work please, update paltform: (in terminal) platformio platform update

WallaceWilliam avatar Mar 20 '19 16:03 WallaceWilliam

Awesome progress! It compiled a lot of files, then at the end it said: `

Linking .pioenvs\8266\firmware.elf xtensa-lx106-elf-gcc: error: Projects\UII-Panel\Controller.pioenvs\8266\firmware.map: No such file or directory `

There is a bootloader.map present now.

gerritv avatar Mar 20 '19 17:03 gerritv

please, update paltform: (in terminal) platformio platform update

WallaceWilliam avatar Mar 20 '19 17:03 WallaceWilliam

Great work!

srini1948 avatar Mar 20 '19 18:03 srini1948

I did that several times, forgot to tell you. It does nothing (Instead I copy/pasted the .py file that you modified today)

`Platform custom Espressif 8266

Updating custom8266 @ 1.0.0 [Detached] Updating framework-esp8266-rtos-sdk @ 8378b1a [Up-to-date] Updating toolchain-xtensa-lx106-elf-520 @ 5.2.0 [Up-to-date] `

So I deleted the package, which got reinstalled with latest. Same result. missing firmware.map file

gerritv avatar Mar 20 '19 18:03 gerritv

Updating custom8266 @ 1.0.0 [Detached] - is not good must be Platform custom Espressif 8266 Updating custom8266 @ 8097678 [Up-to-date]

try delete path C:\Users\Gerrit.platformio\platforms\custom8266 and exec Advanced platform installation from https://github.com/WallaceWilliam/framework-esp8266-rtos-sdk-idf-platformio.git

P.S. after manual change .py file, update platform us run platformio platform update dont work.

WallaceWilliam avatar Mar 20 '19 19:03 WallaceWilliam

Ok, that did it!!!! I uninstalled custom8266, copied new .zip file from your repository, unzipped it in 'packages'. Then 'pio platform install custom8266' and 'pio run -e 8266' (I have several [env] in my .ini file).

Result is an upload attempt to my device, that failed unfortunately due to having space in file path :-(

` Configuring upload protocol... AVAILABLE: esptool CURRENT: upload_protocol = esptool Looking for upload port... Auto-detected: COM4 Uploading .pioenvs\8266\firmware.bin usage: esptool write_flash [-h] [--flash_freq {keep,40m,26m,20m,80m}] [--flash_mode {keep,qio,qout,dio,dout}] [--flash_size FLASH_SIZE] [--spi-connection SPI_CONNECTION] [--no-progress] [--verify] [--compress | --no-compress]

[
...] esptool write_flash: error: argument
: [Errno 2] No such file or directory: 'C:\\Users\\Gerrit\\Documents\\My' `

gerritv avatar Mar 20 '19 19:03 gerritv

update platform and try again

Platform custom Espressif 8266 Updating custom8266 @ 8097678 [91a3a1f]

WallaceWilliam avatar Mar 20 '19 20:03 WallaceWilliam

Uploaded, yippee.....

Again, thank you soo much for the work and help.

gerritv avatar Mar 20 '19 20:03 gerritv

@WallaceWilliam any clue why PlatformIO on VS Code won't find the tools from the toolchain when trying to "build" code?

`Processing nodemcuv2 (framework: esp8266-rtos-sdk; platform: custom8266; board: nodemcuv2)

PackageManager: Installing toolchain-xtensa-lx106-elf-520 @ >5.0.0 Downloading [####################################] 100%
Unpacking [####################################] 100%
Verbose mode can be enabled via -v, --verbose option CONFIGURATION: https://docs.platformio.org/page/boards/custom8266/nodemcuv2.html PLATFORM: custom Espressif 8266 > NodeMCU 1.0 (ESP-12E Module) HARDWARE: ESP8266 160MHz 80KB RAM (4MB Flash) Library Dependency Finder -> http://bit.ly/configure-pio-ldf LDF MODES: FINDER(chain) COMPATIBILITY(soft) Collected 1 compatible libraries Scanning dependencies... No dependencies Warning! Unknown upload protocol Compiling .pioenvs/nodemcuv2/src/main.o Generating LD script .pioenvs/nodemcuv2/esp8266_out.ld Generating LD script .pioenvs/nodemcuv2/esp8266_common_out.ld sh: xtensa-lx106-elf-g++: command not found sh: xtensa-lx106-elf-gcc: command not found sh: xtensa-lx106-elf-gcc: command not found Compiling .pioenvs/nodemcuv2/bootloader/bootloader_start.o sh: xtensa-lx106-elf-gcc: command not found Compiling .pioenvs/nodemcuv2/bootloader/esp8266/source/ets_printf.o sh: xtensa-lx106-elf-gcc: command not found Compiling .pioenvs/nodemcuv2/bootloader/log/log.o sh: xtensa-lx106-elf-gcc: command not found`

What strikes me is that each time I try to build it thinks it needs to reinstall the toolchain again. Also when I do a pio update I get the following result:

`Platform custom Espressif 8266

Updating custom8266 @ 1.0.0 [Detached] Updating framework-esp8266-rtos-sdk @ 2105cf0 [Up-to-date] Uninstalling toolchain-xtensa-lx106-elf-520 @ 5.2.0: [OK]`

DrywFiltiarn avatar Apr 13 '19 21:04 DrywFiltiarn

please, post platforms\custom8266\platform.json

WallaceWilliam avatar Apr 15 '19 15:04 WallaceWilliam

The problem lies in the fact that your implementation so far is only aimed at Windows. As I’m on a Mac it could obviously not install the required tools. I have been working on 2 forks of your repositories to also support the osx toolchain. I will come back on this later.

DrywFiltiarn avatar Apr 15 '19 15:04 DrywFiltiarn