Thanks for this! Although I'm not a complete beginner, I find I'm constantly having to "re-discover" how to set up this pico stuff up. I'm currently working through your mentioned Udemy course and I find it very helpful to see your exact setup and approach.
Thank you. You are not the only one to "re-discover" as you go. I do too. Things also change around us with new versions, creating stumbles in our progress.
Excellent video. I agree, many videos don't show you all of the details of cmake, and even assume you'll run cmake in commandline rather than through VSC. I look forward to further deep-dives into tricks such as building libraries. One very useful thing about VSC is that it checks for mistakes as you write code (sometimes being wrong about external references such as libraries) and can show where functions and variables are used, defined and declared. Sometimes the help gets in the way of typing though. For that bit about extra outputs, the comment above it says it all. It takes the native binary generated by the compile/link process (not sure if it's BIN or ELF) and generates the other support files such as UF2, map file, etc.
It's interesting to hear someone explain how this differs from using conda environments for Python projects. C/C++ Pico projects are organized by folders. Thanks !
Glad you found it useful. You do have to be structured with C/C++ but it isn't as scary as it is suggested to be. So powerful though on a microcontroller.
Interesting video as always, thanks! Short and good prj structure explanation of C/C++ prj for the RP2040. I work for some time on a basic structure for more complex C/C++ prj. My question is: Where to store external libraries? Should they always be stored in the project (port or lib folder) or should they be stored in a centralized external lib folder? What is your oppinion? I also import the pico_sdk_import.cmake file directly from the SDK into my projects. (include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake). The idea is to only change the PICO_SDK_PATH ENV variable when I switch to an other SDK version. I don't know if the pico_sdk_import.cmake changes with other SDK versions. Thanks for your ideas/inputs!
Hi Martin, great questions. On your second point I agree that importing pico_sdk_import from the sdk is better. This is me being a little lazy. Something I will look at changing. On the first point about where should libraries be. Well I do think they should be in each projects because otherwise you create a huge task for yourself upgrading everything to a new version at once, or accept potentially breaking your builds. Certainly making your build unreproducible because libraries have moved to newer versions. I use git submodules for libraries so I am holding a reference to them rather than copying others code.
Thanks! Useful background info. As a Java programmer I'm finding C a bit of a straightjacket but C++ might be easier, so is C++ fully compatible with the Pico ?(maybe the compiler/linker takes care of it?)
Yes C++ is fully supported on the Pico. I've also been a Java developer in the past and C++ let you keep OO design and polymorphism. C/C++ give you more control over memory management, which was always a challenge in Java.
Visual Studio Code. Yes not Microsofts product. Though to be honest you can use any IDE to edit the C code. I use Eclipse apart from when filming when I find VSCode is clearer.
Thanks for this!
Although I'm not a complete beginner, I find I'm constantly having to "re-discover" how to set up this pico stuff up.
I'm currently working through your mentioned Udemy course and I find it very helpful to see your exact setup and approach.
Thank you. You are not the only one to "re-discover" as you go. I do too. Things also change around us with new versions, creating stumbles in our progress.
Excellent video. I agree, many videos don't show you all of the details of cmake, and even assume you'll run cmake in commandline rather than through VSC.
I look forward to further deep-dives into tricks such as building libraries.
One very useful thing about VSC is that it checks for mistakes as you write code (sometimes being wrong about external references such as libraries) and can show where functions and variables are used, defined and declared.
Sometimes the help gets in the way of typing though.
For that bit about extra outputs, the comment above it says it all. It takes the native binary generated by the compile/link process (not sure if it's BIN or ELF) and generates the other support files such as UF2, map file, etc.
Thank you. I try.
Very useful as I new to CMAKE. I started 6 months ago and now I don't remember how I got to compile the sdk examples. Thank you.
Glad it was helpful!
It's interesting to hear someone explain how this differs from using conda environments for Python projects. C/C++ Pico projects are organized by folders. Thanks !
Glad you found it useful. You do have to be structured with C/C++ but it isn't as scary as it is suggested to be. So powerful though on a microcontroller.
Interesting video as always, thanks! Short and good prj structure explanation of C/C++ prj for the RP2040. I work for some time on a basic structure for more complex C/C++ prj. My question is: Where to store external libraries? Should they always be stored in the project (port or lib folder) or should they be stored in a centralized external lib folder? What is your oppinion?
I also import the pico_sdk_import.cmake file directly from the SDK into my projects. (include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake). The idea is to only change the PICO_SDK_PATH ENV variable when I switch to an other SDK version. I don't know if the pico_sdk_import.cmake changes with other SDK versions. Thanks for your ideas/inputs!
Hi Martin, great questions. On your second point I agree that importing pico_sdk_import from the sdk is better. This is me being a little lazy. Something I will look at changing.
On the first point about where should libraries be. Well I do think they should be in each projects because otherwise you create a huge task for yourself upgrading everything to a new version at once, or accept potentially breaking your builds. Certainly making your build unreproducible because libraries have moved to newer versions.
I use git submodules for libraries so I am holding a reference to them rather than copying others code.
Thanks! Useful background info. As a Java programmer I'm finding C a bit of a straightjacket but C++ might be easier, so is C++ fully compatible with the Pico ?(maybe the compiler/linker takes care of it?)
Yes C++ is fully supported on the Pico. I've also been a Java developer in the past and C++ let you keep OO design and polymorphism. C/C++ give you more control over memory management, which was always a challenge in Java.
Did you say visual studio? Did you mean visual code? Is the use of visual studio for the pico new?
Visual Studio Code. Yes not Microsofts product. Though to be honest you can use any IDE to edit the C code. I use Eclipse apart from when filming when I find VSCode is clearer.