Adding a new framework to Platformio

Thanks, getting a better understanding.

For @valeros :
No need for example now, also learning scons better.

Hi,
When updating/testing the sming.py I regular like to understand scons results.

Question : How can I add command line options to the scons process.
As an example “scons --debug=prepare” or “scons --tree=all”

You need

export SCONSFLAGS=" --debug=prepare"
pio run ...

Thanks, works for getting scons options.

FYI :
When using SCONSFLAGS= --tree=all → works OK
When using SCONSFLAGS= --tree=status I get the following error :


scons: `.pioenvs\nodemcuv2\firmware.bin’ is up to date.
E = exists
R = exists in repository only
b = implicit builder
B = explicit builder
S = side effect
P = precious
A = always build
C = current
N = no clean
H = no cache

[E B C ]±.pioenvs\nodemcuv2\firmware.bin
[E B C ] ±.pioenvs\nodemcuv2\firmware.elf
[E B C ] | ±.pioenvs\nodemcuv2\src\application.o
AttributeError: ‘NoneType’ object has no attribute ‘get_contents’:
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Script\Main.py”, line 1346:
_exec_main(parser, values)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Script\Main.py”, line 1309:
_main(parser)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Script\Main.py”, line 1091:
nodes = build_targets(fs, options, targets, target_top)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Script\Main.py”, line 1283:
jobs.run(postfunc = jobs_postfunc)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Job.py”, line 111:
self.job.start()
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Job.py”, line 399:
task.postprocess()
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Script\Main.py”, line 288:
tp.display(t)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Script\Main.py”, line 419:
SCons.Util.print_tree(t, func, prune=self.prune, showtags=s)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Util.py”, line 286:
print_tree(C, child_func, prune, idx, margin, visited)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Util.py”, line 286:
print_tree(C, child_func, prune, idx, margin, visited)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Util.py”, line 286:
print_tree(C, child_func, prune, idx, margin, visited)
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Util.py”, line 260:
tags.append(’ C’[IDX(root.is_up_to_date())])
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Node\FS.py”, line 3286:
if not self.changed(r):
File “c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Node\FS.py”, line 3241:
has_changed = SCons.Node.Node.changed(self, node)
File "c:\userdata\piodata\packages\tool-scons\script..\engine\SCons\Node_init
.py", line 1462:
contents = self.get_executor().get_contents()
[ ERROR ] Took 0.79 seconds

Please wait for a while… @valeros prepared a “beta” version of Sming integration. He is going to create a separate branch in the repository and will explain here how to use. You can discuss here further steps about integration.

Ok, great.

I will continue learning platformio & scons with my current trial of sming.py.

@valeros : Don’t go to far in the beta version of sming. I take the opportunity to (re)structure the sming build process while integrating into platformio.

PS : Will be out coming week for a short holiday, don’t expect answers then :slight_smile:

Hi @hreintke, looks like you are using Windows machine, so here are a few steps to try beta version:

  • If you still don’t have PlatformIO 3.0 install it.
  • Install beta version of espressif development platform from Github:
pio platform install git+https://github.com/platformio/platform-espressif.git#feature/framework-sming
pio run -d C:\Users\YOUR_USER_NAME\.platformio\platforms\espressif\examples\sming-basic-wifi\

If you want to try another board with more than 512K memory, please edit main.py:161 line according to your memory size.

PS:
Can we use esptool-ck instead of esptool2 and esptool.py for splitting and uploading firmware?
Is there a dependency on the toolchain version?
Which version of the SDK is preferable?

Hi Vallerii,

Thanks for time and effort to start & help on the sming framework.

First remarks on the above.

That’s it for now, more to come.

No, see command above

pio platform install git+https://github.com/platformio/platform-espressif.git#feature/framework-sming

But then I get :

C:\temp>pio platform install git+https://github.com/platformio/platform-espressif.git#feature/framework-sming


If you like PlatformIO, please:


Installing platform git+https://github.com/platformio/platform-espressif.git#feature/framework-sming @ latest:
‘git’ is not recognized as an internal or external command,
operable program or batch file.

Or when trying without the “git+”

C:\temp>pio platform install GitHub - platformio/platform-espressif8266: Espressif 8266: development platform for PlatformIO
Installing platform GitHub - platformio/platform-espressif8266: Espressif 8266: development platform for PlatformIO @ latest:
Downloading…
Error: Can not unpack file ‘c:\userdata\piodata\platforms\installing-i10nbv-package\framework-sming’

Please install Git Git - Downloads

P.S: Users will not need to install Git, this step is required for Windows developers.

Ah, sorry.
Was to much focused on platformio that I missed it as a windows error message.

  • Installation
    Hope not to make another mistake like that but now I have :
    Installing platform git+https://github.com/platformio/platform-espressif.git#feature/framework-sming @ latest:
    git version 1.8.3.msysgit.0
    Cloning into ‘c:\userdata\piodata\platforms\installing-1za5ys-package’…
    remote: Counting objects: 87, done.
    remote: Compressing objects: 100% (57/57), done.
    emote: Total 87 (delta 44), reused 59 (delta 22), pack-reused 0
    Unpacking objects: 100% (87/87), done.
    Installing package tool-scons @ >=2.3.0,<2.6.0:
    Downloading [####################################] 100%
    Unpacking [####################################] 100%
    Installing package toolchain-xtensa @ ~1.40802.0:
    Downloading [####################################] 100%
    Unpacking [####################################] 100%
    Installing package tool-esptool @ ~1.408.0:
    Downloading [####################################] 100%
    Unpacking [####################################] 100%
    Installing package tool-esptoolpy @ ~1.10100.0:
    Error: Detected unknown package ‘tool-esptoolpy’

  • Tools
    Yes, as I see it now, we can change the tools Sming is using.
    There are two build processes within Sming, one “normal” and one including “rboot”
    Rboot being the OTA functionality in Sming.
    I will combine the two when integrating in platformio

  • Toolchain version.
    Most Sming users are using toolchain version 5.1.0, platformio is 4.8.2.
    Remember from a time ago that there were issues with a toolchain version but need to check what issues and which version
    What is the upgrade policy of platformio for packages/toolchains/SDK’s ?
    Especially when multiple framework are using the same package ?
    Or can there be multiple versions of the same package within platformio.

  • Integration code
    Looked globally within the beta implementation made by @valeros.
    Was surprised that the Sming specific items were split between main.py and sming.py.
    Isn’t the main.py maintained by platformio team and sming.py by sming team.
    One of the options I was thinking of is taking the approach from simba framework and just put a stub/include in plaformio/sming.py and keep the actual integration code in the sming framwork itself.
    What is your opinion on that ?

Installation issue solved.
Starting further testing.

Have the first small Sming application running using platformio.
Thanks for the help on that.

Will continue after return from my holiday.

PlatformIO 3.0 allows having different toolchains, SDK, etc per different framework, boards… I’ll explain you later how to make it.

That was the main goal of PlatformIO 3.0 - split PlatformIO 2.0 to

  • PlatformIO 3.0 Core
  • PlatformIO 3.0 compatible development platforms

You even can have own espressif-sming development platform with own packages and build scripts. However, I don’t recommend to do it in this situation. The idea to keep Sming build script in the Sming’s repository is very good! We don’t have any objections.

We are so glad to answer your questions and help you! Have a nice holiday! :sunny:

Back in town and restarted the Sming integration.

I have a first, not nice structured, version of the application build running.
There are two build processes within Sming, started depending on environment variables. I will (try to) integrate the two to one.

In the build process I included the framework as a library (local, not platformio).
That prevents the necessity to recompile the framework when application is updated.

I would like to have both “Release” and “Development” options, do I need to have two frameworks included, each with their own versioning ?

This is very interesting. What are you going to keep in framework-sming package?

You have a few options:

  • to have the separate development platforms: espressif and espressif-dev, where you will define different Sming versions and different build scripts
  • to use -DRELEASE macros in platformio.ini > build_flags and then use it in build script

For now I have the full source and a “compiled version” = library.
That is close to the situation I have now in Sming itself.
In there we have full source and users have to do a one-time compile to create the Sming library.
But to create the Sming library I have another build process. By including the compiled version I prevent have to create that in platformio too.

In platformio, the framework content is fixed to the installed version → No possibility for users to update the framework in there → No need to force the user to create one by him/herself when I include it in the platformio framework.

Current plan is to keep both source and library in the platformio framework. Possibly later a split between header (include) and source (excluded) but that is not for now.

Thanks, will do some thinking on that.
Is there a “common practice” within platformio. I try to keep as close to platformio standards as possible.

1 Like

This is not a good idea to ask users to do one-time compilation. Please use original Sming source code and build it using PlatformIO builder without “pre-compiling”.

The philosophy of PlatformIO 3.0 that user can “duplicate” existing platform and modify it (use custom version of the framework and etc)


In PlatformIO 2.0 we have fixed development platforms that are built-in into PlatformIO engine. We have PlatformIO Core and separated development platforms with PlatformIO 3.0

Hello, any update on this Sming support?

I’m getting error when trying to install via posted instructions. I get following error:

PackageManager: Installing tool-esptool @ ~1.408.0
Error: Could not find a version that satisfies the requirement ‘~1.408.0’ for your system ‘windows_x86’

Not going any further from this point. Any pointers to get it installed correctly?

Thanks.

Hey,

Arduino’s OTA with eBoot has always annoyed me for various reasons. I came across the superb GitHub - raburton/rboot: An open source bootloader for the ESP8266 but did not want to deal with bare Makefiles and linker scipts, so Sming does use it and that the reason why I am here and trying to follow the describes steps above. But the sming feature branch does not seem to exist anymore:

$ pio platform install git+https://github.com/platformio/platform-espressif.git#f
eature/framework-sming
Platform Manager: Installing git+https://github.com/platformio/platform-espressif.git#feature/framework-sming
git version 2.29.2.windows.2
Cloning into 'C:\Users\<user>\.platformio\.cache\tmp\pkg-installing-k4p_7o1b'...
warning: Could not find remote branch feature/framework-sming to clone.
fatal: Remote branch feature/framework-sming not found in upstream origin
Error: VCS: Could not process command ['git', 'clone', '--recursive', '--depth', '1', '--branch', 'feature/framework-sming
', 'https://github.com/platformio/platform-espressif.git', 'C:\\Users\\<user>\\.platformio\\.cache\\tmp\\pkg-insta
lling-k4p_7o1b']

Could you re-push it? Or is it even still existing? And is it even compatible with PIO 5.x?

Best regards would really love to see Sming @ PIO… or well at least rboot.