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:
What does git clone -b master https://github.com/raspberrypi/pico-sdk.git do?
- What does git submodule update --init do?
- 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:
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
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:
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
I ran the command :
C:\Users\pico\Download_test\pico-sdk> git submodule update --init
And got the following result:
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!
Top Comments