Lpc1768 - src\main.cpp:1:10: fatal error: Arduino.h: No such file or directory

Hello,

I’m trying to program an lpc1768 (SKR 1.3) using VS Code & Platform IO. Unfortunately I’m running into the following error when I try to build or upload. No issues doing so with an Arduino Uno. platformio.ini is also below.

[env:lpc1768]
platform = nxplpc
board = lpc1768
framework = mbed
Processing lpc1768 (platform: nxplpc; board: lpc1768; framework: mbed)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc/lpc1768.html
PLATFORM: NXP LPC (10.0.0) > NXP mbed LPC1768
HARDWARE: LPC1768 96MHz, 64KB RAM, 512KB Flash
DEBUG: Current (cmsis-dap) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES: 
 - framework-mbed @ 6.61700.231105 (6.17.0) 
 - toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
Collecting mbed sources...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\lpc1768\src\main.o
src\main.cpp:1:10: fatal error: Arduino.h: No such file or directory

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

    1 | #include <Arduino.h>
      |          ^~~~~~~~~~~
compilation terminated.
*** [.pio\build\lpc1768\src\main.o] Error 1
====================================================================================== [FAILED] Took 4.81 seconds ======================================================================================

 *  The terminal process "C:\Users\evans\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

The framework is mbed, not Arduino. And there is no Arduino framework available for the LCP1768.

See NXP mbed LPC1768 — PlatformIO latest documentation

Correction: https://github.com/p3p/pio-nxplpc-arduino-lpc176x implements a platform with Arduino support for LPC176{8, 9}. I have a test firmware at https://github.com/maxgerhardt/pio-nxp-lpc1769-arduino-test.

There is quite some discussion about this in Flashing custom firmware onto SKRV1.4 Board but no firmware seems to be able to run with this configuration. Hard to say why, the bootloader of these 3D printers is involved, custom framework is involved, custom clock code is involved… They never saw a blinking LED. Without a SWD debugger like an ST-Link, J-Link or CMSIS-DAP, impossible to say why.

1 Like

Thank you for the correction and the insights.

But this requires a few additional settings, right?

[env:nxp_lpc1769]
platform = https://github.com/maxgerhardt/pio-nxplpc-arduino-lpc176x.git
platform_packages = framework-arduino-lpc176x@^0.2.6
board = nxp_lpc1769
framework = arduino
upload_protocol = cmsis-dap
debug_tool = cmsis-dap

Thanks @sivar2311 and @maxgerhardt! Since it’s working fine on the Arduino I’ll just return to it for tonight. I did get a successful build with the following:

note: This error originates from a subprocess, and is likely not a problem with pip.
Installing Python dependencies for pyOCD...
Error: Couldn't install dependencies for pyOCD!
*** [upload] Error 1

But I ultimately ended up running into this when I tried to upload. Haven’t figured out how to get past it yet

Installing Python dependencies for pyOCD...
Error: Couldn't install dependencies for pyOCD!
*** [upload] Error 1

Definitely willing to give any suggestions a try! I’ll take another good look at it this weekend otherwise

That problem can be solved by forcing tool-openocd to a higher version:

But you only need pyOCD if you flash the firmware via a debug probe like ST-Link, JLink, CMSIS-DAP. Do you have such a probe connected?