Latest PlatformIO Build (2.4.3) FRDM-K64F - 100% CPU - 7-15 minute build time - Ran out of memory


I am unable to use PlatformIO on the Freescale NXP FRDM-K64F, it is a supported board and I currently am unable to build the base file with the latest Platform IO build. I completely uninstalled and reinstalled all of the VSC, PlatformIO, and Python files. My only two extensions are PlatformIO and C/C++.

I’m trying an earlier version of PlatformIO, 2.4.2 and will post any updates.

Current Platformio.ini is stock:

platform = freescalekinetis

board = frdm_k64f

framework = mbed

Please help

Please try the version without the RTOS.

Alright, everything was successful! The board is blinking as well. How should I continue with my own projects?

Can you post the exact project files that are failing? Something has to be different to the base project I posted above…

cc1plus.exe is what takes up the memory and cpu, when I build the default project, it sits there compiling .pio\build\frdm_k64f\FrameworkMbedconnectivity for almost the entire time

Well high CPU usage is normal and when mbed-os is build in its entirety (not “baremetal mbedos” but full mbedos", that takes a long time too…

Having antivirus activated can make things worse if every compiler invocation is scanned…


I’m unable to get the ran out of memory error consistently, so I cannot get a specific project file. However I’ve disabled my antivirus and it still takes almost 12 minutes to build a fresh project made from the:
PIO Home-> New Project-> Board: FRDM-K64F Framework: Mbed

I’m still pretty new to this so I apologize if I’m not giving you what you need.

And when you use the CLI and do

pio run -t clean
pio run -j2

The out of memory does not occur (but compilation is only 2 threads)?

1 Like

I ran those two commands and it took 891.67 seconds to build. It did not run out of memory, however it’s was sitting at 97% the whole time.

After that, I checked the number of logical processors on my current system with:

python -c “from multiprocessing import cpu_count; print(cpu_count())”

Output: 4

I tried running

pio run -t clean
pio run -j3

The compile time is still very slow.

I switched to my other faster computer which has 8 logical processors. I ran pio run -j7 after cleaning and it still used 100% of all 8 processors. Additionally, it still took almost 6 minutes to build.

Is execution time and CPU usage similiar on a virtual machine running Linux? Would eliminate or point to Windows / installed Windows software being the problem.

If it’s the same, you’re most likely experiencing the (naturally long) compile times of mbed-os and compilers using all CPU they can get.

I would have to check on linux later. But I guess what I don’t understand is that it takes mere seconds to compile the same code or larger on mbed studio or MCUXpresso (NXP IDEs). Seems like more of an issue with VSC.

Definitely not for the first compilation run (after a clean). Maybe for the second (cached) run where it only has to recompile one file.

Do you have reference values for mbed studio?

Clean builds on windows for basic blinky project:
Mbed studio- 2 minutes 50 seconds
MCUExpresso - 2 Seconds
PlatformIO - 6 minutes
Note: The example project I used in PIO was the mbed-rtos-blink-baremetal, which by default has build profiles for multiple boards. I removed the extra boards to reduce build time.

I really wanted to use PIO but I can’t justify waiting any longer than 4 minutes to build a simple project.

Yeah actually the project doesn’t use the baremetal profil until platform-ststm32/mbed_app.json at develop · platformio/platform-ststm32 · GitHub is placed in the root of the project.

Build time with the default

platform = freescalekinetis
board = frdm_k64f
framework = mbed

and no mbed_app.json for baremetal is 4m50s for me.

But one also has to take into accoutn that in mbed studio or elsewhere the default config is not “release” like in PlatformIO (-Os optimization) but debug with no optim (or -Og).

Adding build_type = debug to the platformio.ini and recompiling, the compilation time is however still 4m47s

Adding the above mbed_app.json brings it in the release build down to 25 seconds and in the debug build to 26 seconds.