Help getting started with Pico

Brand new to the Pico, but supper excited to have something more powerful than an Arduino and not as big as a full fledged Pi. I have long stayed away from C due to the complexities of the compiling process. Well this is why. lol.
I am following this site RP2040 Development Setup on Windows | Len42.github.io and the video it is based on… How to Set Up Visual Studio Code to Program the Pi Pico (Windows) - YouTube. I get to the "testing part, about 6:35 in the video, where you use Cmake to coplile the examples. The command used is: cmake -G “NMake Makefiles” … and I get the following:

PICO_SDK_PATH is D:/Bob/Documents/Pico/pico-sdk
PICO platform is rp2040.
CMake Error at CMakeLists.txt:6 (project):
Running

‘nmake’ ‘-?’

failed with:

The system cannot find the file specified

– Configuring incomplete, errors occurred!
See also “D:/Bob/Documents/Pico/pico-examples/build/CMakeFiles/CMakeOutput.log”.

I am doing this from the Developers Command Prompt. My only changes are that I am using visual 2022 and visual code 2022. I am not even sure what CMakeLists.txt it is talking about and not sure what CMake is supposed to be doing so it is hard to figure out what is wrong. The Output log has two line that offer no help:

The target system is: PICO - - cortex-m0plus
The host system is: Windows - 10.0.22000 - AMD64

Technically I am on windows 11.

Any help would be greatly appriciated. I realize I am looking down a steep learning curve, but look forward to better understand compiling, which I why I don’t just install an arduio IDE to program this.

Also if it matters, I had already installed VS 2022 for programing (making small modifications to and compiling firmware) for and Ender 3 Pro 3D printer. But I am not sure if the CMake command even involves that yet.

Do you have nmake available in your developer prompt? If not, you may need some more VS components. I think the Build Tools and/or C/C++ CLI tools are required for nmake.

Thank you for the quick reply. I am not an idiot, but fairly new to VS and the Raspberry Pico. When you say VS I assume you mean VS code. I did not see where to add modules in VS. When I search for modules, I see many for C++ and build. How do I know which to choose… I am trying to set up for programing a Pico. I do have several C/C++ modules, but nothing that says Build tools. When I search for build tools I do show the top item as CMake Tools and it is installed.

Ah, no, I mean the Visual Studio installer.

sweet! thank you so much, seems to be going now.

Can you suggest any good material on the compiling process? Like what cmake does vs. VS 2022 vs. VS Code? Following examples is one thing, but I am not going to be able to do much until I understand what the parts all do… and how to use them.

If you don’t have any sources, I will continue to pour through google.

Thanks again!
Bob

CMake is a “build system” that takes a description of your project and turns it into commands to be performed by a “build tool” (here, nmake) to build your code as specified. VS Code is an editor that has some features that can interact with CMake to better understand your code through how it is built (including flags and such to know what parts of #ifdef blocks are active).

And what is Visual Studio 2022? I have it as a separate app to Visual Studio Code.

Bob

Microsoft naming sadness I fear. Visual Studio is a full IDE (the year denotes the release series). VSCode is an editor with IDE-ish editing features, but no build system or toolchain comes with it (AFAIK).

lol Now that I have the build system and toolchain, can VS be used? Or just better to stay with VS Code and not mess with VS 2022. (I knew what the 2022 was for, was just trying to be clear differentiating with VS code).

And if I want/need to do step through debugging, can that be done with VS Code, or is that a VS capability (I understand that I may not be able to use VS for the Pico)

Bob

I have no idea; I’ve never used VSCode beyond helping others that happen to use it with some things. I know people definitely use just VSCode at least, but those haven’t been in the embedded space.

Well thank you for helping me get CMake working and helping with a brief overview of what the different software does. I have a lot of learning. I think there are some short cuts I can take, but the better I understand what the different parts are doing, the easier troubleshooting my own programs will be.

Bob

Hey Bob, Ive read you here and at the rasp forum, im experiencing the same problem:

CMake Error at CMakeLists.txt:5 (project):Running

‘nmake’ ‘-?’
\nfailed with:

The system cannot find the file specified

May you guide me on how to overcome this problem?

im leaving you my email here just in case is easier for ya:

martinrosolino@gmail.com

I created a new place to put the source files… These were the examples not code I wrote. I have two steep learning curves to overcome… learning to code without pre made libraries and how to use the compiling environment.

Good luck.

Thank you Bob, i realized that problem was because i was opening VS Code “the wrong way”. I figured out that opening first a developer command prompt for VS 2022, and executing there the command “code”, opens VS Code with different settings as if it is opened through the start menu. I overcome that error just by closing the instance of VS Code, and opened it via the command prompt method. Hope itd be useful for you to.
If you want, i can help you setting up a directory to use for each project, it was difficult but i think i got it mastered right now.

I think the key is having the CMake_install.cmake in your build folder. I also found there was another PICO_SDK-PATH item that I had to set to a full path name rather than the relative path that the install instructions mentioned.

But if you have other suggestions, I am open as I am still slowing figuring some of this stuff out.

Bob