Compiling On Raspberry PI

I installed Visual Studio Code and PlatformIO on a Raspberry Pi 3 running headless. I connect via XORG. As a test case, I tried to compile Tasmota. It gets part way through and then hangs with the Resource Monitor at 100%. If a wait a really, really long time, Visual Studio Code will tell me the Windows is not responding and give me the option to close it. I can then re-open Visual Studio Code and restart the build, it will get further, because it finds some stuff already compiled. However, it will then hang again.
Are others able to actually build on the older PIs, like Pi3?
Is there some setting that would throttle it and keep it from running out of resources?

The reason I am trying to build on the Raspberry PI, is that I want a portable development environment. I want to use the same development environment during spare time at work and also at home or on the road. Initially I tried to run portable from a USB HD drive. However, that worked for Visual Studio Code, but not for the PlatformIO extension. The next best thing to carrying the HD around would be to carry the PI around.


To be honest, I don’t think a Pi3 will cut it, sorry. I admittedly have not tried, but I do have a Pi4 with 4Gb RAM and it struggles.

I’ve just started it now, and with the task bar applet “Resource Monitor” showing CPU and RAM usage, just starting VScode up takes just over 500 MB of RAM. After PlatformIO has done its update checks, that drops to around 425 even when nothing is open or happening.

When I open a PlatformIO main.cpp with only the default blink sketch code, it zooms up to 512 MB used. During a compilation, RAM usage zooms up to 630 Mb and CPU to 99%, whether that’s 1 or 4 CPUs in use, I know not, the resource monitor isn’t telling me this!

So, I suspect with even less RAM on your Pi3, you might be out of luck, or at least, out of resources.

I have, in the past, been playing with remote development. This is where I develop in VSCode on my half decent laptop (Dell Vostro 1720, 8GB RAM, twin cores.) and compile remotely on the Pi. I’ve not done this on my Pi3 though, I’m using that for PiHole and DNS, so I’m not able to easily take it down, sorry.

There are a couple of articles that might be helpful if you want to try going this way. At the very least, it should avoid having to have VSCode open on the Pi3 – VSCode being one of those massive “running like a whole website” type of apps, given that it’s built on Electron (if I remember correctly, if I’m wrong, be gentle! :grin:)

This is the one I used when setting it all up originally:

This is one posted recently by a Microsoft chappie, writing for the RaspberryPi Blog:

I’ll be setting my own laptop up again for remote development shortly – I am in my once every decade task of wiping the systems and installing Linux Mint (20.1 this time) from scratch onto a clean system. Then only installing the stuff I want to use, as opposed to all the stuff I tried, sort of liked, but never deleted over the preceding 10 years!

Remote development is only supported on Pi3 and Pi4. So you might be in luck?



Does it work when building the tasmota project on the commandline with pio run? (See install shell commands). Should use less RAM.

Also, use swap, so compilation will still go through (even if it takes a long time due to swapping).

Thank you for the suggestions. I increased the swap file size and retried running from Visual Studio Code. It still crashed and in a separate terminal window, I saw the swap file size go over 500MB before it hung everything. After increasing the swap size to 1.5Gig which was the largest it would do on the SD Card, it still hung and crashed.
I went to the console and tried to run from the terminal. It would fail on linking with a message about a library file being truncated. I did a clean, but it seemed to find cached object files and would then quickly fail with the same linker message. Rebooting did not help and I eventually disabled the cache in the ini file and rebuilt again from the console. That time it did not crash and did build from the command line to a final binary file. Build time was just shy of 20 minutes.

So, on a Raspberry PI 3, it does seem possible from the command line. However, to use Visual Studio Code as an editor, I would have to remove the PlatformIO extension without removing it from the system. Also, its long compile times may not be worth attempting this as a permanent build solution.

Thanks again for the suggestions.