arduino-pico icon indicating copy to clipboard operation
arduino-pico copied to clipboard

Great job! Do you have a plan to adjust it for Platformio?

Open vladkozlov69 opened this issue 3 years ago • 76 comments

Hello Earle,

your codebase looks really great. Do you have a plan to adjust it for Platformio? i.e. adding board definition and platformio-specific packages/platforms?

vladkozlov69 avatar Mar 31 '21 14:03 vladkozlov69

@vladkozlov69 I don’t use Platform IO but I do know of it from my other Arduino core.

It would be great if you or another user sent a PR for this. I know it’s not a big project, but doubt I’ll have time soon on my own to look at it.

earlephilhower avatar Mar 31 '21 16:03 earlephilhower

Has anyone else taken this on? If not, I can give it a shot.

jhmaloney avatar Apr 28 '21 20:04 jhmaloney

Unfortunately, after consulting with Valerii Koval from PlatformIO, I've concluded that this project is more than I care to take on, especially since I'd need to learn a lot about creating build scripts. I also found that PlatformIO does not want to support two Arduino Pico frameworks, so PlatformIO support for this package would be an ongoing community effort.

That said, PlatformIO does have a way to pull unsupported packages from GIT repositories, so adding PlatformIO support could still be useful. This community project has support for things that are not (yet?) in the official Arduino Pico framework, including the LittleFS and Servo libraries, which my project (MicroBlocks) depends on. My sincere thanks to Earle and others who have contributed to this package!

Here are the steps Valerii outlined, in case someone else wants to give this a go.

This integration might need a substantial amount of effort. Here are the steps I think will be needed.

First, the community package uses a custom toolchain with a very recent version of the newlib library, so it is not compatible with the toolchain used in the official Arduino core. That means that you will need to repack and upload to the PlatformIO registry all the necessary toolchains. (I assume there are also other auxiliary tools that should be uploaded (e.g. elf to uf2 converter, some python scripts etc.))

Second -- and most important -- is the build script. The Arduino IDE build logic must be adapted the PlatformIO build system API. This isn't going to be an easy task. All that logic will go to a new python file in this folder https://github.com/platformio/platform-raspberrypi/tree/develop/builder/frameworks/arduino . You can take a look at similar scripts in the STM32 platform, for example https://github.com/platformio/platform-ststm32/blob/develop/builder/frameworks/arduino/mxchip.py

Finally, you will need to implement some logic so users can switch between cores. Usually, we do this using the "build.core" option. Here is how it described in our docs for STM32: https://docs.platformio.org/en/latest/platforms/ststm32.html#configuration

And here is the code responsible for switching cores (look how we change packages, their versions, build scripts, etc) https://github.com/platformio/platform-ststm32/blob/develop/platform.py#L41

jhmaloney avatar May 04 '21 13:05 jhmaloney

@jhmaloney it may not be as bad as it sounds, but it's your call.

I based this core off of my work w/the ESP8266 Arduino core (https://github.com/esp8266/Arduino) and I have a feeling the actual build script there could be used here with minor mods. The toolchain packaging AFAIK isn't much, either, as I'm using the same GCC and newlib there and it didn't seem to be a big deal to the PIO-esp8266 maintainer.

earlephilhower avatar May 04 '21 14:05 earlephilhower

I've opened the matching issue in https://github.com/platformio/platform-raspberrypi/issues/13. I can actually also help with the needed builder script and PR into this repo.. they are not too difficult to write, mostly all the same with some core-specific configuration options added mostly.

maxgerhardt avatar Jul 02 '21 11:07 maxgerhardt

Cool, @maxgerhardt . If there are any changes, let me know! I've followed the ESP8266 tools and core packaging setup, which already supports it, so we should be more than half way there.

I'd do it myself, but I've never been able to get PIO working for me, except to build Marlin. There, it "just worked." But using a git repo instead of a d/l'd package, I could never get it to work...

earlephilhower avatar Jul 02 '21 21:07 earlephilhower

FYI, today I've forked the core and added a builder script, along with the needed platform modifications to use your toolchain-pico and being able to do a core-selection in the platformio.ini in https://github.com/maxgerhardt/platform-raspberrypi. A test firmware repo is at https://github.com/maxgerhardt/pio-pico-core-earlephilhower-test.

The current state is that I can successfully build the firmware (with the linker script also generated by simplesub.py) and it runs :). Tested with a blinky and USB serial sketch.

There's also some ToDos left for being able to select the "partition table" / flash size options, and adding support for uploading files as e.g. supported in ESP8266 & ESP32. But overall, this won't be a big deal, most of the work is already done.

After that's done I'll PR into this repo and do the PRs for the platform-raspberrypi and the documentation, then we'll have it in mainstream PlatformIO.

maxgerhardt avatar Jul 14 '21 02:07 maxgerhardt

Great news! If you're feeling lucky, IIRC platformIO supports debugging and we distribute both GDB and OpenOCD in the tools tarball. But that's definitely a "nice to have" not a "need to have!" :)

Once your PR is in, I think it should be simple enough to add any platformIO specific packaging stages to the automated release process. So when I push a tag to generate a release, the CI system will generate whatever else is needed for PIO, too.

earlephilhower avatar Jul 14 '21 05:07 earlephilhower

IIRC platformIO supports debugging and we distribute both GDB and OpenOCD in the tools tarball. But that's definitely a "nice to have" not a "need to have!" :)

Debugging support is handled on the platform level (platform-raspberrypi), independent of the framework, (Would also be cumbersome to re-add the same debugging logic / commands for every framework.) There, (here, here) it already has support for debugging via JLink (JLink.exe) and OpenOCD (with picotool, cmsis-dap, raspberrypi-swd or any other debug adapter). So that's actually automatically already there and PlatformIO already has the packages for it (with GDB being sourced from toolchain-pico then). I'll of course verify this with my own Pico :)

maxgerhardt avatar Jul 14 '21 08:07 maxgerhardt

I am moving towards the final steps of the builder script refinements and platform code modifications.

It is now working that a user can specify the sketch and filesystem size in the platformio.ini, via a e.g. board_build.filesystem_size = 1M parameter. From that, the linker script input variables are calculated just like in this core.

