pico-sdk/src/rp2_common/pico_flash/flash.c:155:33: warning: implicit declaration of function 'make_timeout_time_ms'
pico-sdk/src/rp2_common/pico_flash/flash.c:156:77: warning: implicit declaration of function 'time_reached'
* support both struct timespec and struct tm variants of the aon timer APIs since use of one type on RP2040 and the other on RP2350 require pulling in C library code. Provide weak pico_ wrappers for localtime_r and mktime so that the user can override the conversion functions
* Propogate non-default pico_cmake_set_default values through to compile definitions
Add PICO_BOARD_CMAKE_OVERRIDES common scope variable, to contain any pico_cmake_set_default
CMake variables which have been overwritten. This allows passing CMake arguments to the
build, without needing extra target_compile_definitions.
Also add pico_cmake_set_default PICO_RP2350_A2_SUPPORTED to enable/disable the E10 abs-block fix
* Fix more board files missing pico_cmake_set_default PICO_RP2350_A2_SUPPORTED
* Apply @lurch's patch to check_board_header.py
* Initial Pico 2 W Bazel support
Improves compatibility with Pico W and Pico 2 W by fixing issues that
prevented correct linking of wireless libraries.
* Improve correctness and configurability
* Require newer rules_python
* Require rules_python@0.36.0
* Fix missing compatibility expressions
* Minor tweaks
* Minor cleanup
* Update suggested version in Bazel README
* More README tweaks
* Improve Bazel btstack build correctness
* Save/restore QMI window 1 registers across calls to flash_exit_xip().
This works around the RP2350 ROM reinitialising window 1 even when it
does not actually issue an XIP exit sequence to that QSPI device. If no
exit sequence is issued, then the original configuration still applies.
This is not valid in the case where the ROM *does* issue an XIP exit
sequence to the second chip select, because the original mode is no
longer valid once the device is in the serial command state. The ROM
does this when FLASH_DEVINFO (loaded from OTP, stored in boot RAM) has a
nonzero size for chip select 1. To distinguish the two cases, this patch
adds getters/setters for FLASH_DEVINFO.
If chip select 1 has a nonzero size in FLASH_DEVINFO then the ROM's
register changes for window 1 are not reverted, and instead the
hardware_flash code makes additional changes to ensure writes also work
(as the ROM only reinitialises for reads).
This means that, in the case you have opted into ROM support for the
second chip select by setting a nonzero CS1 size in FLASH_DEVINFO, the
device on chip select 1 will continue to function correctly, but full
performance won't be restored until it is reinitialised. The best way to
handle this is initialising both chip select devices in your XIP setup
function (your boot2).
* Fix whitespace. Fix handling of PICO_FLASH_SIZE_BYTES == 0.
* making pio_calculate_clkdiv8_from_float round to the neareset 1/256 (not lower 1/256)
* chage rounding of all float clkdivs to round to neareset; default to nearest (which is a backwards incompatible change, but I think OK), and add ability to turn it off
* fix copy/paste errors in PICO_CONFIG
* Calculate size of FRAC field using its own MSB and LSB, rather than hoping that INT_LSB is in the right place
* Add a new REG_FIELD_WIDTH macro, and make the calculation of the clock-dividers more consistent
---------
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
In some cases, the flash lockout task can start on the wrong core and
not have time to move to the correct core before exit is called. This
causes a timeout as the exit function is looking at the wrong core when
checking for the lockout task.
* Thow FATAL_ERROR when using post-processing functions after pico_add_extra_outputs
* Remove property definition, and rename to `PICOTOOL_PROCESSING_CONFIGURED` and `picotool_check_configurable`
* done -> configured
* Slight tweak to the config-extraction scripts.
A small logic bug meant they were reporting more false-positive warnings than they should have been.
* Small code tidy-up
- Re-synchronise the PICO_CMAKE_CONFIG: entries with the corresponding PICO_CONFIG: entries
- Fix a silly typo I made in #2002
- Enhance config-extraction scripts to catch similar typos in future
Tweaks compare_build_systems.py slightly so that it does not assume the
root directory of submodules, which arguably made the implementation a
little less intuitive.
* Remove btstack Segger RTT from pico-btstack
We now have this in the SDK so adding it again in pico-btstack leads to
link errors.
But it's possible to use the btstack RTT functionality by defining
ENABLE_SEGGER_RTT=1, and if we're not using pico_stio_rtt we still need
to add the btstack RTT source.
* Fix build issues when RTT is enabled
Fixes https://github.com/raspberrypi/pico-examples/issues/565
* Fixes to picolibc_interface
- Don't include bindings for tinystdio if picolibc was compiled with POSIX_IO.
- Add times() function, which seems to be missed, in the same pattern as settimeofday/gettimeofday.
* Adds check that ensures the Bazel and CMake Pico SDK version strings
stay in sync.
* Adds check that ensures the Bazel pins for external dependencies stays
in sync with the git submodule pins.
* Updates cyw43-driver pin in Bazel.
* Makes the checks for some build configurability options non-blocking.
* Add XIP cache maintenance API (fixes#2005)
Also add a cache clean to hardware_flash implementations, to avoid
losing pending writes on the subsequent invalidate.
* Fix comment typos, add to docs index, remove unnecessary defaulting of XIP_CACHE assertions on FLASH
* Fix sense of unsigned wrapping test
* update bazel build
---------
Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
* add support for machdyne werkzeug rp2040 board
* boards/machdyne_werkzeug: set default flash size for cmake
---------
Co-authored-by: inc <87362+inc@users.noreply.github.com>
It seems to be possible to get stuck in the loop which is checking for
abort. It can take 100s of iterations before an abort happens and on
each iteration we're clearing the abort interrupt even when it's not
required. If we only clear the abort when needed the lockup doesn't seem
to be reproducible.
Fixes#2025
* Add `pico_btstack_mesh` CMake library to link BlueTooth Mesh capabilities hidden in BTstack
* Add pico_btstack_mesh to docs
---------
Co-authored-by: theshteves <stevenkneiser@gmail.com>
The function is setting the callback after enabing the interrupt which
can cause a hang if a receive character is already pending.
Similarly we also have to clear the callback pointer only after the
interrupt is disabled.
Fixes#2009
Add the key files and partition table JSON to the link dependencies, to ensure the postprocessing is run when any of them are updated. Link dependencies seem to be the simplest way, as the elf file needs re-linking anyway given it has been post-processed, so this doesn't add any unecessary extra processing.
Without this fix, if you modify a pt.json file or a private key, the ouptut binary will not have the correct pt/key.
GCC14 doesn't like the 2-character temporary label "00" and throws an error
.../pico-sdk/src/rp2040/boot_stage2/boot2_w25x10cl.S: Assembler messages:
.../pico-sdk/src/rp2040/boot_stage2/boot2_w25x10cl.S:147: Error: junk at end of line, first unrecognized character is `0'
.../pico/rp2040/pico-sdk/src/rp2040/boot_stage2/boot2_w25x10cl.S:150: Error: garbage following instruction -- `beq 00b'
Convert it to a single number, "1", like in other boot2xxx.S files
Fixes#1999
Correct flash size from 8MB to 4MB to avoid wrapped addresses causing
firmware to be overwritten by the user filesystem in MicroPython.
Signed-off-by: Phil Howard <github@gadgetoid.com>
Stop handle_sync_func_call removing the worker. Depending on thread priority
this can occur after the memory has gone out of scope in
async_context_freertos_execute_sync.
Fixes#1962
It was probably not a good idea to put the default pin definitions in
cyw43_configport.h as they're specific to pico_w and Micropython needs
these but it has it's own version of cyw43_configport.h
* [Bazel] Fix bazel build, add presubmit
* Fixes a missing dep in the Bazel build breaking the host build.
* Automagically finds all board headers.
* Improves presubmit script polish for GH Action readiness.
* Adds a GitHub action workflow for the Bazel build.
* Disable failing checks
* Disables Windows, as there's a mix of real build errors and
overly-ambitious checks that don't work on Windows.
* Disables extra checks temporarily since it's currently failing.
* Update pico_configure_ip4_address comments
Update pico_configure_ip4_address CMakeLists.txt function comments to correct compile definition names
* Swap compile definitions in comments
Swap compile definitions order in pico_configure_ip4_address to group more naturally.
* Export linker scripts in the bazel build.
Make the rp2040 and rp2350 linker scripts available in downstream
projects bazel builds.
* Move exports_files below the package declaration.
The comments for the values of `enum gpio_irq_level` mix up zero and
one. This commit replaces "0" with "1" and vice versa where appropriate
in those comments.
* Add board file for pico2_w
This is a copy of pico2 with the definitions from pico_w added.
Set PICO_BOARD=pico2_w
* Simplify CYW43 PIO config
cyw43_spi_init contains code to find a free PIO and state machine. This
can all be replaced with pio_claim_free_sm_and_add_program_for_gpio_range
* Make CYW43 gpio pins configurable at build time
The CYW43 gpio pins are currently hardcoded. Give the defines better
names and make them overrideable at build time.
Note: CYW43_PIN_WL_REG_ON and CYW43_PIN_WL_HOST_WAKE are already used by
the driver via cyw43_hal_* functions
* Fix pio initialisation
Need to make sure the pio can work with all the gpios
* Add missing doxygen for cyw43_set_pio_clock_divisor
* Support dynamic configuration of cyw43 gpio pins
Add CYW43_PIN_WL_DYNAMIC that means cyw43 gpio pins can be changed at
runtime.
Then CYW43_PIN_WL_* calls cyw43_get_pin_wl to get the gpio out of
the array.
cyw43_set_pins_wl can be used to change the cyw43 gpio pins although
care is needed when calling this?
* Some fixes for cyw32 gpio > 32
* Allow CYW43 to be configured with cmake
* Add default config of CYW43_WL_GPIO_COUNT to cyw43_configport.h
* Fix some review comments
Add some PICO_CMAKE_CONFIG
Stop using gpio_*_mask64 functions
Specifying the final boot2 source file as a link library here causes the
final `.elf` to be linked directly with that `.S`, which causes it to be
compiled into an object file with a name like `/tmp/<random chars>.o`.
This temporary object name is embedded in the final `.elf`, so the
`.elf`'s contents change after each link even if none of the input files
change, breaking reproducibility.
Fix the issue by specifying the source file as the source for an
object-only library, then specifying the library's object files as the
target link libraries, so the source is compiled in a separate step and
only the object is passed to the linker.
Changed the constraint from "l" (specific to ARM) to the general "r" in inline assembly used for RISC-V architecture.
This ensures most compilers are able to compile this header file.
* add PANIC and AUTO_INIT_MUTEX to pico_minimize_runtime; fix build with PICO_PANIC_FUNCTION=
* add pico_minimize_runtime for host builds - does nothing
* Add ALL option to pico_minimize_runtime
* Fix Bazel build breakages
* Adds support for new PICO_DEFAULT_UART_BAUD_RATE option.
* Fixes issues related to Picotool and boot_picoboot_headers.
* Adds pico_float RISC-V pieces to the Bazel build (not yet fully
tested).
* Adds the missing adafruit board header to the Bazel build.
* Exclude hazard3 float test in Bazel validation script
* Restore missing dependency in hardware_boot_lock
* Adding I2C Burst Reading/Writing feature
* Add functions to header file.
Fixing: https://github.com/raspberrypi/pico-sdk/pull/1495
* Some missing changes
Rename the functions. Lose the "mode" and "blocking" needs to be at the
end.
Just set restart_on_next in the caller rather than adding a parameter.
---------
Co-authored-by: anhnhancao <nhan@earable.ai>
Co-authored-by: Peter Harper <peter.harper@raspberrypi.com>
The refactoring of these functions removed the (void) in the function
declarations - thus compiling with -Wstrict-prototypes will yell at us
at compile time.
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
* Add fast single-precision add/sub/mul for Hazard3
* Make test output less noisy. Map -nan to -inf in vector gen. Move random vectors to separate files.
* Re-disable USB stdout for pico_float_test by default...
* Disable pico/float.h exports on RISC-V as these functions aren't implemented
* Add hazard3 instructions to asm_helper. Split hazard3.h to support this.
You can still include hazard3.h to get everything. This just allows you
to pull in less.
* Update config-extraction scripts to work with multiple chips
* Standardise wording between common options
* Various config-related fixes
* Update pico_rand to use correct busctrl_hw struct-name
* Don't start config descriptions with "The ..."
* Add @pico-sdk prefix to bazel/config in lwip.BUILD
Without this, we're trying to refer to a subpackage of
the lwip directory called bazel/config, which doesn't
exist. See similar references in this file.
* bazelbuild: Fix compilation errors with pico_lwip and freertos
This fixes two general problems.
* pico_lwip_contrib_freertos misspelled several things
(omitted contrib/ dir prefix, didn't have @pico-sdk in front of
out references to pico-sdk targets)
This is fixed simply by fixing the spellings.
* Circular dependency between pico_lwip_core and pico_lwip_contrib_freertos.
In NO_SYS=0 mode, lwip wants to include sys_arch.h. But sys_arch.h
is defined in pico_lwip_contrib_freertos. sys_arch.c in turn wants
to include lwip's opt.h and arch.h, among other things. So it needs
to depend on pico_lwip_core.
This is fixed by extracting all the headers into a common rule which
can be depended on by both targets, then depending on it in the
relevant targets.
Additionally, for the LWIP+FreeRTOS build to work correctly, we need
to actually depend on the pico_lwip_contrib_freertos rule from
pico_lwip_core. This the purpose of the select in the deps of
pico_lwip_core.
* bazel+cyw43: Fix compilation errors.
This fixes issues with the cyw43 driver
build rules in Bazel:
* Before this, the btstack would always be included
even if it could not be used. If the user did not
specify a btstack config, this would cause a
compilation error. Now, we condition the linking
and building of the btstack on whether there is
a config for it.
* Before, the btbus was not properly linked.
* Implements code review feedback
I was reading through my PDF copy of the SDK docs, and I think that there's a typo in this example. The macro is `__time_critical_func` but the example spells it `__time_critical`.
* Modify check_board_header.py to work with both RP2040- and RP2350-based boards
* Tweaks to the board-header files so that they pass check_board_header.py
* Update tools/check_board_header.py
so that it handles pico_cmake_set_default the same way as cmake/generic_board.cmake does
* Support serial flash with 16 byte unique id
Flash devices like IS25LP016D have a 16 byte unique id. Reading just the
first 8 bytes causes devices to have duplicate unique ids as the numbers
only differ in the final 8 bytes.
Support overriding FLASH_UNIQUE_ID_SIZE_BYTES in the board header. Use
the final 8 bytes for the unique id.
Fixes#1641
Always write the path as "abosolute" (relative to the root of pico-sdk) as that makes searching for it (when building the RP2040 datasheet) much faster. This matches the behaviour of extract_build_defines.py and extract_cmake_configs.py
* Small whitespace fixup
* typo bugfix
* Small refactoring of check_board_header.py
* Make structure of rp2040_interface_pins.json more explicit, so that it can be more easily extended
* Move definition of valid-pins from python to json
* Check that each interface includes all (minimally) expected pins
Note that UART_CTS, UART_RTS & SPI_CSN are classed as optional
* Split "expected_functions" into "required" (all of these pins must be present) and "one_of" (at least one of these pins must be present)
Without this change, using cyw43 has a dependency on printf code for printing
error message. Everywhere else in cyw43-code this dependency is masked with the
CYW43_PRINTF-macro. This PR extends the usage of the CYW43-PRINTF macro to the
SPI-support code.
* Fix PICO_DEOPTIMIZED_DEBUG not updating compiler flags
Setting CMAKE_${LANG}_FLAGS_DEBUG_INIT specifically only sets the flags for the Debug config the first time it is configured by CMake, pulling the initially-configured flags from CMakeCache.txt on subsequent configurations. This causes PICO_DEOPTIMIZED_DEBUG to not have any effect after the initial configuration, causing breakpoint issues when debugging certain functions.
Clearing the cache of the debug flags allows the flags to be updated every configuration, and appended to appropriately (such as with "-g").
See Issue #1618 and the comments of Pull Request #1620 for further details.
Fixes#1618
To make stdio logging quicker it's probably a good idea to set the default
uart speed 921600, but it's only configurable by adding this define to
your project. Make it configurable from the cmake command line.
* Add script to automatically validate board header files
* Fix small automatically-found inconsistencies in various board header files
* Tweak and add board header file from abandoned PR #1174
* Add host Bazel build
Updates target_compatible_with across the repo to ensure that wildcard
builds for both host and rp2040 succeed.
* Get unit tests building
* Add Python script to identify build system differences
Uses the build system tags to make it easier to identify differences
between the CMake and Bazel builds.
* Temporarily disable pico divider test
* Support PICO_BARE_METAL in Bazel
* Support PICO_NO_GC_SECTIONS in Bazel
* Support boot2 configuration in Bazel
Adds support for PICO_DEFAULT_BOOT_STAGE2 and
PICO_DEFAULT_BOOT_STAGE2_FILE in the Bazel build.
* Allowlist some CMake-only options
* Support CXX configuration options in Bazel
* Move multiple_choice_flag.bzl
* Support all pico boards
* Support linking multiple stdio implementations
Changes the Bazel build so stdio implementations are no longer mutually
exclusive.
* Add PICO_BOOT_STAGE2_LINK_IMAGE
* Support PICO_CMSIS_PATH in Bazel
* Support PICO_USE_DEFAULT_MAX_PAGE_SIZE in Bazel
* Silence PICO_CMSIS_VENDOR and PICO_CMSIS_DEVICE differences
* Support PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS in Bazel
* Properly support version defines
* Support embedding binary info in Bazel
* Embed build type in binary
* Support different linker scripts in Bazel build
* Finish out missing PICO_BUILD_DEFINE in Bazel build
* Support PICO_NO_TARGET_NAME
* Reorganize initial configuration options in Bazel
Cleans up and reorganizes some of the initial configuration options
added to the Bazel build so everything is consistent.
* Add builds for pioasm and elf2uf2
* Use Python rules from rules_python
* Actually link in output formats in pioasm tool
* Make tools have public visibility
* Add UF2 Bazel aspect
* Add TODOs for pioasm/uf2 helpers
* Fix compile flag typo
* Update Bazel SDK configuration strings to match recent CMake changes
* Fix pico_divider test
* Clean up straggling TODOs
* Clarify pico_stdio_test compatibility
* Initial Bazel Pico W support
* Add new files from develop
* Clean up compatibility expressions in Bazel build
* Clean up rp2 constraint handling in Bazel
* More Bazel docs cleanup
* Format Bazel build files
* Consolidate transitions in the Pico SDK
* Make every _allowlist_function_transition explicit
* More docs cleanup
* Add a few missing defines
* Improve PICO_CONFIG_HEADER correctness in Bazel
* Minor docs clarifications
with this change we can use PICO_SDK_FETCH_GIT_TAG to specify a release tag for the Pico SDK to download.
example usage:
```
set(PICO_SDK_FETCH_FROM_GIT true)
set(PICO_SDK_FETCH_FROM_GIT_TAG "1.5.1")
include(pico_sdk_import.cmake)
```
* Build boot_stage2 with Bazel
Introduces the initial foundations of a Bazel build, including a
toolchain, critical generated headers, platform patterns, and enough
BUILD files to build boot_stage2.
* Bazel libraries to support picotool
* Move SDK defines to toolchain
* Switch to `archive_override` in MODULE.bazel
Uses archive_override where applicable to allow transitive bzlmod deps
to propagate.
* Multiplatform objcopy selection in Bazel build
Makes an objcopy alias that redirects to the objcopy tool for the
current exec platform, which allows boot_stage2 to build on Linux,
macOS, and Windows.
* Generate Bazel build files
Adds initial set of generated Bazel build files. Note that these do not
yet build, as dependency cycles are present.
* Fix dependency cycles in Bazel build
Fixes many dependency cycles, some were unintentionally created by the
build file generator, others are true dependency cycles that require
manual workarounds.
* Silence warning in pico_stdio Bazel build
Silences a stray warning in the Bazel build.
* Fix wildcard Bazel build
This makes `bazel build //...` succeed, and also prevents the fetching
of toolchains that aren't compatible with the current execution
environment (i.e. Windows computers will no longer try to download macOS
toolchains).
* Get the SDK working
Finishes out the remainder of the work required to successfully compile
a working blinky example.
* Fix UART stdio dependencies in Bazel build
Fixes some dependencies around pico_stdlib so that pico_stdlib links
properly and UART stdio works.
* Add linux support to Bazel build
* Get Bazel deps from registry
Adds external an external registry for resolving Bazel module
dependencies.
* Fix host configuration for picotool
Provides the appropriate defines for host builds to support the picotool
build.
* Remove -ffreestanding from Bazel toolchain
The -ffreestanding toolchain flag is quite strict, so remove it from the
Bazel toolchain.
* Remove unused .bzl file
* Reduce Bazel compiler flags
Cuts out most of the Bazel toolchain flags and only specifies the
bare-minimum set of flags. Also, adds wrapper linker flags for functions
the SDK wraps.
* Get USB serial working
Adds initial TinyUSB support and enough integration to get USB serial
working.
* Remove "Generated build file"
Removes comments that indicates BUILD.bazel files are generated. This
was used during initial bringup to indicate hand-crafted vs
automatically generated BUILD.bazel files.
* Do not build USB libraries unless configured
Prevents USB libraries from being built unless the build is properly
configured to use them.
* Switch to rules_cc toolchains
Moves toolchain configuration to use the new rules in rules_cc.
* Minor cleanup in parse_version.py
Cleans up trailing whitespace and runs the black formatter on
parse_version.py.
* Simplify constraint dimensions in Bazel build
Consolidates the class/chip constraint settings to be a single
constraint_setting with a config_setting that represents the rp2 class.
* Update pin of rules_cc in Bazel build
Includes a necessary fix for the target_compatible_with expression in
the cc_toolchain to work as intended.
* Move toolchains from pico.bzl to BUILD.bazel
Moves toolchain definitions from pico.bzl to BUILD.bazel to make them
easier to find and read.
* Run buildifier on Bazel build files
Fix trivial formatting issues by running buildifier on all BUILD.bazel
files.
* Make objcopy rule
Makes a simple objcopy rule to remove direct references to the ARM
toolchains.
* Fix link flags in Bazel build
Critical flags were not being applied to link steps. This applies -mcpu
and -mthumb to the link steps to make the produced binaries work again.
* Mention missing host build support
* Fix various Bazel library rules
* pico_bit_ops was incomplete.
* pico_double and pico_float were trying to link in the "none"
implementation.
* Extend Bazel build documentation
Improves documentation and comments across the Bazel build.
* Clean up auxilary tools in Bazel build
Switches genrules to use skylib rules to simplify things. Reworks
version header generation to use the Bazel module version rather than
parsing CMake.
* Update boot_stage2 Bazel build file
Moves `includes` to be enumerated on the correct library.
* Add WORKSPACE version fallback
WORKSPACE Bazel projects don't support querying module version, so add a
fallback of '0.0.1-WORKSPACE' so the build can succeed.
* Fix malloc handling in Bazel build
* Fix Bazel dependency cycle in pico_malloc
* Prevent malloc from being linked into boot_stage2
Prevents Bazel from ever trying to link malloc into the boot_stage2
binary.
* Remove custom bootloader platform
A dedicated boot_stage2 platform introduces a lot of complexity that
needs to be more thought-through.
When you get a callback to tell you a character is available, you should
be able to call getchar_timeout_us, but it's not working for USB
Fixes#1603
Co-authored-by: Andrew Gordon <arg@gordondesign.ltd.uk>
* fix feature request #1442
* Do not require -I before each addtional path
* Fix pico_btstack_make_gatt_header warning
gatt header files are always made into the "generated" folder so you get
a warning if you have more than one target generating a gatt header with
the same name.
Also, simplify the expansion of ARGN
* Improve pico_btstack_make_gatt_header description
---------
Co-authored-by: Peter Harper <peter.harper@raspberrypi.com>
It would be helpful to be able to use the lwip httpd server, but it
generates the content using a tool written in C. This is problematic as
it requires a native compiler to build the tools.
Add a python tool to generate the httpd content and a cmake function to
make use of it.
* USB descriptor string length.
Implement a mechanism to set the maximum string length used in
tud_descriptor_string_cb() by defining USBD_DESC_STR_MAX. If
USBD_DESC_STR_MAX is not defined, the behavior remains unchanged and the
previous default value of 20 is used. A compile time error is produced
if USBD_DESC_STR_MAX is higher than 127 since the length of the string
plus header is returned in a single byte as (2 * len + 2). Similarly, a
compile time error is generated if the length is defined as less than 17
in order to ensure that there is enough room for the 16-character serial
number plus header.
* Fix spelling mistake.
Renamed irq_hander_chain_free_slot_head to irq_handler_chain_free_slot_head
(added missing l).
* Add documentation for gpio_add_raw_irq_handler functions.
Added a note that irq_add_shared_handler() is used internally and that
the function will assert if the maximum number of shared handlers would
be exceeded.
The resulting elf binaries contained an unusual section that leads to an error
when objcopy attempts to update a section (e.g. when using the picowota
combined build mechanism).
This seemed to be due to the order of sections, where two RAM-only sections
were split by a RAM/FLASH section. By moving the RAM-only sections together,
this issue disappeared.
* Fixes shadowing of a global declaration
Required for GCC 12.2.1
* Change other function pointers to be _func to be consistent
---------
Co-authored-by: Andre Zeps <andre.zeps@googlemail.com>
Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
The fix for the following issue adds some macros to configure default
ip addresses. These are expressed in hex which is a bit non-obvious to
set. So add a macro to convert from a string to the hex representation.
https://github.com/georgerobotics/cyw43-driver/issues/41
If LWIP_IPV6=1 a request to update the multicast list occurs in a
callback in the low priority interrupt.
This makes an ioctl call into the driver, at the end of which is a call
to cyw43_await_background_or_timeout_us (see CYW43_DO_IOCTL_WAIT).
It is attempting to delay until there's "some work to do".
For Freertos this fails an assertion as an attempt is made to acquire a
semaphore in interrupt context.
Fixes#1590
* Add ...3.27 to the cmake_minimum_required, and make minimum 3.13 everywhere
Signed-off-by: Ghorban M. Tavakoly <gmt3141@gmail.com>
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
Some RP2040-Zero boards from WaveShare can only be recognized via USB
after flashing UF2 into it, and if you unplug and replug it, nothing
happens on both USB host and device, RP2040-Zero seems just not booting.
According to @ArkBrj, it seems that setting `PICO_FLASH_SPI_CLKDIV` to
`2` makes the clock chip exceed the spec, setting it to `4` fixes this
bug.
I tested it with the blink program in pico-examples, this does fix the
bug for me.
Fixes <https://github.com/raspberrypi/pico-sdk/issues/1304>.
Running a build with a newer CMake version results in a deprecation
warning from the tools subdirectory
[13/108] Performing configure step for 'PioasmBuild'
loading initial cache file /.../build/pico-sdk/src/rp2_common/pico_cyw43_driver/pioasm/tmp/PioasmBuild-cache-Release.cmake
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Raise the minimum version requirement for the tools to the same version
that is required in the top-level CMakeLists.txt anyway.
When the BOOT2.S files were updated, the section name in the IS25LP080 code was set to "text" and not ".text".
The missing "." causes the actual boot code to be thrown out since the rest of the infrastructure expects "section .text" and not "section text"
Re-add the missing period.
* Move multicore_lockout victim initialzied tracking to pico_multicore via new multicore_lockout_victim_is_initialzied method, so user initialization of the multicore_lockout independent of pico_flash will work
* Support dynamic location for flash bank offset
Allow the pico_flash_bank_get_offset function to be changed by
defining pico_flash_bank_get_storage_offset_func
* Add new pico_flash library, with flash_safe_execute(func) method to help with preventing IRQs and other core accessing flash with pico_multicore or FreeRTOS SMP
Implement a mechanism to set the maximum string length used in
tud_descriptor_string_cb() by defining USBD_DESC_STR_MAX. If
USBD_DESC_STR_MAX is not defined, the behavior remains unchanged and the
previous default value of 20 is used. A compile time error is produced
if USBD_DESC_STR_MAX is higher than 127 since the length of the string
plus header is returned in a single byte as (2 * len + 2). Similarly, a
compile time error is generated if the length is defined as less than 17
in order to ensure that there is enough room for the 16-character serial
number plus header.
Change from Infineon to fix the BT buffer corruption which occurs when
making heavy use of BT and WIFI at the same time.
Update cyw43-driver (Includes fix for BT+Wifi buffer corruption issue)
The process for reading VBUS and VSYS on Pico and Pico W is different.
It's hard to write code that compiles for both devices.
Add some configuration to the board files.
Fixes#1222
* Allow pre-processor overrides for Clock/PLL setup
* Use `_KHZ` rather than `_MHZ` for `XOSC_` `SYS_CLOCK_` etc definitions (`_MHZ` versions are provided for compatibility when `_KHZ` is a multiple of 1000)
Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
Bluetooth needs a tempoarary buffer to load firmware. Micropython won't
work safely with malloc and free so allow these calls to be changed by
using cyw43_malloc / cyw43_free macros.
* switch all .S files to unified asm, and use a new macro `pico_default_asm_setup` to setup compiler to help porting to other compilers. Also some minor tweaks:
* switch some code to use more recent helper methods (e.g. busy_wait_at_least_n_cycles)
* add documentation to host divider header (I had this ages ago and never promoted)
* fixup erroneous docs about 32p32 values in all divider headers
* fix some compiler warnings
* rename recently added `unified_asm` macro to `pico_default_asm`
This was changed to use the same algorithm as MP.
This function is used to set the wifi mac if OTP is unset (which
shouldn't ever be the case). But if it does occur, changing the mac
might cause issues, so lets play safe and revert the change.
* Fix various non-GCC warnings (no effect on GCC)
* Reduce use of typeof since non GCC compilers may not support it
* Introduce PICO_C_COMPILER_IS_GNU, PICO_C_COMPILER_IS_CLANG, PICO_C_COMPILER_IS_IAR to CMake as if (CMAKE_C_COMPILER_ID STREQUAL "xxx") is a bit verbose
* Use "unified_asm" macro for all inline asm (it is "volatile __asm" on GNU with a .syntex unified)
* Use NOLOAD instead of COPY in linker scripts (arguably more correct anyway)
* Use the same style for setting _etext in all 4 linker scripts (to the beginning of .data). Clang aligns .data on a 16 byte boundary. Note ideally we'd
add a new symbol __data_source, however that would break backwards compatibility with existing user linker scripts
* Use "a" for .stack, .heap sections because clang complains otherwise, and they are explicitly NOLOAD anyway
* Avoid duplicating __sev, __wfe, __wfi which Clang sometimes seems to provide as built-ins
* Add missing kitchen_sink_blocked_ram binary
* Allow build with LLVM Embedded Toolchain Form ARM v 14.0.0 (unsupported atm)
If you just want to link to pico_btstack_flash_bank_headers to include
the header file you also have to link to pico_btstack_base_headers.
ENABLE_CLASSIC and ENABLE_BLE are used in header files so should be
added by the headers library
Fixes#1271
* * Harden stdio_usb and stdio in general against deadlocks which could otherwise result from doing printfs from within IRQs
* Add a test for the above
* Add mutex_try_enter_block_until API.
* Make best_effort_wfe_or_timeout not use alarms if called from within IRQ
* minor cleanup of lwip+tinyusb docs, and bump sdk verison number to 1.5.0-develop
* Update cyw43_arch docs for async_context_use
* remove accidental copy of some comments
Add a -nostdlib specifically for the check to ensure that it builds
successfully.
The -nostdlib isn't needed normally, because linking against the pico
SDK will add in definitions for the previously-missing function
There's currently no way to be notified in a "stdio" agnostic way
whether there's an incoming character available. You can poll with
getchar_timeout_us, but that's far from ideal.
Add a method that takes a callback to notify that a character might be
available.
1. Make sure Pico SDK libraries have the correct dependencies on other SDK libraries
2. Pico SDK libraries all have _headers variants to include the headers. This may facilitate building user STATIC libraries without
pulling in SDK code, though care will still need to be taken w.r.t. values of #defines
3. Make sure the _headers versions also have the correct dependencies
Note: There are a few exceptions to 1. for some non code libraries like pico_standard_link and pico_cxx_options
* Add BSSID connection options to PicoW
When working with a mesh or multiple APs with the same SSID, it is often
necessary to specify which of the APs to connect to in order to maximize
the WiFi strength.
Add BSSID options to the SDK's PicoW cyw43_arch_wifi_connect_XXX APIs.
Fixes#1090
Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
Basically the integration code (cyw43_config.h and related implementations) are now in the driver.
cyw43_arch now just has
* async_context creation per CYW43_ARCH_TYPE
* pre-existing cyw43_arch methods for connect etc.
Add a general purpose random number generator via pico_rand library. which tries to use as much real entropy as possible mixed into a PRNG
Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
This sets the compile-time flag for tinyusb's dcd_rp2040 driver by
default. Applications that won't ever be plugged into a Pi 4 or Pi 400
can optionally disable this.
* Remove (legacy) direct inclusion of 'pico/platform.h' which potentially skip config/board setup
* also fix direct use of pico/config.h which predated pico.h being assembly includable
* Extract all poll/threadsafe_background/freertos from cyw43_arch into new abstraction async_context:
* provides support for asynchronous events (timers/IRQ notifications) to be handled in a safe context.
* now guarantees all callbacks happen on a single core.
* is reusable by multiple different libraries (stdio_usb can now be ported to this but hasn't been yet).
* supports multiple independent instances (independent instances will not block each other).
* cyw43_arch libraries cleaned up to use the new abstraction. Note each distinct cyw43_arch type is now a very thin layer that creates the right type of context and adds cyw43_driver and lwip support as appropriate.
Additionally,
* Add new pico_time and hardware_alarm APIs
* Add from_us_since_boot()
* Add alarm_pool_create_with_unused_hardware_alarm()
* Add alarm_pool_add_alarm_at_force_in_context()
* Add hardware_alarm_claim_unused()
* Add hardware_alarm_force_irq()
* Added panic_compact() and some minor comment cleanup; moved FIRST_USER_IRQ define to platform_defs.h
* SYS functions and GCC 12 fixes
* Add implementation of _gettimeofday and settimeofday, _times
* Remove some GCC warnings about unimplemented SYS functions (e.g. _open) by making weak implementations that return errors.
* Removed _exit from crt0.S since we have a weak version in runtime.c and we don't want two weak impls since the linker can't pick. If the user omits runtime.c then they'll need to provide _exit or get the error
* Add sys/time.h to arch/cc.h for lwIP as it seems under GCC12 this is not getting included
In arm-gnu-toolchain-12.2 we see this warning, that's not relevant to
pico. Disable it.
warning: blink.elf has a LOAD segment with RWX permissions
Fixes#1029
fix bug #1068 where the raw irq handler that was added masked on IO_IRQ_BANK0 (defined as 13) and not the gpio connected to the CYW43 i.e. CYW43_PIN_WL_HOST_WAKE
Co-authored-by: andrew arm <armdev@openlx.org.uk>
* Added ARCHIVE_OUTPUT_DIRECTORY to uf2 output in CMake
This Commit enables the use of the ARCHIVE_OUTPUT_DIRECTORY target
properties in CMake for the generation of uf2 files.
The changeset in lines 47..51 is necessary due to CMake not
automatically creating the ARCHIVE_OUTPUT_DIRECTORY if no archive target
is present.
* rework cmake changes to make it friendler for non absolute paths
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
* Fix unexpected (CMake) behaviour with PICO_BOARD variable.
Changing PICO_BOARD value from "pico_w" to "pico" did not
unset PICO_CYW43_SUPPORTED variable. Which could lead
CYW43 driver included in builds for "pico".
solution: make PICO_CYW43_SUPPORTED a non cache variable
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
* Remove incorrect override for LWIP_PLATFORM_ASSERT
LWIP_PLATFORM_ASSERT macro is used by lwip driver implementations to specify the behavior of the assertions in lwip code.
The previous override of this macro incorrectly assumed that the parameter to the function macro was the condition to check. However this is incorrect. The parameter is actually a message string defining what failed.
This mistake caused all assertions to be ignored. ( and myself to loose many hours of debugging time )
By removing this, we restore the default behavior specified by lwip which is to use `printf` to log the message.
* I think i prefer to use panic (which doesn't pull in fflush etc)
Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
* Remove unnecessary wait in pico_divider.
There is no need to wait if there is more than 8 cycles between setup and result readout.
Dividend/divisor readout should be correct without delay. Update comment to reflect that.
* Optimize hw_divider_save_state/hw_divider_restore_state.
Doing multiple pushes to avoid stack usage is faster.
The wait loop in hw_divider_save_state had an incorrect branch in the wait loop.
This didn't matter since the wait wasn't necessary to begin with.
* Remove pointless aligns in hardware_divider.
The regular_func_with_section inserts a new section so if aligning
is desired it should be placed in the macro after section start.
* Save a few bytes in hardware_divider.
Signed and unsigned code can use the same exit code.
Branching to the common code is free since we need the 8 cycle
delay anyway.
* Add mbedtls as a submodule
Checked out on branch mbedtls-2.28
* Add mbedtls to pico-sdk
Link your code to pico_lwip_mbedtls and pico_mbedtls.
See tls_client example in pico-examples
Fixes https://github.com/raspberrypi/pico-sdk/issues/893
* Implement whole-buffer write semihosting
Each semihosting call is very slow, so doing it for each character
does not provide an ideal developer experience.
This change allows the entire buffer to be printed out in a single call.
* Enable/disable connection check made with DTR
this gives users the option to disable DTR check.
Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
SDK1.3.0 was mistakenly released as a squash commit. This merge re-integrates
that squashed commit, along with the actual individual changes back into SDK1.3.1
so that SDK1.3.1 will have the actual SDK1.3.0 release in its history.
The squash commit will be visible in the history, however git blame should show
the correct individual commits
When cloning the pico-sdk repo manually, one normally would do `git
submodule update --init`, which is non-recursive. However, when cloning
automatically, CMake will recursively update submodules by default.
Updating all of tiny-usb's submodules takes an extremely long time.
Luckily, CMake 3.17 added an option we can specify for FetchContent to
tell it not to recursively update submodules. On older CMake versions,
the flag is not used. For those with a new enough version of CMake, this
will significantly speed up SDK cloning.
Fixes#771.
When using a linker script which does not provide a .time_critical.
section that is marked "ax" and wrongly define
PICO_INT64_OPS_IN_RAM=1 this would generate a malformed
executable with strange runtime bugs in the worst case.
The mask passed in shouldn't already be shifted by ADC_CS_RROBIN_LSB
(16) otherwise the shift in the call to hw_write_masked() would shift
all of the bits off the end of the mask, hence we should be asserting
not against ADC_CS_RROBIN_BITS (0x1f0000) but against the number of ADC
channels available.
Fixes the following compiler warning
```
.../vendor/pico-sdk/src/rp2_common/pico_runtime/runtime.c: In function 'panic':
.../pico-sdk/src/rp2_common/pico_runtime/runtime.c:284:1: warning: 'noreturn' function does return
284 | }
| ^
```
* fix __force_inline for different GCC versions in cpp mode (the affected versions are different from c mode), and build kitchsink.c as a cpp file too for testing
* silly bug in host platform.h
* Platform updates
- Add PICO_RP2040=1 to rp2040 builds
- Add new PICO_RP2040_B0/1/2_SUPPORTED macros and retailer chip specific code to use
- Add doxygen to platform.h
- Make pico.h includable from assembly (because header order is important and tricky) - split out platform_asm.h
- Switch to using PICO_RP2040_B0_SUPPORTED in board headers
mutex_t and mutex_ are reverted to non recursive versions (pre SDK1.2.0) and new recursive_mutex_t and recursive_mutex_ functions have been added
PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY flag has been added to allow old SDK1.2.0 compatibility (i.e. mutex_t can be used recursively or not) but this is slower (and is will be removed in a future version)
add watchdog_enable_caused_reboot. Note there is a small backwards incompatibility in so far as watchdog_enable sets scratch[4] to a magic value not 0 now, however this behavior was not documented before.
* add stdio_usb_connected() method
* add PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS to allow waiting for CDC connection during init(*
* add puts_raw and putchar_raw to skip any CR/LF translation
Due to the well known electronic market situation, we were forced to mount an alternative part number in a batch of Arduino Nano RP2040 Connect.
These flash chips, from ISSI, need yet another way to configure the QE sticky bit :|
At the moment, the safest way to handle the dual sourcing is to fallback using W25Q080 loader, and requiring that the sticky bit has already been programmed during production.
Fixes build when pico_stdlib isn't included in the target libraries:
pico-sdk/src/rp2_common/pico_divider/divider.S:8:10: fatal error: hardware/divider_helper.S: No such file or directory
Also fixes the same error in pico_double, though I'm not sure how/why:
pico-sdk/src/rp2_common/pico_double/double_aeabi.S:9:10: fatal error: hardware/divider_helper.S: No such file or directory
* use PICO_DISABLE_SHARED_IRQ_HANDLERS exclusively as config for no shared handler support (rather than also PICO_MAX_SHARED_IRQ_HANDLERS == 0)
additionally make irq_add_shared_irq_handler() call irq_set_exclusive_handler() so that single usage of an IRQ still works
* Comment typo
Co-authored-by: Luke Wren <wren6991@gmail.com>
While working on the [online pioasm](https://wokwi.com/tools/pioasm), I found several PIO instructions that result in invalid python code. Here is a small program that demonstrate the issue:
```
.program python_issue
push block
wait 0 irq 1 rel
irq clear 1 rel
```
And the resulting Python program:
```python
# -------------------------------------------------- #
# This file is autogenerated by pioasm; do not edit! #
# -------------------------------------------------- #
import rp2
from machine import Pin
# ----------- #
# python_test #
# ----------- #
@rp2.asm_pio()
def python_test():
wrap_target()
push(, block) # 0
wait(0, irq, 1 rel) # 1
irq(clear 1 rel) # 2
wrap()
```
After this fix, the above program compiles to a valid python syntax:
```python
# -------------------------------------------------- #
# This file is autogenerated by pioasm; do not edit! #
# -------------------------------------------------- #
import rp2
from machine import Pin
# ----------- #
# python_test #
# ----------- #
@rp2.asm_pio()
def python_test():
wrap_target()
push(block) # 0
wait(0, irq, rel(1)) # 1
irq(clear, rel(1)) # 2
wrap()
```
* Add missing DREQ_s
* store actual clock frequency in clock_configure (fixes#368)
* use dma DREQ values defined in dreqs/dma.h
* Fix hw_is_claimed, and add xxx_is_claimed APIs
* Add some PIO irq helper methods
* Add DMA channel IRQ status getter and clear methods
* Implement the correct PIO IRQ status/clear methods (good to have methods here as the h/w interrupt registers are super confusing)
* fix pico_multicore dependencies
* add missing wrapper func __aeabi_f2d
* Further DMA/PIO IRQ API cleanup (and review fixes)
* add PICO_INT64_OPS_IN_RAM flag
Most build related items have moved into <tinyusb>/hw/bsp/rp2040/family.cmake which is now the source of truth
force merging as same code save submodule was already reviewed
* - fix interp_claim_lane (in case of interp1 and lane==1 bit was 0b11 instead of 0b1000)
- added missing function interp_unclaim_lane_mask
* - interp_hw_save_t are not I/O registers
* Fix warnings about some unused parameters in pico_stdio_usb
* Use `__unused` for the unused parameter in tud_descriptor_configuration_cb
* Remove redundant inclusions of `pico/platform.h`
This header is included by the other library headers (via `pico.h`)
Fixes the following warning when building for host
```
[...]/pico-sdk/src/common/pico_time/time.c: In function 'alarm_pool_dump_key':
[...]/pico-sdk/src/common/pico_time/time.c:282:15: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
printf("%ld", to_us_since_boot(get_entry(pool, id)->target));
~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%I64d
```
I'm using this in my program to get a better idea of how many entries I
need to allocate to avoid blocking or losing data, and to debug performance
issues.
Fixes the following warning:
```
[...]/pico-sdk/src/host/hardware_divider/include/hardware/divider.h:81:26: warning: operand of ?: changes signedness from 'int' to 'uint32_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
return b ? (a / b) : -1;
^~
```
- The divider state needs to be saved for __aeabi_ddiv, __aeabi_fdiv, __aeabi_dtan and __aeabi_ftan or they won't work in interrupts *(probably not used much youd hope), or on an RTOS context switch
- Refactored code out for the integer and floating point cases
- Improved the floating point 'tests' in passing to check more return values against GCC implementations
- Added floating point usage to the IRQ nesting test case
Adds a new cmsis_core INTERFACE library, which provides the basic CMSIS macros/definitions, and RP2040.h and system_RP2040.h
By default the isr_ methods in the vector table are renamed to their CMSIS versions, but this can be overridden by defining PICO_CMSIS_RENAME_EXCEPTIONS=0
- Add recursive_mutex
- Make all locking primitives and sleep use common overridable wait/notify support to allow RTOS
implementations to replace WFE/SEV with something more appropriate
- Add busy_wait_ms
* Change some cmake output to DEBUG level
Make SDK build more consistent with other libraries (use an INTERFACE marker library for inclusion tests)
Add PICO_SDK_PRE_LIST_FILES, PICO_SDK_POST_LIST_FILES build vars
* fix typo
* remove leftover debugging message
* SPI Definitions for SparkFun boards
Added the #defines for the default SPI pins on SparkFun boards
* SPI Definitions for SparkFun boards
Added the #defines for the default SPI pins on SparkFun boards
Co-authored-by: Kirk <blowme@cow.com>
This prevents a comparison between a signed and an unsigned number which
will create a warning tripping -Werror.
Also added a check for the alignment of the spin lock structure
* i2c: set hold time of SDA during transmit to 2 for TCS34725 color sensor
* i2c: fix issues in i2c_write_blocking_internal
* i2c: rename sda_hold_count to sda_tx_hold_count
* use assert rather than invalid_params_if for internal consistency checks
* i2c: use a more appropriate sda tx hold time at higher baudrates
* i2c: reduce 120/1e9 to the smallest possible integer numerator and denominator
* Don't use implicit 0 for field LSB
Co-authored-by: Luke Wren <wren6991@gmail.com>
* move PLL reset code from clocks driver to pll driver
* Don't clear PLL PWR/FBDIV after reset as unnecessary. Call out in runtime.c why USB/syscfg aren't reset.
Co-authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
Co-authored-by: Luke Wren <wren6991@gmail.com>
* build: allow compile time - and hence via board config header - choice of boot stage2 via a default compile_time_choice.S boot stage 2 which conditionally includes others
adafruit_rp2040_feather: fix flash size/clkdiv
* fixup GENERIC_03H #define names
* Add pico_get_unique_board_id_string API
Add a new API to pico_unique which will turn the unique ID into a
canonical text string.
Use this API to update the USB device serial number in stdio_usb.
Supercedes #280
* Clean up -Wconversion=error issues
* Address review comments, fix api typing
Use cleaner binary-to-hex conversion. Update the length parameter to
use uint per the SDK standard .
In order for the returned value to accurately reflect a single moment in time,
ensure the registers are read just once and in the datasheet order.
Before this change, the RTC registers would each be read multiple times,
leading (infrequently) to the returned fields not all reflecting the same
moment in time.
The rp2040 datasheet has what I believe is an incorrect example (embedding
the source of this function); will the datasheet be updated if this function is
fixed?
This problem is only a speculative one; I did not actually observe it in the
wild.
* pico_stdio_usb: be more explicit about includes, fix warning (#257)
* pico_base: NDEBUG backwards for absolute_time_t (#255)
* pico_util: missing extern C in queue.h (#249)
* build: remove -march which was masking -mcpu, now SVC available (#253)
Fixed font for examples
Removed extraneous tag in DoxygenLayout.xml
More spacing on Doxygen version number, associated position change for seach boxes.
* Add documentation for gpio_irq_callback_t and rtc_callback_t (fixes#175)
* Hook up pico_binary_info and pico_bootsel_via_double_reset to the Doxygen index
* Add link to new Raspberry Pi Pico FAQ
* Consistently add parentheses for \sa or \see links to function-names
* Use consistent capitalisation for 'GitHub'
* Small typos and markup errors
* Board definition header files for the iniital set of SparkFun rp2040 boards
* Add default PICO_DEFAULT_I2C*, allow no PICO_DEFAULT_LED_PIN, no PICO_DEFAULT_UART* (instead of -1)
Fixup SparkFun headers
* Pimoroni board headers
* Add LED related board defines PICO_CONFIGs (to pico_stdlib for now)
* more board config changes
* add Adafruit feather, itsybitsy, qtpy board headers
* add PICO_DEFAULT_WS2812_POWER_PIN define
* MOSI/MISO -> TX/RX, some UART cleanup.. make vgaboard.h defines take preference over pico.h ones
* local change to tinyusb to cope with no default LED or UART
* fix review issues
Co-authored-by: Kirk Benell <github-stuff@accvec.com>
Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
Co-authored-by: hathach <thach@tinyusb.org>
- setting baud rate to magic value (default=1200) will cause a reset to BOOTSEL mode
- a VENDOR interface along side the CDC interface can be used to reset via refular flash boot, or into
BOOTSEL mode with control for the reset_usb_boot parameters for the latter
either method can be configured/enabled/disabled via #define
* remove broken and fairly pointless deep sleep API, use multicore_reset_core1 instead
* strict-prototype for multicore_fifo_drain() in host header
* Also for multicore_lockout_victim_init()
Co-authored-by: Luke Wren <wren6991@gmail.com>
* Move PICO_FLASH_SIZE_BYTES out of platform_defs.h since it precedes board config; also default to -1 for unknown
* make default for PICO_FLASH_SIZE_BYTES undefined - i.e. no value
* use valid_params_if macro for lock assertion
* fixup param checking in pwm.h
* Fix range of fractional divider parameter check in pwm.h
Co-authored-by: Luke Wren <wren6991@gmail.com>
* Add pico_bootsel_via_double_reset library, fix#87
* pico_bootsel_via_double_reset: remove unnecessary library guard, fix subdirectory ordering
* Fix C type used as PICO_CONFIG type
In C, func() is a function taking an unspecified number of arguments,
vs func(void) a function taking no arguments. In C++ both forms indicate
"no arguments."
Update these headers to use the (void) form, which is correct in both
languages and avoids complaints when -Wstrict-prototypes is specified.
Fixed font for examples
Removed extraneous tag in DoxygenLayout.xml
More spacing on Doxygen version number, associated position change for seach boxes.
* Add documentation for gpio_irq_callback_t and rtc_callback_t (fixes#175)
* Hook up pico_binary_info and pico_bootsel_via_double_reset to the Doxygen index
* Add link to new Raspberry Pi Pico FAQ
* Consistently add parentheses for \sa or \see links to function-names
* Use consistent capitalisation for 'GitHub'
* Small typos and markup errors
* Board definition header files for the iniital set of SparkFun rp2040 boards
* Add default PICO_DEFAULT_I2C*, allow no PICO_DEFAULT_LED_PIN, no PICO_DEFAULT_UART* (instead of -1)
Fixup SparkFun headers
* Pimoroni board headers
* Add LED related board defines PICO_CONFIGs (to pico_stdlib for now)
* more board config changes
* add Adafruit feather, itsybitsy, qtpy board headers
* add PICO_DEFAULT_WS2812_POWER_PIN define
* MOSI/MISO -> TX/RX, some UART cleanup.. make vgaboard.h defines take preference over pico.h ones
* local change to tinyusb to cope with no default LED or UART
* fix review issues
Co-authored-by: Kirk Benell <github-stuff@accvec.com>
Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
Co-authored-by: hathach <thach@tinyusb.org>
- setting baud rate to magic value (default=1200) will cause a reset to BOOTSEL mode
- a VENDOR interface along side the CDC interface can be used to reset via refular flash boot, or into
BOOTSEL mode with control for the reset_usb_boot parameters for the latter
either method can be configured/enabled/disabled via #define
* remove broken and fairly pointless deep sleep API, use multicore_reset_core1 instead
* strict-prototype for multicore_fifo_drain() in host header
* Also for multicore_lockout_victim_init()
Co-authored-by: Luke Wren <wren6991@gmail.com>
* Move PICO_FLASH_SIZE_BYTES out of platform_defs.h since it precedes board config; also default to -1 for unknown
* make default for PICO_FLASH_SIZE_BYTES undefined - i.e. no value
* use valid_params_if macro for lock assertion
* fixup param checking in pwm.h
* Fix range of fractional divider parameter check in pwm.h
Co-authored-by: Luke Wren <wren6991@gmail.com>
* Add pico_bootsel_via_double_reset library, fix#87
* pico_bootsel_via_double_reset: remove unnecessary library guard, fix subdirectory ordering
* Fix C type used as PICO_CONFIG type
In C, func() is a function taking an unspecified number of arguments,
vs func(void) a function taking no arguments. In C++ both forms indicate
"no arguments."
Update these headers to use the (void) form, which is correct in both
languages and avoids complaints when -Wstrict-prototypes is specified.
* Move vector table to beginning of flash image. Modify a boot2 to use the table.
* Move binary info header up between ELF entry and reset handler
* Extract common routines from boot2_w25q080 into helper files
* Non-default boot2s: use common routines, make callable as void(*)(void)
* BSD3 headers on boot2 files (people might want to use them elsewhere)
* Promote binary info header to its own section, + comment/readability changes
* Fix scope of asminclude path (fixes user custom boot2 definitions)
* Rename symbol, clarify comment
* fix #if in hardware/structs/dma.h
* move dma driver code from register definitions to dma drivers
Co-authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
* elf2uf2: add the cache memory range described in Section 2.8.4.2 of datasheet
* elf2uf2: update memory region nomenclature
* elf2uf2: update ROM size
* elf2uf2: use existing metadata to evaluate ram_style
Authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
* Move vector table to beginning of flash image. Modify a boot2 to use the table.
* Move binary info header up between ELF entry and reset handler
* Extract common routines from boot2_w25q080 into helper files
* Non-default boot2s: use common routines, make callable as void(*)(void)
* BSD3 headers on boot2 files (people might want to use them elsewhere)
* Promote binary info header to its own section, + comment/readability changes
* Fix scope of asminclude path (fixes user custom boot2 definitions)
* Rename symbol, clarify comment
* fix #if in hardware/structs/dma.h
* move dma driver code from register definitions to dma drivers
Co-authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
* elf2uf2: add the cache memory range described in Section 2.8.4.2 of datasheet
* elf2uf2: update memory region nomenclature
* elf2uf2: update ROM size
* elf2uf2: use existing metadata to evaluate ram_style
Authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
We use GitHub to host code, track [issues](https://github.com/raspberrypi/pico-sdk/issues) and feature requests, and to accept [pull requests](https://github.com/raspberrypi/pico-sdk/pulls). If you find think you have found a bug in the SDK please report it by [opening a new issue](https://github.com/raspberrypi/pico-sdk/issues/new). Please include as much detail as possible, and ideally some code to reproduce the problem.
## How to Contribute Code
In order to contribute new or updated code, you must first create a GitHub account and fork the original repository to your own account. You can make changes, save them in your repository, then [make a pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) against this repository. The pull request will appear [in the repository](https://github.com/raspberrypi/pico-sdk/pulls) where it can be assessed by the maintainers, and if appropriate, merged with the official repository.
**NOTE:** Development takes place on the `develop` branch in this repository. Please open your [pull request](https://github.com/raspberrypi/pico-sdk/pulls) (PR) against the [`develop`](https://github.com/raspberrypi/pico-sdk/tree/develop) branch, pull requests against the `master` branch will automatically CI fail checks and will not be accepted. You will be asked to rebase your PR against `develop` and if you do not do so, your PR will be closed.
While we are happy to take contributions, big or small, changes in the SDK may have knock-on effects in other places so it is possible that apparently benign pull requests that make seemingly small changes could be refused.
### Code Style
If you are contributing new or updated code please match the existing code style, particularly:
* Use 4 spaces for indentation rather than tabs.
* Braces are required for everything except single line `if` statements.
* Opening braces should not be placed on a new line.
### Licensing
Code in this repository is licensed under the [BSD-3 License](LICENSE.TXT). By contributing content to this repository you are agreeing to place your contributions under this license.
The Pico SDK provides the headers, libraries and build system
necessary to write programs for the RP2040 based devices such as the Raspberry Pi Pico
The Raspberry Pi Pico SDK (henceforth the SDK) provides the headers, libraries and build system
necessary to write programs for the RP-series microcontroller-based devices such as the Raspberry Pi Pico or Raspberry Pi Pico 2
in C, C++ or assembly language.
The Pico SDK is designed to provide an API and programming environment that is familiar both to non-embedded C developers and embedded C developers alike.
A single program runs on the device at a time and startrs with a conventional `main()` method. Standard C/C++ libraries are supported along with
C level libraries/APIs for accessing all of the RP2040's hardware include PIO (Programmable IO)
The SDK is designed to provide an API and programming environment that is familiar both to non-embedded C developers and embedded C developers alike.
A single program runs on the device at a time and starts with a conventional `main()` method. Standard C/C++ libraries are supported along with
C-level libraries/APIs for accessing all of the RP-series microcontroller's hardware including PIO (Programmable IO).
Additionally the Pico SDK provides higher level libraries for dealing with timers, synchronization, USB (TinyUSB) and multi-core programming
along with various utilities.
Additionally, the SDK provides higher level libraries for dealing with timers, synchronization, Wi-Fi and Bluetooth networking, USB and multicore programming. These libraries should be comprehensive enough that your application code rarely, if at all, needs to access hardware registers directly. However, if you do need or prefer to access the raw hardware registers, you will also find complete and fully-commented register definition headers in the SDK. There's no need to look up addresses in the datasheet.
The Pico SDK can be used to build anything from simple applications, fullfledged runtime environments such as MicroPython, to low level software
such as RP2040's on chip bootrom itself.
The SDK can be used to build anything from simple applications, fully-fledged runtime environments such as MicroPython, to low level software
such as the RP-series microcontroller's on-chip bootrom itself.
Additional libraries/APIs that are not yet ready for inclusion in the Pico SDK can be found in [pico-extras](https://github.com/raspberrypi/pico-extras).
The design goal for entire SDK is to be simple but powerful.
Additional libraries/APIs that are not yet ready for inclusion in the SDK can be found in [pico-extras](https://github.com/raspberrypi/pico-extras).
# Documentation
See [Getting Started with the Raspberry Pi Pico](https://rptl.io/pico-get-started) for information on how to setup your
hardware, IDE/environment and for how to build and debug software for the Raspberry Pi Pico
and other RP2040 based devices.
See [Getting Started with the Raspberry Pi Pico-Series](https://rptl.io/pico-get-started) for information on how to setup your
hardware, IDE/environment and how to build and debug software for the Raspberry Pi Pico and other RP-series microcontroller based devices.
See [Pico C/C++ SDK](https://rptl.io/pico-c-sdk) to learn more about programming using the
Pico SDK, exploring more advanced features, and complete PDF based API documentation.
See [Connecting to the Internet with Raspberry Pi Pico W](https://rptl.io/picow-connect) to learn more about writing
applications for your Raspberry Pi Pico W that connect to the internet.
See [Online Pico SDK API docs](https://rptl.io/pico-doxygen) for HTML based API documentation.
See [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk) to learn more about programming using the
SDK, to explore more advanced features, and for complete PDF-based API documentation.
See [Online Raspberry Pi Pico SDK API docs](https://rptl.io/pico-doxygen) for HTML-based API documentation.
# Example code
See [pico-examples](https://github.com/raspberrypi/pico-examples) for example code you can build.
# Getting the latest SDK code
The [master](https://github.com/raspberrypi/pico-sdk/tree/master/) branch of `pico-sdk` on GitHub contains the
_latest stable release_ of the SDK. If you need or want to test upcoming features, you can try the
These instructions are exteremly terse, and Linux based only. For detailed steps,
instructions for other platforms, and just in general, we recommend you see [Pico C/C++ SDK](https://rptl.io/pico-c-sdk)
## Using Visual Studio Code
1. Install CMake (at least version 3.12), and GCC cross compiler
```
sudo apt install cmake gcc-arm-none-eabi
```
1. Set up your project to point to use the Pico SDK
You can install the [Raspberry Pi Pico Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=raspberry-pi.raspberry-pi-pico) in VS Code.
* By cloning the Pico SDK locally (most common)
1. `git clone` this Pico SDK repository
## Unix command line
These instructions are extremely terse, and Linux-based only. For detailed steps,
instructions for other platforms, and just in general, we recommend you see [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk)
1. Install CMake (at least version 3.13), python 3, a native compiler, and a GCC cross compiler
# (note this can come from environment, CMake cache etc)
set(PICO_SDK_FETCH_FROM_GIT on)
@ -103,23 +118,32 @@ instructions for other platforms, and just in general, we recommend you see [Pic
project(my_project)
# initialize the Pico SDK
# initialize the Raspberry Pi Pico SDK
pico_sdk_init()
# rest of your project
```
3. Setup a CMake build directory.
For example, if not using an IDE:
```
$ mkdir build
$ cd build
$ cmake ..
```
* Or by cloning the SDK locally, but without copying `pico_sdk_import.cmake`:
1. `git clone` this Raspberry Pi Pico SDK repository
2. Setup a `CMakeLists.txt` like:
4. Write your code (see [pico-examples](https://github.com/raspberrypi/pico-examples) or the [Pico C/C++ SDK](https://rptl.io/pico-c-sdk) documentation
for more information)
```cmake
cmake_minimum_required(VERSION 3.13)
# initialize the SDK directly
include(/path/to/pico-sdk/pico_sdk_init.cmake)
project(my_project)
# initialize the Raspberry Pi Pico SDK
pico_sdk_init()
# rest of your project
```
1. Write your code (see [pico-examples](https://github.com/raspberrypi/pico-examples) or the [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk) documentation for more information)
About the simplest you can do is a single source file (e.g. hello_world.c)
@ -128,7 +152,7 @@ for more information)
#include "pico/stdlib.h"
int main() {
setup_default_uart();
stdio_init_all();
printf("Hello, world!\n");
return 0;
}
@ -148,13 +172,32 @@ for more information)
```
Note this example uses the default UART for _stdout_;
if you want ot use the default USB see the [hello-usb](https://github.com/raspberrypi/pico-examples/tree/master/hello_world/usb) example.
if you want to use the default USB see the [hello-usb](https://github.com/raspberrypi/pico-examples/tree/master/hello_world/usb) example.
1. Setup a CMake build directory.
For example, if not using an IDE:
```
$ mkdir build
$ cd build
$ cmake ..
```
5. Make your target from the build directory you created.
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=pico2 ..` or `cmake -DPICO_BOARD=pico_w ..` to configure the SDK and build options accordingly for that particular board.
Specifying `PICO_BOARD=<booardname>` 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 hardware functionality.
For a list of boards defined in the SDK itself, look in [this directory](src/boards/include/boards) which has a
header for each named board.
1. Make your target from the build directory you created.
```sh
$ make hello_world
```
6. 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.
1. 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-series device via drag and drop.
# RISC-V support on RP2350
See [Raspberry Pi Pico-series C/C++ SDK](https://rptl.io/pico-c-sdk) for information on setting up a build environment for RISC-V on RP2350.
# PICO_BAZEL_CONFIG: PICO_DEFAULT_BOOT_STAGE2_FILE, Boot stage 2 file to use; this should point to a filegroup with the .S file to use, type=string, group=build
# PICO_BAZEL_CONFIG: PICO_DEFAULT_BOOT_STAGE2, Simpler alternative to specifying PICO_DEFAULT_BOOT_STAGE2_FILE where the latter is set to src/rp2_common/boot_stage2/{PICO_DEFAULT_BOOT_STAGE2}.S, type=string, default=compile_time_choice, group=build
string_flag(
name = "PICO_DEFAULT_BOOT_STAGE2",
build_setting_default = "compile_time_choice",
)
# PICO_BAZEL_CONFIG: PICO_BOOT_STAGE2_LINK_IMAGE, [Bazel only] The final boot_stage2 image target to link in. Use this to fully override/replace boot_stage2, default=@pico-sdk//src/rp2_common:boot_stage2, group=build
# PICO_BAZEL_CONFIG: PICO_STDIO_USB, Option to globally enable stdio USB for all targets by default, type=bool, default=0, group=pico_stdlib
bool_flag(
name = "PICO_STDIO_USB",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_STDIO_SEMIHOSTING, Option to globally enable stdio semi-hosting for all targets by default, type=bool, default=0, group=pico_stdlib
bool_flag(
name = "PICO_STDIO_SEMIHOSTING",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_STDIO_RTT, Option to globally enable stdio RTT for all targets by default, type=bool, default=0, group=pico_stdlib
# PICO_BAZEL_CONFIG: PICO_DEFAULT_DOUBLE_IMPL, The default implementation for pico_double to link. auto selects an appropriate default for the current platform. rp2040 is only supported on the rp2040. dcp is only supported on rp2350, type=string, default=auto, group=build
string_flag(
name = "PICO_DEFAULT_DOUBLE_IMPL",
build_setting_default = "auto",
values = [
"auto",
"compiler",
"dcp",
"rp2040",
"none",
],
)
# PICO_BAZEL_CONFIG: PICO_DEFAULT_FLOAT_IMPL, The default implementation for pico_float to link. auto selects an appropriate default for the current platform. rp2040 is only supported on the rp2040. vfp and dcp are only supported on rp2350, type=string, default=auto, group=build
string_flag(
name = "PICO_DEFAULT_FLOAT_IMPL",
build_setting_default = "auto",
values = [
"auto",
"compiler",
"dcp",
"rp2040",
"vfp",
"none",
],
)
# PICO_BAZEL_CONFIG: PICO_DEFAULT_DIVIDER_IMPL, The default implementation for pico_divider to link. hardware uses accelerated divide instructions while compiler allows the compiler to decide how to handle divide instructions. auto uses the platform default (hardware on RP2040 and compiler on RP2350), type=string, default=auto, group=build
string_flag(
name = "PICO_DEFAULT_DIVIDER_IMPL",
build_setting_default = "auto",
values = [
"auto",
"hardware",
"compiler",
],
)
# PICO_BAZEL_CONFIG: PICO_DEFAULT_PRINTF_IMPL, The default implementation for pico_printf to link. compiler lets the compiler control printf behavior while pico provides a pico-specific implementation, type=string, default=double, group=build
string_flag(
name = "PICO_DEFAULT_PRINTF_IMPL",
build_setting_default = "pico",
values = [
"pico",
"compiler",
"none",
],
)
# PICO_BAZEL_CONFIG: PICO_ASYNC_CONTEXT_IMPL, The default implementation for pico_async_context to link, type=string, default=threadsafe_background, group=build
string_flag(
name = "PICO_ASYNC_CONTEXT_IMPL",
build_setting_default = "threadsafe_background",
values = [
"poll",
"threadsafe_background",
"freertos",
],
)
# PICO_BAZEL_CONFIG: PICO_BINARY_INFO_ENABLED, Whether to include binary info in final firmware, type=bool, default=1, group=pico_stdlib
bool_flag(
name = "PICO_BINARY_INFO_ENABLED",
build_setting_default = True,
)
# PICO_BAZEL_CONFIG: PICO_CMSIS_PATH, Label of a cc_ibrary providing CMSIS core, type=string, default="included stub CORE only impl", group=build
# PICO_BAZEL_CONFIG: PICO_USE_DEFAULT_MAX_PAGE_SIZE, Don't shrink linker max page to 4096, type=bool, default=0, advanced=true, group=pico_standard_link
bool_flag(
name = "PICO_USE_DEFAULT_MAX_PAGE_SIZE",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS, Maximum number of milliseconds to wait during initialization for a CDC connection from the host (negative means indefinite) during initialization, type=int, default=0, group=pico_stdio_usb
int_flag(
name = "PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS",
build_setting_default = 0,
)
# PICO_BAZEL_CONFIG: PICO_TINYUSB_LIB, [Bazel only] The library that provides TinyUSB, default=@tinyusb//:tinyusb, group=build
label_flag(
name = "PICO_TINYUSB_LIB",
build_setting_default = "@tinyusb//:tinyusb",
)
# TODO: Bazel build for mbedtls at @mbedtls//:mbedtls.
# PICO_BAZEL_CONFIG: PICO_MBEDTLS_LIB, [Bazel only] The library that provides mbedtls, default=@mbedtls//:mbedtls, group=build
# PICO_BAZEL_CONFIG: PICO_DEFAULT_BINARY_INFO, [Bazel only] The library that provides custom_pico_binary_info to link into all binaries, default=//src/rp2_common/pico_standard_binary_info:default_binary_info, group=pico_standard_link
# PICO_BAZEL_CONFIG: PICO_BAZEL_BUILD_TYPE, The type of build (e.g. Debug or Release) to embed in binary info, type=string, default=pico, group=build
string_flag(
name = "PICO_BAZEL_BUILD_TYPE",
build_setting_default = "Debug",
)
# PICO_BAZEL_CONFIG: PICO_DEFAULT_LINKER_SCRIPT, [Bazel only] The library that provides a linker script to link into all binaries, default=//src/rp2_common/pico_crt0:default_linker_script, group=pico_standard_link
# PICO_BAZEL_CONFIG: PICO_CONFIG_PLATFORM_HEADER, [Bazel only] The cc_library that provides "pico_config_platform_headers.h" and defines PICO_BOARD, default=//src/common/pico_base_headers:default_platform_headers, group=pico_base
label_flag(
name = "PICO_CONFIG_PLATFORM_HEADER",
build_setting_default = "//src/boards:default",
)
# PICO_BAZEL_CONFIG: PICO_CONFIG_HEADER, [Bazel only] The cc_library that defines PICO_CONFIG_HEADER or pico/config_autogen.h and other SDK critical defines (overrides PICO_BOARD setting), default=//bazel:generate_config_header, group=pico_base
# PICO_BAZEL_CONFIG: PICO_CLIB, [Bazel only] The flavor of libc porting layer to use. auto infers the correct value to use from PICO_TOOLCHAIN, group=pico_standard_link
string_flag(
name = "PICO_CLIB",
build_setting_default = "auto",
values = [
"auto",
"llvm_libc",
"newlib",
"picolibc",
],
)
# PICO_BAZEL_CONFIG: PICO_BTSTACK_CONFIG, [Bazel only] The cc_library that provides btstack_config.h, default=//bazel:empty_cc_lib, group=wireless
label_flag(
name = "PICO_BTSTACK_CONFIG",
build_setting_default = "//bazel:empty_cc_lib",
)
# PICO_BAZEL_CONFIG: PICO_BT_ENABLE_BLE, [Bazel only] Whether or not to link in BLE portions of the btstack as part of //src/rp2_common/pico_btstack. Also defines ENABLE_BLE=1, type=bool, default=False, group=wireless
bool_flag(
name = "PICO_BT_ENABLE_BLE",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_BT_ENABLE_CLASSIC, [Bazel only] Whether or not to link in classic BT portions of the btstack as part of //src/rp2_common/pico_btstack. Also defines ENABLE_CLASSIC=1, type=bool, default=False, group=wireless
bool_flag(
name = "PICO_BT_ENABLE_CLASSIC",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_BT_ENABLE_MESH, [Bazel only] Whether or not to link in mesh BT portions of the btstack as part of //src/rp2_common/pico_btstack. Also defines ENABLE_MESH=1, type=bool, default=False, group=wireless
bool_flag(
name = "PICO_BT_ENABLE_MESH",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_LWIP_CONFIG, [Bazel only] The cc_library that provides lwipopts.h, default=//bazel:empty_cc_lib, group=wireless
label_flag(
name = "PICO_LWIP_CONFIG",
build_setting_default = "//bazel:empty_cc_lib",
)
# PICO_BAZEL_CONFIG: PICO_FREERTOS_LIB, [Bazel only] The cc_library that provides FreeRTOS, default=//bazel:empty_cc_lib, group=wireless
message(STATUS"Defaulting build type to '${default_build_type}' since not specified.")
set(CMAKE_BUILD_TYPE"${default_build_type}"CACHESTRING"Choose the type of build, options are: 'Debug', 'Release', 'MinSizeRel', 'RelWithDebInfo'."FORCE)
@ -17,28 +18,59 @@ if (CMAKE_BUILD_TYPE STREQUAL "Default")
This page links to the various example code fragments in this documentation. For more complete examples, please see the pico_examples repository, which contains complete buildable projects.
This page links to the various example code fragments in this documentation. For more complete examples, please see the [pico-examples](https://github.com/raspberrypi/pico-examples) repository, which contains complete buildable projects.
The Pico SDK (Software Development Kit) provides the headers, libraries and build system necessary to write programs for the RP2040 based devices such as the Raspberry Pi Pico in C, C++ or assembly language. The Pico SDK is designed to provide an API and programming environment that is familiar both to non-embedded C developers and embedded C developers alike.
The Raspberry Pi Pico SDK (Software Development Kit), henceforth SDK, provides the headers, libraries and build system necessary to write programs for RP-series microcontroller devices such as the Raspberry Pi Pico in C, C++ or assembly language. The SDK is designed to provide an API (Application Programming Interface) and programming environment that is familiar both to non-embedded C developers and embedded C developers alike.
A single program runs on the device at a time with a conventional main() method. Standard C/C++ libraries are supported along with APIs for accessing the RP2040’s hardware, including DMA, IRQs, and the wide variety fixed function peripherals and PIO (Programmable IO).
A single program runs on the device at a time with a conventional `main()` method. Standard C/C++ libraries are supported along with APIs for accessing the microcontroller's hardware, including DMA, IRQs, and the wide variety of fixed-function peripherals and PIO (Programmable IO).
Additionally the Pico SDK provides higher level libraries for dealing with timers, USB, synchronization and multi-core programming, along with additional high level functionality built using PIO such as audio. The Pico SDK can be used to build anything from simple applications, full fledged runtime environments such as MicroPython, to low level software such as the RP2040’s on chip bootrom itself.
Additionally the SDK provides higher-level libraries for dealing with timers, USB, synchronization and multi-core programming, along with additional high-level functionality built using PIO, such as audio. The SDK can be used to build anything from simple applications, or full-fledged runtime environments such as MicroPython, to low-level software such as the microcontroller's on-chip bootrom itself.
This documentation is generated from the Pico SDK source tree using Doxygen. It provides basic information on the APIs used for each library, but does not provide usage information. Please refer to the Databooks for usage and more technical information.
This documentation is generated from the SDK source tree using Doxygen. It provides basic information on the APIs used for each library, but does not provide usage information. Please refer to the Databooks for usage and more technical information.
## SDK Design
The RP2040 is a powerful chip, however it is an embedded environment, so both RAM, and program space are at premium. Additionally the trade offs between performance and other factors (e.g. edge case error handling, runtime vs compile time configuration) are necessarily much more visible to the developer than they might be on other higherlevel platforms.
The RP-series microcontroller range are powerful chips, however they are used in an embedded environment, so both RAM and program space are at premium. Additionally the trade-offs between performance and other factors (e.g. edge-case error handling, runtime vs compile-time configuration) are necessarily much more visible to the developer than they might be on other higher-level platforms.
The intention within the SDK has been for features to just work out of the box, with sensible defaults, but also to give the developer as much control and power as possible (if they want it) to finetune every aspect of the application they are building and the libraries used.
The intention within the SDK has been for features to just work out of the box, with sensible defaults, but also to give the developer as much control and power as possible (if they want it) to fine-tune every aspect of the application they are building and the libraries used.
## The build system
## The Build System
The Pico SDK uses CMake to manage the build. CMake is widely supported by IDEs (Integrated Development Environments), and allows a simple specification of the build (via CMakeLists.txt files), from which CMake can generate a build system (for use by `make`, `ninja` or other build tools) customized for the platform and by any configuration variables the developer chooses for a list of configuration variables).
The SDK uses CMake to manage the build. CMake is widely supported by IDEs (Integrated Development Environments), and allows a simple specification of the build (via `CMakeLists.txt` files), from which CMake can generate a build system (for use by `make`, `ninja` or other build tools) customized for the platform and by any configuration variables the developer chooses.
Apart from being a widelyused build system for C/C++ development, CMake is fundamental to the way the Pico SDK is structured, and how applications are configured and built.
Apart from being a widely-used build system for C/C++ development, CMake is fundamental to the way the SDK is structured, and how applications are configured and built.
The Pico SDK builds an executable which is bare metal, i.e. it includes the entirety of the code needed to run on the device (other than floating point and other optimized code contained in the bootrom within the RP2040).
The SDK builds an executable which is bare-metal, i.e. it includes the entirety of the code needed to run on the device (other than device specific floating-point and other optimized code contained in the bootrom within the microcontroller).
## Examples
This SDK contains a number of example code fragments. An index of these examples can be found [here](@ref examples_page)
- [Raspberry Pi Pico2 Datasheet](https://rptl.io/pico-datasheet)
- [Raspberry Pi Pico W Datasheet](https://rptl.io/picow-datasheet)
- [Hardware design with RP2040](https://rptl.io/rp2040-design)
- [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk)
- [Raspberry Pi Pico Python SDK](https://rptl.io/pico-micropython)
- [Getting started with Raspberry Pi Pico](https://rptl.io/pico-get-started)
- [Connecting to the Internet with Raspberry Pi Pico W](https://rptl.io/picow-connect)
### Weblinks
At Raspberry Pi we have a very community based attitude to help. We run a very popular and busy forum where you can ask questions about any aspect of the Raspberry Pi ecosystem, including the Raspberry Pi Pico.
At Raspberry Pi we have a very community-based attitude to help. We run a very popular and busy forum where you can ask questions about any aspect of the Raspberry Pi ecosystem, including the Raspberry Pi Pico.
You can find our forums at the [following link](https://www.raspberrypi.org/forums).
You can find our forums at the [following link](https://forums.raspberrypi.com/).
For the main Raspberry Pi website, [see here](https://www.raspberrypi.org)
For the main Raspberry Pi website, [see here](https://www.raspberrypi.com)
For the Raspberry Pi Pico page, [see here](https://rptl.io/rp2040-get-started)
### Github
### GitHub
All the source code for the Pico SDK, examples and other libraries can be found on Github.
All the source code for the Raspberry Pi Pico SDK, examples and other libraries can be found on GitHub.