element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Adventures with the Raspberry Pi pico - part 2
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: neilk
  • Date Created: 28 Jan 2021 4:20 PM Date Created
  • Views 2169 views
  • Likes 10 likes
  • Comments 5 comments
  • raspberry pico
  • git
Related
Recommended

Adventures with the Raspberry Pi pico - part 2

neilk
neilk
28 Jan 2021
Introduction

 

At the end of my previous blog:  Adventures with the Raspberry Pi pico - part 1

 

I said:

 

"Next Step:"

"Learn how to modify the blink source file - to blink2 -  build/compile it and then flash the pico with the modified file."

 

In fact, I need to understand what I've actually done - I was just following someone else's instructions. Many people reading this will already know, but maybe some won't! I hope it helps them!

 

Although I don't fully understand them, all the steps associated with downloading and setting up all the software will stand - that only has to be done once (I hope), although I will have to repeat it, if I decide to install all this on my desktop PC.

 

I'm going to start my understanding process at section 7 of my previous blog, which is taken from:

 

https://datasheets.raspberrypi.org/pico/getting-started-with-pico.pdf 

 

Has been revised and sections renumbered since this blog was written.

 

Note, this assumes that C:\Users\pico\Downloads has already been created

 

8.2.2. EDIT 9.2.2 Getting the SDK and examples

 

C:\Users\pico\Downloads> git clone -b master https://github.com/raspberrypi/pico-sdk.git

C:\Users\pico\Downloads> cd pico-sdk

C:\Users\pico\Downloads\pico-sdk> git submodule update --init

C:\Users\pico\Downloads\pico-sdk> cd ..

C:\Users\pico\Downloads> git clone -b master https://github.com/raspberrypi/pico-examples.git

 

My questions are:

 

  1. What does  git clone -b master https://github.com/raspberrypi/pico-sdk.git  do?

  2. What does  git submodule update --init  do?
  3. What does git clone -b master https://github.com/raspberrypi/pico-examples.git  do?

 

Taking each of these in turn:

 

1. What does  git clone -b master https://github.com/raspberrypi/pico-sdk.git  do?

 

I think it means what it says - ie clone the pico-sdk from github to my device. I assume that by default, it will create the clone in a new sub-folder - .../pico-sdk/.

But what does "-b master" mean?

 

Looking at the git documentation:  https://git-scm.com/docs/git-clone  we find:

 

image

 

That means that we want to clone the master branch, rather than any other branch that the remote HEAD is pointing to.

Below is a screen shot from the remote repository - https://github.com/raspberrypi/pico-sdk

image

This shows a master and 6 branches, with master set as the default. Including "-b master"  seems to be "belt and braces", which, of course, is ALWAYS good, fail-safe, practice.

Taking my understanding further, I opened a command window in admistrator mode and created a new folder below .. \pico\ :   C:\Users\pico\Download_test .

I then ran the command:

C:\Users\pico\Download_test> git clone -b master https://github.com/raspberrypi/pico-sdk.git

Below is screenshot from Windows File Manager of the structures created by that command:image

Apart from the presence of a folder called .git, this looks exactly like the screenshot of the remote repository. This was to be expected.

 

2. What does  git submodule update --init  do?

 

I looked at the documentation and it meant nothing to me image

I ran the command :

C:\Users\pico\Download_test\pico-sdk> git submodule update --init

And got the following result:

image

So, 'tinyusb', which belongs at a higher level - raspberrypi - is also registered at the level of the pico and needs to be cloned and added in.

I don't understand what this means - it's my first exposure to git! Perhaps if an expert reads this, he/she could explain it to me, please.

 

3. What does git clone -b master https://github.com/raspberrypi/pico-examples.git  do?

 

Fairly obviously, I think, this is going to clone the contents of pico-examples to my device.

I ran the command:

C:\Users\pico\Download_test> git clone -b master https://github.com/raspberrypi/pico-examples.git

Without repeating screenshots, I can say that I now have a clone of pico-examples which looks exactly like the contents of the remote repository, except that it also has a .git folder.

 

8.2.3. Building "Hello World" from the Command Line

This is misleading, as shabaz and I discussed in my previous blog - it builds ALL of the examples!

The commands I don't understand are:

C:\Users\pico\Downloads\pico-examples\build> cmake -G "NMake Makefiles" ..

Which sets somethings up for all the examples.

 

EDIT - something went wrong and the last part of the document wasn't saved!!!

 

C:\Users\pico\Downloads\pico-examples\build> nmake

Which builds all the examples.

 

I tried to find some information on cmake, NMake, Makefiles, but couldn't find anything useful!

 

I haven't understood everything, but I've had enough!

 

Next part will be Visual Studio proper!

  • Sign in to reply

Top Comments

  • neilk
    neilk over 4 years ago +1
    I just noticed that the last few lines hadn't been published correctly. I've just edited that. Neil
  • dubbie
    dubbie over 4 years ago +1
    Neil, This reminds me of when I used to do all this command line stuff on a mini-computer - it might have been a PDP8 or maybe a PDP11 - I don't remember. Then I used to do it for embedded C programmes…
  • neilk
    neilk over 4 years ago in reply to dubbie +1
    Dubbie, I don't like it either! I earned my spurs on a PDP and a Data General Eclipse many many years ago. I'm about to start getting Visual Studio to do it properly - just having a cup of coffee & reading…
  • neilk
    neilk over 4 years ago

    https://datasheets.raspberrypi.org/pico/getting-started-with-pico.pdf

     

    Has been revised and sections renumbered since I originally wrote this blog. I have edited accordingly.

     

    Neil

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 4 years ago in reply to neilk

    Neil,

     

    Maybe I'll have a cup of tea and then play with something easier.

     

    Dubbie

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • neilk
    neilk over 4 years ago in reply to dubbie

    Dubbie,

     

    I don't like it either! I earned my spurs on a PDP and a Data General Eclipse many many years ago.

     

    I'm about to start getting Visual Studio to do it properly - just having a cup of coffee & reading the paper!

     

    Neil

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 4 years ago

    Neil,

     

    This reminds me of when I used to do all this command line stuff on a mini-computer - it might have been a PDP8 or maybe a PDP11 - I don't remember. Then I used to do it for embedded C programmes for DOS and then for Tornado. I preferred TurboC - press a button and it was all done for me in the blink of an eye. Now it all makes my brain hurt.

     

    Dubbie

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • neilk
    neilk over 4 years ago

    I just noticed that the last few lines hadn't been published correctly.

     

    I've just edited that.

     

    Neil

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube