-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add PlatformIO support #250
Conversation
To make package easily integratable with PlatformIO
@maxgerhardt Thanks! I'll try and get to the toolchain issues very soon. How about adding your notes in this issue to a new |
I've added a |
package.json
Outdated
"version": "0.9.2" | ||
} | ||
"name": "framework-arduinopico", | ||
"version": "1.10902.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version is auto-generated by the package script. It's a minor change I can do to change the #, but what's wrong with the existing #.#.#
format? I always update it (during package/release, but not in git) for releases, so it will be unique no matter what...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format I used is used by pretty much PlatformIO packages, decodable per this, aka <major package version>.<semver encoding of exact version>.<datecode>
, so this is just for the sake of being in-sync with PlatformIO (see e.g. toolchain-gccarmnoneeabi). PlatformIO has no problems also decoding 0.9.2
if it detects that it's not in PlatformIO's preferred format. Although even PlatformIO has inconsistencies.. (see framework-arduino-mbed
).
Note that if changed, also the platform.json
must be adapted (no big deal since no package version has been released anyway). I'm fine with either :)
Oh, and FYI I updated a minor typo in the doc and added your file to the table of contents (otherwise it's invisible to most people!). |
I just had to correct another typo, too. |
I was occupied with other things this weekend so unable to start on the PIO support work, sorry! I'll see what I can get going this week. Or, if you think it's safe to merge this w/o the add'l things in pico-quick-toolchain let me know and I can merge here and work on PIO-proper stuff later. |
I'll add some more documentation (small introduction to PlatformIO in the docs, not jumping straight into Regarding the toolchain: The compiler package |
I've not forgotten about this! Just been very busy these past couple weeks, but it's still on the radar. |
Same same, but I'll aim to push the things I talked about above today. |
I know this is a work in progress but is it possible for me to use/test it? |
@derekmulcahy In the PR description I've mentioned my test project
@earlephilhower I've further updated the docs regarding a general PlatformIO section. I also retested the building & uploading with this latest version. This is good to merge for now in my eyes. Notice that I do change the |
I've re-based onto master. |
@maxgerhardt toolchain for Windows is missing.
|
Correct, that's why one needs to do a |
Thx, good so far. Now i get this
Any hints? |
Something is still wrong with the toolchain or path. Possibly wrong downloadlink for wrong architecture. Can you open an issue in the Tasmota repo with this repo so that we can discuss it here instead of in the PR? This should be a project-specific issue. (Or an issue in my |
Arrgh, sorry! All good. Silly Copy&Paste error!. |
Can we get this merged @earlephilhower? Otherwise let me know if there are open points for this script as of now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay! It's been one heck of a busy late summer.
The script (and docs!) LGTM, so thanks again for doing the integration work!
I'll address the update of the package.JSON numbering in a later PR, but for now this can go in as-is! |
The builder script is pretty much final.
The rest of the work is in the platform scripts / board definitions at https://github.com/maxgerhardt/platform-raspberrypi, where e.g. filesystem uploading etc. is handled.
Updates the
package.json
too with some more meta-information and corrects the version field (SemVer expression).All Arduino IDE menu settings of this core can be replicated within the
platformio.ini
.Selecting the new core
Prerequisite for using this core is to tell PlatformIO to switch to it. There will be board definition files where the Earle-Philhower core will be the default since it's a board that only exists in this core (and not the other https://github.com/arduino/ArduinoCore-mbed). To switch boards for which this is not the default core (e.g. the standard
board = pico
), the directiveboard_build.core = earlephilhower
must be added to the
platformio.ini
. This controls the core switching logic.Flash size
Controlled via specifying the size allocated for the filesystem. Available sketch size is calculated accordingly by using (as in
makeboards.py
) that number and the (constant) EEPROM size (4096 bytes) and the total flash size as known to PlatformIO via the board definition file. The expression on the right can involve "b","k","m" (bytes/kilobytes/megabytes) and floating point numbers. This makes it actually more flexible than in the Arduino IDE where there is a finite list of choices. Calculations happen in the platform.CPU Speed
As for all other PlatformIO platforms, the
f_cpu
macro value (which is passed to the core) can be changed as documentedDebug Port
Via
build_flags
as done for many other cores (example).Debug Level
Done again by directly adding the needed build flags. When wanting to define multiple buid flags, they must be accumulated in either a sing line or a newline-separated expression.
USB Stack
Not specifying any special build flags regarding this gives one the default Pico SDK USB stack. To change it, add
Note that the special "No USB" setting is also supported, through the shortcut-define
PIO_FRAMEWORK_ARDUINO_NO_USB
.arduino-pico/boards.txt
Lines 337 to 338 in 05356da
Selecting a different core version
If you wish to use a different version of the core, e.g., the latest git
master
version, you can use aplatform_packages
directive to do so. Simply specify that the framework package (framework-arduinopico
) comes from a different source.Whereas the
#master
can also be replaced by a#branchname
or a#commithash
.Note that this can only be done for versions that have the PlatformIO builder script it in, so versions before 1.9.2 are not supported.
Examples
The following example
platformio.ini
can be used for a Raspberry Pi Pico and 0.5MByte filesystem.The initial project structure should be generated just creating a new project for the Pico and the Arduino framework, after which the auto-generated
platformio.ini
can be adapter per above.The project has been tested with https://github.com/maxgerhardt/pio-pico-core-earlephilhower-test on a Pi Pico and a Sparkfun RP2040 Thing Plus and wit works just fine.
Following the merge of this PR, there's still some packaging and publishing work to do (
toolchain-pico
,tool-pioasm
, this repo asframework-arduinopico
), along with porting all board definitions into the platform to fully support the core. Oh, and of course a PR to https://github.com/platformio/platformio-docs/ for the documentation of core settings.