-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fd5e12
commit 5b7165f
Showing
20 changed files
with
827 additions
and
4,436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"tabs": [ | ||
{ | ||
"title": "Microcontrollers", | ||
"path": "/microcontrollers/", | ||
"subitems": [ | ||
{ | ||
"title": "The C/C++ SDK", | ||
"description": "Getting started with the C/C++ SDK", | ||
"image": "full-sized/C-and-CPP.png", | ||
"subpath": "c_sdk.adoc", | ||
"path": "/microcontrollers/c_sdk.html", | ||
"imagepath": "/images/full-sized/C-and-CPP.png" | ||
}, | ||
{ | ||
"title": "Product Information Portal", | ||
"description": "Raspberry Pi compliance documents", | ||
"imagepath": "/images/full-sized/PIP.png", | ||
"url": "https://pip.raspberrypi.com/" | ||
}, | ||
{ | ||
"title": "Datasheets", | ||
"description": "PDF-based documentation", | ||
"imagepath": "/images/full-sized/Datasheets.png", | ||
"url": "https://datasheets.raspberrypi.com" | ||
}, | ||
{ | ||
"title": "Tutorials", | ||
"description": "Hands-on hardware and software tutorials", | ||
"imagepath": "/images/full-sized/Tutorials.png", | ||
"url": "https://www.raspberrypi.com/tutorials/" | ||
}, | ||
{ | ||
"title": "Forums", | ||
"description": "User and product support forums", | ||
"imagepath": "/images/full-sized/Forums.png", | ||
"url": "https://forums.raspberrypi.com" | ||
} | ||
] | ||
} | ||
] | ||
} |
File renamed without changes.
Binary file added
BIN
+4.44 MB
tests/fixtures/microcontrollers/c_sdk/images/Blink-an-LED-640x360-v2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.79 MB
tests/fixtures/microcontrollers/c_sdk/images/Blink-an-LED-640x360.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.54 MB
tests/fixtures/microcontrollers/c_sdk/images/Hello-World-640x360-v2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.31 MB
tests/fixtures/microcontrollers/c_sdk/images/Hello-World-No-Wires-FINAL.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
== Raspberry Pi Pico C/{cpp} SDK | ||
|
||
Our official C SDK can be used from the command line, or from popular integrated development environments like Visual Studio Code, Eclipse, and CLion. To get started, download our C/{cpp} SDK and Examples, and take a look at our 'https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf[getting started]' documentation to get going. Or for a quick setup see the next section. | ||
|
||
* The SDK https://github.com/raspberrypi/pico-sdk[Github repository] | ||
* The Examples https://github.com/raspberrypi/pico-examples[Github repository] | ||
You can find documentation around the C/{cpp} SDK at; | ||
|
||
https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf[Getting started with Raspberry Pi Pico]:: C/{cpp} development with Raspberry Pi Pico and other RP2040-based microcontroller boards | ||
|
||
https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf[Connecting to the Internet with Raspberry Pi Pico W]:: Getting Raspberry Pi Pico W online with C/{cpp} or MicroPython | ||
|
||
https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf[Raspberry Pi Pico C/{cpp} SDK]:: Libraries and tools for C/{cpp} development on RP2040 microcontrollers | ||
|
||
xref:../pico-sdk/index_doxygen.adoc[API level documentation]:: Documentation for the Raspberry Pi Pico C/{cpp} SDK | ||
|
||
[NOTE] | ||
==== | ||
If you are building applications with the C/{cpp} SDK and targeting boards other than the Raspberry Pi Pico, you will need to pass `-DPICO_BOARD=boardname` to CMake. Here `boardname` is the name of your board, e.g. for the Adafruit Feather RP2040 you should pass `-DPICO_BOARD=adafruit_feather_rp2040`. See the https://github.com/raspberrypi/pico-sdk/tree/master/src/boards[`boards/` directory] in the Raspberry Pi Pico SDK, and the https://forums.raspberrypi.com/viewtopic.php?f=147&t=304393[forums], for more information. | ||
==== | ||
|
||
[NOTE] | ||
==== | ||
Documentation introducing working with Wi-Fi and Bluetooth on Raspberry Pi Pico W with C/{cpp} or MicroPython is presented in the https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf[Connecting to the Internet with Raspberry Pi Pico W] book. | ||
==== | ||
|
||
[NOTE] | ||
==== | ||
If you are building applications with the C/{cpp} SDK for Raspberry Pi Pico W and, to connect to a network you will need to pass `-DPICO_BOARD=pico_w -DWIFI_SSID="Your Network" -DWIFI_PASSWORD="Your Password"` to CMake. If you only need to enable Bluetooth support then you do not need to pass a SSID and password, but still need to pass the `-DPICO_BOARD=pico_w` string to CMake. | ||
==== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
== Quick-start your own project | ||
|
||
NOTE: The following instructions are terse, and Linux-based only. For detailed steps, instructions for other platforms, and just in general, we recommend you see the https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf[Getting started with Raspberry Pi Pico] and https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf[Raspberry Pi Pico C/{cpp} SDK] books. | ||
|
||
Install CMake (at least version 3.13), and GCC cross compiler | ||
|
||
---- | ||
$ sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib | ||
---- | ||
|
||
Set up your project to point to use the Raspberry Pi Pico SDK by cloning the SDK locally: | ||
|
||
---- | ||
$ git clone https://github.com/raspberrypi/pico-sdk.git | ||
---- | ||
|
||
Copy `external/pico_sdk_import.cmake` from the SDK into your project directory | ||
|
||
Set `PICO_SDK_PATH` to the SDK location in your environment, or pass it (`-DPICO_SDK_PATH=`) to `cmake` later. | ||
|
||
Setup a `CMakeLists.txt` like: | ||
|
||
---- | ||
cmake_minimum_required(VERSION 3.13) | ||
# initialize the SDK based on PICO_SDK_PATH | ||
# note: this must happen before project() | ||
include(pico_sdk_import.cmake) | ||
project(my_project) | ||
# initialize the Raspberry Pi Pico SDK | ||
pico_sdk_init() | ||
# rest of your project | ||
---- | ||
|
||
Go ahead and write your code, see https://github.com/raspberrypi/pico-examples[pico-examples] or the https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf[Raspberry Pi Pico C/{cpp} SDK] book for more information on how to go about that. | ||
|
||
About the simplest you can do is a single source file (e.g. `hello_world.c`) | ||
|
||
---- | ||
#include <stdio.h> | ||
#include "pico/stdlib.h" | ||
int main() { | ||
setup_default_uart(); | ||
printf("Hello, world!\n"); | ||
return 0; | ||
} | ||
---- | ||
|
||
and add the following to your CMakeLists.txt: | ||
|
||
---- | ||
add_executable(hello_world | ||
hello_world.c | ||
) | ||
# Add pico_stdlib library which aggregates commonly used features | ||
target_link_libraries(hello_world pico_stdlib) | ||
# create map/bin/hex/uf2 file in addition to ELF. | ||
pico_add_extra_outputs(hello_world) | ||
---- | ||
|
||
NOTE: This example uses the default UART for stdout; if you want to use the default USB see the hello-usb example. | ||
|
||
Setup a CMake build directory. For example, if not using an IDE: | ||
|
||
---- | ||
$ mkdir build | ||
$ cd build | ||
$ cmake .. | ||
---- | ||
|
||
When building for a board other than the Raspberry Pi Pico, you should pass `-DPICO_BOARD=board_name` to the cmake command above, e.g. cmake `-DPICO_BOARD=pico_w ..` to configure the SDK and build options accordingly for that particular board. | ||
|
||
Doing so sets up various compiler defines (e.g. default pin numbers for UART and other hardware) and in certain cases also enables the use of additional libraries (e.g. wireless support when building for `PICO_BOARD=pico_w`) which cannot be built without a board which provides the requisite functionality. | ||
|
||
For a list of boards defined in the SDK itself, look in https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/include/boards[this directory] which has a header for each named board. | ||
|
||
Make your target from the build directory you created. | ||
|
||
---- | ||
$ make hello_world | ||
---- | ||
|
||
You now have `hello_world.elf` to load via a debugger, or `hello_world.uf2` that can be installed and run on your Raspberry Pi Pico via drag and drop. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
== SDK Setup | ||
|
||
For a full walk-through of how to get going with the C/{cpp} SDK, you should read our 'https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf[getting started]' documentation. However, if you are intending to develop for Pico on a Raspberry Pi, then you can set up the C/{cpp} toolchain quickly by running our https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh[setup script] from the command line. | ||
|
||
NOTE: You should make sure the OS on your Raspberry Pi is up to date before running the setup script. | ||
|
File renamed without changes.
Oops, something went wrong.