Also I've added the code in the platform to create LittleFS images with the config that this core uses and the ability to flash those images via picotool to the device via the usual "Build Filesystem" and "Upload Filesystem" project tasks. It is all working pretty nicely :)

grafik

The final steps are making it work via OpenOCD / JLink.exe upload methods and verifying that debugging works.

maxgerhardt avatar Jul 14 '21 21:07 maxgerhardt

I'm making progress regarding adding debugging support using Picoprobe, but it's not 100% working yet.

grafik

The stacktrace doesn't reach back to the actual user function (in the sketch I do Serial.printf() and the furthest in the stacktrace is SerialUART::write() and doesn't halt in e.g. setup() or loop(). Interestingly it sees both Cortex-M0+ cores as hardware threads and I can inspect them individually, with only Core 0 running a firmware for now.

PR #250 has been opened in the meantime for the builder script for this core.

EDIT: Hm interesting, changing the linker script to comment out that stuff is placed in RAM.. has caused all functions to be placed in RAM.. and with that debugging is working better.

grafik

maxgerhardt avatar Aug 08 '21 11:08 maxgerhardt

To me, https://github.com/earlephilhower/arduino-pico/issues/501 seems like the biggest issue with using this on PlatformIO right now. Adafruit TinyUSB isn't working at all, meaning USB functionality is severely limited. I couldn't figure out a way of using Pico SDK tinyusb directly either.

JonnyHaystack avatar Apr 28 '22 10:04 JonnyHaystack

Sorry if this is not the right place for my issue (please let me know in that case).

I have tried to use the core in PlatformIO, but I get an error in the line #include Arduino.h that says:

#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\micro\Documents\PlatformIO\Projects\Amigo\src\main.cpp).C/C++(1696)
cannot open source file "stdint.h" (dependency of "Arduino.h")C/C++(1696)

Here's my platformio.ini:

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
board_build.f_cpu = 133000000L
board_build.filesystem_size = 0.5m
platform_packages = 
	maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
	maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.3-a/i686-w64-mingw32.arm-none-eabi-ed6d983.220212.zip

When trying to compile, the terminal says that various commands all named arm-none-eabi-... (seems to be the compiler itself?) cannot be found.

The entire folder .pio\build\pico\FrameworkArduino is empty, as well as the other folders under pico. I assume this is not how it's supposed to be ...

Can anyone help with this?

Laserjones avatar May 08 '22 16:05 Laserjones

Which operating system are you using? The platformio.ini has a Windows-specific download link, if you have a different one you need to adapt it.

You can also try and force a redownload of the components by removing the <home folder>/.platformio/.cache and <home folder>/.platformio/packages/toolchain-pico folders and building the project again.

maxgerhardt avatar May 08 '22 21:05 maxgerhardt

Here's what I use on Mac OS:

platform_packages = maxgerhardt/framework-arduinopico@https://github.com/maxgerhardt/arduino-pico.git maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.2-a/x86_64-apple-darwin14.arm-none-eabi-9d55fd1.220202.tar.gz

Hope that helps!

jhmaloney avatar May 08 '22 21:05 jhmaloney

Sorry, I should have mentioned that I'm using Windows 10, 64-bit. I used the current link provided on https://github.com/earlephilhower/pico-quick-toolchain/releases.

You can also try and force a redownload of the components by removing the /.platformio/.cache and /.platformio/packages/toolchain-pico folders and building the project again.

I emptied the two folders. When trying to rebuild, they were filled again as expected. But the error remains, and the .pio\build\pico\FrameworkArduino folder is still empty. I then even created a new project from scratch with the above platformio.ini and the default barebone main.cpp file, but the problem still persists.

So it looks like the toolchain is not copied into the project for some reason ...?

Laserjones avatar May 08 '22 22:05 Laserjones

Here's what I use on Mac OS:

platform_packages = maxgerhardt/framework-arduinopico@https://github.com/maxgerhardt/arduino-pico.git

That's interesting, this is not the link stated by Earle in his documentation, which is https://github.com/earlephilhower/arduino-pico.git (is there a specific reason for this change?). Anyway, I now tried using your link instead, but it did not solve the problem either ...

Laserjones avatar May 08 '22 22:05 Laserjones

The IntelliSense C/C++ Configuration of PlatformIO says that there is no valid compiler path found. I can specify a path manually, but shouldn't this be handled automatically?

Doing a Windows search, I found the following path and entered it in the configuration: C:\Users\ (...) .platformio\packages\[email protected]\bin\arm-none-eabi-g++.exe

This removed the includePath error in the line #include Arduino.h, but when trying to build, I still get messages that "arm-none-eabi-gcc" and "arm-none-eabi-g++" cannot be found.

Laserjones avatar May 08 '22 23:05 Laserjones

That's interesting, this is not the link stated by Earle in his documentation, which is https://github.com/earlephilhower/arduino-pico.git (is there a specific reason for this change?). Anyway, I now tried using your link instead, but it did not solve the problem either ...

I was an early user of using Earle's framework with platformio and I'm using the platform_packages that Earle and Max recommended at the time. There may be a better way to do things now, but this is still working for me.

When I was first getting the toolchain set up I got errors like the one's you report because I had the wrong toolchain link. It's been a while, but I believe I picked the toolchain for my operating system from:

https://github.com/earlephilhower/pico-quick-toolchain/releases

Good luck!

jhmaloney avatar May 09 '22 02:05 jhmaloney

Could it depend on the way I created the original project before I adapted the platformio.ini? When I selected the board, there were several entries called "Raspberry Pico" or similar. I have no idea what the differences are, so I just picked the first one ...

Laserjones avatar May 09 '22 09:05 Laserjones

board = pico is perfectly valid. This is in fact the very first board in my example.

That's interesting, this is not the link stated by Earle in his documentation, which is https://github.com/earlephilhower/arduino-pico.git (is there a specific reason for this change?). Anyway, I now tried using your link instead, but it did not solve the problem either ...

