VS Code, C, and Feather RP2040

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
robcranfill
 
Posts: 142
Joined: Wed Feb 13, 2013 4:14 pm

VS Code, C, and Feather RP2040

Post by robcranfill »

This is really the same question posed in viewtopic.php?p=909396, but that's closed and has zero responses, so here goes:

I have been using VS Code (on a Windows PC using WSL2) to successfully write C code to run on a Pico, but how the heck do I switch things to build for an Adafruit Feather RP2040? I know the crux is defining PICO_BOARD=adafruit_feather_rp2040, but simply doing this in the CMake extension's settings is not enough.

I guess I need to set that ... somewhere ... and then regenerate the makefiles ... somehow.

Any help appreciated!
/rob in Seattle

User avatar
robcranfill
 
Posts: 142
Joined: Wed Feb 13, 2013 4:14 pm

Re: VS Code, C, and Feather RP2040

Post by robcranfill »

My best guess at the moment: in the file ".vscode/c_cpp_properties.json", add

"defines": ["PICO_BOARD=adafruit_feather_rp2040"],

and then somehow get VSCode to regenerate the makefiles. (Can you tell I'm new-ish to VSCode?)

Thanks,
/r

User avatar
robcranfill
 
Posts: 142
Joined: Wed Feb 13, 2013 4:14 pm

Re: VS Code, C, and Feather RP2040

Post by robcranfill »

Well, shucks. I think I found the answer: set the env var in the shell! D'oh!

In WSL, that is:

Code: Select all

cran@Flex15:~/pico/pico-examples$ export PICO_BOARD=adafruit_feather_rp2040
cran@Flex15:~/pico/pico-examples$ code .
results in good stuff in the CMake output:

Code: Select all

...
[cmake] PICO_SDK_PATH is /home/cran/pico/pico-sdk
[cmake] PICO platform is rp2040.
[cmake] Build type is Debug
[cmake] Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)
[cmake] Using PICO_BOARD from environment ('adafruit_feather_rp2040')
[cmake] Using board configuration from /home/cran/pico/pico-sdk/src/boards/include/boards/adafruit_feather_rp2040.h
...
I haven't actually built the code yet, it's kinda late now, but I will follow up tomorrow.

User avatar
robcranfill
 
Posts: 142
Joined: Wed Feb 13, 2013 4:14 pm

Re: VS Code, C, and Feather RP2040

Post by robcranfill »

Sorry to bomb y'all, but hopefully this helps someone else!

Yes, that works - I can now build for Pico or Feather. :-) Still seems a little weird that I have to restart the IDE when want to switch targets. Seems like I should be able to do that *within* the IDE. Whatever. I'm ok with this for now. :-)

/rob

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”