this post was submitted on 17 Jul 2023
3 points (100.0% liked)

Raspberry Pi Pico

300 readers
16 users here now

Unofficial Raspberry Pi Pico/RP2040 Forum on Lemmy.

Visit us on discord! @Discord

Other Lemmy Communities (not affiliated, see related post to make suggestions for changes)

General Electronics

Embedded (generic)

Embedded (hardware specific)

Radio Frequency / RF

founded 1 year ago
MODERATORS
 

Is there a pico-sdk based hello world for c++? Basically CMakeLists.txt and main.cpp with a led blinker. On the surface everything is C based. Thanks!

top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago (2 children)

I haven't gotten it to work for me yet, but have you taken a look at pico-project-generator? It has a --cpp flag in there to supposedly generate c++ code.

[–] [email protected] 2 points 1 year ago

No I didn't know about such tool. Thanks, I'm going to try it and post back later.

[–] [email protected] 2 points 1 year ago

So I tried the generator and it seems to be working. I also found out that you don't really need anything special for C++ to work with pico-sdk, it's already set up and they just don't advertise it much. Just add your .cpp files in CMakeLists.txt and it picks them up. Maybe there will be problems later on but so far it's just like that.

The generator is also a good reference of configuration options, like how to disable/enable exception handling etc.