I would actually recommend using the earlephilhower original core, my fork of it is just for some testing (e.g. RAM linker scripts, debugging, ..) and present in my test projects, use this repo (https://github.com/earlephilhower/arduino-pico.git) to get the latest things.

maxgerhardt avatar May 09 '22 09:05 maxgerhardt

board = pico is perfectly valid. This is in fact the very first board in my example.

I know, but my thought was that besides the platformio.ini file, there might be other parts of the project set up differently depending which of the "Rapberry Pico" board entries I select in advance? Or does the platformio.ini control everything?

Image1

Laserjones avatar May 09 '22 09:05 Laserjones

The platformio.ini controls all base build configuration options, nothing else you selected in the UI matters. In fact one can create an "Arduino Uno" project then change the platformio.ini to the one you posted above and it will compile for a pico. No traces of an Arduino Uno then.

maxgerhardt avatar May 09 '22 09:05 maxgerhardt

The platformio.ini controls all base build configuration options, nothing else you selected in the UI matters. In fact one can create an "Arduino Uno" project then change the platformio.ini to the one you posted above and it will compile for a pico. No traces of an Arduino Uno then.

Good to know. But then I have absolutely no idea why the compiler is not found ... Shouldn't it be installed along with the other stuff? Where would it usually be located?

Here's a portion of the terminal output, maybe it helps:

image

The German error messages say that arm-none-eabi-... is misspelled or not found. (Any idea how I can enforce English error messages? PlatformIO is set to English already.)

Laserjones avatar May 09 '22 10:05 Laserjones

Is the folder <home folder>/.platformio/packages/toolchain-pico still empty after that? Even after removing toolchain-pico and that .cache folder referenced above?

Do you have antivirus active?

The only two possibilities I see is a corrupted download or an AV blocking execution.

maxgerhardt avatar May 09 '22 10:05 maxgerhardt

No, as I wrote above, the toolchain-pico and .cache folders were re-filled automatically after I emptied them. What is still empty is the .pio\build\pico\FrameworkArduino folder within the project.

I also found now that the compiler EXEs are indeed there in toolchain-pico\bin. I tried to set this path as the compiler path in the IntelliSense settings (which I can open via the light bulb icon next to the error message in the #include Arduino.h line, which has reappeared for some reason), but for some reason it is not saved. Is there a config file I can edit directly? I found a website that speaks of a .vscode\c_cpp_properties.json file including the compile path, but it does not exist on my system.

I'm using the standard Windows Defender as AV. I don't think it has to do with that. I could compile a project using the MBED core without problems.

Laserjones avatar May 09 '22 11:05 Laserjones

tried to set this path as the compiler path in the IntelliSense settings (which I can open via the light bulb icon next to the error message in the #include Arduino.h line, which has reappeared for some reason), but for some reason it is not saved.

PlatformIO controls + will overwrite the .vscode/ configuration files, it has to be fixed in PlatformIO, VSCode follows automatically.

I also found now that the compiler EXEs are indeed there in toolchain-pico\bin.

Can you try adding an exception for the toolchain-pico/bin folder in Windows defender per https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26?

What happens when you open a terminal (Windows + R -> cmd.exe), go into the compiler directory (cd <path to toolchain-pico/bin folder) and execute arm-none-eabi-gcc --version?

maxgerhardt avatar May 09 '22 11:05 maxgerhardt

Can you try adding an exception for the toolchain-pico/bin folder in Windows defender

This did not help.

What happens when you open a terminal (Windows + R -> cmd.exe), go into the compiler directory (cd <path to toolchain-pico/bin folder) and execute arm-none-eabi-gcc --version?

I get the same error message as in the compiler terminal (which explains why it is German, as it is generated by Windows directly). When I run the terminal as Administrator, the command works (version is displayed: arm-none-eabi-gcc (GCC) 10.3.0). However, running VSCode as Administrator did not help.

Laserjones avatar May 09 '22 12:05 Laserjones

There's something really wrong when you can execute a binary which should have been created as a regular user only as administrator, and not as a regular user. :/. The binary should be readable and executable by your regular user account.

At this point I can only propose a clean reinstall of PlatformIO as a regular user. That is, remove the VSCode PlatformIO extension, remove the entire <home folder>/.platformio folder, re-open VSCode, reinstall the PlatformIO extension, re-import your old Pico project and try compiling it again.

maxgerhardt avatar May 09 '22 12:05 maxgerhardt

It's getting stranger and stranger. After reinstalling PlatformIO, I can now call the compiler via the terminal as a normal user, but trying to compile the project, the error messages still appear!

Should I reinstall VSCode from scratch?

Laserjones avatar May 09 '22 12:05 Laserjones

It may be worth a try, as I'm out of ideas 😄.

maxgerhardt avatar May 09 '22 12:05 maxgerhardt

I'm out of ideas, too. Reinstalling everything still did not solve the problem. :-(

I created a fresh project again after the reinstall and only copied the platformio.ini into it. No other change. I was able to compile the project before that change (i.e. using the default MBED core, I assume), but not afterwards. Running the compiler from the Windows terminal still works as a normal user.

To me, the error messages indicate that the executable that calls the compiler (I don't know which executable that is) either has no sufficient rights to call it, or it doesn't even find the compiler. But both I as a normal user and Administrators have full access to the bin folder according to Windows.

I now understood that each PlatformIO project has its own c_cpp_properties.json file. I found that during the changes initiated by the new platformio.ini, the compiler path in that file was automatically changed to "compilerPath": "arm-none-eabi-gcc",, which triggered a warning at the bottom that this cannot be found (interestingly, in German again, see screenshot). Is this "path" correct nevertheless, or could it be related to my problem? With the MBED core, that line still contained a complete Windows path starting with C:/users/... But changing the path to the actual one (.../.platformio/packages/toolchain-pico/bin/arm-none-eabi-gcc.exe) did not solve the problem either.

image

Laserjones avatar May 09 '22 13:05 Laserjones

Do you have more VSCode extensions installed beyond C/C++ by Microsoft and PlatformIO? You may try disabling them and rebuilding the index. (Ctrl+Shift+P -> Rebuild IntelliSense Index in VScode)

maxgerhardt avatar May 11 '22 14:05 maxgerhardt

No other extensions. For now I have given up and switched to the Arduino IDE 2.0.

Laserjones avatar May 11 '22 15:05 Laserjones

I'm having a weird, but very minor, issue on Linux with PlatformIO. It reinstalls the toolchain every time I build.

Processing pico (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: pico; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.3-a/arm-linux-gnueabihf.arm-none-eabi-ed6d983.220212.tar.gz
Unpacking  [########----------------------------]   23%  00:00:38

Happy to move this to a separate issue too.

PS. Fantastic work on this core and on the PlatformIO integration.

vaelen avatar May 24 '22 01:05 vaelen

That's weird -- does that appear with the latest PlatformIO core version? (CLI -> pio upgrade --dev). In <home folder>/.platformio/packages/toolchain-pico/>, does there exist a .piopm (PIO packet manager) file?

maxgerhardt avatar May 24 '22 08:05 maxgerhardt

Yes, it still does it on the newest build.

andrew@raspberrypi:~ $ pio upgrade --dev
Please wait while upgrading PlatformIO ...
PlatformIO has been successfully upgraded to 6.0.2a2
Release notes: https://docs.platformio.org/en/latest/history.html

The file does exist. The contents are listed below.

andrew@raspberrypi:~ $ cat ~/.platformio/packages/toolchain-pico/.piopm 
{"type": "tool", "name": "toolchain-pico", "version": "5.100300.220212", "spec": {"owner": "maxgerhardt", "id": null, "name": "toolchain-pico", "requirements": null, "uri": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.3-a/arm-linux-gnueabihf.arm-none-eabi-ed6d983.220212.tar.gz"}}

Here is my platformio.ini

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower

platform_packages =
    maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
    maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.3-a/arm-linux-gnueabihf.arm-none-eabi-ed6d983.220212.tar.gz

vaelen avatar May 24 '22 09:05 vaelen

Could you try using https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.1-a/arm-linux-gnueabihf.arm-none-eabi-7855b0c.210706.tar.gz as the download link for toolchain-pico? I have tested that against an earlier version. Compilation might fail, but if you compile it multiple times, does it unpack the toolchain anew every time?

maxgerhardt avatar May 24 '22 11:05 maxgerhardt

Same behavior with that version. I'll see if I can setup another project with a similar toolchain requirement, where it links to a specific URL instead of just a version. It might be a bug in pio on Linux.

vaelen avatar May 24 '22 15:05 vaelen

We did a major integration rehault at https://github.com/platformio/platform-raspberrypi/pull/36, please update the platform as described in the third comment of the PR and use the same platformio.ini as the PR (no more platform_packages). Does it still occurr?

maxgerhardt avatar Jun 09 '22 22:06 maxgerhardt

That fixed it! Thanks. :)

vaelen avatar Jun 10 '22 06:06 vaelen

Hi,

EDIT: I've read the third comment on PR 😇 I'll try to fix my install …

I'm trying to use your platform IO config for my Arduino RP2040 Connect, but it seems that all your examples are for the last pico? From your platform.txt given, I've tried this config:

[env:nanorp2040connect]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = nanorp2040connect
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m
platform_packages = 
    maxgerhardt/framework-arduinopico@https://github.com/maxgerhardt/arduino-pico.git
    maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.4.0-c/x86_64-linux-gnu.arm-none-eabi-0196c06.220714.tar.gz

But I've got an error about the toolchain:

Processing nanorp2040connect (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: nanorp2040connect; framework: arduino)
------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing earlephilhower/toolchain-rp2040-earlephilhower @ 5.100300.220629
Error: Could not find the package with 'earlephilhower/toolchain-rp2040-earlephilhower @ 5.100300.220629' requirements for your system 'linux_x86_64'

I think the build tool is looking for a toolchain for rp2040, but I've only found mention of the one for pico.

OK. The answer was on PR:

You are using an old platform version. CLI -> pio platform update https://github.com/maxgerhardt/platform-raspberrypi.git.

NicolasDumoulin avatar Jul 15 '22 16:07 NicolasDumoulin

Please just use

[env:nanorp2040connect]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = nanorp2040connect
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m
platform_packages = 
    maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git

And use the CLI to pio pkg update -g -p https://github.com/maxgerhardt/platform-raspberrypi.git.

Your PlatformIO installation seems to want to install an outdated compiler version (5.100300.220629) when a new one was released just 4 hours ago as 5.100300.220714 . If these caching issues persist, please delete C:\Users\<user>\.platformio\platforms\raspberrypi* and rebuild the project.

And if that still did not help, remove C:\Users\<user>\.platformio\.cache and rebuild, since it may cache API requests there.

maxgerhardt avatar Jul 15 '22 16:07 maxgerhardt

Yeah, @maxgerhardt , I was just about to drop a note in the PR about the updated toolchain which was just published. Was debugging the PicoW LWIP stack when I found I missed a mutex in the FILE structure, so I needed a new toolchain build.

earlephilhower avatar Jul 15 '22 16:07 earlephilhower

Thanks @maxgerhardt for your very quick answer!

I've updated the CLI for the mentionned update and removed the cache dirs ~/.platformio\platforms\raspberrypi* and .platformio/.cache

But I've still the error when I try to build the project:

Processing nanorp2040connect (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: nanorp2040connect; framework: arduino)
------------------------------------------------------------------------------------------------------------------------
Platform Manager: Installing git+https://github.com/maxgerhardt/platform-raspberrypi.git
git version 2.25.1
Clonage dans '/home/dumoulin/.platformio/.cache/tmp/pkg-installing-_cgm83ha'...
remote: Enumerating objects: 70, done.
remote: Counting objects: 100% (70/70), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 70 (delta 32), reused 25 (delta 2), pack-reused 0
Dépaquetage des objets: 100% (70/70), 121.78 Kio | 733.00 Kio/s, fait.
Sous-module 'builder/frameworks/arduino/mbed-core' (https://github.com/platformio/builder-framework-arduino-core-mbed.git) enregistré pour le chemin 'builder/frameworks/arduino/mbed-core'
Clonage dans '/home/dumoulin/.platformio/.cache/tmp/pkg-installing-_cgm83ha/builder/frameworks/arduino/mbed-core'...
remote: Enumerating objects: 31, done.        
remote: Counting objects: 100% (31/31), done.        
remote: Compressing objects: 100% (23/23), done.        
remote: Total 31 (delta 8), reused 24 (delta 7), pack-reused 0        
Chemin de sous-module 'builder/frameworks/arduino/mbed-core' : 'ed9a3458e336660fdf2b1d4a4c828a2ddfd214ad' extrait
Platform Manager: [email protected]+sha.28e5339 has been installed!
Tool Manager: Installing earlephilhower/toolchain-rp2040-earlephilhower @ 5.100300.220629
Error: Could not find the package with 'earlephilhower/toolchain-rp2040-earlephilhower @ 5.100300.220629' requirements for your system 'linux_x86_64'

NicolasDumoulin avatar Jul 15 '22 16:07 NicolasDumoulin

My bad, I actually hardcoded the toolchain reference with its datecode and so naturally I had to update it (https://github.com/maxgerhardt/platform-raspberrypi/commit/17cb99f3fbe6df9895a0a51ded5324e288a28cb7). Please issue the pio platform update ... command again and rebuild.

maxgerhardt avatar Jul 15 '22 16:07 maxgerhardt

Cool. It works ✌️ Thanks!

NicolasDumoulin avatar Jul 15 '22 17:07 NicolasDumoulin

After updating the platform just now, I'm getting the following error

 *  Executing task: C:\Users\Haystack\.platformio\penv\Scripts\platformio.exe run --environment pico 

Processing pico (platform: https://github.com/maxgerhardt/platform-raspberrypi; framework: arduino; board: pico)
----------------------------------------------------------------------Tool Manager: Installing earlephilhower/toolchain-rp2040-earlephilhower @ 5.100300.220714
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing earlephilhower/framework-arduinopico @ ~1.20202.0
Error: Could not find the package with 'earlephilhower/framework-arduinopico @ ~1.20202.0' requirements for your system 'windows_amd64'

JonnyHaystack avatar Jul 18 '22 23:07 JonnyHaystack

Fixed in https://github.com/maxgerhardt/platform-raspberrypi/commit/488689c592f8e20512c0f31f00b051e7cd13af8f, please update platform again.

maxgerhardt avatar Jul 19 '22 09:07 maxgerhardt

Alright I just went ahead and updated a bunch of stuff, which as a sideffect gives us Raspberry Pi Pico W support in PlatformIO, see PR.

maxgerhardt avatar Jul 19 '22 10:07 maxgerhardt

I finally managed to upload, but unfortunately it cannot detect any networks, while it works fine with micropython.

Thats my main.cpp

#include <Arduino.h>
#include <WiFi.h>

void setup() { Serial.begin(115200); }

void loop() {
  Serial.println(WiFi.scanNetworks());
  delay(5000);
}

Thats my platformio.ini

[env:rpipicow]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipicow
framework = arduino
board_build.core = earlephilhower


platform_packages =
    maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
    maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.4.0-c/x86_64-w64-mingw32.arm-none-eabi-0196c06.220714.zip

Thats the output:

0
0
0
...

With micropython i find a bunch of networks. VSC does not show any errors or warnings, i am lost ^^

WaGi-Coding avatar Jul 21 '22 00:07 WaGi-Coding

--edit-- Oops, funny typo... :laughing:

I just tested and the ScanNetworks example works fine, so I think you have a build problem. I'd dump the full compile commands and make sure you have the proper defines set.

Beginning scan at 188393
Found 9 networks

                            SSID   ENC     BSSID         CH RSSI
                                  WPA2 08:36:C9:87:C8:FF  9  -86
                                  WPA2 10:0C:6B:50:2D:EB  6  -92
                        JK-Guest  WPA2 12:36:C9:87:C8:FF  9  -86
                           Scout  WPA2 30:FD:38:FD:69:E2  6  -90
                        NOBABIES  WPA2 38:2C:4A:90:FA:80 10  -32
                       Grace4all  WPA2 4C:B1:CD:0D:2C:F8  6  -89
                        NOBABIES  WPA2 50:D4:F7:FE:A3:4D  1  -73
             ngHub_31946CN402774  WPA2 9C:3D:CF:F3:89:AF 11  -88
                        NOBABIES  AUTO AC:84:C6:6C:EF:F3  1  -60

--- Sleeping ---

A normal IDE compile line looks like:

/home/earle/.arduino15/packages/rp2040/tools/pqt-gcc/1.4.0-c-0196c06/bin/arm-none-eabi-g++ -c -Werror=return-type -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DUSB_VID=0x2e8a -DUSB_PID=0xf00a "-DUSB_MANUFACTURER=\"Raspberry Pi\"" "-DUSB_PRODUCT=\"Pico W\"" -DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_LWIP=0 -DLWIP_IPV6=0 -DLWIP_IPV4=1 -DLWIP_IGMP=1 -DLWIP_CHECKSUM_CTRL_PER_NETIF=1 -march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections -fno-exceptions -iprefix/home/earle/Arduino/hardware/pico/rp2040/ @/home/earle/Arduino/hardware/pico/rp2040/lib/platform_inc.txt -I/home/earle/Arduino/hardware/pico/rp2040/include -fno-rtti -std=gnu++17 -g -w -x c++ -E -CC -DSERIALUSB_PID=0xf00a -DUSBD_MAX_POWER_MA=250 -DF_CPU=133000000L -DARDUINO=10816 -DARDUINO_RASPBERRY_PI_PICO_W "-DBOARD_NAME=\"RASPBERRY_PI_PICO_W\"" -DARDUINO_ARCH_RP2040 -Os -I/home/earle/Arduino/hardware/pico/rp2040/cores/rp2040 -I/home/earle/Arduino/hardware/pico/rp2040/variants/rpipicow -I/home/earle/Arduino/hardware/pico/rp2040/libraries/WiFi/src /home/earle/Arduino/hardware/pico/rp2040/libraries/WiFi/src/BearSSLHelpers.cpp -o /dev/null

earlephilhower avatar Jul 21 '22 00:07 earlephilhower

Hmm, I have no idea how i'd check that to be honest. I just got into platformio and i think it's just too much for me it seems & i should prob. stick to micropython or wait for official support :S I was happy already when i managed uploading to the board ^^

Sorry for my confusing

WaGi-Coding avatar Jul 21 '22 08:07 WaGi-Coding

I will double check the compile commands on PlatformIO -- since I don't have my Pico W yet, I couldn't test on real hardware, only got it to compile. Though the adaptions of the builder script made before me looked perfectly fine.

maxgerhardt avatar Jul 21 '22 09:07 maxgerhardt

I will double check the compile commands on PlatformIO -- since I don't have my Pico W yet, I couldn't test on real hardware, only got it to compile. Though the adaptions of the builder script made before me looked perfectly fine.

If there is any way i can remotely help you with it easily, feel free to tell me/us what to do ^^ Also, if you really need one(they seem to be hard to get atm), i can send you one of mine from Austria to Germany. Free of charge as thanks for your work

WaGi-Coding avatar Jul 21 '22 09:07 WaGi-Coding

In the meantime @WaGi-Coding, can you install the Arduino-Pico core in the Arduino IDE and see if you also get 0 networks?

maxgerhardt avatar Jul 21 '22 09:07 maxgerhardt

In the meantime @WaGi-Coding, can you install the Arduino-Pico core in the Arduino IDE and see if you also get 0 networks?

Seems to work fine, beside the weird fact it somehow finds less and less networks with each scan, then finds them "all" again. But i guess thats some normal behaviour, also see that on my ESP32 boards

image

WaGi-Coding avatar Jul 21 '22 09:07 WaGi-Coding

Okay, thanks for confirming, if the Arduino IDE and PlatformIO results differ with the exact same code, then the fault is likely in the PIO builder script -- I'll have a look.

Also, if you really need one(they seem to be hard to get atm), i can send you one of mine

I preordered two Pico W from Elektor the day the sent the email that preorders are available. And wow, looking at their website now it used to say available on July 20th, now it says August 1st.. not a good sign :/. I hope they're really shipped to me by then.

But for a first check I'll compare compile commands, no hardware needed yet.

maxgerhardt avatar Jul 21 '22 10:07 maxgerhardt

@WaGi-Coding I have a bad dejavu with variant-specific initVariant() not being linked correctly due to using a .a archive instead of an object file. In the code for PlatformIO, can you use the code

#include <Arduino.h>
#include <WiFi.h>
#include <pico/cyw43_arch.h>

void setup() { cyw43_arch_init(); Serial.begin(115200); }

void loop() {
  Serial.println(WiFi.scanNetworks());
  delay(5000);
}

and retry?

maxgerhardt avatar Jul 21 '22 10:07 maxgerhardt

@maxgerhardt oh yeah that seems to work, many many thanks <3 image

WaGi-Coding avatar Jul 21 '22 10:07 WaGi-Coding

Alright then I know exactly what's wrong, many thanks. I'll PR this in shortly.

Same as I did in https://github.com/espressif/arduino-esp32/pull/6809.

maxgerhardt avatar Jul 21 '22 10:07 maxgerhardt

This will be fixed by https://github.com/earlephilhower/arduino-pico/pull/696.

maxgerhardt avatar Jul 21 '22 10:07 maxgerhardt

@WaGi-Coding since the PR was merged and I updated the commit reference (https://github.com/maxgerhardt/platform-raspberrypi/commit/bd2f3e756ba7340150f2bebc2d46110988243018), please do a pio pkg update -g -p https://github.com/maxgerhardt/platform-raspberrypi.git in the CLI and try it without calling into cyw43_arch_init(); explicitly -- Arduino IDE and PlatformIO behavior should be exactly equal now.

maxgerhardt avatar Jul 21 '22 12:07 maxgerhardt

@maxgerhardt it works like a charm now. Again, many thanks

WaGi-Coding avatar Jul 21 '22 12:07 WaGi-Coding

NOTE: I'm using PlatformIO via Visual Studio Code with custom upload/debug config

@maxgerhardt I had the same issue as @WaGi-Coding yesterday, where everything appeared to compile fine but didn't get any networks/no wi-fi connections. I can confirm that it works today.

I've been playing with various platformio.ini configurations over the last couple of days and I'm not 100% convinced that platformio correctly handles all the updates/pkg changes quite right. After moving out my .platformio directory and letting the extension re-install along with the toolchains etc., I found that the dependency graph picked up the lwIP_CYW43 which I swear wasn't in there before and I've also noticed that some of the defines changed, such as LWIP_IPV6 is now disabled where as it was enabled before (when it didn't work).

Scanning dependencies...
Dependency Graph
|-- WiFi @ 1.0.0
|   |-- lwIP-Ethernet @ 1
|   |   |-- lwIP_CYW43 @ 1
|   |   |   |-- SPI @ 1.0
|   |   |-- SPI @ 1.0
|-- NTPClient @ 3.2.1

Appreciate all the hard work on this. Thanks.

pquinton avatar Jul 22 '22 06:07 pquinton

We from OpenKNX are impatiently waiting for this getting into offical PIO because we want it to be our default Toolchain. What is the status of the pio integration, since some week it looked to me that it may be only a matter of days ? Thanks.

Ing-Dom avatar Jul 25 '22 15:07 Ing-Dom

The holdup with the merge into official PIO is at https://github.com/platformio/platform-raspberrypi/pull/36, not in this issue; I can't say what is holding it up directly, but I'm trying to resolve it soon. Had a lot to do the past weeks, and this looks like it's going to be a bit more involved..

maxgerhardt avatar Jul 25 '22 16:07 maxgerhardt

Looking for some help (been trying for a couple days). The code builds and uploads to the RPi Pico via the Arduino IDE 1.8.19. I followed the boards manager method on arduino-pico.readthedocs.io/en/latest/install.html etc...

But I can't seem to get it to compile and upload PIO VSC.

Here's my platformio.ini

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower

platform_packages =
    maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
    maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.4.0-c/x86_64-w64-mingw32.arm-none-eabi-0196c06.220714.zip

lib_deps = 
	fortyseveneffects/MIDI Library@^5.0.2
	adafruit/Adafruit TinyUSB Library@^1.14.1

The error I get is this... Error: Missing PlatformIO build script C:\Users\Steve\.platformio\packages\framework-arduinopico\tools\platformio-build.py! Any help would be greatly appreciated! :-)

Barilium8 avatar Jul 29 '22 00:07 Barilium8

Some progress...

  1. Deleted all sub dirs at "C:\Users\Steve.platformio\packages"
  2. commented out the "platform_packages =..." in platformio.ini

that got me to here...

.....
Compiling .pio\build\pico\FrameworkArduino\wiring_analog.cpp.o
Compiling .pio\build\pico\FrameworkArduino\wiring_digital.cpp.o
Compiling .pio\build\pico\FrameworkArduino\wiring_private.cpp.o
src\main.cpp:4:10: fatal error: Adafruit_TinyUSB.h: No such file or directory

**************************************************************************
* Looking for Adafruit_TinyUSB.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Adafruit_TinyUSB.h"
* Web  > https://registry.platformio.org/search?q=header:Adafruit_TinyUSB.h
*
**************************************************************************

    4 | #include <Adafruit_TinyUSB.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

some searching suggested adding below to platformio.ini

build_flags =
	-IC:/Users/Steve/.platformio/packages/framework-arduinopico/libraries/Adafruit_TinyUSB_Arduino/src

This got me to here....

......
Compiling .pio\build\pico\FrameworkArduino\wiring_analog.cpp.o
Compiling .pio\build\pico\FrameworkArduino\wiring_digital.cpp.o
Compiling .pio\build\pico\FrameworkArduino\wiring_private.cpp.o
In file included from src\main.cpp:4:
C:\Users\Steve\.platformio\packages\framework-arduinopico\libraries\Adafruit_TinyUSB_Arduino\src/Adafruit_TinyUSB.h:31:2: error: #error TinyUSB is not selected, please select it in "Tools->Menu->USB Stack"
   31 | #error TinyUSB is not selected, please select it in "Tools->Menu->USB Stack"

some more searching suggested adding below to platformio.ini

build_flags =
	-IC:/Users/Steve/.platformio/packages/framework-arduinopico/libraries/Adafruit_TinyUSB_Arduino/src
	-DUSE_TINYUSB

This got me to here....

Processing pico (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: pico; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/raspberrypi/pico.html
PLATFORM: Raspberry Pi RP2040 (1.7.0+sha.5677d9b) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, picoprobe, raspberrypi-swd)
PACKAGES:
 - framework-arduinopico @ 1.20303.0 (2.3.3)
 - tool-mklittlefs-rp2040-earlephilhower @ 5.100300.220714 (10.3.0)
 - tool-openocd-rp2040-earlephilhower @ 5.100300.220714 (10.3.0)
 - tool-rp2040tools @ 1.0.2 
 - toolchain-rp2040-earlephilhower @ 5.100300.220714 (10.3.0)
Flash size: 2.00MB
Sketch size: 2.00MB
Filesystem size: 0.00MB
Maximium Sketch size: 2093056 EEPROM start: 0x101ff000 Filesystem start: 0x101ff000 Filesystem end: 0x101ff000
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 25 compatible libraries
Scanning dependencies...
Dependency Graph
|-- MIDI Library @ 5.0.2
|-- Adafruit TinyUSB Library @ 1.14.1
Building in release mode
Retrieving maximum program size .pio\build\pico\firmware.elf
Flash size: 2.00MB
Sketch size: 2.00MB
Filesystem size: 0.00MB
Maximium Sketch size: 2093056 EEPROM start: 0x101ff000 Filesystem start: 0x101ff000 Filesystem end: 0x101ff000
Checking size .pio\build\pico\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.4% (used 11612 bytes from 262144 bytes)
Flash: [          ]   3.2% (used 66840 bytes from 2093056 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap, jlink, picoprobe, picotool, raspberrypi-swd
CURRENT: upload_protocol = picotool
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
================================================== [FAILED] Took 6.18 seconds ==================================================

But I can't get it to upload! YIKES It seems like I shouldn't need the build flags??? Thoughts? Thanks again!

Barilium8 avatar Jul 29 '22 00:07 Barilium8

The first one was the result of a corrupted package, you did correctly by remocing those folders to force a redownload. However, as you still have platform_packages for the toolchain in your platformio.ini, that is outdated. We updated the documentation for that some time ago. Also, TinyUSB is already included in this core, you don't need to add it to lib_deps. Also no need for the -I flag for TinyUSB, the builder script takes care of that once you give it -DUSE_TINYUSB, as documented. You should be just using

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
lib_deps = 
	fortyseveneffects/MIDI Library@^5.0.2

for the latest stable 2.3.3 core. For your your upload problem: For the very first upload, you have to manually put the .uf2 file (.pio\build\pico\firmware.elf) on the boot drive (plug in Pico with BOOTSEL button pressed into the PC), the firmware will then open the USB serial port which is used by the upload_protocol = picotool method. Don't forget to also use Zadig to load WinUSB drivers for the Boot Interface 1 device as said here for picotool to be able to speak to the Pico once it was reset into bootloader mode.

For an alternative first upload, set upload_protocol = mbed in the platformio.ini, plug the Pico in in bootloader mode, and press upload. It will just copy the .uf2 file on the Pico's usb drive. (No automatic reset though, so after that picotool is advised.)

maxgerhardt avatar Jul 29 '22 07:07 maxgerhardt

THANKS MAX!!! Got it all running! Here's the final platformio.ini with some notes:

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
; NOTE: must use: Zadig (https://zadig.akeo.ie/) to install WinUSB driver for Pico,
; so Pico acts as mass-storage-dev that PIO can copy firmware.uf2 to.

lib_deps = 
	fortyseveneffects/MIDI Library@^5.0.2
	; not needed, it's built-in... adafruit/Adafruit TinyUSB Library@^1.14.1

build_flags =	
	-DUSE_TINYUSB
        ; not needed, DUSE_TINYUSB sets this path... -IC:/Users/Steve/.platformio/packages/framework-arduinopico/libraries/Adafruit_TinyUSB_Arduino/src

; HELPFUL LINKS:
; UPDATER: paste into the CLI... "pio pkg update -g -p https://github.com/maxgerhardt/platform-raspberrypi.git"
; Pico Core (NOT Arduino official) by Earle Philhower - https://arduino-pico.readthedocs.io/en/latest/platformio.html#current-state-of-development
; thread on the manual install process - https://github.com/earlephilhower/arduino-pico/issues/66
; platformio.ini info - https://docs.platformio.org/en/latest/projectconf/section_platformio.html#data-dir
; Pico mass-storage-device Bootloader & USB driver info - https://forums.raspberrypi.com/viewtopic.php?t=33656

Barilium8 avatar Jul 29 '22 19:07 Barilium8

Hi, Max and Earle.

I just upgraded Platformio and and I am now getting this compile error on Linux:

$ pio run -e pico-linux Processing pico-linux (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: pico; framework: arduino)

Verbose mode can be enabled via -v, --verbose option CONFIGURATION: https://docs.platformio.org/page/boards/raspberrypi/pico.html PLATFORM: Raspberry Pi RP2040 (1.7.0+sha.ff7a675) > Raspberry Pi Pico HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, picoprobe, raspberrypi-swd) PACKAGES:

  • framework-arduinopico @ 1.20003.0+sha.bde4da2
  • tool-rp2040tools @ 1.0.2
  • toolchain-pico @ 5.100300.220212 (10.3.0)
  • toolchain-rp2040-earlephilhower @ 5.100300.220714 (10.3.0) Converting vm.ino Flash size: 2.00MB Sketch size: 0.50MB Filesystem size: 1.50MB Maximium Sketch size: 520192 EEPROM start: 0x101ff000 Filesystem start: 0x1007f000 Filesystem end: 0x101ff000 LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain+, Compatibility ~ soft Found 28 compatible libraries Scanning dependencies... Dependency Graph |-- LittleFS @ 0.1.0 |-- Servo(rp2040) @ 1.0.0 |-- SPI @ 1.0 |-- Wire @ 1.0 Building in release mode Compiling .pio/build/pico-linux/FrameworkArduinoBootloader/boot2_w25q080_2_padded_checksum.S.o Compiling .pio/build/pico-linux/src/dataPrims.c.o Compiling .pio/build/pico-linux/src/filePrims.cpp.o In file included from /home/git/.platformio/packages/framework-arduinopico/cores/rp2040/api/ArduinoAPI.h:30, from /home/git/.platformio/packages/framework-arduinopico/cores/rp2040/Arduino.h:28, from /home/git/.platformio/packages/framework-arduinopico/cores/rp2040/FS.h:24, from vm/fileSys.h:10, from vm/filePrims.cpp:21: /home/git/.platformio/packages/framework-arduinopico/cores/rp2040/api/IPAddress.h:26:10: fatal error: lwip/init.h: No such file or directory 26 | #include <lwip/init.h> | ^~~~~~~~~~~~~ compilation terminated.

Oddly, I'm not getting the error when building on MacOS.

Here are my platformio.ini file entries:

[env:pico-linux] ; Linux toolchain. Used during deploy. platform = https://github.com/maxgerhardt/platform-raspberrypi.git board = pico board_build.filesystem_size = 1.5m lib_ldf_mode = chain+ build_flags = -Os board_build.core = earlephilhower ; Core package not yet registered with PlatformIO, so pull from git ; Note: Toolchain download link is specific to OS! See https://github.com/earlephilhower/pico-quick-toolchain/releases. platform_packages = maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.4.0-c/x86_64-linux-gnu.arm-none-eabi-0196c06.220714.tar.gz

[env:pico-mac] ; MacOS toolchain. Used during development. platform = https://github.com/maxgerhardt/platform-raspberrypi.git board = pico board_build.filesystem_size = 1.5m lib_ldf_mode = chain+ build_flags = -Os board_build.core = earlephilhower ; Core package not yet registered with PlatformIO, so pull from git ; Note: Toolchain download link is specific to OS! See https://github.com/earlephilhower/pico-quick-toolchain/releases. platform_packages = maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.4.0-c/x86_64-apple-darwin14.arm-none-eabi-0196c06.220714.tar.gz

Do I need to explicitly include the WiFi library in lib_deps?

Thanks!

jhmaloney avatar Aug 29 '22 19:08 jhmaloney

~~Not sure why vm/filePrims.cpp would include LWIP, but hm,~~ (okay it's coming from IPAddress.h of the core) can you link to the src/main.cpp code you're currently using?

(Note: You can also edit your post to format the logs and platformio.ini in a code block by surrounding it with tripple backtick + newline)

Edit: Hm, actually these LWIP headers are supposed to be always found, because the

https://github.com/earlephilhower/arduino-pico/blob/master/lib/platform_inc.txt#L55-L56

adds them. Does the folder /home/git/.platformio/packages/framework-arduinopico/pico-sdk/lib/lwip/src/include exist and have that file it says is missing?

maxgerhardt avatar Aug 29 '22 19:08 maxgerhardt

Hi, Max.

The folder /home/git/.platformio/packages/framework-arduinopico/pico-sdk/lib/lwip/src/include does exist, but it is empty.

My repository is here:

https://bitbucket.org/john_maloney/smallvm/src/master/

All the code is in the vm subfolder.

To reproduce the problem, clone the repository, cd into "smallvm" folder, check out the "dev" branch, and run:

pio run -e pico-linux

jhmaloney avatar Aug 29 '22 21:08 jhmaloney

The folder /home/git/.platformio/packages/framework-arduinopico/pico-sdk/lib/lwip/src/include does exist, but it is empty.

Then the Arduino core was downloaded incorrectly. rm -rf /home/git/.platformio/packages/framework-arduinopico and build again.

maxgerhardt avatar Aug 29 '22 21:08 maxgerhardt

Brilliant! That did the trick.

I've been using this platformio setup since before the PicoW was released and had not upgraded for a while. I'm guessing that the platformio package updating process did not properly add the new lpiw submodule.

In any case, thank you for the super quick answer!

jhmaloney avatar Aug 29 '22 21:08 jhmaloney