Compare commits

...

983 commits

Author SHA1 Message Date
graham sanderson
95ea6acad1 SDK 2.1.0 release 2024-11-24 23:44:29 -06:00
graham sanderson
beb2449622 Update picotool dependency to 2.1.0 (not strictly required, but we prefer people to be on the latest) 2024-11-24 23:43:46 -06:00
graham sanderson
2a1e1af6af Add missing CYW43_DEFAULT_PIN_WL_CS to pimoroni_pico_plus2_w_rp2350.h 2024-11-24 20:33:51 -06:00
Gonzalo Larralde
b7e255d18d
Add board file for Pimoroni Pico Plus 2 W (#2092)
* Add board pimoroni_pico_plus2_w_rp2350.
2024-11-24 20:04:39 -06:00
yh-sb
58e253ce04
Fix implicit declaration warning (#2093)
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'
2024-11-24 19:44:36 -06:00
Graham Sanderson
5f607a9829
Comment out CMake cyw43 vars which aren't really that useful in general i don't think (#2090) 2024-11-24 11:27:10 -06:00
Graham Sanderson
a6ae2e6e4a
Fix compilation warnings (#2089) 2024-11-23 13:41:51 -06:00
yh-sb
3c39eecea3
Fix CMake build. (#2088)
hardware_watchdog depends from pico_bootrom due to header pico/bootrom.h

BUILD.bazel also has this dependency.
2024-11-23 13:02:57 -06:00
Luke Wren
65d118c342
RISC-V __mulsf3: handle exponent increase due to rounding (#2086) 2024-11-23 13:02:03 -06:00
Graham Sanderson
39a7f97116
Cleanup/clarification of PIO behavior with >32 pins (#2085) 2024-11-22 13:13:15 -06:00
Graham Sanderson
3dce58f21b
support both struct timespec and struct tm variants of the aon timer APIs (#2079)
* 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
2024-11-22 12:11:02 -06:00
will-v-pi
2692d9a4cb
Propogate changed pico_cmake_set_default values to the compilation (#2034)
* 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
2024-11-21 17:47:51 -06:00
armandomontanez
338f99ff1c
Initial Pico/2 W Bazel support (#2049)
* 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
2024-11-21 16:58:02 -06:00
Graham Sanderson
08ea1d89a9
prevent self-deadlock with PICOLIBC due to calloc/realloc internally calling malloc/free (#2069) 2024-11-21 16:53:24 -06:00
Luke Wren
7b07b0b6a1
Save/restore QMI window 1 registers across calls to flash_exit_xip(). (#2082)
* 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.
2024-11-21 16:52:34 -06:00
Graham Sanderson
9762b00c13
disable all IRQs in dma_chanel_cleanup - fixes for RP2350 (#2060) 2024-11-21 16:52:04 -06:00
Graham Sanderson
6bb44dd07d
Make all float->int/frac conversions round to nearest by default (#2065)
* 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>
2024-11-21 16:48:33 -06:00
Graham Sanderson
5a98889434
add rom_reset_usb_boot_extra which supports >32 pins and ACTIVE_LOW; change existing uses to use this (#2084) 2024-11-21 16:48:05 -06:00
Graham Sanderson
6bb3ccf822
some minor pioasm fixes for #1950 (#2056) 2024-11-21 11:56:22 -06:00
Jack Wilsdon
8970241772
Fix flash_safe_execute timeout under FreeRTOS (#2021)
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.
2024-11-21 11:24:17 -06:00
Luke Wren
36fefb5f30
Implement pico_bootsel_via_double_reset with the POWMAN DOUBLE_TAP flag on RP2350. (#2083)
The existing RAM implementation does not work because asserting the RUN pin holds SRAM in power-down.
2024-11-21 10:31:33 -06:00
Graham Sanderson
90bfb532a7
provide slightly meaningless _start symbol for boot_stage2 to make LLVM lld happy (#2080) 2024-11-21 10:10:12 -06:00
Graham Sanderson
31c1be5d5c
make panic loop back to breakpoint FWIW, and remove spurious header (#2062) 2024-11-21 10:00:38 -06:00
Andrew Scheller
f3459a45d4
Update documented max PIN values, to accomodate RP2350B (#2072) 2024-11-20 20:28:54 -06:00
Andrew Scheller
e17a82d291
Change __always_inline to __force_inline to suppress GCC errors (#2078) 2024-11-20 18:06:50 -06:00
newbrain
105a2b89d5
Update pwm.h (#2077)
NUM_DMA_IRQS was used instead of NUM_PWM_IRQS
2024-11-20 18:05:50 -06:00
will-v-pi
6bf5d9bf7d
Enforce ordering of pico_add_extra_outputs and picotool functions (#2054)
* 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
2024-11-20 16:43:05 -06:00
Graham Sanderson
9a2b75e26e
prevent early macro expansion in PICOBIN_..._AS_BITS() macros (#2068) 2024-11-20 16:42:19 -06:00
will-v-pi
74db3c2d86
Update work area size from 3064 to 3264, and recommend 3.25K (#2073) 2024-11-20 16:41:48 -06:00
Andrew Scheller
d3080e777f
Slight tweak to the config-extraction scripts. (#2070)
* 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
2024-11-20 16:41:28 -06:00
Peter Harper
54d4f3a8f7
Add some missing pio functions (#2074)
Adds some 64 versions to work with rp2350b and more than 32 pins.
Change cyw43 code to use the new function.

Fixes #1834
2024-11-20 16:38:05 -06:00
Graham Sanderson
46283dd00f
github action upgrades (#2075)
* Windows workflow: bump cmake version

* Actions: update all workflows to checkout@v4
2024-11-20 11:02:03 -06:00
Graham Sanderson
06a244b2b5
fix incorrect disassembly of MOV rx_fifo (#2067) 2024-11-20 10:57:22 -06:00
Graham Sanderson
c2118cc005
allow PICO_CORE1_STACK_SIZE=0 (#2058) 2024-11-20 10:56:25 -06:00
Graham Sanderson
08bf6a7faa
use configured uart_instance rather than default instance for flushing stdio uart (#2066) 2024-11-20 10:45:20 -06:00
Andrew Scheller
2a4dbd9b7c
Small comment typo (#2064) 2024-11-20 10:44:50 -06:00
Andrew Scheller
c4b55f6346
Fix the name of a PICO_CMAKE_CONFIG (#2061)
Looks like this change accidentally got omitted from #1926
2024-11-19 19:12:48 -06:00
Graham Sanderson
e99c43b670
fix method name spelling (#2057) 2024-11-19 16:14:56 -06:00
Peter Harper
482dd59b5e
Abilty to limit iterations in hci processing loop (#1998)
Fixes #1455
2024-11-19 14:11:47 -06:00
Andrew Scheller
b122c42989
More CYW43 config tweaks (#2033)
- 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
2024-11-19 14:10:40 -06:00
Liam Fraser
363302f780
Move to TinyUSB release 0.17.0 (#2053) 2024-11-19 14:08:44 -06:00
Liam Fraser
35fcc34747
Clocks doxygen: Remove incorrect clk_ref auxsrc value LPOSC. LPOSC is a primary source of clk_ref. Fixes issue #2047 (#2052) 2024-11-19 14:03:13 -06:00
Earle F. Philhower, III
5f6c432806
Fix minor uninitialized warnings from G++ 12.3.0 (#1786)
Use empty initializer list for struct clearing, avoiding a pedantic
warning from G++ 12 and 14.

Fixes #1785
2024-11-19 13:42:46 -06:00
armandomontanez
89691ed879
Do not assume submodule root directory in presubmit (#2040)
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.
2024-11-18 17:33:00 -06:00
armandomontanez
11e7801ba4
Remove repeated source file from pico_btstack (#2042)
Removes a duplicate reference to btstack's src/mesh/mesh.c file in the
CMake build.
2024-11-18 17:32:29 -06:00
graham sanderson
37e42578b0 bump macOS build action to macos-latest from deprecated macos-12 2024-11-18 17:32:00 -06:00
Peter Harper
8d1378dcd2
Remove Segger RTT from pico-btstack (#1995)
* 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
2024-11-18 17:29:34 -06:00
Dryw Wade
fe018f92ab
Add SparkFun ThingPlus RP2350 (#2038)
* Add SparkFun Thing Plus RP2350

* Add pico_cmake_set_default to Thing Plus RP2350
2024-11-18 17:25:16 -06:00
Philip Howard
7ceca315f1
PPP2 and Plasma2350: SPICE to SPCE. (#2048)
As per discussion on https://github.com/adafruit/circuitpython/pull/9803

Change "SPICE" to "SPCE" for consistency.

Signed-off-by: Phil Howard <github@gadgetoid.com>
2024-11-18 17:25:01 -06:00
Gregory Neverov
d6e3fa06f1
Fixes to picolibc_interface (#1795)
* 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.
2024-11-18 17:24:37 -06:00
Andrew Scheller
d0db3780fd
Fix typo in rom_get_partition_table_info doxygen (#2041) 2024-11-18 17:13:21 -06:00
Earle F. Philhower, III
0f847db371
Remove ARM assembly from RISC-V CYW43 SPI PIO (#2045)
Add hand-coded assembly RISC-V version of swap16x2 for CYW32 SPI PIO
driver.

Fixes #2044
2024-11-18 17:11:39 -06:00
armandomontanez
1b64cac8d6
Extend build system checks (#2039)
* 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.
2024-11-13 14:11:49 -06:00
Graham Sanderson
06b7c1cf9e
Change div_int_frac methods to be suffixed by the number of bits of fraction e.g. div_int_frac8 (#1926) 2024-11-12 11:18:42 -06:00
Luke Wren
f9eb48bd91
Add XIP cache maintenance API (fixes #2005) (#2013)
* 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>
2024-11-11 12:09:30 -06:00
Graham Sanderson
09a9379ea9
Add explicit alignment for embedded_end_block (#2017) 2024-11-11 11:13:12 -06:00
Machdyne UG
c7e562604e
add support for machdyne werkzeug rp2040 board (#2023)
* 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>
2024-11-11 10:44:55 -06:00
Peter Harper
68778b1135
Clear i2c abort reason less often. (#2026)
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
2024-11-11 10:09:08 -06:00
Peter Harper
4726a56d24
Update cyw43-driver to latest main. (#2032) 2024-11-11 10:07:29 -06:00
Andrew Scheller
f642b763be
Move CYW43-related PICO_CONFIG lines to cyw43_driver.h (#2002) 2024-11-08 19:04:53 -06:00
Graham Sanderson
5c6fece28a
Minor header cleanups and ASM compatibility (#2019) 2024-11-08 19:04:02 -06:00
Peter Harper
750bfaeed3
Mesh support (#2001)
* 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>
2024-11-08 19:03:21 -06:00
Peter Harper
4196f2c17e
Avoid hang in stdio_set_chars_available_callback (#2020)
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
2024-11-08 18:34:30 -06:00
Tobias Simetsreiter
1aa049f14b
update glibc header sys/cdefs.h include guard (#2029) 2024-11-08 18:33:11 -06:00
will-v-pi
2331e6f203
Fix dependency on files used by picotool (#2027)
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.
2024-11-08 18:27:30 -06:00
Peter Harper
809a423fb0
Fix some header dependencies (#2031)
Fixes #1929
2024-11-08 18:09:13 -06:00
andygpz11
6587f5cc9a
Add the required SYS_CLK_HZ definition to the suggested cmake output (#2022)
Fixes #2014
2024-11-06 10:24:10 -06:00
Earle F. Philhower, III
11961b97e4
Very minor typos in contributing.md (#1939) 2024-11-05 14:07:38 -06:00
Earle F. Philhower, III
ca0c0db979
Fix GCC14.1 compile error in w25x10cls.S (#2000)
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
2024-11-05 14:06:04 -06:00
armandomontanez
e48a2e158c
[Bazel] Update rules_cc to v0.0.10 (#1989)
Updates rules_cc to v0.0.10 to reduce the steps required to get started
with creating a Bazel-based Pi Pico project.
2024-11-05 14:05:44 -06:00
Peter Harper
d649c6c77a
Add some tests (#1978)
* Test for best_effort_wfe_or_timeout sev issue

best_effort_wfe_or_timeout should not ignore an outstanding sev
See https://github.com/raspberrypi/pico-sdk/issues/1812

* Test for alarm being set in the past issue

See https://github.com/raspberrypi/pico-sdk/issues/1953
2024-11-05 17:27:19 +00:00
Graham Sanderson
bd130eddff
Remove code bloat in public SDK for 64K roms (#2016) 2024-11-05 10:57:22 -06:00
Graham Sanderson
8905de509f
Add missing instruction to vestigial copro_dis.py (#2018) 2024-11-05 10:54:26 -06:00
Graham Sanderson
37c6b24b1b
Add missing instruction to vestigial copro_dis.py (#2018) 2024-11-05 10:53:19 -06:00
Philip Howard
50322234b7
boards/pimoroni_plasma2350.h: correct flash size. (#2015)
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>
2024-11-04 13:12:11 -06:00
Hugh Nixon
98c114a8ee
Updated hardware/pio.h to correct the comment for the third (PIO 2) hardware PIO instance (#2004) 2024-11-04 13:11:46 -06:00
Dave Roth
37085889b0
Add RP2350 specific values to the exception_number enum (#1988) 2024-10-17 13:56:35 -05:00
Peter Harper
91dfbd01e8
Fix issue with free rtos execute sync (#1979)
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
2024-10-17 13:55:20 -05:00
Peter Harper
66c7f0f607
Move cyw32 pin definitions (#1982)
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
2024-10-17 13:53:49 -05:00
armandomontanez
07d6dc1315
[Bazel] Fix bazel build, add presubmit (#1973)
* [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.
2024-10-12 17:41:43 -05:00
Petr Hosek
03a82f3d2f
Update Clang toolchain used by Bazel (#1976)
LLVM-libc baremetal build now includes `mktime` so we no longer need to
provide our own declaration in the polyfill header.
2024-10-12 11:24:18 -05:00
chrisboross
fa91723371
Update hellbender_0001.h (#1967)
Updating flash sizes to match BOM
2024-10-01 18:46:39 -05:00
Graham Sanderson
c675dfeaa5
fix mis-spelling of PICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCK (#1966) 2024-10-01 09:48:23 -05:00
Caleb Jamison
761bb1dba0
hellbender_0001 board file (#1957)
* hellbender_0001 board file

* Fix FTRX_RX_PIN, Fix define names to match filename
2024-09-30 16:17:45 -05:00
Graham Sanderson
bd5523cc64
Improve best_effort_wfe_or_timeout (#1822)
* #1812 improvements to best_effort_wfe_or_timeout

* Fix best_effort_wfe_or_timeout further by not having the IRQ ever move the alarm target backwards
2024-09-30 09:43:55 -05:00
Dhiru Kholia
cf8301f3e6
Doc fix for aon_timer on RP2350 (#1960) 2024-09-30 09:39:58 -05:00
Graham Sanderson
e2e0fd51c3
remove support for A0 & A1 versions of RP2350 (#1958) 2024-09-30 09:39:36 -05:00
Giampiero Baggiani
075e829cd9
Update i2c_slave.c: clock stretching comment fix (#1811)
* Update i2c_slave.c: clock stretching comment fix

This changed since 89914870ae06b2418c8ecc7e21af00d2dd77f8cb

* Update i2c_slave.c
2024-09-27 23:54:47 -05:00
Matt Bennett
ff373b33dc
Fixes #1891 Update pico_configure_ip4_address comments (#1892)
* 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.
2024-09-27 23:54:12 -05:00
Andrew Scheller
78533ec119
Specify minimum cmake version for generic_board.cmake (#1879) 2024-09-27 23:53:44 -05:00
Stanislav Rubint
20cf7119f4
removed dangling #ifdef __cplusplus (#1941) 2024-09-27 23:52:39 -05:00
Peter Harper
66335f1dc7
Clarify that RP2350 gets its unique id from OTP (#1942)
* Clarify that RP2350 gets its unique id from OTP

Fixes #1915

* Wrap rp2040_specific and rp2350_specific bits
2024-09-27 23:51:39 -05:00
Dave Roth
8c08f2b8ff
Export linker scripts in the bazel build. (#1944)
* 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.
2024-09-27 23:50:22 -05:00
Andrew Featherstone
0e5ef0f40f
Fix hardware_alarm_irq_handler when using Timer 1 (#1949)
Correct the logic for determining `timer_num`. Previously this would
always evaluate to 0 due to using `alarm_num` instead of `irq_num`.

Fixes #1948.
2024-09-27 23:49:22 -05:00
Andrew Scheller
a0f828fb16
Fix doxygen typo (#1945) 2024-09-27 23:48:58 -05:00
Peter Harper
9f56a47dca
Avoid setting an alarm in the past (#1954)
* Avoid setting an alarm in the past

Fixes #1953

* Call ta_time_us_64 when needed

Remove local "now" variable.
2024-09-26 10:56:05 -05:00
graham sanderson
d08f36cd1c fix assertion failure in rp2350_chip_version 2024-09-20 12:18:18 -05:00
David Goffredo
780817a8c7
Fix comments next to enum gpio_irq_level values. (#1928)
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.
2024-09-18 14:17:18 -05:00
Peter Harper
af2f42613e
Changes for pico2_w (#1816)
* 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
2024-09-18 14:16:41 -05:00
Graham Sanderson
6500c59d70
Add busy_wait_at_leasy_cycles to host (#1925) 2024-09-11 18:33:33 -05:00
Mete Balcı
42e234f8f3
#1909 fix system_RP2350 typos (#1910) 2024-09-11 10:48:35 -05:00
Thomas Watson
0ed2840306
boot_stage2: improve reproducibility (#1907)
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.
2024-09-11 10:43:32 -05:00
seesturm
ec0037b508
Enable building with Bazel on Raspberry PI OS machines (#1921)
* Adding RaspberryPI OS as build host

* Add rp2350 for build on Raspberry PI OS
2024-09-11 10:34:44 -05:00
CMD
f12ac1c2c1
RISC-V inline assembly constraints fix - platform.h (#1923)
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.
2024-09-11 10:08:15 -05:00
armandomontanez
0f38151002
[Bazel] Update version string to 2.0.1-develop (#1885)
Updates the Bazel module version string to match the current CMake
version string for the develop branch.
2024-09-10 18:49:04 -05:00
Graham Sanderson
398ac2baf9
Some small fixes/improvements for pico_minimize_runtime (#1919)
* 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
2024-09-10 18:45:25 -05:00
armandomontanez
b49d4ec949
Fix Bazel build breakages (#1908)
* 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
2024-09-10 18:44:55 -05:00
Koji KITAYAMA
3a79149d2c
Fix a compile error by using clang-x86_64-pc-windows-msvc (#1890) 2024-09-05 11:37:39 -05:00
will-v-pi
dfb573818f
Use lib instead of CMAKE_INSTALL_LIBDIR for pioasm install (#1865) 2024-09-03 16:26:43 -05:00
Dranoel
f13306c8a7
Fix typo in documentation of PICO_RAND_ENTROPY_SRC_TRNG (#1794) 2024-09-03 16:21:33 -05:00
graham sanderson
b3cadb7de2 fix RISC-V build 2024-09-01 09:45:02 -05:00
Sylwester
d957c738db
Add RP2350 PicoADK variant (#1787) 2024-09-01 09:33:41 -05:00
Andrew Scheller
b98970f71e
PIO doxygen typo (#1894) 2024-09-01 09:31:41 -05:00
Nhan Cao
3bc866395c
Adding I2C Burst Reading/Writing feature (#1495)
* 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>
2024-08-30 12:55:25 -05:00
Stefan Kerkmann
3cb21c8134
pico_bootrom: bootrom.h: fix -Wstrict-prototypes (#1888)
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>
2024-08-30 11:45:58 -05:00
Luke Wren
d886df6eb0
Add fast single-precision add/sub/mul for Hazard3 (#1883)
* 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.
2024-08-30 11:36:30 -05:00
Graham Sanderson
876f331033
bump picotool to the develop branch (#1886) 2024-08-29 19:14:50 -05:00
Graham Sanderson
ff5401f3b2
separate actual shared bootrom header into boot_bootrom_headers, as pico_bootrom which is focused on calling the bootrom now has non trivial dependencies like pico_flash (#1881) 2024-08-29 19:07:23 -05:00
Graham Sanderson
91864a0d6e
fix bug in sm_config_set_in_pin_count (#1880)
* fix bug in sm_config_set_in_pin_count

* comment updates
2024-08-29 11:17:06 -05:00
graham sanderson
2d60604b6e Revert "bootrom build includes pico_bootrom but not bootrom.h which is the only thing which requires pico_flash... slightly hacky fix to not include pico_flash if not available"
This reverts commit 4bbf701b4b.
2024-08-28 18:51:10 -05:00
graham sanderson
4bbf701b4b bootrom build includes pico_bootrom but not bootrom.h which is the only thing which requires pico_flash... slightly hacky fix to not include pico_flash if not available 2024-08-28 12:40:14 -05:00
will-v-pi
a2a4c2041e
Don't run coprodis on Risc-V or RP2040 binaries (#1875) 2024-08-27 11:22:15 -05:00
Graham Sanderson
dd4aacbd1c
fix linker script bug using ALL of RAM (#1872) 2024-08-27 11:13:28 -05:00
Andrew Scheller
d639292fea
Update extract configs (#1845)
* 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 ..."
2024-08-27 11:11:42 -05:00
Andrew Scheller
a700b7784b
Small pico_pre_load_platform.cmake tweak (#1867)
Make one of the messages more accurate, in the event that the user changes `PICO_DEFAULT_RP2350_PLATFORM`
2024-08-24 15:03:54 -05:00
will-v-pi
a46addba7b
Fix stdio_usb with reset interface disabled on Windows (#1857)
* Only use bcdUSB = 0x0200 with MS_OS_20 descriptor enabled

* Add comment
2024-08-24 14:54:44 -05:00
will-v-pi
bc598fff27
Fix #1861 - MAX_EXCEPTION_NUM is the highest number, so check should be > not >= (#1866) 2024-08-24 14:54:06 -05:00
Andrew Scheller
7d5d9276a8
Workaround gcc/newlib issue on Ubuntu 24 (#1863) 2024-08-23 10:59:36 -05:00
Peter Harper
aa8cf17732
Fix assert in gpio_set_irq_enabled (#1864)
* Fix assert in gpio_set_irq_enabled
2024-08-23 10:58:38 -05:00
Taylor Cramer
7dc10d7aad
Bazel: disable link_extra_lib when building bootloader (#1854)
Fixes #1853
2024-08-22 11:56:51 -05:00
will-v-pi
9b16c797b4
Reorder pins in bi_pins_with_names to work with mask (#1858) 2024-08-22 11:56:16 -05:00
will-v-pi
598ba01ec8
Add build-essential to README command line install (#1859)
* Add build-essential to README command line install

* Update README.md
2024-08-22 11:43:52 -05:00
J
4cb5c1ccf1
bazel build: Fix compilation bugs for Pico-W support (#1797)
* 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
2024-08-22 11:30:26 -05:00
will-v-pi
4a272778cd
Disable interrupts while doing flash_op, explicit_buy, and chain_image (#1835)
* Disable interrupts for some rom functions

* Use flash_safe_execute

* Inline and rename helpers
2024-08-22 11:29:35 -05:00
Graham Sanderson
eba6adb4e1
#1851 fix signature of hardware_alarm_get_irq_num (#1852) 2024-08-20 13:26:08 -05:00
Scott Shawcroft
19d5f4c0d7
Add board definition for Adafruit Feather 2350 (#1784) 2024-08-20 13:12:17 -05:00
David Goffredo
eaaa4a5ab3
typo in documentation of __time_critical_func (#1792)
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`.
2024-08-20 13:03:46 -05:00
Ikko Eltociear Ashimine
fa88c125b8
Update aon_timer.h (#1809)
specifed -> specified
2024-08-20 12:48:45 -05:00
Andrew Scheller
9a41722dd3
More board header checks (#1814)
* 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
2024-08-20 12:47:20 -05:00
Andrew Scheller
1bdd006c8d
Small doxygen fixes (#1828) 2024-08-20 12:41:49 -05:00
will-v-pi
7be79e8abe
Fix picobin inclusion from assembler with NO_PICO_PLATFORM (#1832)
Needs to copy the _u(x) definition from platform_defs.h
2024-08-20 12:40:52 -05:00
Nikhil Dabas
789ea75c63
Ensure makefsdata.py generates valid variable names (#1841)
* Ensure makefsdata.py generates valid variable names

* Use mimetypes library in makefsdata.py

* Avoid generating duplicate variable names
2024-08-20 12:31:45 -05:00
graham sanderson
e930bf3261 Deprecate copro_dis.py - keep for now as it is used by bootrom build 2024-08-20 09:48:50 -05:00
graham sanderson
9430469e18 Revert "Delete tools/copro_dis.py (#1833)"
This reverts commit b271208071.
2024-08-20 09:48:50 -05:00
Graham Sanderson
fab47c8071
Fix Cmsis irq regression (#1821)
* #1817 fix regression with CMSIS interrupt renaming
2024-08-20 08:52:41 -05:00
will-v-pi
8886f272a9
Fix Windows CI build (#1846)
* Use powershell for windows CI build

* Remove unnecessary warning
2024-08-19 12:49:54 -05:00
Graham Sanderson
cd71c8953e
Fix missing Binary Info for boot_stage2 (#1844)
* fix boot stage2 not showing up in binary info; sync rp2040 and rp230 bs2 CMakeLists.txt
2024-08-19 12:47:29 -05:00
Graham Sanderson
62df126ad5
#1805 fix merge issue in pico_atomic which ended up with using IRQ disble instead of spin lock (#1838) 2024-08-19 12:13:51 -05:00
Andrew Scheller
b271208071
Delete tools/copro_dis.py (#1833)
This functionality has been moved into `picotool`, so remove this Python script to avoid confusion
2024-08-16 12:21:27 -05:00
graham sanderson
7a0f1f03dd #1829 .HEX files missing since SDK2.0.0 2024-08-15 14:15:29 -05:00
will-v-pi
a6f21b6e10
Include Platform Paths files for the host (#1826)
This fixes searching for installed picotool/pioasm on Windows, and generally improves default find_package behaviour
2024-08-15 11:29:22 -05:00
Peter Harper
e049f5063f
Support serial flash with 16 byte unique id (#1819)
* 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
2024-08-15 11:23:15 -05:00
J
a2642f93a4
.gitignore: Add .cache (#1825)
This is where clangd puts a bunch of junk,
so it's nice to have it ignored for folks who
use clangd.
2024-08-15 11:04:08 -05:00
graham sanderson
424e21ec07 #1788 fix missing static_assert message 2024-08-14 17:57:36 -05:00
graham sanderson
8177366292 bump version for sdk 2.0.1-develop 2024-08-14 16:12:37 -05:00
Andrew Scheller
f4a691a2c7
Update doxygen group for clock functions (#1808)
Fixes #1806
2024-08-12 16:01:07 -07:00
graham sanderson
efe2103f9b SDK 2.0.0 release 2024-08-08 08:54:38 -05:00
Andrew Scheller
45984e276f
Small tweak to extract_configs.py (#1776)
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
2024-07-25 15:13:00 -05:00
andygpz11
b3bf690d0a
Clarify uart_write_blocking() API vs UART still busy sending (#1274) (#1709) 2024-07-25 11:12:21 -05:00
Andrew Scheller
9f85f25640
Add extra checks to check_board_header.py (#1775)
* 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)
2024-07-25 09:47:26 -05:00
WallyWare
6624098756
Add board file for Pi-Plates MICROPi (#1487) 2024-07-24 07:21:54 -05:00
graham sanderson
41b4d3adb4 rename gpio_set_function_mask to gpio_set_function_masked to match naming schema of other gpio functions 2024-07-24 07:00:37 -05:00
George Peppard
7c5b426a0f
Add gpio_set_function_mask function (#1462) 2024-07-24 06:47:59 -05:00
Gigahawk
af9b47c668
Add board definition for Adafruit Feather RP2040 with USB Type A Host (#1761) 2024-07-24 06:29:53 -05:00
Chris Burton
b45632b06e
Add 8086 USB Interposer board (#1767) 2024-07-24 06:27:38 -05:00
Peter Harper
5ec40711f4
Some doc issues (#1772)
* Fix doxygen for uart example

Fixes https://github.com/raspberrypi/pico-sdk/issues/1685

* Clarify uart write

will block until data "has been sent to the UART transmit buffer"

Fixes https://github.com/raspberrypi/pico-sdk/issues/1481

* Add note to flash API about erasing sectors

Fixes: https://github.com/raspberrypi/pico-sdk/issues/650
2024-07-23 13:00:41 -05:00
Peter Harper
6328fffc71
Update LwIP to 2.2.0 (#1769)
Fixes #1565
2024-07-22 10:01:24 -05:00
graham sanderson
7f37af837b add missing rtt cmake functions for host 2024-07-20 20:58:34 -05:00
Andrew Fernandes
0996a9e354
Add support for SEGGER RTT STDIO (updated) (#1411) 2024-07-20 20:52:41 -05:00
felixdoerre
c93c3f49ec
Use CYW43_PRINTF macro in cyw43-support code. (#1745)
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.
2024-07-09 10:32:43 -05:00
graham sanderson
b1abf96cec Revert "Add C11 standard atomic support (#1645)"
This reverts commit 01dec6fb6f.
2024-07-08 18:54:48 -05:00
Stephen Street
01dec6fb6f
Add C11 standard atomic support (#1645)
* Add runtime support for stdatomics

* Fix lock calculation and enable atomic_flag support
2024-07-08 18:38:06 -05:00
Mr. Jake
86aab81c47
IRQ enabling guard (when no callback set) (#1504) 2024-07-07 12:57:50 -05:00
Graham Sanderson
74b9ea4d46
use best_effort_wfe_or_timeout instead of wfe (#1404) 2024-07-07 11:42:07 -05:00
Jack Wilsdon
778221ba99
Add missing semicolon (#1750) 2024-06-27 17:45:55 -05:00
Graham Sanderson
73e719691d
#1748 replace incorrect license (#1749) 2024-06-27 09:58:42 -05:00
aizaki77
8b0146c142
Fixed an issue that caused incorrect settings when the SPI clock was less than 244141Hz. (#1633) 2024-06-27 09:28:46 -05:00
MarcinKlosowskiMobica
f5b7a9135b
corrected issue#1536 - used correct define to create a configuration mask (#1613) 2024-06-21 14:38:48 -05:00
Sonya Vasquez
9290bdde58
fix harware_alarm_irq_number typo (#1619) 2024-06-21 14:38:20 -05:00
Peter S. Hollander
2de70c79c2
Fix PICO_DEOPTIMIZED_DEBUG not updating compiler flags (#1620)
* 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
2024-06-21 14:37:33 -05:00
Maarten van der Schrieck
f5fea7f09b
pico_cyw43_driver/cyw43_bus_pio_spi.c: make SPI_PROGRAM_NAME and CLOCK_DIV configurable in makefile (#1499) 2024-06-21 14:35:51 -05:00
Peter Harper
5d36c90331
Make it easier to configure default baud rate (#1648)
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.
2024-06-21 14:31:52 -05:00
Pontus Oldberg
5118b4aae8
Adds support for the iLabs opendec02 decoder. (#1667) 2024-06-21 14:31:04 -05:00
Andrew Scheller
cea8211834
Fix FIFO size in Doxygen in hardware/adc.h (#1720)
See https://github.com/raspberrypi/pico-feedback/issues/357
2024-06-21 14:30:13 -05:00
Andrew Scheller
5be87f1e22
Clarify that DMA timer fraction must be <= 1 (#1723) 2024-06-21 14:29:47 -05:00
Andrew Scheller
0e5cef3ffa
Boards header updates (#1724)
* 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
2024-06-21 14:26:45 -05:00
Hiroyuki OYAMA
333974fd6c
Corrects errors in returning constant labels (#1735) 2024-06-21 14:24:44 -05:00
Peter Harper
a567349aae
Update btstack v1.6.1 (#1736)
* Update btstack to v1.6.1

* Add build changes for btstack v1.6.1
2024-06-21 14:23:50 -05:00
Peter Harper
f193ed6bc9
Update cyw43-driver to fix build warnings (#1739)
This resolves kitchensink build issues
2024-06-21 14:22:14 -05:00
J
c526ec1c3d
custom_(un)lock_tcpip_core: link properly in C++ (#1738) 2024-06-20 09:07:32 -05:00
armandomontanez
6ff3e4fab2
Expand bazel build to include configuration options and broader support. (#1731)
* 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
2024-06-13 09:50:04 -05:00
Peter Harper
0dc17e5149
Update cyw43_driver to v1.0.3 (#1732) 2024-06-13 09:03:46 -05:00
Christian Halter
a391f641b6
Added Newsan's Archi board (#1730)
Co-authored-by: Christian Halter <christian.halter@newsan.com.ar>
2024-06-12 13:42:25 -05:00
Peter Harper
a456964c19
Fix btstack compilation (#1726)
hardware/flash.h has been removed from pico/flash.h in the fix
for #1699. This breaks btstack compilation. Let's fix it.
2024-06-10 10:03:09 -05:00
Ahmet Kizilay
3ee062318f
set git tag for the SDK (#1630)
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)
```
2024-06-04 20:04:21 -05:00
Mykle
79977dbc4a
Update dma.h (#1678)
Fix inline doc for dma_timer_set_fraction()
2024-06-04 20:00:55 -05:00
J
e84eedff32
Remove unneeded includes from pico_flash. (#1699) 2024-06-04 19:59:59 -05:00
Andrew Scheller
115eae7c66
Add scripts to extract PICO_CMAKE_CONFIG and PICO_BUILD_DEFINE entries (#1708)
Tidy up a couple of PICO_CMAKE_CONFIG and PICO_BUILD_DEFINE entries
2024-06-04 19:59:28 -05:00
armandomontanez
abce1d427c
Introduce initial Bazel build (#1705)
* 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.
2024-06-04 18:50:32 -05:00
dthomas981
23dec9d38c
Correct clk_sys auxsrc definition for XOSC (#1571) 2024-05-21 13:37:43 +01:00
Agustín Mista
f81537d9e0
Add board definition for Cytron Maker Pi RP2040 (#1473) 2024-05-19 19:49:27 -05:00
Andrew Scheller
a6c65b426d
Small kitchen-sink fixes (#1707)
- tweak CMakeLists.txt and kitchen_sink.c to be in a more similar order
- add some "missing" headers to kitchen_sink.c
2024-05-19 19:26:30 -05:00
Andrew Scheller
dcc2241a16
Add a script to create a header file including all other header files (#319) 2024-05-19 17:44:03 -05:00
Mr. Jake
3f41d7d2ee
Added comments referencing spin-lock lock/unlock read/writes (#1501) 2024-05-19 17:03:32 -05:00
Patrick Plenefisch
7d238ea2cc
[pioasm] Fix build warning due to extra parameters (#1625) 2024-05-19 16:48:53 -05:00
Peter Harper
0d56f52b7b
Add some missing i2c function documentation (#1650)
Add i2c_get_index for consistency - just calls i2c_hw_index
2024-05-19 16:36:27 -05:00
Mr. Jake
f1f3bd6bf6
Disable FIFO IRQ when doing reset of core1 (same as with launching) (#1447)
* fifo irq disabled during core1 reset

* silence warning about unused variable in multicore.c
2024-05-18 19:53:37 -05:00
Joseph Bellahcen
5941969380
Improved const correctness of rtc functions (#1460) 2024-05-18 19:42:51 -05:00
Peter Harper
ac8f277e5a
Fix stdio_set_chars_available_callback for usb (#1649)
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>
2024-05-18 18:59:47 -05:00
Siarhei Volkau
fcd5333f6b
remove dead code in __aeabi_dcmpun (#1703)
two tail instructions were unreachable
2024-05-18 18:33:03 -05:00
Patricio Whittingslow
a0f4cd4096
Implement Pioasm for Go (TinyGo) (#1604)
Co-authored-by: Kenneth Bell <ken@netleap.io>
Co-authored-by: Christian Ege <ch@ege.io>
2024-05-07 17:39:28 -05:00
Nellie McKesson
b27f13b83b
reformatting doxygen comment markup (#1660) 2024-03-22 09:09:44 -05:00
J. Neuschäfer
0c65e1d755
pico/mutex.h: Fix typo in comment (#1637) 2024-02-15 08:45:35 -06:00
timg236
c9cce7a312
pico_generate_pio_header: Create OUTPUT_DIR (#1610)
Previously, if a custom OUTPUT_DIR was specified but didn't exist
then this command would fail.

Fixes: https://github.com/raspberrypi/pico-sdk/issues/1609
2024-01-19 08:57:16 -06:00
rppicomidi
f1c6fc8b6d
Fix #1442: Allow adding alternative .gatt file import paths (#1445)
* 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>
2024-01-16 09:43:57 -06:00
Peter Harper
62bb486f2a
Add tool for lwip httpd server (#1600)
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.
2024-01-16 09:20:17 -06:00
hubiscode
8353cb61e3
Fix spelling mistake, add documentation (#1444)
* 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.
2024-01-12 20:41:22 -06:00
Maarten van der Schrieck
4d19007607
rp2_common/pico_standard_link: linker script fixes (#1539)
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.
2024-01-12 16:18:42 -06:00
Andrew Scheller
73dce4e540
Doxygen comment typo (#1463) 2024-01-12 15:59:57 -06:00
Brandon Ros
6bb38a87fa
fix cybt_mem_read debug log typo (#1480) 2024-01-12 15:59:29 -06:00
Andre Zeps
ff2e2028ea
Fixes #1468 (#1497)
* 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>
2024-01-12 15:55:43 -06:00
Graham Sanderson
46bddd6b54
save about 100 bytes of code (release) size for simple UART usage (#1431) 2024-01-12 09:41:37 -06:00
Timo Kokkonen
3274cc8aec
Fix CWE-686 in tools/elf2uf2/main.cpp:132 (#1585)
* Fix CWE-686: This argument should be of type 'void *' but is of type 'unsigned int'.

* Switch %p to %08x.
2024-01-08 12:33:21 -06:00
Peter Harper
d7bbadb291
Add a cmake function for configuring IP addresses (#1424)
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
2024-01-05 09:33:41 -06:00
Peter Harper
9f45e3c905
Freertos background asserts if IPv6 is enabled (#1591)
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
2023-12-21 07:51:21 -06:00
Paul Grayson
9ff8a98df6
Add board definition for upcoming Pololu Zumo 2040 Robot (#1475) 2023-12-15 13:49:19 +00:00
Andrew Scheller
538b901290
Add watchdog parameter-validation, and fix up misleading comments (#1567) 2023-12-15 13:48:02 +00:00
Ghorban M. Tavakoly
e5e30b40fd
CMake cmake_minimum_required Deprecation Warning (#1546)
* 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>
2023-12-15 13:45:42 +00:00
Joshua H
01804acb0a
added weact studio board variants (#1437) 2023-12-15 13:40:43 +00:00
Stanislav Rubint
4e3951df26
added Xerxes RP2040 board to includes (#1459) 2023-12-15 13:39:16 +00:00
Alynx Zhou
7dcb984214
Fix waveshare_rp2040_zero USB unrecognize after unplug and replug (#1421)
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>.
2023-12-15 13:38:14 +00:00
Andrew Scheller
7ed83dd2d3
Add calls to tight_loop_contents in a few more places. (#1401)
Fixes #1290
2023-12-15 13:36:51 +00:00
Earle F. Philhower, III
d92e26afca
Remove unused warning in async_context_freertos (#1574)
Fixes #1573
2023-12-14 12:01:14 +00:00
Mr. Jake
21cf892b77
Added stdio.h include to pico malloc when debug enabled (#1503) 2023-12-14 11:45:25 +00:00
Patrick Plenefisch
8787bc9b4d
pioasm: Add JSON output format for machine consumption (#1394) 2023-12-14 11:37:01 +00:00
Graham Sanderson
263a6680aa
workflow update for macOS to fix bad GCC install 2023-09-05 11:09:05 -05:00
Graham Sanderson
8262a08af3
rom_hword_as_ptr should use __force_inline (#1494) 2023-09-05 10:34:02 -05:00
Graham Sanderson
8e169346a9
remove incorrect repeating_timer assertion, which fails if the timer fires during creation (#1488) 2023-08-29 11:29:12 -05:00
Stefan Becker
f85d67961c
tools: fix CMake deprecation warnings (#1477)
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.
2023-08-17 11:02:18 -05:00
Paul Mucur
81b3200df4
Fix documentation for gpio_set_irq_enabled (#1470)
Add missing column separator for the table of gpio_irq_level values.

Fixes https://github.com/raspberrypi/pico-sdk/issues/1469
2023-08-14 08:28:17 -05:00
Earle F. Philhower, III
fbb0783eb5
Fix boot2_is25lp080.S section naming (#1430)
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.
2023-06-15 09:53:25 -05:00
graham sanderson
88fa39165e Merge branch 'master' into develop 2023-06-13 17:28:01 -05:00
graham sanderson
6a7db34ff6 revert changes to when -nostartfiles is specified in link for 1.5.1 as it can cause link errors with C++; see #1368 2023-06-13 17:27:33 -05:00
graham sanderson
9f9936140c start 1.5.2 development 2023-06-13 16:20:45 -05:00
graham sanderson
8ecc5ababa set release version 1.5.1 2023-06-13 11:52:27 -05:00
Graham Sanderson
f316272a80
Move multicore_lockout victim initialzied tracking to pico_multicore (#1427)
* 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
2023-06-13 10:52:37 -05:00
Andrew Scheller
bb460d076f
Add missing "default defines" (#1426)
To match the documented PICO_CONFIG default values
2023-06-13 10:49:51 -05:00
Andrew Scheller
0be7fb8045
Add missing doxygen ingroup tags (#1425)
So that the doxygen-descriptions end up in the right place
2023-06-13 08:56:00 -05:00
Graham Sanderson
3352ccf5de
split asm volatile back out (#1420) 2023-06-10 11:15:08 -05:00
Liam Fraser
7119978e92
Update svd using latest version of generation tools (#1417) 2023-06-09 09:39:17 -05:00
Peter Harper
0423d7a257
Update BTstack to pick up fix. (#1418) 2023-06-08 10:20:03 -05:00
Peter Harper
c0a615e99c
Improve the comments around VSYS/VBUS config. (#1414) 2023-06-07 11:52:07 -05:00
Peter Harper
ab766096e5
WIP: Add btstack files missing from build (#1380) 2023-06-07 11:28:30 -05:00
Peter Harper
1b81fcc704
Update to btstack v1.5.6 (#1415)
Fixes #1376
2023-06-07 11:27:10 -05:00
Peter Harper
f3ebd62d51
Flash bank customisation (#1293)
* 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
2023-06-06 12:48:09 -05:00
andygpz11
d315a04661
Correct writes to the UART LCR register (#1347)
Co-authored-by: Luke Wren <wren6991@gmail.com>
2023-06-06 12:08:53 -05:00
Graham Sanderson
f28bbfd4ec
Add new pico_flash library with flash_safe_execute(func) (#1412)
* 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
2023-06-06 11:19:27 -05:00
Graham Sanderson
8188adf98b
avoid calling find_package for pico-sdk-tools over and over again (#1403) 2023-06-06 10:46:17 -05:00
Peter Harper
5d47872cb4
Update cyw43-driver to main (#1408)
Latest version of driver includes BT fixes

Fixes #1377
2023-06-03 07:33:35 -05:00
Peter Harper
6a221e023d
Add dma_channel_cleanup method and use it to cleanup after pico_cyw43_driver is closed (#1372) 2023-06-02 12:52:39 -05:00
Graham Sanderson
3b44b0d177
update cmake vars which come from environment with FORCE so they can be updated (#1405) 2023-06-02 12:49:54 -05:00
Peter Harper
8e89e955fc
Fix PICO_CYW43_ARCH_POLL header guard (#1407)
Fixes #1268
2023-06-02 12:49:20 -05:00
Graham Sanderson
c026314e17
subs requires a lo register (#1402) 2023-05-29 11:10:11 -05:00
hubiscode
b0a6f244f3
USB descriptor string length. (#1341)
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.
2023-05-29 10:10:19 -05:00
Malte Thiesen
c7211db2b3
Fixed assert when calling cancel_alarm(0) (#1173) 2023-05-26 12:22:09 -05:00
Peter Harper
826efbc524
pico_lwip_arch build fix (#1389)
It should use pico_mirrored_target_link_libraries.

Fixes #1387
2023-05-26 08:46:45 -05:00
Peter Harper
5ee4c1c3ee
Add cyw43_arch_disable_sta_mode (#1383)
We have a function to "enable" STA mode, so add a "disable" version to
match AP mode.

Fixes #1371
2023-05-26 08:45:30 -05:00
Peter Harper
8dbc6f20a3
Bt wifi buffer corruption (#1362)
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)
2023-05-26 08:28:12 -05:00
Graham Sanderson
c34d3d5602
Work around issue with unreferenced sections marked allocated in the asm being discarded by GNU linker (#1391) 2023-05-26 07:04:40 -05:00
Graham Sanderson
affbb31a8c
fix build (#1395) 2023-05-25 19:41:23 -05:00
andygpz11
8888fd7998
Add a PICO_CONFIG control to disable switching the peripheral clk to usb clk when the sys pll is changed 2023-05-25 15:47:32 -05:00
andygpz11
4515719909
Add conditionalization for (potentially unused) struct and function (#1282) (#1348) 2023-05-25 15:46:47 -05:00
Michael Busby
1d9f1873d5
add cyw43_arch_disable_ap_mode() to cyw43_arch (#1331) 2023-05-25 15:21:48 -05:00
Brendan
8ebb83ccaa
resolves #1161 (#1322)
This corrects the mismatched `PICO_DEFAULT_I2C` bus number (favors the breadboard pins not the stemma connector).
2023-05-25 15:20:32 -05:00
James Hughes
ab4f23c7ee
Update mainpage.md (#1320) 2023-05-25 15:18:32 -05:00
djazz
7070d230c0
GCC 13 update. Move #include <cstdint> to header. Fixes #1363 (#1367) 2023-05-24 07:51:59 -05:00
Peter Harper
257959bc07
Add user_data to async_when_pending_worker_t. (#1384)
Fixes #1382
2023-05-22 09:14:11 -05:00
Andrew Scheller
62201a83e2
MarkDown syntax typo (#1366) 2023-05-07 10:34:33 -05:00
Peter Harper
e87f11bd2b
Add some configuration for VBUS / VSYS (#1252)
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
2023-03-27 09:43:26 -05:00
andygpz11
a42564b4b4
Allow support of crystals other than 12MHz (#1024) (#1272)
* 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>
2023-03-21 12:49:20 -05:00
Liam Fraser
cb0ac5bd1a
CI: Improve multi-gcc workflow (#1316) 2023-03-20 16:51:13 -05:00
arjunak234
be4c80d355
include cstdint (#1318)
This fixes build on newer versions of GCC(13.0.1)
2023-03-20 16:48:48 -05:00
Peter Harper
4000c9f414
Allow malloc and free to be changed. (#1309)
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.
2023-03-20 11:52:35 -05:00
Peter Harper
2bfa90ccbb
Set PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS (#1253)
If PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS is passed to cmake, use it to
set the build macro of the same name.

Fixes #1210
2023-03-19 16:44:08 -05:00
agento2
cd54c3297d
Add Default for the thingplus ws2812 (#1312) 2023-03-19 16:35:00 -05:00
Graham Sanderson
7f7232541a
switch all .S files to unified asm, and use a macro to setup compiler and some other misc changes (#1295)
* 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`
2023-03-09 17:40:20 -06:00
Paul Grayson
dca773f36b
Add board definition for upcoming Pololu 3pi+ 2040 Robot (#1259)
Co-authored-by: Paul Grayson <paul@pololu.com>
2023-03-04 18:28:21 -06:00
Peter Harper
0b285af452
Revert change to cyw43_hal_generate_laa_mac (#1291)
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.
2023-03-01 15:10:49 -06:00
Graham Sanderson
1ac90374e3
Various small fixes towards building with other compilers (#1285)
* 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)
2023-03-01 15:10:18 -06:00
Peter Harper
bc7d9ce95a
Fix some header dependencies in bluetooth (#1294)
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
2023-03-01 13:12:55 -06:00
Graham Sanderson
18479e0300
filter pull request source for pull_request to avoid IAR (#1289) 2023-02-27 19:18:03 -06:00
Graham Sanderson
67b0a11d3e
remove iar/ branches from default workflow (#1288) 2023-02-27 18:59:41 -06:00
Peter Harper
d9c88c6306
Make sure BT device address is set. (#1284)
* Make sure BT device address is set.
* Change cyw43_hal_generate_laa_mac to match MicroPython
2023-02-27 11:12:20 -06:00
Andrew Scheller
b1d4ba570e
Doxygen formatting fixes (#1283) 2023-02-26 17:05:39 -06:00
Andrew Scheller
777cd52e21
Git rid of some errant apostrophes in Doxygen / code comments (#1275) 2023-02-23 07:37:56 -06:00
Graham Sanderson
d172067f47
Add Raspberry Pi BTstack license (#1273) 2023-02-22 10:43:54 -06:00
Mr. Green's Workshop
37c8e9f0b2
typo fix (#1264) 2023-02-17 09:07:39 -06:00
Graham Sanderson
1331c47c9e
Add missing busy_wait_ms functino to host platform (#1254) 2023-02-13 15:22:03 -06:00
Andrew Scheller
c2af4e8bf4
Fix various Doxygen errors (#1251)
Co-authored-by: Peter Harper <peter.harper@raspberrypi.com>
2023-02-13 11:45:54 -06:00
Graham Sanderson
d30b97ab79
remove unnecessary headers - particular pico_stdlib.h which should not be included by libraries (#1250) 2023-02-13 10:40:46 -06:00
Andrew Scheller
226374a364
Documentation typos (#1249) 2023-02-13 09:40:26 -06:00
Graham Sanderson
e763cb8e99
Fix typo in pico_rand breaking randomness when PICO_RAND_ENTROPY_SRC_BUS_PERF_COUNTER=1 (#1246) 2023-02-12 10:51:08 -06:00
graham sanderson
79d0eb472d Merge branch 'master' into develop 2023-02-11 19:11:59 -06:00
Graham Sanderson
f396d05f82 Actually target correct USB1.5.0 version - same code (#1245) 2023-02-11 19:10:42 -06:00
Graham Sanderson
4ba5ad34cb
Actually target correct USB1.5.0 version - same code (#1245) 2023-02-11 16:54:33 -06:00
Andrew Scheller
5abb4eb911
Fix typos in the PICO_CONFIG settings (#1242) 2023-02-11 09:42:21 -06:00
Graham Sanderson
0121007c85
Improve SPI set-up: Don't change the config whilst it is enabled (#1227)
Co-authored-by: David Thacher <davidethacher@gmail.com>
2023-02-10 19:02:46 -06:00
graham sanderson
6d336e04be start 1.5.1 development 2023-02-10 18:51:01 -06:00
graham sanderson
2ccab115de release SDK 1.5.0 2023-02-10 18:27:36 -06:00
graham sanderson
c8ccefb972 Add Bluetooth support
Co-authored-by: Peter Harper <77111776+peterharperuk@users.noreply.github.com>
2023-02-10 18:27:23 -06:00
graham sanderson
0d207f4878 Add new github workflows 2023-02-10 18:27:13 -06:00
Peter Harper
d07abf3ac0
Setup clock pin when starting SPI comms. (#1236)
Because the clock pin (29) also has to be used to read vsys,
its properties might be changed.
So reset when starting a spi transaction.

Fixes #1141
2023-02-10 10:18:34 -06:00
andygpz11
756c4f24a4
Remove duplicated comment line in header (#1237) 2023-02-09 12:06:16 -06:00
andygpz11
f54ca1a42e
Add/tidy API doxygen for the new pico_i2c_slave library (#1233) 2023-02-08 10:48:02 -06:00
Graham Sanderson
8c8006d457
Fix build backwards-incompatibilities with LIB_XXX defines, and add fix pico_time in host mode (#1232)
* restore original setters of LIB_PICO_ as some external code depends on it

* add __get_current_exception to host
2023-02-07 16:39:37 -06:00
Graham Sanderson
18b97fcba0
add new pcio_I2c_slave library (#1205)
* add (slightly modified) pico_i2c_slave library from https://github.com/vmilea/pico_i2c_slave
* introduce VTABLE_FIRST_IRQ constant
2023-02-07 07:47:01 -06:00
Andrew Scheller
66bd4d8aab
Comment typos (#1231) 2023-02-06 18:48:44 -06:00
Graham Sanderson
5eff1726c2
revert use of pico_add_library in pico_usb_reset_interface which is used by picotool and included directly as _headers library by SDK anyway (#1230) 2023-02-06 18:07:16 -06:00
Graham Sanderson
cc169ddd68
stdio hardening + new mutex API (#1224)
* * 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
2023-02-06 16:27:39 -06:00
Graham Sanderson
5b467997b2
Update TinyUSB to c0d79457f (post 0.14.0) (#1229) 2023-02-06 16:27:19 -06:00
Peter Harper
7ef7ec8491
Fix Windows build warning (#1228) 2023-02-06 16:13:26 -06:00
Graham Sanderson
ab18927533
Various Documentation Updates + bump version to SDK1.5.0-develop (#1220)
* 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
2023-02-06 15:07:37 -06:00
Brad S
a916761e7d
issue 1219, minor improvements to doxygen comments (#1223) 2023-02-05 19:00:26 -06:00
Nikhil Dabas
795d021ca6
Allow external pico-sdk-tools package (#1221)
This will enable builds to use pre-compiled copies of pioasm and elf2uf2, instead of requiring a native compiler.
2023-02-05 18:05:54 -06:00
Flaviu Tamas
74b6c1ccc3
Re-enable compiler checks (#1097)
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
2023-02-05 16:34:24 -06:00
Graham Sanderson
7e305a70b0
fix typo (#1217) 2023-02-03 10:21:40 -06:00
Peter Harper
c05c97d338
Fix PICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACK (#1216)
It's being used in the wrong place
2023-02-03 09:23:17 -06:00
Graham Sanderson
fff2c6b467
add thread info to pico_rand docs (#1214) 2023-02-02 12:29:06 -06:00
Peter Harper
31780aed2c
Add stdio_set_chars_available_callback (#1213)
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.
2023-01-31 15:47:36 -06:00
Graham Sanderson
0e4e25a343
Rework build targets such that: (#1211)
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
2023-01-30 10:56:03 -06:00
Graham Sanderson
d717fe239a
Add mention of develop branch to README.md (#1207) 2023-01-29 17:02:21 -06:00
Peter Harper
0b0931a9a2
Bssid (#1212)
* 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>
2023-01-29 16:56:58 -06:00
Flaviu Tamas
5984849594
Add manual windows CI (#1209) 2023-01-29 13:45:40 -06:00
Sencer
c852a65ecc
define option to disable cpp allocation overrides (#1145)
Setting `PICO_CXX_DISABLE_ALLOCATION_OVERRIDES=1` will prevent `new` etc. operators being overridden
2023-01-29 12:40:01 -06:00
Graham Sanderson
2a9c59925a
remove duplicate pico_rand inclusion in kitchen_sink (#1206) 2023-01-27 16:37:47 -06:00
Peter Harper
1552324a64
Add mbedtls_hardware_poll implementation to pico_mbedtls 2023-01-27 11:15:22 -06:00
Graham Sanderson
1bd9de95de
add pico_rand to kitchen_sink (#1204) 2023-01-27 10:59:59 -06:00
Graham Sanderson
45d2dc4c95
add missing pico_rand dependency (#1203) 2023-01-27 10:48:20 -06:00
Andrew Scheller
729c7f4326
Tweaks to section-attribute stuff in platform.h (#1202) 2023-01-27 08:05:11 -06:00
Liam Fraser
36ba9e64bc
Add NVIC struct. Fixes #947 (#1199) 2023-01-26 16:07:20 -06:00
Graham Sanderson
fefb6b6d1e
Move more code from pico_cyw43_arch to pico_cyw43_driver (#1201)
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.
2023-01-26 16:05:29 -06:00
andygpz11
b70f984f2a
Add pico_rand library (#1111)
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>
2023-01-26 13:25:27 -06:00
Peter Harper
67af83f069
Fix compile issue with clock_t conversion (#1200)
We don't enable -Wconversion on the kitchen-sink build. But it's
enabled for some tinyusb examples.
2023-01-26 13:11:42 -06:00
Peter Harper
b979395c5e
Keep retrying if cyw43_wifi_join fails (#1195)
Currently, if the network can't be found we fail almost immediately.
Also fix error codes.

Fixes #1054
2023-01-26 11:28:04 -06:00
Graham Sanderson
78d7a2522f
elf2uf2: Use LMA (instead of VMA) of entry_point to determine whether binary is flash/RAM (#1187) 2023-01-26 10:04:48 -06:00
P33M
260df95e44
tinyusb: enable workaround for RP2040-E15 (#1137)
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.
2023-01-25 17:19:23 -06:00
Graham Sanderson
b8bd8ac702
update multi-gcc action to be on push to develop or main (#1197)
* make multi-gcc workflow on-demand only

* actually run multi-gcc after merge

* update yml generator for Multi GCC too
2023-01-25 17:14:16 -06:00
Graham Sanderson
60016e2cf2
update multi-gcc workflow (#1194)
* make multi-gcc workflow on-demand only
* actually run multi-gcc after merge into develop/master
2023-01-25 11:55:57 -06:00
Graham Sanderson
9a5eae111b
fix compiler warning (#1193) 2023-01-25 11:41:45 -06:00
Liam Fraser
0cfeec253a
CI Improvements. Add multi-gcc workflow that tests each ARM GCC available (#1192) 2023-01-25 10:48:35 -06:00
Graham Sanderson
248fc72f96
Remove (legacy) direct inclusion of 'pico/platform.h' and 'pico/config.h' (#1190)
* 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
2023-01-24 12:03:48 -06:00
Graham Sanderson
a540ca905a
Add new async_context abstraction and refactor cyw43_arch to use it (#1177)
* 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
2023-01-24 12:01:24 -06:00
Liam Fraser
c578422528
Remove PLL postdiv assert. Fixes #1047 (#1189) 2023-01-24 09:10:05 -06:00
Graham Sanderson
177b0303dd
SYS funcs and GCC12 fixes (#1186)
* 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
2023-01-24 09:00:26 -06:00
Graham Sanderson
a66ba7a942
user_irqs should be claimed globally not per core, since vector tabes are shared (#1183) 2023-01-24 08:58:01 -06:00
Graham Sanderson
8b8778c59b
compile issue seems to have snuck thru (#1184) 2023-01-20 16:47:23 -06:00
Howard Su
aaf0828250
change clock_gpio_init to take float and add clock_gpio_init_int_frac (#1178) 2023-01-20 15:45:18 -06:00
Peter Harper
021a1b6bad
Update cyw43-driver (#1181)
Update to the latest version. Matching Micropython.
2023-01-20 09:11:18 -06:00
andygpz11
2e45d8ec65
Update source code to use the correct bit - fixes #993 (#1180) 2023-01-20 09:10:01 -06:00
Mr. Green's Workshop
885bd922cf
Ability to set USB device as self powered device (#1105) 2023-01-19 16:49:00 -06:00
Andrew Scheller
05c3f22879
Update documentation-links (remove FAQ and add the two Pico W books) (#1123) 2023-01-19 16:47:21 -06:00
Andrew Scheller
4215d4a793
Latest updates to the autogenerated headers (#1122) 2023-01-19 16:41:34 -06:00
DipSwitch
35787255af
Avoid generating garbage input due to initialization (#1125)
First mapping the GPIO pins to the UART peripheral before enabling the UART peripheral avoids generation of garbage character on the UART's input.
2023-01-19 16:39:19 -06:00
Andrew Scheller
13a171a971
Small doxygen fixes (#1092) 2023-01-19 16:38:14 -06:00
KafCoppelia
73dcbec837
Improved code format (#1146) 2023-01-19 16:24:26 -06:00
Graham Sanderson
88bc4f974c
cleanup header guard names to be consistent (#1179) 2023-01-18 08:40:10 -06:00
Jay Greco
99ee33ad25
Add nullbits Bit-C PRO (#1149) 2023-01-18 07:20:37 -06:00
Peter Harper
419eb739c2
Disable linker warning (#1114)
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
2023-01-17 16:46:02 -06:00
ryanjsims
488bd66eb3
Fix conflicting C++ linkage for pico_lwip panic() (#1167) 2023-01-09 09:49:25 -06:00
Graham Sanderson
605e21ae6f
pairing heap free link list gets orphaned when fully depleted (#1120) (#1121)
add some more asserts, and fix test case for debug which was broken by all the assserts slowing it down
2022-12-08 11:14:53 -06:00
Peter Harper
0b52603667
Fix build issues with spaces and parentheses (#1136)
Add VERBATIM to add_custom_command

Fixes #1043
2022-12-06 18:45:57 -05:00
Stargirl Flowers
56594e75af
Allow changing the USB VID, PID, manufacturer, and product via CMake (#1130) 2022-12-03 05:39:01 +00:00
David Greaves
616e120558
Add information on targetting the Pico W. Fixes #895 (#896)
* Add information on targetting the Pico W

Based on comments in https://github.com/raspberrypi/pico-sdk/issues/895 which pointed here:
https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf

I didn't add the pdf link as there are no links to other pdfs.

* Rewording

* stray comma

Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
2022-11-30 13:08:04 -06:00
Radoslav Gerganov
0ef07e5215
Fix the description of stdio_flush() (#1095)
Closes #1094
2022-11-24 09:05:00 -06:00
envirocoder
887c0b8443
IRQ on CYW43_PIN_WL_HOST_WAKE not gpio13 (#1069)
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>
2022-11-24 08:42:25 -06:00
Peter Harper
6cc9394c5c
Update cyw43-driver to latest version (#1115)
Fixes #900
2022-11-24 08:40:29 -06:00
Nicolas Pouillon
586850e66f
binary_info/structure.h: Fix pins_with_func format comment (#1070) 2022-11-22 18:26:16 -06:00
andygpz11
5258ee640b
Add new DMA sniffer's API (#887) 2022-11-02 09:25:27 -05:00
Lord-Lucan
e4da37cf0c
Fix for cyw43 driver working with SMs other than 0 (#1080) 2022-10-27 16:06:33 -05:00
Daniel Treffenstädt
a88baafc16
Implemented ARCHIVE_OUTPUT_DIRECTORY for uf2 output in CMake. Fixes #1012 (#1036)
* 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>
2022-10-21 09:01:55 -05:00
Engineer_Will
6d15974e96
Add some definition files for waveshare board. (#984)
* src/boards/include: Change the default I2C interface of RP2040_lcd_0.96.

* src/boards/include: Add some definition files for waveshare board.
2022-10-21 09:01:10 -05:00
Timo Kokkonen
e50e107d91
Fix unexpected (CMake) behavior with PICO_BOARD variable. (#1050)
* 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>
2022-10-21 08:59:02 -05:00
James Peach
16ab2b21ba
Remove incorrect override for LWIP_PLATFORM_ASSERT (#1064)
* 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>
2022-10-21 08:57:21 -05:00
Graham Sanderson
b0294d6bf4
fix build without mbedtls submodule initialized, and fix deoptimized debug build (#1067) 2022-10-17 11:34:10 -05:00
Peter Pettersson
3bd7a829db
Some optimizations for the hardware divider (#1033)
* 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.
2022-10-16 17:40:22 -05:00
Pedro Tôrres
2d4e3baa82
Set CMAKE_MAKE_PROGRAM when building ELF2UF2 and PIOASM (#935) 2022-10-16 17:31:58 -05:00
Jonathan Reichelt Gjertsen
587ac803c5
Avoid compound assignment with volatile left operand as described in #1017 (#1018)
also move to use of hw_set_bits where appropriate
2022-10-16 17:24:23 -05:00
Koji KITAYAMA
e22807bc2e
Add a compile option to suppress fopen deprecated warning (#1035) 2022-10-16 17:22:25 -05:00
Koji KITAYAMA
8c6963d7ed
Fix compile errors when building with clang x86_64-pc-windows-msvc (#1038) 2022-10-16 17:22:06 -05:00
Peter Harper
719d5e41a2
Add mbedtls to pico-sdk (#894)
* 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
2022-10-16 16:41:21 -05:00
Jan Niehusmann
8e014e6b5d
Make sure OUT_STICKY is not set when setting pins / pindirs (#989) 2022-10-16 16:39:44 -05:00
Peter Harper
c4f37b2e44
Lwip build fixes (#1011)
Only build lwip acd.c if it exists (after 2.1.3)
Some mdns files only exist in 2.2.x

Fixes #1009
2022-10-16 16:38:42 -05:00
Patrick Plenefisch
6f1fc56833
pioasm: python output incorrectly rendered mov x, ~x as nop() (#1053)
This affects all move operations where source and destination are the same
but with an operation applied, ex: mov y, ::y, mov osr, ~osr, etc
2022-10-09 12:59:52 -05:00
alastairpatrick
24bb3627cf
PLL REFDIV values > 1 considered by vcocalc.py (#952) 2022-10-05 19:06:26 -05:00
Graham Sanderson
3ed9e2fb1e
Avoid initializing full stdio_stack_buffer object with zeros (#992) 2022-09-26 11:49:16 -05:00
alastairpatrick
98aba25e64
Make __get_current_exception inline (#1016)
not `static` inline, so we keep an implementation around if needed (someone might have called it from assembly)
2022-09-12 15:28:18 -05:00
Jeremy Grosser
849cdf8a30
Typo in float_aeabi.S: srqtf => sqrtf (#702) 2022-09-12 13:44:38 -05:00
Flaviu Tamas
5e9eb27ac2
Implement whole-buffer write semihosting (#1013)
* 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.
2022-09-12 13:20:30 -05:00
Ha Thach
a4ec3c4848
fix wconversion warning (#981) 2022-09-06 11:02:45 -05:00
bruelltuete
189d377be2
Only include mutex header if necessary (#991) 2022-09-06 11:00:51 -05:00
Zachary Kohnen
07e5caf341
Supress -Wunused-parameter when PICO_STDIO_ENABLE_CRLF_SUPPORT is unset (#998) 2022-09-06 10:59:48 -05:00
Peter Harper
0041f4b7fd
set CYW43_WIFI_NVRAM_INCLUDE_FILE allowing user override 2022-09-01 14:10:06 -05:00
David Thacher
89bce613ae
Remove hw_set_bits from pio->irq (#978)
It is not known if this is required. This is done for consistency purposes. Related to #974
2022-08-18 08:14:40 -05:00
Graham Sanderson
0d872ea409
Move to TinyUSB 0.14.0 (#937) 2022-08-18 07:51:38 -05:00
NomiChirps
830e867211
Fix dma_irqn_acknowledge_channel (#977)
Also dma_channel_acknowledge_irq0 and dma_channel_acknowledge_irq1.
Using hw_set_bits acked every channel because INTS0/1 are WC registers.

Fixes #974.
2022-08-17 14:37:50 -05:00
Graham Sanderson
00780f0de9
Make sure stack is 8 byte aligned in shared IRQ handlers (#971) 2022-08-17 10:25:23 -05:00
Mr. Green's Workshop
80cde7276d
Enable/disable connection check made with DTR (#932)
* 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>
2022-08-10 09:16:44 -05:00
Attila Wagner
a33a11ea16
Call cyw43_deinit() from cyw43_arch_deinit() to release the DMA channels and power off the WLAN chip (#965) 2022-08-10 07:55:54 -05:00
Graham Sanderson
2dfaa1ab4c
Fix various stdio_usb issues, add stdio_init_all return code, and add alarm_pool_core_num() API (#918)
This issue addresses possible starvation issues when using `getchar()` with `stdio_usb` and also fixes possible missing of IRQs as a result of #871
2022-08-08 10:12:54 -05:00
Thomas Roberts
150be75aa4
Add pico_lwip_mqtt library (#948) 2022-08-08 09:14:01 -05:00
Attila Wagner
2ebba462ac
Properly terminate cyw43 task when cyw43_arch_deinit() is called (#962) 2022-08-08 07:48:29 -05:00
Graham Sanderson
fe7849d645
fix delayed_by_us and delayed_by_ms to not return times > at_the_end_of_time (#936) 2022-08-08 07:42:52 -05:00
Andrew Scheller
49d7d9edfb
typo (#905) 2022-08-02 07:29:08 -05:00
Andrew Scheller
17c759b6e9
Fix various typos in CMake CONFIG lines. Also add a script that found some of these errors. (#907) 2022-08-02 07:28:37 -05:00
Mr. Green's Workshop
de8f857de4
fix typo datsheet -> datasheet (#942)
fix typo datsheet -> datasheet
2022-08-02 07:26:04 -05:00
Graham Sanderson
0fa3e7247d
Some PIO setup was using SM 0 rather than the allocated SM (#940) 2022-07-27 08:24:42 -05:00
graham sanderson
d1e7294dab Start SDK 1.4.1 development 2022-06-30 01:20:10 -05:00
graham sanderson
2e6142b15b SDK 1.4.0 release 2022-06-30 00:46:24 -05:00
graham sanderson
5e9a5e827b Add Pico W and lwIP support 2022-06-30 00:46:13 -05:00
Graham Sanderson
77c04e458c
revert TinyUSB update (#889) 2022-06-29 22:43:20 -05:00
Graham Sanderson
bc5d1b8485
Add channel_config_set_high_priority (#888) 2022-06-29 20:56:45 -05:00
Graham Sanderson
85dbbfdf4d
Update TinyUSB to commit 39069cf4b to pick up recent RP2040 fixes (#886) 2022-06-29 17:09:33 +01:00
Earle F. Philhower, III
e7267f99fe
Fix GPIO # callback parameter (#880)
Fixes #879
2022-06-24 03:58:36 -05:00
Earle F. Philhower, III
4c49427bf3
Fix auto_init_recursive_mutex definition for C++ (#875)
Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
2022-06-20 12:47:46 -05:00
Liam Fraser
33818dd0bd
Increase PLL min VCO from 400MHz to 750MHz for improved stability across operating conditions (#869)
Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
2022-06-20 10:28:03 -05:00
Graham Sanderson
8f09099757
sem_acquire has no reason to do a notify! (#857) 2022-06-20 09:52:43 -05:00
Graham Sanderson
9644399993
Suppress new GCC 12 warning (#842) 2022-06-20 09:52:25 -05:00
Graham Sanderson
b3c56e7169
Add stderr support and remove 1us timeout for timeouts of 0us (#858) 2022-06-20 09:52:06 -05:00
Graham Sanderson
7858601a58
stdio_usb improvements (#871)
Use shared IRQ if available to avoid 1ms timer. Allow use of stdio_usb with user's tinyusb setup if it has CDC
2022-06-20 09:51:51 -05:00
Datanoise
0bdd463898
Add DatanoiseTV DSP Board. (#866) 2022-06-17 18:03:46 -05:00
arturo182
7daa20ce4c
Add board definition for the RP2040 Stamp Round Carrier (#837) 2022-06-17 12:58:13 -05:00
Earle F. Philhower, III
705b5cedcd
Wrap realloc() call with malloc_mutex in multicore (#864)
Protect against heap corruption by mutex-protecting the realloc() call
(like malloc/free are already).

Fixes #863
Fixes https://github.com/maxgerhardt/platform-raspberrypi/issues/7
Fixes https://github.com/earlephilhower/arduino-pico/issues/614
2022-06-17 09:50:53 -05:00
Luke Wren
bdd9746635
Don't copy .data for NO_FLASH binaries, as it's loaded in-place (#859) 2022-06-17 09:50:12 -05:00
Andrew Scheller
babc4a1794
Remove 'default=none' from PICO_CONFIG lines (#865) 2022-06-13 09:49:43 -05:00
Andrew Scheller
6c19d20aa5
Fix up filename displayed by extract_config.py when an invalid attribute is found (#853)
(and tidy up the code a bit at the same time)
2022-06-13 09:48:01 -05:00
Graham Sanderson
672e48e9e9
Add sem_try_acquire(). Fixes #846 (#856)
Co-authored-by: Geoff Simmons <geoff@uplex.de>
2022-06-08 13:23:36 -05:00
Graham Sanderson
ef47dfeeaf
Add new GPIO APIs for adding shared GPIO handlers, and improve docs (#850)
Co-authored-by: Adam Nielsen <malvineous@shikadi.net>
2022-06-08 13:03:11 -05:00
Graham Sanderson
6389927cf9
Add some optional header includes, to make per-target changes to config easier (#851) 2022-06-08 12:59:45 -05:00
Graham Sanderson
d3dcbb8292
Add new user_irq claim APIs to make it easier for independent code using them to interoperate (#854) 2022-06-07 14:27:38 -05:00
Graham Sanderson
f3c446ae14
move get_core_num() into platform.h (#852) 2022-06-06 08:20:00 -05:00
graham sanderson
4e4cf11d9b Start SDK 1.3.2 development 2022-05-18 15:52:03 -05:00
graham sanderson
426e46126b SDK 1.3.1 release 2022-05-18 10:41:48 -05:00
graham sanderson
ebc601f71f Re-merge SDK1.3.0 history back into SDK1.3.1
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
2022-05-18 10:41:14 -05:00
Graham Sanderson
1e6c122fc9
gate inclusion of pico.h in binary info, so as not to break picotool builds (#836) 2022-05-18 10:39:17 -05:00
Andrew Scheller
7880405292
Doxygen typo (#835) 2022-05-17 19:26:00 -05:00
Andrew Scheller
530204ec0c
Small tweak to busy_wait_at_least_cycles doxygen (#834) 2022-05-17 19:24:52 -05:00
graham sanderson
ea79d29cd6 Merge non-squashed history of 1.3.0 release back in to master 2022-05-17 13:32:32 -05:00
Graham Sanderson
b2ad632c24
Minor additions to PIO documentation (#831) 2022-05-17 13:04:38 -05:00
Graham Sanderson
658a21b946
Update rtc_set_datetime docs to point out that the written value may not be immediately visible (#832) 2022-05-17 12:59:00 -05:00
Graham Sanderson
e44d2c0010
Add busy_wait_at_least_cycles method (#830) 2022-05-16 16:45:39 -05:00
Ferdinand Bachmann
43a5593e8f
Pass PIOASM_EXTRA_SOURCE_FILES to Pioasm sub-cmake and add OUTPUT_FORMAT option (fixes #827) (#828) 2022-05-16 14:20:41 -05:00
Graham Sanderson
792813926d
Make pioasm accept windows CRLF input (#829) 2022-05-16 13:44:42 -05:00
Graham Sanderson
159d552150
Fix bug in irq_remove_shared_handler and add test #823 (#825)
* Fix bug in irq_remove_shared_handler and add test #823

* Add comments to irq_handler_chain.S

Co-authored-by: Luke Wren <wren6991@gmail.com>
2022-05-16 13:44:15 -05:00
Andrew Scheller
3a3d5fe6c4
Small IRQ doxygen tweaks (#824) 2022-05-15 15:02:13 -05:00
Graham Sanderson
5e22c09660
convert unlikely panic to hard_assert to not waste space for string (#826) 2022-05-15 15:01:44 -05:00
Graham Sanderson
4e62c26a2c
Add documentation to dma_channel_abort regarding errata RP2040-E13 (#816)
Co-authored-by: Luke Wren <wren6991@gmail.com>
2022-05-11 19:24:42 -05:00
Graham Sanderson
5a927792ef
Suppress false GCC 11 warning on TinyUSB (#819) 2022-05-11 14:49:57 -05:00
Graham Sanderson
60a6fea534
Fix list management in stdio_set_driver_enabled so drivers can be freely added and removed (#822) 2022-05-11 10:44:41 -05:00
Graham Sanderson
04c68c554b
cleanup pico_stdlib_test. add actual check for __builtin bitops (#821) 2022-05-10 13:56:48 -05:00
Graham Sanderson
0d2591e1f1
Pad all but last sector in flash binary to write whole of sector (#800) 2022-05-10 13:03:44 -05:00
Graham Sanderson
81bdcb6681
print build type during CMake config; remove spurious call to pico_is_toplevel_project() (#818) 2022-05-10 13:00:22 -05:00
Graham Sanderson
9c616da1e5
fix bug in pico_float_test (#817) 2022-05-10 12:58:55 -05:00
eskimo-software
f260477802
Adapt assembler syntax to eliminate Clang errors. (LLVM 14.0.0) (#798)
Co-authored-by: jeremyd <>
2022-05-09 15:11:59 -05:00
Graham Sanderson
e1c5fd34e4
PLL setup check bug (#796) (#806) 2022-05-09 14:52:38 -05:00
Andrew Scheller
5d422deed1
Add extra info about address_range defined values (#652) 2022-05-04 16:36:21 -05:00
Eunkyoung Kim
0c501c246a
Add wiznet_w5100s_evb_pico support (#666) 2022-05-04 16:35:06 -05:00
Graham Sanderson
259da19660
Include structs/iobank0.h from hardware/gpio.h (#733) (#807) 2022-05-04 16:34:11 -05:00
ZodiusInfuser
5325008956
Added board definition for upcoming Pimoroni motor driver (#795) 2022-05-04 16:21:30 -05:00
Andrew Scheller
510ca47c92
Additional PWM validation and small tidy-up (#801)
See #768 for discussion / inspiration
2022-05-04 15:29:26 -05:00
ZodiusInfuser
d5121dc880
Removed unnecessary ifdefs from Pimoroni boards (#802)
* Removed unnecessary ifdefs from Pim boards
* Re-ordered some pins
2022-05-04 15:26:55 -05:00
Andrew Scheller
3c450011da
Additional param-validation for PIO (#805)
The RP2040 datasheet says "If INT is 0, FRAC must also be 0."
2022-05-04 15:25:43 -05:00
Ryan Hartlage
6149b9e4ec
Add board definition for Seeed Xiao RP2040 (#691)
* Add board definition for Seeed Xiao RP2040

https://www.seeedstudio.com/XIAO-RP2040-v1-0-p-5026.html
https://wiki.seeedstudio.com/XIAO-RP2040/
2022-05-03 12:40:40 -05:00
bruelltuete
8554fc4ea1
Add is_at_the_end_of_time() method (#784) 2022-05-03 11:55:01 -05:00
ZodiusInfuser
01290c4cb3
Added int_frac function for configuring PWM (#768) 2022-05-03 11:54:46 -05:00
Andrew Scheller
8d43364cfb
Small typos (#776) 2022-05-03 11:47:48 -05:00
Andrew Scheller
1c9f72ba1c
Small edits to the Doxygen mainpage and update the RPi logo (#778) 2022-05-03 11:47:18 -05:00
bruelltuete
76c1830aeb
Add gpio_deinit (#793) 2022-05-03 11:46:27 -05:00
Andrew Scheller
c66a2c1c3b
Remove implicit grouping for PIO defines (#779) 2022-05-03 11:46:10 -05:00
Akiyuki Okayasu
e4a2aa7262
Fix typo in binary_info description (#788) 2022-05-03 11:43:42 -05:00
Andrew Scheller
fc86203f49
comment typo (#794) 2022-05-03 11:41:10 -05:00
Andrew Scheller
6619a2d329
Typo (#799)
Remove superfluous apostrophes in Doxygen comments
2022-05-03 11:34:46 -05:00
Graham Sanderson
5a427fbf1f
irq_add_shared_handler assertion fix #724 (#747) 2022-04-29 14:34:20 -05:00
ZodiusInfuser
bb5a2a3906
Added definition for Badger RP2040 board (#735) 2022-04-04 16:10:32 -05:00
Graham Sanderson
8291f1013a
add #ifdef guards to vgaboard.h to allow user overrides (#746) 2022-04-04 16:08:53 -05:00
Kai
e90f831756
add board definition of eetree gamekit rp2040 (#732) 2022-04-04 16:08:30 -05:00
Graham Sanderson
541f93541c
improve comment (#658) 2022-04-04 16:08:12 -05:00
Andrew Scheller
17d53af105
Allow 252-byte binaries to be checksummed (#764)
Fixes #740
2022-04-04 15:46:34 -05:00
Doug Rabson
1896b1491b
fix __ctzdi2 for values with non-zero low 32 bits (fixes #765) (#766) 2022-04-04 15:45:01 -05:00
ZodiusInfuser
3d45276423
Added board definition for upcoming Pimoroni servo driver (#769) 2022-04-04 15:31:52 -05:00
Andrew Scheller
d35083b3f7
Fix typo in SIO register description (#770) 2022-04-04 15:30:13 -05:00
Will Eccles
38b26b5d65
pico_sdk_import: don't recurse git submodules (#772)
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.
2022-04-04 15:29:33 -05:00
Brian Murphy
d54104a1e5
fix when PICO_NO_BINARY_INFO is set (#693)
Co-authored-by: Brian Murphy <brm@robotize.com>
2022-03-22 17:53:32 -05:00
Stefan Kerkmann
bc3484e793
Mark __aeabi_lmul section as allocatable and executable (#722)
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.
2022-03-22 17:51:24 -05:00
Andrew Scheller
b7e82b638a
Fix function-names reported by hardware_pwm_test (#736) 2022-03-22 17:49:17 -05:00
Andrew Scheller
bf9848eaf9
Updated DMA CTRL_TRIG.CHAIN_TO reset values (#743) 2022-03-04 16:47:41 -06:00
Akiyuki Okayasu
ae7ef546a6
Fix typo in Doxygen comment (#731) 2022-02-14 12:03:47 -06:00
Stephen Robinson
b3cf3e8f6f
Correct comment in time.h (#715)
There was `microseconds` written where there should have been `milliseconds`.

Co-authored-by: Stephen <stephen@drsudo.com>
2022-01-22 19:57:47 -06:00
bobsayshilol
25a3b36793
Fix assert in adc_set_round_robin() (#698)
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.
2022-01-19 09:34:18 -06:00
Daniel KJ
96afce8ece
Add board definition for Adafruit Macropad (#684)
* added board header for adafruit macropad rp2040

Co-authored-by: Daniel Kenyon-Jones <mail@dlkj.co.uk>
2022-01-19 09:32:17 -06:00
Andrew Scheller
5bcf4ed83a
Clarify header-comments about pico_enable_stdio_ CMake-functions (#705) 2022-01-19 09:30:21 -06:00
arturo182
e379f6764b
Add board definition for RP2040 Stamp and Carrier (#696) 2022-01-19 09:26:54 -06:00
Jonathan Reichelt Gjertsen
91462e430a
Add __attribute__((noreturn)) to _exit (#707)
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 | }
      | ^
```
2022-01-19 09:25:40 -06:00
Michael Olson
d831eff5a2
fix pioasm python output (#694) (#695)
Issue:
    irq wait 0
    irq 0
are translated as:
    irq(wait, 0)                          # 0
    irq(nowait, 0)                        # 1
wait/nowait are incorrect, should be block or ommited (alt: noblock).

After change:
    irq(block, 0)                         # 0
    irq(0)                                # 1
2022-01-08 13:55:23 -06:00
Thomas Fike
215f77b836
Moves the #if guards to before the comments (#690)
Fixes #683
2022-01-08 13:53:21 -06:00
David Shadoff
0f67a6c00c
Add board definition for Adafruit KB2040 (#676) 2021-12-13 09:45:29 -06:00
Graham Sanderson
add120e4f6
add missing change to dma.h from __force_inline fix (#680) 2021-12-08 12:32:09 -06:00
ZodiusInfuser
386e2a7bc6
Added Tiny2040 2MB (#672) 2021-12-08 12:06:53 -06:00
Graham Sanderson
0562089fab
fixup __forceinline for cpp code and add kitchen_sink cpp test (#670)
* 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
2021-12-08 12:05:49 -06:00
Andrew Scheller
269332dc21
rename pybstick26_rp2040.h to garatronic_pybstick26_rp2040.h (#675) 2021-12-06 11:37:24 -06:00
Maarten Vanraes
a8fa19a74d
pio_set_irqn_source_mask_enabled() sets wrong irq (#655)
if irq_index == 0, irq_index evaluates to false; which uses pio_set_irq1_source_mask_enabled() ; and vice versa
2021-11-12 07:51:29 -06:00
Graham Sanderson
699838d153
Start SDK 1.3.1 development (#648) 2021-11-01 21:46:36 -05:00
Graham Sanderson
2062372d20
SDK 1.3.0 release
See release notes for details

Co-authored-by: Brian Cooke <bdscooke@gmail.com>
Co-authored-by: Luke Wren <wren6991@gmail.com>
Co-authored-by: Uri Shaked <uri@urishaked.com>
Co-authored-by: Zapta <zapta@users.noreply.github.com>
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
Co-authored-by: Liam Fraser <liam@raspberrypi.com>
Co-authored-by: Gabriel Wang <embedded_zhuoran@Hotmail.com>
Co-authored-by: Matias Silva <matita.martins@gmail.com>
Co-authored-by: dp111 <19616418+dp111@users.noreply.github.com>
Co-authored-by: Leonardo La Rocca <46094699+leoli51@users.noreply.github.com>
Co-authored-by: Mahyar Koshkouei <mk@deltabeard.com>
Co-authored-by: Brian Starkey <stark3y@gmail.com>
Co-authored-by: Philip Howard <github@gadgetoid.com>
Co-authored-by: Mike Causer <mcauser@gmail.com>
Co-authored-by: Martino Facchin <m.facchin@arduino.cc>
Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
Co-authored-by: Manuel Wick <manuel@matronix.de>
Co-authored-by: Matias Silva <git@matiasilva.com>
Co-authored-by: Robert Pafford <19439938+rjp5th@users.noreply.github.com>
Co-authored-by: Alasdair Allan <alasdair@raspberrypi.com>
Co-authored-by: Engineer_Will <646689853@qq.com>
Co-authored-by: Garatronic <31109090+garatronic@users.noreply.github.com>
2021-11-01 14:20:54 -05:00
Graham Sanderson
60c5a929cc
Remove <b> from mutex doxygen due to PDF generation bug 2021-11-01 14:16:20 -05:00
Graham Sanderson
d0af70bd77
fix __packed attribute for MSVC (#646) 2021-11-01 13:29:02 -05:00
Graham Sanderson
da476610e2
allow override of XOSC_MHZ (#644)
* And increased assertion limit to 50 as 15 was the limit for the oscillator but not for XIN
2021-11-01 08:11:21 -05:00
Graham Sanderson
d7358e4ed8
update generated struct headers to fix collision (#641)
* update generated struct headers to fix collision and include all headers in kitchen_sink test
2021-11-01 08:06:34 -05:00
Garatronic
ccccff8450
Add pybstick26_rp2040 support (#636) 2021-10-31 09:31:51 -05:00
Andrew Scheller
d0c7642369
Update ADC ENOB comment to match (measured) value in RP2040 datasheet (#643) 2021-10-30 08:29:58 -05:00
Andrew Scheller
cc1e2e8758
Small typo in kitchen_sink (#642) 2021-10-30 08:29:26 -05:00
Graham Sanderson
e4d6ff9ecd
Small PICO_PLATFORM=host fixes (#639) 2021-10-28 15:16:36 -05:00
Andrew Scheller
97eec951b1
Another .org -> .com fix (#638) 2021-10-27 22:26:27 -05:00
Graham Sanderson
fba9c8ce4d
change SDK version to 1.3.0 (#628) 2021-10-26 16:09:32 -05:00
Andrew Scheller
da7c39bc23
Fix some of the (simpler) errors reported by the doxygen command (#617) 2021-10-26 16:09:06 -05:00
Graham Sanderson
b04a09110f
revert additional assertion check which breaks used of hw_alias macro outside of functions (#635)
* revert additional assertion check which breaks used of hw_alias macros outside of functions
2021-10-26 16:07:21 -05:00
Graham Sanderson
5641cd0a4a
__aeabi_memset* were switching the wrong arguments (#634) 2021-10-26 13:47:46 -05:00
Engineer_Will
68555c9751
Added some waveshare boards definition (#619) 2021-10-26 13:47:01 -05:00
Graham Sanderson
e5110dfce1
add docs for pio_instructions.h (#624)
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
2021-10-26 13:45:32 -05:00
Graham Sanderson
3604a6fa13
add CONTRIBUTING.md (#626)
Co-authored-by: Alasdair Allan <alasdair@raspberrypi.com>
2021-10-26 13:44:03 -05:00
Graham Sanderson
e850214938
Platform updates (#611)
* 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
2021-10-25 12:26:06 -05:00
Graham Sanderson
723dfd04ff
add more/better documentation to pico/multicore (#620) 2021-10-25 12:23:41 -05:00
Graham Sanderson
05418b4e71
fix minor bug in add_repeating_timer_us, and add some comments (#621) 2021-10-25 09:32:02 -05:00
Graham Sanderson
83cd1da1ef
fix build if TinyUSB not present (#631) 2021-10-25 08:56:25 -05:00
Graham Sanderson
0ccd0db163
Update to TinyUSB 0.12.0 (#622)
Update kitchent_sink compilation test to include TinyUSB to catch warnings
Fix warnings in stdio_usb and stdio_semihosting caught by above
2021-10-25 08:33:42 -05:00
Andrew Scheller
22b0d5d2ed
Update links in Doxygen pages from .org to .com (#625) 2021-10-23 08:45:43 -05:00
Graham Sanderson
3c72e753b6
Split recursive mutex into their own functions (was Reduce performance hit of recursive mutex) (#495)
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)
2021-10-20 18:27:59 -05:00
Graham Sanderson
9320d192c3
add watchdog_enable_caused_reboot (minor compatibility issue) (#594)
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.
2021-10-20 17:30:24 -05:00
Graham Sanderson
68571ad33e
Hardware struct regeneration (#613)
* Use reg[0] description for hardware structs register arrays

* Update struct headers to match SVD and latest svd2struct
2021-10-14 15:35:28 -05:00
Andrew Scheller
a0450d0133
Updated reg_headers and SVD (#612) 2021-10-14 12:21:14 -05:00
Robert Pafford
3c94bc8137
Change _watchdog_enable to trigger immediate reboot when no delay set (#561) 2021-10-14 11:30:16 -05:00
Graham Sanderson
f808b5f2dc
Add DREQ methods for PWM/SPI/UART/I2C (#603) 2021-10-12 16:04:16 -05:00
Graham Sanderson
2f2e62968d
Use auto-generated hardware/structs/ headers (based off SVD) SVD errors fixed. 2021-10-12 09:15:19 -05:00
Graham Sanderson
a793222331
add template PR - very polite (#596) 2021-10-12 09:13:44 -05:00
Graham Sanderson
ec4036181f
tweak info message for TinyUSB support (#590) 2021-10-12 09:09:09 -05:00
Graham Sanderson
db47fba48d
respect OUTPUT_NAME target property when generating supplemental files (#592) 2021-10-12 09:08:44 -05:00
Graham Sanderson
a0d4bdf731
fix pico_set_printf_implementation(TARGET compiler) (#593) 2021-10-12 09:08:15 -05:00
Graham Sanderson
d50e743e0e
make type punning of floating point/int in float_math and double_math use union to avoid warnings (#600) 2021-10-12 09:07:36 -05:00
Graham Sanderson
30673fb6d0
move inline assembly constant out into C code so it doesn't get out of range in a large function (#602) 2021-10-12 09:07:06 -05:00
Graham Sanderson
e76d5a9008
add dma_timer related methods (#604) 2021-10-12 09:04:59 -05:00
Graham Sanderson
9f1c37318b
add irq_get_priority method - improve efficiency of irq_init_priorities (#609) 2021-10-12 09:04:04 -05:00
Liam Fraser
4c9ba3e8ad
USB: Fix description of Length 0 in dpram_regs. Fixes #541 (#608) 2021-10-11 13:21:31 -05:00
Andrew Scheller
ace97f3387
More accurate register access-types and reset-values (#601)
* More accurate register access-types and reset-values

* I2C configuration constants are now included in the autogenerated header
2021-10-08 15:19:41 -05:00
Graham Sanderson
0fa58ed219
Adding/propage macros/signature typedefs for ROM functions. Make rom_func_lookup non-flash safe for flash functions (#586)
* add typedef signatures and ROM code defines for bootrom functions. Propogate uses thru SDK code. Add _inline version of rom_func_lookup
2021-10-08 09:02:19 -05:00
Graham Sanderson
0a32023aac
fix arg parsing segfault (#595) 2021-10-08 09:01:56 -05:00
Graham Sanderson
13be546dc3
pico_stdio improvements (#598)
* 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
2021-10-08 09:01:30 -05:00
Andrew Scheller
12017a07ab
SPINLOCK regs are RW. (#599) 2021-10-07 18:51:28 -05:00
Graham Sanderson
9319ab11d9
Add xip window alias macros (#566) (#585) 2021-10-07 08:18:02 -05:00
Graham Sanderson
62854f5eff
shrink max-page-size for linker to more sensible 4096 by default (#587) 2021-10-07 08:17:32 -05:00
Graham Sanderson
13ed99df0d
split out usb_reset_interface header into its own library for consumption by picotool or others (#589) 2021-10-07 08:17:13 -05:00
Graham Sanderson
0fdf543126
Missing extern C in datetime.h #581 (#584) 2021-10-04 15:17:00 -05:00
Matias Silva
3c53029c24
Fix some typos (#517) 2021-10-04 13:29:22 -05:00
Manuel Wick
ce0db40223
adafruit_feather_rp2040: Fix default I2C instance (#526)
Use i2c1 as default, because the default pins can't be muxed to i2c0.
2021-10-04 13:28:21 -05:00
Brian Starkey
a119b5bd9f
Fix semihosting_putc (#530)
Per the Arm semihosting protocol documentation[1], the SYS_WRITEC command
expects *a pointer to* the character to be printed in r1, not the
character itself.

[1] https://developer.arm.com/documentation/dui0471/g/Semihosting/SYS-WRITEC--0x03-?lang=en
2021-10-04 13:24:50 -05:00
ZodiusInfuser
eb42ecfaa5
Added definitions for some upcoming Pimoroni LED driver boards (#535)
* Added definitions for Plasma and Interstate boards

* Tweak to interstate pinout
2021-10-04 13:24:31 -05:00
Martino Facchin
cd4e53a202
Use W25Q080 second stage loader for Nano RP2040 Connect (#537)
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.
2021-10-04 13:23:18 -05:00
Andrew Scheller
f63a14e9ee
Change PWM_CH1_DIV_INT_LSB to PWM_CH0_DIV_INT_LSB (#560)
For consistency with all the other PWM_...._LSB constants
2021-10-04 13:21:55 -05:00
Mike Causer
2214468b51
Add Adafruit Trinkey QT2040 board (#525) 2021-10-04 13:11:45 -05:00
Philip Howard
e12713d70b
pio_assembler: typo fix (#538)
Change pleaced to placed
2021-10-04 13:11:03 -05:00
Andrew Scheller
e6b8c7b64e
bugfix: "WO" registers should be listed in the SVD as write-only, not read-write (#544) 2021-10-04 13:10:42 -05:00
Brian Starkey
1d0dcc8177
pico_time: Fix alarm_pool_dump_key format string (#557)
Add requred "%" before PRIu64.

pico-sdk/src/common/pico_time/time.c:282:20: warning: data argument not used by format string [-Wformat-extra-args]
2021-10-04 13:09:59 -05:00
Brian Starkey
46d8597d35
Add hardware_divider to pico_divider dependencies (#571)
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
2021-10-04 13:09:43 -05:00
Mahyar Koshkouei
d7feac1495
Fix syntax error in cmake when using custom stage2 (#580)
Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
2021-10-04 13:09:23 -05:00
Leonardo La Rocca
ca232e9404
Add Melopero Shake RP2040 Board header file (#565)
* added melopero shake definition
2021-10-04 13:07:16 -05:00
dp111
c08136b696
Move ret_dzero to the same section as it get used (#513) 2021-08-11 09:24:23 -05:00
Andrew Scheller
672d18a6f0
Fix default PICO_BOARD value (#536) 2021-08-06 12:21:59 -05:00
Luke Wren
2622e9bc29 Enable UART RX timeout IRQ, as well as RX IRQ, so that individual characters can be received. 2021-07-22 14:46:29 +01:00
Luke Wren
9a586371db
Add doxygen clarifying PWM behaviour when enabled/disabled, and advice for controlling the pin state when disabled (#521) 2021-07-19 10:21:12 -05:00
graham sanderson
a6a436b1fe use PUBLIC for pio headers on any target except INTERFACE library 2021-07-19 12:09:57 +01:00
Matias Silva
7e90980118
Add explanatory note on 7-bit I2C addresses (#520) 2021-07-19 12:02:19 +01:00
Matias Silva
ae6e574f53
Improve wording of comments in irq.h (#509) 2021-07-15 09:32:45 +01:00
Gabriel Wang
ccc0ba5649
elf2uf2: correctly parse ELF files where the program header is not directly following the file header
fixes #506
2021-07-14 15:59:09 -05:00
Graham Sanderson
5e05469373
bug in sleep_until on host mode for macOS (#502) 2021-07-06 12:19:39 -05:00
Liam Fraser
dc4342f0f6 Update usb regs to fix https://github.com/raspberrypi/pico-feedback/issues/172 2021-07-06 17:02:33 +01:00
Graham Sanderson
35b4965054
make sure PICO_DEFAULT_BOOT_STAGE2_FILE is defined in parent CMake file (#491) 2021-07-06 16:56:17 +01:00
graham sanderson
e02c6b327d Allow one of float/double to have 'none' impl but not the other - previously caused a link error 2021-07-06 16:24:46 +01:00
graham sanderson
f4ab723eb5 compile failure with PICO_STDOUT_MUTEX=0 2021-07-06 16:06:52 +01:00
graham sanderson
529d7087eb fix operatore precedence of */ vs +- in pioasm 2021-07-06 16:00:02 +01:00
Graham Sanderson
cefe5c5b2a
Better support for PICO_DISABLE_SHARED_IRQ_HANDLERS (#496)
* 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>
2021-06-29 11:55:35 -05:00
Luke Wren
edcb65c916
Enable I2C FIFO full hold in slave mode (stretch clock when RX full), fixes #456 (#494) 2021-06-29 11:55:01 -05:00
Andrew Scheller
f16ccfa1ff Small comment typos 2021-06-29 10:57:21 +01:00
graham sanderson
44feae4caf set DIVISOR for each use of h/w divider 2021-06-29 10:55:14 +01:00
Zapta
61b7cbdc54
Using ' inline __always_inline' also for GNUC 7. (#484)
Per the discussion at https://www.raspberrypi.org/forums/viewtopic.php?f=145&t=313961
2021-06-28 16:07:48 -05:00
Graham Sanderson
21bbaf3ca6
remove -Winline (#481) 2021-06-28 16:05:14 -05:00
Uri Shaked
4328b2c75f
fix pioasm python output (#479)
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()
```
2021-06-07 22:02:04 -05:00
Luke Wren
1f1c6162cd
Header info string updates for PIO DBG_PADx and XOSC STARTUP (#478) 2021-06-04 10:39:00 -05:00
graham sanderson
979045dc12 removed CMSIS from SDK doxygen 2021-06-03 16:46:19 -05:00
Brian Cooke
d42e6a9d10
include pico.h so that uint is defined (#475) 2021-06-03 15:22:28 -05:00
graham sanderson
654b66693f start 1.3.0 development 2021-06-03 10:49:01 -05:00
Graham Sanderson
bfcbefafc5
Merge pull request #472 from raspberrypi/release.1.2.0
SDK 1.2.0 release; see release notes for details
2021-06-03 10:46:02 -05:00
graham sanderson
fdf695b8d8 remove incorrect default from PICO_PANIC_FUNCTION PICO_CONFIG entry 2021-06-03 10:42:31 -05:00
graham sanderson
45a1e08265 fix sem_acquire_block_until function name 2021-06-03 10:36:48 -05:00
ZodiusInfuser
c44e62defd
Added board definition (#471) 2021-06-03 10:24:12 -05:00
Luke Wren
bba0420c76
Add gpio_set_irqover to match inover/outover/oeover (fixes #265) (#470) 2021-06-03 08:37:06 -05:00
graham sanderson
8d7bdd2006 change version to 1.2.0 proper 2021-06-02 15:35:29 -05:00
Graham Sanderson
4b0dea4339
Move to upstream tinyusb (#467)
* Move to tinyusb 0.10.1 (from upstream tinyusb)
2021-06-02 15:27:11 -05:00
Ha Thach
eeb6b501ff
fix qtpy rp2040 uart rx rev B (#466)
also add static check for USB DPRAM
2021-06-02 14:00:29 -05:00
Graham Sanderson
5afa3636d6
Small API additions and minor fixes (#406)
* 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
2021-06-02 13:12:27 -05:00
Graham Sanderson
91e9327ff1
Add PICO_PANIC_FUNCTION define to allow replacement of the default panic function (#463) 2021-06-02 13:04:38 -05:00
Liam Fraser
b3e1d2d8b8
Add usb device dpram to svd file. Fixes #351 (#465) 2021-06-02 13:04:27 -05:00
Graham Sanderson
561502c2da
Move to Tinyusb 0.10.0 (still with RP patches) (#462)
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
2021-06-02 13:04:08 -05:00
graham sanderson
496ff66d19 Make PICO_CONFIG descriptions unique 2021-06-02 16:14:11 +01:00
graham sanderson
66c54d807b fix PICO_CONFIG entry 2021-06-02 16:14:11 +01:00
graham sanderson
27c1a89b3d review fixes 2021-06-02 16:14:11 +01:00
graham sanderson
895bad790e Add some spin lock related doxygen 2021-06-02 16:14:11 +01:00
Luke Wren
30041d8513
Add hardware_gpio accessors for Schmitt, slew rate, drive strength (fixes #290) (#464) 2021-06-01 14:25:11 -05:00
Dan Halbert
d026118499
Allow lengthening xosc startup delay with a compile option (#457) 2021-06-01 14:24:40 -05:00
Rene
42cbdcb13a
added spi_get_baudrate() + some consistency changes (#395)
* added spi_get_baudrate()
2021-06-01 11:12:15 -05:00
ewpa
c573775f86
Change the quick-start instructions to include installation of the (#92) 2021-05-31 12:17:00 -05:00
geurtv
1996a21e3a
dma_channel_transfer_[from/to]_buffer_now: added const volatile to read_addr and volatile to write_addr (#449) 2021-05-27 12:12:39 -05:00
Brendan
e0872a32cc
Add missing board detection macros (#448)
* add board detection macros for Sparkfun & RPi Pico / VGA Board
2021-05-27 11:55:38 -05:00
Jonathan Reichelt Gjertsen
5ad072af5b
Add function to get the currently selected channel (#451)
This is most useful in combination with round-robin sampling to avoid
having to track it manually.
2021-05-27 07:25:40 -05:00
Jonathan Reichelt Gjertsen
a531123080
Prevent the literal string DEBUG from being appended to some messages in CMake < 3.15 (#433)
Fixes issue #422
2021-05-25 17:10:55 -05:00
Rene
6994a3858d
-some typo fixes (#408)
-small consistency changes
2021-05-24 16:56:56 -05:00
Rene
2eb76bb058
- interp_ fixes (#428)
* - 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
2021-05-24 16:56:11 -05:00
Jonathan Reichelt Gjertsen
b8dc054eba
queue: make data pointers const in queue_try_add and queue_add_blocking (#423)
The only operation done on the data pointer is to pass it into the second
argument of memcpy, which is `const void *`
2021-05-24 16:52:49 -05:00
Jonathan Reichelt Gjertsen
cc8b2156fb
Define void operator delete[](void *p, std::size_t n) in new_delete.cpp (#430) 2021-05-24 16:47:29 -05:00
Jonathan Reichelt Gjertsen
048fcdefd6
Prevent warnings about some unused parameters in pico_stdio_usb when building with -Wextra (#431)
* 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`)
2021-05-24 16:42:28 -05:00
Jonathan Reichelt Gjertsen
80356a4f02
Define __STRING for other compilers than MSVC in the host platform.h file (#434) 2021-05-24 16:40:29 -05:00
Jonathan Reichelt Gjertsen
d79dd219ce
Implement uart_write_blocking and uart_read_blocking for host (#438) 2021-05-24 16:37:31 -05:00
Jonathan Reichelt Gjertsen
94b83315d9
Update host multicore.h to match multicore.h in rp2_common (#439) 2021-05-24 16:35:11 -05:00
Andrew Scheller
777ccb8e56
Fix function-name misspelling (#443)
If "init tty" is `_inittty` then "reset tty" ought to be `_resettty`
2021-05-24 16:34:23 -05:00
Martino Facchin
17ee1a877d
Add support for Arduino Nano RP2040 Connect (#425)
* Add support for Arduino Nano RP2040 Connect

* Add support for at25sf128a flash

Derived from W25Q080 code, QE bit is set via a single command
2021-05-24 16:32:56 -05:00
Jonathan Reichelt Gjertsen
b2832b3acb
Fix wrong format string in alarm_pool_dump_key (#437)
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
```
2021-05-24 16:32:31 -05:00
Jonathan Reichelt Gjertsen
060123dc8d
Optional feature to get the max level that has ever been held by a queue (#444)
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.
2021-05-24 16:31:30 -05:00
Jonathan Reichelt Gjertsen
596d08ea62
Add missing cast to uint32_t in hw_divider_u32_quotient for host (#436)
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;
                          ^~
```
2021-05-23 08:21:09 -05:00
Rafael G. Martins
a32d614b43
pioasm: prevent double inclusion for C SDK generated headers (#417) 2021-05-18 18:05:35 -05:00
Joni Kähärä
5384b6b4d3 add comment about using clk_gpout0 enable bit (Fixes #413) 2021-05-17 09:12:41 +01:00
Graham Sanderson
607b42006a
fix pico_promote_common_scope_vars (#397) 2021-05-13 07:39:04 -05:00
Graham Sanderson
574fdee37b
Fixup divider save_restore for floating point too; improve tests (#405)
- 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
2021-05-13 07:38:42 -05:00
Graham Sanderson
c6c4eeb122
add timeout_us/until to mutex/sem blocking methods (#402) 2021-05-12 16:32:45 -05:00
Andrew Scheller
54c78bf985
Fix the PICO_CONFIG default value for PICO_CMSIS_RENAME_EXCEPTIONS (#399) 2021-05-11 19:21:44 -05:00
Graham Sanderson
b05d863428
Add basic CMSIS core headers (#384)
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
2021-05-11 10:47:13 -05:00
Graham Sanderson
6182a2a078
make host pico_platform.h and binary_info.h CMakeLists.txt safe for inclusion in non SDK build (#388)
* make host pico_platform.h and binary_info.h CMakeLists.txt safe for inclusion in non SDK build

* fix comment
2021-05-11 10:37:49 -05:00
Graham Sanderson
508828f8ea
allow setting exception handler to the same value, as this might happen if exceptions are set dynamically on both cores, but VTOR is the same... this should indeed cause an error if the values differ, but not otherwise (#385) 2021-05-11 10:34:41 -05:00
Graham Sanderson
36dda1c5c4
Fix some hardware_library dependencies (#383) 2021-05-11 10:34:11 -05:00
Graham Sanderson
e57b99a652
Rework ordering of cmake, so that libraries in subdirectories can add to internal lists as PICO_SDK_POST_LIST_FILES, PICO_CONFIG_HEADER_FILES etc. (#382)
Move generation of config header later, so it gets to include all values for PICO_CONFIG_HEADER_FILES
2021-05-11 10:33:34 -05:00
Andrew Scheller
9396b9c7e1
Fix a bunch of doxygen typos (#391) 2021-05-10 08:48:09 -05:00
Andrew Scheller
ecf66bf514
Correct doxygen for mutex_try_enter (#392) 2021-05-10 08:47:23 -05:00
Andrew Scheller
114dc5a80d
Fixup IRQ_PRIORITY #define values (#393)
Related to #245
2021-05-10 08:46:53 -05:00
Graham Sanderson
8d4f4e148d
remove spurious sys/select.h include (#377) 2021-05-05 11:51:18 -05:00
Graham Sanderson
6d87da4c59
Rework lock_core / timers (#378)
- 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
2021-05-05 11:46:25 -05:00
Graham Sanderson
ec0dc7a88b
add __always_inline to trivial super low level inline functions (#379) 2021-05-05 11:46:07 -05:00
Graham Sanderson
53f1915a6b
Add hardware_exception for setting exception handlers at runtime (#380) 2021-05-05 11:45:39 -05:00
Luke Wren
7fc75d8c90
Definitions for IC_TX_BUFFER_DEPTH inconsistent (fixes #335) (#381) 2021-05-05 11:45:12 -05:00
fivdi
8f3c3ff12a i2c: improve communication with i2c devices in i2c_write_blocking 2021-05-05 14:46:09 +01:00
Graham Sanderson
18c39856bd
Some cmake build improvements (#376)
* 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
2021-05-04 08:40:11 -05:00
Graham Sanderson
929ede7482
add small delay to stdio_get_until to prevent starvation of USB IRQ handler due to in use mutex. build was non deterministic due to missing link wrapping of getchar (#364) 2021-05-04 08:01:34 -05:00
Graham Sanderson
b6f812f647
Change various (confusing to user) message to be DEBUG only (#365) 2021-05-04 08:01:11 -05:00
Graham Sanderson
b7da70a53b
make all non hardware_ libraries foo add C preprocessor definition LIB_FOO=1, and remove bespoke definitions which were all undocumented anyway (#374) 2021-05-04 08:00:17 -05:00
Graham Sanderson
6796faf0d5
add PICO_DIVIDER_DISABLE_INTERRUPTS flag which makes PICO_DIVIDER disable interrupts around division rather than using co-operative guards to protect nested use (i.e. within IRQ/exception). Use of this flag can simplify porting of RTOSes but with a different performance profile (#372) 2021-05-04 07:48:07 -05:00
Graham Sanderson
c979ca591f
disable core 0 SIO FIFO IRQ handler during core 1 launch in case someone has already installed one (#375) 2021-05-04 07:43:25 -05:00
Exr0n
d35d1b331e
Fix path + typo in README.md (#347)
* Fix path + typo in README.md

* Remove incorrect path change

* Remove typo
2021-05-02 15:14:17 -05:00
Graham Sanderson
4c83c10f01
make spi_init return baud rate set (#296) 2021-05-01 14:34:28 -05:00
Andrew Scheller
5259693774
Small typos (#366) 2021-05-01 14:32:16 -05:00
Ha Thach
6c4d25b887
correct adafruit flash size for itsybitsy and qt rp2040 (#348)
from 4 MB to 8 MB
2021-04-21 08:26:57 -05:00
Andrew Scheller
b17fc76c8f
Clarify multicore_fifo doxygen (#323)
Based on my observations in #284
2021-04-18 17:10:24 -05:00
Kirk Benell
b8dbbcf0d7
SPI Definitions for SparkFun boards (#344)
* 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>
2021-04-18 17:07:35 -05:00
ZodiusInfuser
93d3cf4d8e
Updated existing Pimoroni board headers to match latest style, and added a new board (#343)
* Updated existing pimoroni board headers to newer style from pico.h

* Added new pimoroni board headers

* Fixed incorrect MB and missing _pin

* Removed SPI defaults from Picosystem
2021-04-18 16:13:47 -05:00
Andrew Scheller
c6d70d51f4
Source code licence clarification (#340) 2021-04-15 15:35:06 -05:00
Michael Stoops
127543a425
Fixing arithmetic underflow in SPI I/O loops https://github.com/raspberrypi/pico-sdk/issues/337 (#338)
Co-authored-by: Michael Stoops <spam@michaelstoops.com>
2021-04-13 23:06:14 +01:00
Andrew Scheller
9c3538e8b0
Remove MASTER_ON_HOLD bit from I2C status registers. Fix typos. (#326) 2021-04-12 11:15:50 +01:00
Andrew Scheller
ec16d3ff28
Fix param-validation for PIO sideset encoding (#311) 2021-04-12 11:13:22 +01:00
Luke Wren
5fdc663ff8
Fix implementation config listing in structs/i2c.h (#325) 2021-04-09 14:42:06 +01:00
Luke Wren
962da33ea7
Clarify that cache is flushed, but that function is intended for low-level metadata access during startup (#322) 2021-04-09 08:05:29 -05:00
Luke Wren
344b961ebf
Fix implementation config listing in structs/i2c.h (#324) 2021-04-09 08:03:19 -05:00
Scott Shawcroft
814d2bd855
Make flash_do_cmd public (#269)
* Make flash_do_cmd public

* Fix typo in comment
2021-04-09 11:47:16 +01:00
Brian Cooke
f69f513a29
i2c: set high and low times to values that conform to the i2c specification (#314) 2021-04-09 11:00:33 +01:00
Andrew Scheller
4fe995d0ec
Update NULL GPIO function to 0x1f (#320)
Fixes #210
2021-04-08 15:25:01 -05:00
graham sanderson
aabae62caa Merge branch 'master' into develop 2021-04-07 08:29:59 -05:00
graham sanderson
afc10f3599 1.1.2 release 2021-04-07 08:17:18 -05:00
Graham Sanderson
92f948c123
Make kitchen_sink check param assertions, and include all headers - fix sign-compare warnings (#316) 2021-04-06 20:50:26 -05:00
Lyle Cheatham
0911393fe2
Changed the parameter check to avoid tripping -Werror on spin locks (#307)
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
2021-04-06 16:41:57 -05:00
graham sanderson
d974a3b0e9 boot_stage2: cleanup and correctness fixes 2021-04-06 12:47:34 -05:00
graham sanderson
c6f87c7d62 set version to 1.1.2 2021-04-06 11:09:32 -05:00
Brian Cooke
2e777d47d3
i2c: set hold time of SDA during transmit to an appropriate value (#273)
* 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>
2021-04-06 10:57:25 +01:00
majbthrd
162098678b
move PLL reset code from clocks driver to pll driver (#110)
* 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>
2021-04-06 10:42:18 +01:00
Graham Sanderson
fd16563f8f
Merge pull request #299 from raspberrypi/back-merge-1.1.1
Back merge 1.1.1
2021-04-01 17:32:02 -05:00
graham sanderson
1089c1b83a remove whitespace 2021-04-01 17:31:01 -05:00
graham sanderson
707555f5bc revert version number to correct develop settings 2021-04-01 17:27:33 -05:00
Graham Sanderson
1769968c42
Merge pull request #298 from raspberrypi/fix-version
fix version to non develop
2021-04-01 17:25:45 -05:00
graham sanderson
63d1baf263 fix version to non develop 2021-04-01 17:25:19 -05:00
Graham Sanderson
02b98e5476
Merge pull request #297 from raspberrypi/develop-1.1.1
Develop 1.1.1
2021-04-01 17:22:06 -05:00
graham sanderson
1b25cf0ed1 set version for release 2021-04-01 16:43:50 -05:00
Graham Sanderson
7f2f186bcc
build: allow board config header to specify bootstage 2 without using custom per board cmake (#293)
* 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
2021-04-01 16:42:53 -05:00
Graham Sanderson
260128a725
fixup elf2uf2 to allow blocked_ram (flash) binaries (#294) 2021-04-01 15:03:04 -05:00
Earle F. Philhower, III
3c0309c10e
Add pico_get_unique_board_id_string API (#281)
* 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 .
2021-03-30 09:04:58 -05:00
Liam Fraser
859d1d27b8
Don't advertise REMOTE_WAKEUP for USB stdio as it is is not currently implemented. Longer term need to implement REMOTE_WAKUP properly in TinyUSB. Similar fix needed in MicroPython to fix MicroPython issue #6866. The symptom is that USB serial will stop working if there is a delay of > 2 seconds ish between messages. We have seen this issue on Linux laptops with USB autosuspend enabled. (#289) 2021-03-30 09:03:28 -05:00
Andrew Scheller
85ac3d7cf8
I2C doxygen typos (#287)
* I2C doxygen typos

* another typo
2021-03-29 11:37:50 -05:00
Tom Wasiluk
c1f164b9fd
corrected clk_gpout3 to gpio pin 25 as per the rp2040 datasheet (#250) 2021-03-24 09:35:02 -05:00
Andrew Scheller
0c941d9767
Tweaks to PIO clkdiv-setting code (#254)
- refactor to reduce duplication
 - add extra param-validation
2021-03-24 09:32:38 -05:00
Mike Bell
a47d6d6e14
Allow heap end to be equal to stack limit (#266) 2021-03-24 09:26:54 -05:00
Andrew Scheller
1d4588a565
Board-header typos (#270) 2021-03-24 09:15:36 -05:00
Luke Wren
98574564b8
Add gpio_get_out_level() accessor, and correct SIO GPIO_OUT struct ty… (#247)
* Add gpio_get_out_level() accessor, and correct SIO GPIO_OUT struct type from WO to RW

* Clean up ambiguous-looking parentheses
2021-03-22 12:54:33 -05:00
Jeff Epler
e9a521a9b1 rtc_get_datetime: read the rtc registers just once each
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.
2021-03-22 09:11:51 -05:00
Andrew Scheller
f76567eb7f Merge pico_sdk_version.cmake changes from develop branch into develop-1.1.1 branch 2021-03-21 19:07:32 -05:00
José Simões
304ab7dd92
Fix loading of PICO_TOOLCHAIN_PATH (#262)
- Add double quotes because build option it's a string.
- Remove comment as requested by @kilograham.
- Resolves #258.
2021-03-18 15:02:21 -05:00
Andrew Scheller
f6d32f87a1
Fix typo in sparkfun_micromod.h (#268) 2021-03-18 14:41:40 -05:00
Graham Sanderson
fe3408b286
Small fixes (#260)
* 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)
2021-03-17 18:05:48 +00:00
Andrew Scheller
cdf1a956eb
Typo (#251) 2021-03-15 14:29:59 -05:00
Andrew Scheller
336aae518e
Fix ROSC typo (#259)
* Fix ROSC typo

* Additional ROSC typos
2021-03-15 13:57:37 -05:00
Luke Wren
6c1150f3f4
Fix back-to-front description of IRQ priority in doxygen (#245) 2021-03-13 18:08:04 -06:00
Graham Sanderson
d36b1ca8ae
hardware_timer: fix race condition whem a new timer being added becomes missed thus obviating the need for an IRQ but there is an IRQ already pending for another timer (#243) 2021-03-10 12:04:04 -06:00
Andrew Scheller
a2576202ff Add param-validation to spin_lock_instance 2021-03-10 11:06:34 +00:00
Andrew Scheller
26fd36f853 Fixup incorrect doxygen for multicore_fifo_wready 2021-03-10 11:01:51 +00:00
graham sanderson
3ad5e1570c missing group rubbish: 2021-03-10 11:00:42 +00:00
graham sanderson
a2c7d7507b build: fix mismatched config descriptions 2021-03-10 11:00:42 +00:00
graham sanderson
ea40696827 fix config type 2021-03-10 11:00:42 +00:00
graham sanderson
5867849b17 start development of 1.2.0 2021-03-10 11:00:42 +00:00
graham sanderson
c4e35d914d build: fix mismatched config descriptions 2021-03-08 15:12:07 -06:00
Christian Flach
6f7dc67791
pio: allow programs with 32 instructions (#236) 2021-03-08 12:48:28 -06:00
graham sanderson
c68a57aa34 start 1.1.1 patch branch 2021-03-08 12:35:17 -06:00
Christian Flach
090c5cd83b
pio: Add 'pragma once' to generated header files (#237)
We can't really use traditional include guards, because the header file may be piped to stdout (which means we might not have a file name).
2021-03-08 12:21:36 -06:00
Andrew Scheller
20b9823aca
Delete some redundant CMake parts (#240) 2021-03-08 12:02:22 -06:00
Graham Sanderson
fc10a97c38
Merge commit of 1.1.0 changes 2021-03-05 09:11:54 -06:00
graham sanderson
8c059ca147 Merge branch 'develop' into mergeable-develop 2021-03-04 21:23:34 -06:00
Graham Sanderson
d4b0408fb8 tinyusb: restore correct version (#233) 2021-03-04 21:22:48 -06:00
Graham Sanderson
595062faac change revision to 1.1.0 (#231) 2021-03-04 21:22:48 -06:00
Graham Sanderson
04ee63428f Remove PICO_FLASH_SIZE_BYTES warning from header as it breaks any build with -Werror; actual uses that care should warn instead (#229) 2021-03-04 21:22:48 -06:00
Andrew Scheller
4c768d2bb8 Add some extra defines to customise behaviour of STDIO_USB_RESET modes (#226)
* Add some extra defines to customise behaviour of STDIO_USB_RESET modes

* Tweaks to STDIO_USB_RESET defines
2021-03-04 21:22:48 -06:00
Andrew Scheller
dff0633c20 Add some extra defines to platform_defs.h (#227) 2021-03-04 21:22:48 -06:00
Andrew Scheller
62b2d33e8f Add PICO_DEFAULT_SPI pins to pico.h (#225)
(and define min and max values for some of the PICO_DEFAULT_* configs)
2021-03-04 21:22:48 -06:00
Andrew Scheller
2b1dbfa3d2 Fix SDK to build cleanly if PICO_DEFAULT_UART isn't defined (#223) 2021-03-04 21:22:48 -06:00
James Hughes
9ba10751f8 Doxygen Updates (#117)
Fixed font for examples
Removed extraneous tag in DoxygenLayout.xml
More spacing on Doxygen version number, associated position change for seach boxes.
2021-03-04 21:22:48 -06:00
Andrew Scheller
f3ee2f311c Modify extract_configs.py to deal with _u(X) macros (#222) 2021-03-04 21:22:48 -06:00
graham sanderson
6770bd2a46 use _u(0x800) insteand of 0x800u in platform_defs which is included by assembler 2021-03-04 21:22:48 -06:00
Andrew Scheller
549eec6568 Previous change didn't allow CI checks to run when an external fork PRs to raspberrypi 2021-03-04 21:22:48 -06:00
Andrew Scheller
1a2bb7c219 Add SPI enums to Doxygen output, fixes #213 (#216)
Also fix a few typos
2021-03-04 21:22:48 -06:00
Andrew Scheller
0755674cc4 Attempt to prevent workflows being triggered on forks 2021-03-04 21:22:48 -06:00
Andrew Scheller
1413a4f470 Fixup PICO_CONFIG entries (#208)
* remove default=undefined
 * fix a couple of typos / syntax "errors"
 * perform even better default-value-checking in extract_configs.py
2021-03-04 21:22:48 -06:00
Andrew Scheller
fc17f880fd Lots of Doxygen tweaks and fixes (#212)
* 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
2021-03-04 21:22:48 -06:00
Andrew Scheller
b64cb686ae Remove PICO_SMPS_MODE_PIN from boards/vgaboard.h (#209)
...as it's already present in boards/pico.h
2021-03-04 21:22:48 -06:00
Graham Sanderson
7ee36e3328 Rationalize board header pin defines, and add partner board headers (#192)
* 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>
2021-03-04 21:22:48 -06:00
Liam Fraser
839224c2a3 Add cmake build github action 2021-03-04 21:22:48 -06:00
Andrew Scheller
e870582e48 Typo
Set correct name in PICO_CONFIG line for PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
2021-03-04 21:22:48 -06:00
graham sanderson
383e88ea16 Add support for resetting RP2040 via the USB connection when using pico_stdio_usb
- 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
2021-03-04 21:22:48 -06:00
graham sanderson
61e46fefe5 Add binary info 'feature' for pico_bootsel_via_double_reset 2021-03-04 21:22:48 -06:00
graham sanderson
8ada5fa7eb hardware_rtc: make rtc_enable_alarm public 2021-03-04 21:22:48 -06:00
Graham Sanderson
4904fe2e32 remove broken and fairly pointless deep sleep API (#198)
* 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>
2021-03-04 21:22:48 -06:00
Andrew Scheller
f239bd3de5 Fixup PICO_FLASH_SIZE_BYTES PICO_CONFIG entry (no default) 2021-03-04 21:22:48 -06:00
Andrew Scheller
a53b3a2ff0 extract_configs: Do better matching-up of default values (regex was too strict)
also error if PICO_CONFIG says there's a default but no matching #define is found
2021-03-04 21:22:48 -06:00
foopub
a989f4f6ee Added ".syntax unified"
Otherwise gcc complains. I've tested this to work with the normal CMakeLists.txt provided in a few examples.
2021-03-04 21:22:48 -06:00
foopub
542b86e5db Replace unavailable flag-preserving instruction
It seems sub requires thumb2 instructions which are unavailable. This is in line with the rest of the sdk code base which uses subs.
2021-03-04 21:22:48 -06:00
graham sanderson
e371f6af60 remove useless PICO_ALLOW_SLEED_IN_EXCEPTION 2021-03-04 21:22:48 -06:00
graham sanderson
aca685ceae panic in debug mode if sleep methods are called in an exception handler (unless PICO_ALLOW_SLEEP_IN_EXCEPTION is set) 2021-03-04 21:22:48 -06:00
Andrew Scheller
6b2c249961 Also check enum params and doxygenise pio_mov_status_type 2021-03-04 21:22:48 -06:00
Andrew Scheller
786be7524a Extra param-checking for hardware_pio library (switch asserts to valid_params_if, and add additional checks) 2021-03-04 21:22:48 -06:00
Andrew Scheller
e5d61f1ad3 Add some "\ingroup timestamp" doxy-comments so that they actually appear in the output! 2021-03-04 21:22:48 -06:00
Andrew Scheller
c1c7197757 Remove duplicate PARAM_ASSERTIONS_ENABLED_SYNC PICO_CONFIG entry 2021-03-04 21:22:48 -06:00
Graham Sanderson
743dbabdec Pico flash size bytes (#159)
* 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
2021-03-04 21:22:48 -06:00
graham sanderson
0d789c9b54 fix compiler warning 2021-03-04 21:22:48 -06:00
graham sanderson
7ed5d87fb1 host mode fixups 2021-03-04 21:22:48 -06:00
graham sanderson
3f5f5a1fd7 pio: improve (slightly) error message for claim failure on PIO 1 2021-03-04 21:22:48 -06:00
graham sanderson
d652f71e1b move test cases after PICO_SDK_POST_LIDR_DIRS inclusion, so pico-host-sdl can be used 2021-03-04 21:22:48 -06:00
graham sanderson
d3fa64afc8 cmake: change warning message for unititialized TinyUSB 2021-03-04 21:22:48 -06:00
Graham Sanderson
e526e4f850 %g should not print 0 as infe-308 (#185) 2021-03-04 21:22:48 -06:00
Andrew Scheller
4335268a93 Default PARAM_ASSERTIONS_ENABLED_LOCK_CORE to 0 (#184)
so that it matches all the other PARAM_ASSERTIONS_* default values
2021-03-04 21:22:48 -06:00
Zachary Kohnen
132d6df695 Add 'hardware/structs/sio.h' header to the 'pico/multicore.h' header\n\nThe pico/multicore.h header uses the sio_hw struct, but does not include the header that defines it. This normally is not a problem since other headers include the structure as well, but since this structure is used in the header, we should not rely on other headers bringing it in and instead include it directly (#176) 2021-03-04 21:22:48 -06:00
Graham Sanderson
e730e03e7f No malloc for default alarm pool an pheap docs/cleanup (#143)
* Statically allocate the default timer pool (to avoid pulling in malloc); doxygen for pheap (and some function name changes)

* fix comments
2021-03-04 21:22:48 -06:00
graham sanderson
0a22f704a6 re-arrange pico/types.h to avoid duplicate doxygen 2021-03-04 21:22:48 -06:00
graham sanderson
228de60da0 fix comment 2021-03-04 21:22:48 -06:00
graham sanderson
684986aae6 fix the represntation of at_the_end_of_time to be 63 one bits rather than 32 2021-03-04 21:22:48 -06:00
graham sanderson
debef7471e Change _U to _u as _U exists in ctype.h 2021-03-04 21:22:48 -06:00
graham sanderson
503bc8b385 Fixup another level of compiler warnings, add _U() definition 2021-03-04 21:22:48 -06:00
Andrew Scheller
7ded9df488 Explicitly mark constants in autogenerated headers as unsigned values 2021-03-04 21:22:48 -06:00
graham sanderson
f16af45f9e b0 sincos shim was incorrect, causing crash 2021-03-04 21:22:48 -06:00
Peter Lawrence
173d63ef8d elf2uf2: fix address range bug 2021-03-04 21:22:48 -06:00
graham sanderson
1822d113d9 elf2uf2: fix breakage for no_flash builds; removep 0xFFFFFFFF constantds and error messsage 2021-03-04 21:22:48 -06:00
Peter Lawrence
cfff23c5a3 elf2uf2: determine entry address selected by Boot ROM (Plan B) 2021-03-04 21:22:48 -06:00
Peter Lawrence
ef030701c9 elf2uf2: determine entry address selected by Boot ROM 2021-03-04 21:22:48 -06:00
Graham Sanderson
b53b0bac70 Bunch of small fixes (#154)
* 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>
2021-03-04 21:22:48 -06:00
Graham Sanderson
0732d0c2a3 Add more memory barriers to avoid code re-ordering issues with DMA (#155)
* Add more memory barriers to avoid code re-ordering issues with DMA

* Comment typos

* Fix Wstrict-prototype on __compiler_memory_barrier

* Remove now-redundant __compiler_barrier macro from hardware_flash

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-03-04 21:22:48 -06:00
graham sanderson
4b7ffd71f0 add boot2 info to binary info 2021-03-04 21:22:48 -06:00
Jeremy Grosser
4639e75d0d pioasm: Ada output format 2021-03-04 21:22:48 -06:00
Andrew Scheller
7fea95386c REAMDE.md improvements
Fix the order of the steps (fixes #133) and make it clearer that step 2 is choose-just-one-option
2021-03-04 21:22:48 -06:00
Luke Wren
df3e9c9536 Missing comma in pioasm python wait output 2021-03-04 21:22:48 -06:00
Luke Wren
d492b72c29 Add pico_bootsel_via_double_reset library, fix #87 (#137)
* 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
2021-03-04 21:22:48 -06:00
Graham Sanderson
0828178561 fixup not/reverse for pioasm python output (#146) 2021-03-04 21:22:48 -06:00
graham sanderson
dee8bd992c remove always true assertions (fix #83) 2021-03-04 21:22:48 -06:00
graham sanderson
18dbb5985c move two hardware_timer methods to the right doxygen group (fix #131) 2021-03-04 21:22:48 -06:00
graham sanderson
8b6d27d0e5 missing pico/malloc.h fixes #136 2021-03-04 21:22:48 -06:00
Graham Sanderson
6f94f6a3d7 Add -Wuninitialized -Wunused -Wcast-align to warnings checked by kitchen_sink (and fixup warnings) (#125) 2021-03-04 21:22:48 -06:00
Luke Wren
a59fd524d5 Reword some confusing terms in pio.h doxygen 2021-03-04 21:22:48 -06:00
Luke Wren
2844e7ac2d Update info strings in PIO register header for clarity (matching changes in datasheet) 2021-03-04 21:22:48 -06:00
Luke Wren
6f7c539062 oops 2021-03-04 21:22:47 -06:00
Luke Wren
24e036bde0 Fix bad range check on sideset count in pio.h 2021-03-04 21:22:47 -06:00
Luke Wren
d4c9dced40 Add missing extern "C" to header files (closes #104) 2021-03-04 21:22:47 -06:00
Luke Wren
0f4a5f8e60 Document PWM double buffering behaviour in pwm.h doxygen 2021-03-04 21:22:47 -06:00
Luke Wren
eb4023e263 pwm.h typo: int16_t -> uint16_t (closes #109) 2021-03-04 21:22:47 -06:00
Luke Wren
539270feca pio.h doxygen fixes and clarifications (closes #114) 2021-03-04 21:22:47 -06:00
Luke Wren
2a243a33e2 Fix -Wsign-compare warnings 2021-03-04 21:22:47 -06:00
Liam Fraser
6d272c056a Mark usb buffer status registers as write clear instead of read only. 2021-03-04 21:22:47 -06:00
James Hughes
d2a13d0366 Added version number of SDK to Doxygen navigation pane 2021-03-04 21:22:47 -06:00
Brian Swetland
a362925eda Clean up various C source and headers to appease -Wstrict-prototypes
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.
2021-03-04 21:22:47 -06:00
Luke Wren
93c600736e Add enumvals to busctrl PERFSEL registers 2021-03-04 21:22:47 -06:00
graham sanderson
dd09c4ea4a add pico_unique_id to kitchen_sink app 2021-03-04 21:22:47 -06:00
Luke Wren
c7cf7cd728 Fix incorrect type in systick struct header vs machine-generated register header 2021-03-04 21:22:47 -06:00
Liam Fraser
5514401bf4 Restore GPIO15 state after modifying it for USB enumeration fix (#80)
Restore GPIO15 state after usb enumeration fix
Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-03-04 21:22:47 -06:00
Luke Wren
c44d5026db Add PICO_NO_FPGA_CHECK define to remove FPGA check and save some bytes 2021-03-04 21:22:47 -06:00
Luke Wren
4bad452517 Document clock SELECTED registers in headers and SVD 2021-03-04 21:22:47 -06:00
Andrew Scheller
5e5a1e1b26 Fix typo ;-) 2021-03-04 21:22:47 -06:00
Graham Sanderson
3c9a4168fe
tinyusb: restore correct version (#233) 2021-03-04 21:20:48 -06:00
Graham Sanderson
9c5d2963f6
change revision to 1.1.0 (#231) 2021-03-04 20:30:57 -06:00
Graham Sanderson
7f17a45f0b
Remove PICO_FLASH_SIZE_BYTES warning from header as it breaks any build with -Werror; actual uses that care should warn instead (#229) 2021-03-04 20:20:56 -06:00
Andrew Scheller
0a940b8915
Add some extra defines to customise behaviour of STDIO_USB_RESET modes (#226)
* Add some extra defines to customise behaviour of STDIO_USB_RESET modes

* Tweaks to STDIO_USB_RESET defines
2021-03-04 19:01:30 -06:00
Andrew Scheller
0f119727c1
Add some extra defines to platform_defs.h (#227) 2021-03-04 12:52:42 -06:00
Andrew Scheller
c6a09bd495
Add PICO_DEFAULT_SPI pins to pico.h (#225)
(and define min and max values for some of the PICO_DEFAULT_* configs)
2021-03-04 08:46:14 -06:00
Andrew Scheller
a1856a91e4
Fix SDK to build cleanly if PICO_DEFAULT_UART isn't defined (#223) 2021-03-04 08:45:30 -06:00
James Hughes
ae2f040e86
Doxygen Updates (#117)
Fixed font for examples
Removed extraneous tag in DoxygenLayout.xml
More spacing on Doxygen version number, associated position change for seach boxes.
2021-03-04 08:43:26 -06:00
Andrew Scheller
1a471f13bd
Modify extract_configs.py to deal with _u(X) macros (#222) 2021-03-04 08:42:03 -06:00
graham sanderson
6390fe56ae use _u(0x800) insteand of 0x800u in platform_defs which is included by assembler 2021-03-03 15:43:46 +00:00
Andrew Scheller
14b5ea39cd Previous change didn't allow CI checks to run when an external fork PRs to raspberrypi 2021-03-03 14:58:38 +00:00
Andrew Scheller
2592c59e74
Add SPI enums to Doxygen output, fixes #213 (#216)
Also fix a few typos
2021-03-03 08:51:17 -06:00
Andrew Scheller
50acbb499d Attempt to prevent workflows being triggered on forks 2021-03-03 14:43:11 +00:00
Andrew Scheller
967cbc5c3d
Fixup PICO_CONFIG entries (#208)
* remove default=undefined
 * fix a couple of typos / syntax "errors"
 * perform even better default-value-checking in extract_configs.py
2021-03-02 15:37:46 -06:00
Andrew Scheller
6a8167b5bb
Lots of Doxygen tweaks and fixes (#212)
* 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
2021-03-02 15:37:27 -06:00
Andrew Scheller
1fb924a5ec
Remove PICO_SMPS_MODE_PIN from boards/vgaboard.h (#209)
...as it's already present in boards/pico.h
2021-03-02 11:20:21 -06:00
Graham Sanderson
61978dc707
Rationalize board header pin defines, and add partner board headers (#192)
* 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>
2021-03-01 09:59:05 -06:00
Liam Fraser
429cca23ac Add cmake build github action 2021-03-01 09:25:44 -06:00
Andrew Scheller
d55d3a79bc Typo
Set correct name in PICO_CONFIG line for PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
2021-03-01 09:25:09 -06:00
graham sanderson
73751b89d1 Add support for resetting RP2040 via the USB connection when using pico_stdio_usb
- 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
2021-03-01 08:36:29 -06:00
graham sanderson
642b312fec Add binary info 'feature' for pico_bootsel_via_double_reset 2021-03-01 08:36:09 -06:00
graham sanderson
0b1de0a62e hardware_rtc: make rtc_enable_alarm public 2021-03-01 08:36:09 -06:00
Graham Sanderson
fa34820fb9
remove broken and fairly pointless deep sleep API (#198)
* 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>
2021-03-01 14:10:45 +00:00
Andrew Scheller
265485c773 Fixup PICO_FLASH_SIZE_BYTES PICO_CONFIG entry (no default) 2021-02-27 12:09:02 -06:00
Andrew Scheller
37dbe8862e extract_configs: Do better matching-up of default values (regex was too strict)
also error if PICO_CONFIG says there's a default but no matching #define is found
2021-02-27 12:09:02 -06:00
foopub
a0481b2e02 Added ".syntax unified"
Otherwise gcc complains. I've tested this to work with the normal CMakeLists.txt provided in a few examples.
2021-02-27 12:07:57 -06:00
foopub
be7a655824 Replace unavailable flag-preserving instruction
It seems sub requires thumb2 instructions which are unavailable. This is in line with the rest of the sdk code base which uses subs.
2021-02-27 12:07:57 -06:00
graham sanderson
f8015f266a remove useless PICO_ALLOW_SLEED_IN_EXCEPTION 2021-02-26 08:52:14 -06:00
graham sanderson
9fdf87f729 panic in debug mode if sleep methods are called in an exception handler (unless PICO_ALLOW_SLEEP_IN_EXCEPTION is set) 2021-02-26 08:52:14 -06:00
Andrew Scheller
fb5a847026 Also check enum params and doxygenise pio_mov_status_type 2021-02-25 16:21:06 -06:00
Andrew Scheller
3fb6a489f6 Extra param-checking for hardware_pio library (switch asserts to valid_params_if, and add additional checks) 2021-02-25 16:21:06 -06:00
Andrew Scheller
5a245d549a Add some "\ingroup timestamp" doxy-comments so that they actually appear in the output! 2021-02-25 16:20:20 -06:00
Andrew Scheller
1281fbe9fa Remove duplicate PARAM_ASSERTIONS_ENABLED_SYNC PICO_CONFIG entry 2021-02-25 16:19:38 -06:00
Graham Sanderson
3110843159
Pico flash size bytes (#159)
* 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
2021-02-25 11:01:01 -06:00
graham sanderson
693311a74d fix compiler warning 2021-02-25 10:43:28 -06:00
graham sanderson
75422bbd68 host mode fixups 2021-02-25 10:16:40 -06:00
graham sanderson
72307e99dc pio: improve (slightly) error message for claim failure on PIO 1 2021-02-25 10:16:40 -06:00
graham sanderson
24e6668b35 move test cases after PICO_SDK_POST_LIDR_DIRS inclusion, so pico-host-sdl can be used 2021-02-25 10:16:40 -06:00
graham sanderson
760cb59c97 cmake: change warning message for unititialized TinyUSB 2021-02-25 10:16:40 -06:00
Graham Sanderson
cf3182021a
%g should not print 0 as infe-308 (#185) 2021-02-25 10:00:05 -06:00
Andrew Scheller
036d90d8cf
Default PARAM_ASSERTIONS_ENABLED_LOCK_CORE to 0 (#184)
so that it matches all the other PARAM_ASSERTIONS_* default values
2021-02-25 09:52:21 -06:00
Zachary Kohnen
cf383d484f
Add 'hardware/structs/sio.h' header to the 'pico/multicore.h' header\n\nThe pico/multicore.h header uses the sio_hw struct, but does not include the header that defines it. This normally is not a problem since other headers include the structure as well, but since this structure is used in the header, we should not rely on other headers bringing it in and instead include it directly (#176) 2021-02-25 08:41:51 -06:00
Graham Sanderson
d3aa6f7f98
No malloc for default alarm pool an pheap docs/cleanup (#143)
* Statically allocate the default timer pool (to avoid pulling in malloc); doxygen for pheap (and some function name changes)

* fix comments
2021-02-25 08:40:03 -06:00
graham sanderson
d7ed2aeaa3 re-arrange pico/types.h to avoid duplicate doxygen 2021-02-25 08:28:17 -06:00
graham sanderson
096b65d8db fix comment 2021-02-25 08:28:17 -06:00
graham sanderson
db6cc12027 fix the represntation of at_the_end_of_time to be 63 one bits rather than 32 2021-02-25 08:28:17 -06:00
graham sanderson
8ebe036665 Change _U to _u as _U exists in ctype.h 2021-02-25 08:26:16 -06:00
graham sanderson
41c0e9f3b9 Fixup another level of compiler warnings, add _U() definition 2021-02-25 08:26:16 -06:00
Andrew Scheller
be13f591d0 Explicitly mark constants in autogenerated headers as unsigned values 2021-02-25 08:26:16 -06:00
graham sanderson
45b39d067b b0 sincos shim was incorrect, causing crash 2021-02-24 17:15:40 -06:00
Peter Lawrence
63ff3483d5 elf2uf2: fix address range bug 2021-02-22 18:52:43 -06:00
graham sanderson
e3925f5864 elf2uf2: fix breakage for no_flash builds; removep 0xFFFFFFFF constantds and error messsage 2021-02-19 14:23:24 -06:00
Peter Lawrence
eae2006f79 elf2uf2: determine entry address selected by Boot ROM (Plan B) 2021-02-19 14:05:11 -06:00
Peter Lawrence
07e3387458 elf2uf2: determine entry address selected by Boot ROM 2021-02-19 14:05:11 -06:00
Graham Sanderson
1478c6b89f
Bunch of small fixes (#154)
* 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>
2021-02-19 14:15:29 +00:00
Graham Sanderson
3f0529a25c
Add more memory barriers to avoid code re-ordering issues with DMA (#155)
* Add more memory barriers to avoid code re-ordering issues with DMA

* Comment typos

* Fix Wstrict-prototype on __compiler_memory_barrier

* Remove now-redundant __compiler_barrier macro from hardware_flash

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-02-19 13:11:56 +00:00
graham sanderson
e349dbbf4f add boot2 info to binary info 2021-02-19 12:32:38 +00:00
Jeremy Grosser
a498b888b2 pioasm: Ada output format 2021-02-18 18:42:19 -06:00
Andrew Scheller
9fbfa1fcbc REAMDE.md improvements
Fix the order of the steps (fixes #133) and make it clearer that step 2 is choose-just-one-option
2021-02-18 11:39:11 -06:00
Luke Wren
2fa84c7743 Missing comma in pioasm python wait output 2021-02-18 11:38:21 -06:00
Luke Wren
4c1fac58d3
Add pico_bootsel_via_double_reset library, fix #87 (#137)
* 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
2021-02-18 16:12:22 +00:00
Graham Sanderson
6b0f736d3b
fixup not/reverse for pioasm python output (#146) 2021-02-18 16:04:06 +00:00
graham sanderson
01c8e2a8dc remove always true assertions (fix #83) 2021-02-18 15:47:07 +00:00
graham sanderson
ffc7f19f46 move two hardware_timer methods to the right doxygen group (fix #131) 2021-02-18 15:47:07 +00:00
graham sanderson
a28217be4b missing pico/malloc.h fixes #136 2021-02-18 15:47:07 +00:00
Graham Sanderson
8b9907e7f2
Add -Wuninitialized -Wunused -Wcast-align to warnings checked by kitchen_sink (and fixup warnings) (#125) 2021-02-15 16:06:12 +00:00
Luke Wren
81c3d3fae6 Reword some confusing terms in pio.h doxygen 2021-02-12 13:57:54 +00:00
Luke Wren
07aadbb658 Update info strings in PIO register header for clarity (matching changes in datasheet) 2021-02-12 13:57:54 +00:00
Luke Wren
a2d82431e6 oops 2021-02-11 12:16:07 -06:00
Luke Wren
f22adc5081 Fix bad range check on sideset count in pio.h 2021-02-11 12:16:07 -06:00
Luke Wren
b34995a549 Add missing extern "C" to header files (closes #104) 2021-02-11 11:25:55 -06:00
Luke Wren
32ada8a2de Document PWM double buffering behaviour in pwm.h doxygen 2021-02-11 11:23:08 -06:00
Luke Wren
2dc030ba70 pwm.h typo: int16_t -> uint16_t (closes #109) 2021-02-11 11:22:27 -06:00
Luke Wren
0fbaaabe6f pio.h doxygen fixes and clarifications (closes #114) 2021-02-11 11:20:20 -06:00
Luke Wren
a33a7c0b2c Fix -Wsign-compare warnings 2021-02-11 11:17:15 -06:00
Liam Fraser
d3ecf3ef2e Mark usb buffer status registers as write clear instead of read only. 2021-02-10 08:43:16 -06:00
James Hughes
0688d9140e Added version number of SDK to Doxygen navigation pane 2021-02-10 08:39:09 -06:00
Brian Swetland
ebb228bfea Clean up various C source and headers to appease -Wstrict-prototypes
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.
2021-02-08 12:46:05 -06:00
Luke Wren
9546c1ce32 Add enumvals to busctrl PERFSEL registers 2021-02-08 14:43:33 +00:00
graham sanderson
af9dedd081 add pico_unique_id to kitchen_sink app 2021-02-07 18:34:23 -06:00
Luke Wren
14f4a54837 Fix incorrect type in systick struct header vs machine-generated register header 2021-02-07 18:34:00 -06:00
Liam Fraser
55346c9530
Restore GPIO15 state after modifying it for USB enumeration fix (#80)
Restore GPIO15 state after usb enumeration fix
Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-02-05 15:22:23 +00:00
Luke Wren
b63e54c14d Add PICO_NO_FPGA_CHECK define to remove FPGA check and save some bytes 2021-02-04 11:16:55 +00:00
Luke Wren
b9c75803e6 Document clock SELECTED registers in headers and SVD 2021-02-03 20:34:04 +00:00
Andrew Scheller
2b47e47053 Fix typo ;-) 2021-02-02 16:56:24 -06:00
graham sanderson
2d5789eca8 remove static order dependency 2021-02-01 14:46:45 -06:00
graham sanderson
8a4e21bd8e fixup bad static_assert 2021-02-01 14:46:45 -06:00
graham sanderson
983a0299a5 bump version number to 1.0.1 2021-02-01 14:46:45 -06:00
Luke Wren
fdcee47b70 Doxygen for uart_set_baudrate return 2021-02-01 14:46:45 -06:00
graham sanderson
f73611c322 remove added unused error code 2021-02-01 14:46:45 -06:00
graham sanderson
a98136628c uart_set_baudrate should return actual rate set even in case of out of range parameters 2021-02-01 14:46:45 -06:00
graham sanderson
4cc1efa01a fixup debug build 2021-02-01 14:46:45 -06:00
graham sanderson
d131919a09 Fix python output of IN instruction in pioasm 2021-02-01 14:46:45 -06:00
Luke Wren
0d666eaf29 Set thumb and executable attributes on padded boot2 2021-02-01 14:46:45 -06:00
Olivier
de449d1314 Improve spi write16/read16 documentation.
The write16/read16 only work as described after changing the amount of
data_bits using spi_set_format.
2021-02-01 14:46:45 -06:00
Luke Wren
7872969915 Remove copy/pasted return from doxygen 2021-02-01 14:46:45 -06:00
graham sanderson
73ce5d2b4e fix formatting 2021-02-01 14:46:45 -06:00
Joe Komlodi
b2a44a8074 rp2_common/hardware_pio/pio: Add 'pio_add_program_at_offset' implementation
pio_add_program_at_offset() had a prototype in the header, but was
missing an implementation in the C file.
2021-02-01 14:46:45 -06:00
andrum99
9111614e98 README.md: minor grammar fixes (#35)
Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-02-01 14:46:45 -06:00
graham sanderson
f58c6d9cc9 bump cmake minimum version to 3.13 2021-02-01 14:46:45 -06:00
graham sanderson
b8c17354e4 Fix dependency on boot_stage2 so that changes actually cause update of .S and relink of main application elf 2021-02-01 14:46:45 -06:00
graham sanderson
1243ee175f flash_cs_force was ending up in flash on debug builds which is very bad! 2021-02-01 14:46:45 -06:00
graham sanderson
9ab5e8d543 fix warning/Werror in NO_FLASH build 2021-02-01 14:46:45 -06:00
Luke Wren
0e44a8013c Clarify static_assert message 2021-02-01 14:46:45 -06:00
Luke Wren
12925bc9d7 Fix doxygen group name and add to index 2021-02-01 14:46:45 -06:00
Luke Wren
82e7d02bd2 Add message to static_assert, fix formatting 2021-02-01 14:46:45 -06:00
Luke Wren
a33e620424 Add pico_unique_board_id_t struct and rename some functions/defines 2021-02-01 14:46:45 -06:00
Luke Wren
35f193386b Correct copyright header date 2021-02-01 14:46:45 -06:00
Luke Wren
c1196e9af6 Add pico_unique_id to inject ID access before main and provide accessor 2021-02-01 14:46:45 -06:00
Luke Wren
bb3cf10a09 Use correct define for FLASH_RUID_CMD 2021-02-01 14:46:45 -06:00
Luke Wren
620c75b9b8 Add flash_get_unique_id to hardware_flash 2021-02-01 14:46:45 -06:00
Charlie Birks
dd2b7039a5 Remove a dependecy on Pioasm
This fixes the "'pioasm/pioasm.exe', needed by '...', missing and no known rule to make it" error with ninja.
2021-02-01 14:46:45 -06:00
graham sanderson
3e52e57f5f Standardise references to the Raspberry Pi Pico SDK 2021-02-01 14:46:45 -06:00
Amitesh Singh
705f1ae59f fix compilation for non github users
ssh git cloning requires ssh key. Allow non github users to compile the
code
2021-02-01 14:46:45 -06:00
graham sanderson
90ce1faa14 Mutex owned and owner were not initialized by mutex_init. Combined owned and owner as they had no separate value any more 2021-02-01 14:46:45 -06:00
Andrew Scheller
e95df76a19 Typos 2021-02-01 14:46:45 -06:00
graham sanderson
8dd84ad0d8 pico_time comment changes: remove stale comment, include warning about integer overflow 2021-02-01 14:46:45 -06:00
graham sanderson
372aee1445 Fix regressed tinyusb link 2021-02-01 14:46:45 -06:00
Graham Sanderson
e0b9d0ecd8 remove debugging left in by mistake (#31) 2021-02-01 14:46:45 -06:00
Luke Wren
166cb0fef6 Move vector table to beginning of flash image (#10)
* 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
2021-02-01 14:46:45 -06:00
Graham Sanderson
419890cfd8 N_GPIOS duplicates NUM_BANK0_GPIOS (#7) 2021-02-01 14:46:45 -06:00
majbthrd
92bd96a3b2 fix #if in hardware/structs/dma.h (#9)
* 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>
2021-02-01 14:46:45 -06:00
majbthrd
76b385bc26 elf2uf2: add the cache memory range described in Section 2.8.4.2 (#14)
* 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>
2021-02-01 14:46:45 -06:00
Luke Wren
7125bbb535 Fix missing timer registers in DMA header (#26) 2021-02-01 14:46:45 -06:00
Adam Boardman
9ff6b24cce Add header needed for USB flashing mode on exit when needed to avoid user having to include the header themselves. 2021-02-01 14:46:45 -06:00
Tristan Miller
7b97967fe4 Move irq rel flag to setting bit 4 instead of bit 5 2021-02-01 14:46:45 -06:00
Tristan Miller
da22bf95de Push/Pull disassembly no longer incorrectly concatenates operands in disassembly 2021-02-01 14:46:45 -06:00
Peter Lawrence
93d1c9ce56 fix incorrect name of systick struct 2021-02-01 14:46:45 -06:00
graham sanderson
310a122b0a remove static order dependency 2021-02-01 10:16:41 -06:00
graham sanderson
cfefc1775b fixup bad static_assert 2021-02-01 08:46:42 -06:00
graham sanderson
2a8e0b40d1 bump version number to 1.0.1 2021-01-31 22:58:31 +00:00
Luke Wren
5e9c42a998 Doxygen for uart_set_baudrate return 2021-01-31 22:57:06 +00:00
graham sanderson
19f946f78e remove added unused error code 2021-01-31 22:57:06 +00:00
graham sanderson
16df9f8a95 uart_set_baudrate should return actual rate set even in case of out of range parameters 2021-01-31 22:57:06 +00:00
graham sanderson
5ca82a9467 fixup debug build 2021-01-31 22:48:26 +00:00
graham sanderson
33dbd11dad Fix python output of IN instruction in pioasm 2021-01-31 22:45:31 +00:00
Luke Wren
095091208a Set thumb and executable attributes on padded boot2 2021-01-31 16:44:38 -06:00
Olivier
3073cdd802 Improve spi write16/read16 documentation.
The write16/read16 only work as described after changing the amount of
data_bits using spi_set_format.
2021-01-31 22:35:39 +00:00
Luke Wren
8a45435cb8 Remove copy/pasted return from doxygen 2021-01-31 22:34:37 +00:00
graham sanderson
294f0d2e4a fix formatting 2021-01-31 22:34:37 +00:00
Joe Komlodi
c5f8527145 rp2_common/hardware_pio/pio: Add 'pio_add_program_at_offset' implementation
pio_add_program_at_offset() had a prototype in the header, but was
missing an implementation in the C file.
2021-01-31 22:34:37 +00:00
andrum99
ee16a8c370
README.md: minor grammar fixes (#35)
Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-01-31 22:25:55 +00:00
graham sanderson
c622007564 bump cmake minimum version to 3.13 2021-01-31 22:17:03 +00:00
graham sanderson
4a0586225c Fix dependency on boot_stage2 so that changes actually cause update of .S and relink of main application elf 2021-01-31 22:12:31 +00:00
graham sanderson
da63ddd6ef flash_cs_force was ending up in flash on debug builds which is very bad! 2021-01-31 15:34:19 -06:00
graham sanderson
a2bcca264f fix warning/Werror in NO_FLASH build 2021-01-31 15:34:19 -06:00
Luke Wren
9f207485da Clarify static_assert message 2021-01-31 15:34:19 -06:00
Luke Wren
a49fab6138 Fix doxygen group name and add to index 2021-01-31 15:34:19 -06:00
Luke Wren
a49aba023b Add message to static_assert, fix formatting 2021-01-31 15:34:19 -06:00
Luke Wren
21d447fa28 Add pico_unique_board_id_t struct and rename some functions/defines 2021-01-31 15:34:19 -06:00
Luke Wren
6cef7931f5 Correct copyright header date 2021-01-31 15:34:19 -06:00
Luke Wren
05abfcdbe2 Add pico_unique_id to inject ID access before main and provide accessor 2021-01-31 15:34:19 -06:00
Luke Wren
03345f1703 Use correct define for FLASH_RUID_CMD 2021-01-31 15:34:19 -06:00
Luke Wren
a43cf2846c Add flash_get_unique_id to hardware_flash 2021-01-31 15:34:19 -06:00
Charlie Birks
d2127cead0 Remove a dependecy on Pioasm
This fixes the "'pioasm/pioasm.exe', needed by '...', missing and no known rule to make it" error with ninja.
2021-01-30 20:04:00 -06:00
graham sanderson
143657b875 Standardise references to the Raspberry Pi Pico SDK 2021-01-30 10:32:31 -06:00
Amitesh Singh
0396bf1da9 fix compilation for non github users
ssh git cloning requires ssh key. Allow non github users to compile the
code
2021-01-30 10:31:56 -06:00
graham sanderson
eb19e49522 Mutex owned and owner were not initialized by mutex_init. Combined owned and owner as they had no separate value any more 2021-01-29 17:14:22 +00:00
Andrew Scheller
70240c2508 Typos 2021-01-28 11:00:27 -06:00
graham sanderson
f8cef7a9b5 pico_time comment changes: remove stale comment, include warning about integer overflow 2021-01-28 08:54:45 -06:00
graham sanderson
5bd926ff5e Fix regressed tinyusb link 2021-01-28 08:51:08 -06:00
Graham Sanderson
cdece2f5d6
remove debugging left in by mistake (#31) 2021-01-28 07:51:06 -06:00
Luke Wren
732b53271f
Move vector table to beginning of flash image (#10)
* 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
2021-01-28 07:50:45 -06:00
Graham Sanderson
5e5776b9c0
N_GPIOS duplicates NUM_BANK0_GPIOS (#7) 2021-01-28 07:48:11 -06:00
majbthrd
78190a5e27
fix #if in hardware/structs/dma.h (#9)
* 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>
2021-01-27 12:22:26 -06:00
majbthrd
27c833ae28
elf2uf2: add the cache memory range described in Section 2.8.4.2 (#14)
* 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>
2021-01-27 12:14:10 -06:00
Luke Wren
8c7eb868aa
Fix missing timer registers in DMA header (#26) 2021-01-27 15:00:46 +00:00
Adam Boardman
40d2b5fdd4 Add header needed for USB flashing mode on exit when needed to avoid user having to include the header themselves. 2021-01-25 11:04:27 -06:00
Tristan Miller
b40185d925 Move irq rel flag to setting bit 4 instead of bit 5 2021-01-25 11:02:26 -06:00
Tristan Miller
e8a21020cd Push/Pull disassembly no longer incorrectly concatenates operands in disassembly 2021-01-25 10:55:29 -06:00
Peter Lawrence
990fa97953 fix incorrect name of systick struct 2021-01-25 10:54:15 -06:00
Bartek Pacia
0f3b795116 Update README.md 2021-01-23 14:22:41 -06:00
Liam Fraser
ef38b746ef Explicitly add libnewlib-arm-none-eabi to dependencies. It is typically pulled in by gcc-arm-none-eabi as a recommended package. 2021-01-21 16:51:40 +00:00
graham sanderson
493ed000dd update tinyusb url to use https 2021-01-21 01:24:45 -06:00
1102 changed files with 423326 additions and 74926 deletions

4
.bazelignore Normal file
View file

@ -0,0 +1,4 @@
# Don't accidentally pick up external CMake deps with Bazel build files.
build
# Don't treat submodules as part of this project.
lib

6
.bazelrc Normal file
View file

@ -0,0 +1,6 @@
# Silence all C/C++ warnings in external code.
common --per_file_copt=external/.*@-w
common --host_per_file_copt=external/.*@-w
# Produce useful output when the build fails.
common --verbose_failures

1
.bazelversion Normal file
View file

@ -0,0 +1 @@
7.2.1

4
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,4 @@
_Instructions: (please delete)_
- _please do not submit against `master`, use `develop` instead_
- _please make sure there is an associated issue for your PR, and reference it via "Fixes #num" in the description_
- _please enter a detailed description_

75
.github/workflows/bazel_build.yml vendored Normal file
View file

@ -0,0 +1,75 @@
name: Bazel presubmit checks
on:
push:
pull_request:
jobs:
bazel-build-check:
strategy:
matrix:
# TODO: Windows is currently broken.
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Bazel
uses: bazel-contrib/setup-bazel@0.9.0
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true
# Only needed to drive the presbumit scripts.
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Fetch latest Picotool
uses: actions/checkout@v4
with:
repository: raspberrypi/picotool
ref: develop
fetch-depth: 0
path: lib/picotool
- name: Full Bazel build with develop Picotool
run: python3 tools/run_all_bazel_checks.py --program=build --picotool-dir=lib/picotool
# Checks that the current BCR-requested version of Picotool builds.
- name: Bazel Picotool backwards compatibility
run: bazel build @picotool//:picotool
other-bazel-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Bazel
uses: bazel-contrib/setup-bazel@0.9.0
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true
# Only needed to drive the presbumit scripts.
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Fetch latest Picotool
uses: actions/checkout@v4
with:
repository: raspberrypi/picotool
ref: develop
fetch-depth: 0
path: lib/picotool
- name: Other Bazel checks
run: python3 tools/run_all_bazel_checks.py --program=other --picotool-dir=lib/picotool

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="gcc-arm-embedded" version="10.2.1" />
<package id="cmake" version="3.31.0" installArguments="ADD_CMAKE_TO_PATH=System" />
<package id="mingw" version="12.2.0" />
<package id="ninja" version="1.11.1" />
</packages>

50
.github/workflows/cmake.yml vendored Normal file
View file

@ -0,0 +1,50 @@
name: CMake
on:
push:
branches-ignore:
- 'iar/**'
pull_request:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# cannot specify filter for pull_request in on: above, so do it here
if: github.repository_owner == 'raspberrypi' && (github.event_name != 'pull_request' || !startsWith(github.head_ref, 'iar/'))
runs-on: [self-hosted, Linux, X64]
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- name: Checkout repo
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPICO_SDK_TESTS_ENABLED=1
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE --parallel $(nproc)

44
.github/workflows/macOS.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: Build on macOS
on:
workflow_dispatch:
push:
branches:
- 'develop'
- 'master'
- 'test_workflow'
jobs:
build:
runs-on: macos-latest
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- name: Checkout repo
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init
- name: Install dependencies
run: |
brew install cmake
brew install --cask gcc-arm-embedded
- name: Build Project
# bash required otherwise this mysteriously (no error) fails at "Generating cyw43_bus_pio_spi.pio.h"
shell: bash
run: |
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_BOARD=pico_w
cmake --build .
- name: Build Native
# bash required otherwise this mysteriously (no error) fails at "Generating cyw43_bus_pio_spi.pio.h"
shell: bash
run: |
mkdir build_native
cd build_native
cmake .. -G "Unix Makefiles" -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_PLATFORM=host
cmake --build .

157
.github/workflows/multi-gcc.yml vendored Normal file
View file

@ -0,0 +1,157 @@
name: Multi GCC
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'test_workflow'
jobs:
build:
if: github.repository_owner == 'raspberrypi'
runs-on: [self-hosted, Linux, X64]
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- name: Checkout repo
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init
- name: GCC 6.2.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-6_2-2016q4 -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 6.2.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-6_2-2016q4 -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 6.3.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-6-2017-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 6.3.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-6-2017-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 7.2.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-7-2017-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 7.2.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-7-2017-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 7.3.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-7-2018-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 7.3.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-7-2018-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 8.2.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-8-2018-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 8.2.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-8-2018-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 8.3.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-8-2019-q3-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 8.3.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-8-2019-q3-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 9.2.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-9-2019-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 9.2.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-9-2019-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 9.3.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-9-2020-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 9.3.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-9-2020-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 10.2.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-10-2020-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 10.2.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-10-2020-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 10.3.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-10.3-2021.10 -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 10.3.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-10.3-2021.10 -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 11.2.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 11.2.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 11.3.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 11.3.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 12.2.1 Debug
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
- name: GCC 12.2.1 Release
if: always()
shell: bash
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)

View file

@ -0,0 +1,72 @@
#!/usr/bin/env python3
import os
from collections import OrderedDict
import subprocess
import re
toolchain_dir = "/opt/arm"
toolchains = os.listdir(toolchain_dir)
gcc_versions = OrderedDict()
for toolchain in toolchains:
fullpath = os.path.join(toolchain_dir, toolchain)
gcc_path = os.path.join(fullpath, "bin/arm-none-eabi-gcc")
version = subprocess.run([gcc_path, "--version"], capture_output=True)
stdout = version.stdout.decode('utf-8')
stderr = version.stderr.decode('utf-8')
assert(len(stderr) == 0)
# Version should be on first line
version_line = stdout.split("\n")[0]
m = re.search("(\d+\.\d+\.\d+)", version_line)
assert(m is not None)
version = m.group(1)
if version in gcc_versions:
raise Exception("Already have version {} in versions current path {}, this path {}".format(version, gcc_versions[version], fullpath))
gcc_versions[version] = fullpath
# Sort by major version
gcc_versions_sorted = OrderedDict(sorted(gcc_versions.items(), key=lambda item: int(item[0].replace(".", ""))))
# Create output
output = '''
name: Multi GCC
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'test_workflow'
jobs:
build:
if: github.repository_owner == 'raspberrypi'
runs-on: [self-hosted, Linux, X64]
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- name: Checkout repo
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init
'''
for gcc_version, toolchain_path in gcc_versions_sorted.items():
for build_type in ["Debug", "Release"]:
output += "\n"
output += " - name: GCC {} {}\n".format(gcc_version, build_type)
output += " if: always()\n"
output += " shell: bash\n"
output += " run: cd ${{{{github.workspace}}}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE={} -DPICO_TOOLCHAIN_PATH={} -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)\n".format(build_type, toolchain_path)
print(output)

32
.github/workflows/windows.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Build on Windows
on:
workflow_dispatch:
push:
branches:
- 'develop'
- 'master'
- 'test_workflow'
jobs:
build:
runs-on: windows-2022
steps:
- name: Clean workspace
shell: bash
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}/pico-sdk"
- name: Checkout repo
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init
- name: Install dependencies
run: choco install .github/workflows/choco_packages.config
- name: Build Project
shell: pwsh
run: |
mkdir build
cd build
cmake .. -G Ninja -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_BOARD=pico_w
cmake --build .

8
.gitignore vendored
View file

@ -1,5 +1,13 @@
.idea .idea
.vscode .vscode
cmake-* cmake-*
.cache
.DS_Store .DS_Store
build build
build-*
bazel-*
# Ignore until https://github.com/bazelbuild/bazel/issues/20369 is fixed.
MODULE.bazel.lock
__pycache__/

15
.gitmodules vendored
View file

@ -1,4 +1,15 @@
[submodule "tinyusb"] [submodule "tinyusb"]
path = lib/tinyusb path = lib/tinyusb
url = git@github.com:raspberrypi/tinyusb.git url = https://github.com/hathach/tinyusb.git
branch = pico [submodule "lib/cyw43-driver"]
path = lib/cyw43-driver
url = https://github.com/georgerobotics/cyw43-driver.git
[submodule "lib/lwip"]
path = lib/lwip
url = https://github.com/lwip-tcpip/lwip.git
[submodule "lib/mbedtls"]
path = lib/mbedtls
url = https://github.com/Mbed-TLS/mbedtls.git
[submodule "lib/btstack"]
path = lib/btstack
url = https://github.com/bluekitchen/btstack.git

0
BUILD.bazel Normal file
View file

View file

@ -1,10 +1,27 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.13...3.27)
# Note: this CMakeLists.txt can be used as a top-level CMakeLists.txt for the SDK itself. For all other uses
# it is included as a subdirectory via the pico_sdk_init() method provided by pico_sdk_init.cmake
if (NOT TARGET _pico_sdk_inclusion_marker) if (NOT TARGET _pico_sdk_inclusion_marker)
add_library(_pico_sdk_inclusion_marker INTERFACE) add_library(_pico_sdk_inclusion_marker INTERFACE)
# This is a no-op unless we are the top-level CMakeLists.txt
include(pico_sdk_init.cmake) include(pico_sdk_init.cmake)
project(pico_sdk C CXX ASM) project(pico_sdk C CXX ASM)
string(REGEX MATCH "Clang" PICO_C_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}")
string(REGEX MATCH "GNU" PICO_C_COMPILER_IS_GNU "${CMAKE_C_COMPILER_ID}")
string(REGEX MATCH "IAR" PICO_C_COMPILER_IS_IAR "${CMAKE_C_COMPILER_ID}")
pico_register_common_scope_var(PICO_C_COMPILER_IS_CLANG)
pico_register_common_scope_var(PICO_C_COMPILER_IS_GNU)
pico_register_common_scope_var(PICO_C_COMPILER_IS_IAR)
pico_register_common_scope_var(PICO_SDK_VERSION_MAJOR)
pico_register_common_scope_var(PICO_SDK_VERSION_MINOR)
pico_register_common_scope_var(PICO_SDK_VERSION_REVISION)
pico_register_common_scope_var(PICO_SDK_VERSION_PRE_RELEASE_ID)
pico_register_common_scope_var(PICO_SDK_VERSION_STRING)
message("Build type is ${CMAKE_BUILD_TYPE}")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
if (PICO_DEOPTIMIZED_DEBUG) if (PICO_DEOPTIMIZED_DEBUG)
message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)") message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)")
@ -24,11 +41,17 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
# allow customization # allow customization
add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS) add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
add_sub_list_files(PICO_SDK_PRE_LIST_FILES)
# needed by certain functions
set(PICO_TOOLS_DIR "${CMAKE_CURRENT_LIST_DIR}/tools" CACHE INTERNAL "")
add_subdirectory(tools) add_subdirectory(tools)
add_subdirectory(src) add_subdirectory(src)
add_compile_options(-Winline) # allow customization
add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
add_sub_list_files(PICO_SDK_POST_LIST_FILES)
if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED) if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED)
set(PICO_SDK_TESTS_ENABLED 1) set(PICO_SDK_TESTS_ENABLED 1)
@ -36,12 +59,13 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
if (PICO_SDK_TESTS_ENABLED) if (PICO_SDK_TESTS_ENABLED)
add_subdirectory(test) add_subdirectory(test)
endif () endif ()
set(PICO_SDK_TESTS_ENABLED "${PICO_SDK_TESTS_ENABLED}" CACHE INTERNAL "Enable build of SDK tests")
# allow customization set(PICO_SDK_TESTS_ENABLED "${PICO_SDK_TESTS_ENABLED}" CACHE INTERNAL "Enable build of SDK tests")
add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
# add docs at the end, as we gather documentation dirs as we go # add docs at the end, as we gather documentation dirs as we go
add_subdirectory(docs) add_subdirectory(docs)
endif()
if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
pico_promote_common_scope_vars()
endif()
endif()

25
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,25 @@
# Contributing to Raspberry Pi Pico C/C++ SDK
## How to Report a Bug
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.

150
MODULE.bazel Normal file
View file

@ -0,0 +1,150 @@
module(
name = "pico-sdk",
version = "2.1.0",
)
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "rules_python", version = "0.36.0")
bazel_dep(name = "picotool", version = "2.1.0")
bazel_dep(name = "rules_cc", version = "0.0.10")
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "arm_gcc_linux-aarch64",
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
sha256 = "8fd8b4a0a8d44ab2e195ccfbeef42223dfb3ede29d80f14dcf2183c34b8d199a",
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-aarch64-arm-none-eabi",
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-aarch64-arm-none-eabi.tar.xz",
)
http_archive(
name = "arm_gcc_linux-x86_64",
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
sha256 = "6cd1bbc1d9ae57312bcd169ae283153a9572bd6a8e4eeae2fedfbc33b115fdbb",
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi",
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz",
)
http_archive(
name = "arm_gcc_win-x86_64",
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
sha256 = "51d933f00578aa28016c5e3c84f94403274ea7915539f8e56c13e2196437d18f",
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi",
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi.zip",
)
http_archive(
name = "arm_gcc_mac-x86_64",
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
sha256 = "075faa4f3e8eb45e59144858202351a28706f54a6ec17eedd88c9fb9412372cc",
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-arm-none-eabi",
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xz",
)
http_archive(
name = "arm_gcc_mac-aarch64",
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
sha256 = "39c44f8af42695b7b871df42e346c09fee670ea8dfc11f17083e296ea2b0d279",
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-arm64-arm-none-eabi",
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-arm64-arm-none-eabi.tar.xz",
)
http_archive(
name = "clang_linux-x86_64",
build_file = "//bazel/toolchain:clang.BUILD",
sha256 = "6c599d1aba568236064c340d7813324849896d5a4e2f3fd8225a8c31bfcbf884",
type = "zip",
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/linux-amd64/+/git_revision:2b0a708f41dd6291ee744704d43febc975e3d026",
)
http_archive(
name = "clang_win-x86_64",
build_file = "//bazel/toolchain:clang.BUILD",
sha256 = "f49ba4123ee3958f2b47289d017a5b3f1ca01f82dd7a2168c45412c18101fd13",
type = "zip",
# Windows doesn't like `:` in the produced filename, so replace it with `%3A`.
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/windows-amd64/+/git_revision:2b0a708f41dd6291ee744704d43febc975e3d026".replace("git_revision:", "git_revision%3A"),
)
http_archive(
name = "clang_mac-x86_64",
build_file = "//bazel/toolchain:clang.BUILD",
sha256 = "d3516f2eb4c12d17ae77ee84c9226fbea581d4fb806910ceac4717d5adfcf748",
type = "zip",
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-amd64/+/git_revision:2b0a708f41dd6291ee744704d43febc975e3d026",
)
http_archive(
name = "clang_mac-aarch64",
build_file = "//bazel/toolchain:clang.BUILD",
sha256 = "68e551f41c7e9473063b09819f6ab8ec6e7e53677f4078189656cb14dc52984b",
type = "zip",
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-arm64/+/git_revision:2b0a708f41dd6291ee744704d43febc975e3d026",
)
new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
# TODO: Provide tinyusb as a proper Bazel module.
new_git_repository(
name = "tinyusb",
build_file = "//src/rp2_common/tinyusb:tinyusb.BUILD",
commit = "5217cee5de4cd555018da90f9f1bcc87fb1c1d3a", # keep-in-sync-with-submodule: lib/tinyusb
remote = "https://github.com/hathach/tinyusb.git",
)
# TODO: Provide btstack as a proper Bazel module.
new_git_repository(
name = "btstack",
build_file = "//src/rp2_common/pico_btstack:btstack.BUILD",
commit = "2b49e57bd1fae85ac32ac1f41cdb7c794de335f6", # keep-in-sync-with-submodule: lib/btstack
remote = "https://github.com/bluekitchen/btstack.git",
)
# TODO: Provide cyw43-driver as a proper Bazel module.
new_git_repository(
name = "cyw43-driver",
build_file = "//src/rp2_common/pico_cyw43_driver:cyw43-driver.BUILD",
commit = "cf924bb04c8984675ca0fc2178f082e404e048c3", # keep-in-sync-with-submodule: lib/cyw43-driver
remote = "https://github.com/georgerobotics/cyw43-driver.git",
)
# TODO: Provide lwip as a proper Bazel module.
new_git_repository(
name = "lwip",
build_file = "//src/rp2_common/pico_lwip:lwip.BUILD",
commit = "0a0452b2c39bdd91e252aef045c115f88f6ca773", # keep-in-sync-with-submodule: lib/lwip
remote = "https://github.com/lwip-tcpip/lwip.git",
)
register_toolchains(
"//bazel/toolchain:linux-aarch64-rp2040",
"//bazel/toolchain:linux-aarch64-rp2350",
"//bazel/toolchain:linux-x86_64-rp2040",
"//bazel/toolchain:linux-x86_64-rp2350",
"//bazel/toolchain:win-x86_64-rp2040",
"//bazel/toolchain:win-x86_64-rp2350",
"//bazel/toolchain:mac-x86_64-rp2040",
"//bazel/toolchain:mac-x86_64-rp2350",
"//bazel/toolchain:mac-aarch64-rp2040",
"//bazel/toolchain:mac-aarch64-rp2350",
# Require users to opt-in to the Pico SDK's toolchains.
dev_dependency = True,
)
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
python_version = "3.9",
)
use_repo(python, "pythons_hub")
register_toolchains(
"@pythons_hub//:all",
dev_dependency = True,
)
register_toolchains(
"@rules_python//python/runtime_env_toolchains:all",
dev_dependency = True,
)

143
README.md
View file

@ -1,56 +1,71 @@
# Pico SDK # Raspberry Pi Pico SDK
The Pico SDK provides the headers, libraries and build system The Raspberry Pi Pico SDK (henceforth the SDK) provides the headers, libraries and build system
necessary to write programs for the RP2040 based devices such as the Raspberry Pi Pico 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. 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 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 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 RP2040's hardware include PIO (Programmable IO) 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 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.
along with various utilities.
The Pico SDK can be used to build anything from simple applications, full fledged runtime environments such as MicroPython, to low level software The SDK can be used to build anything from simple applications, fully-fledged runtime environments such as MicroPython, to low level software
such as RP2040's on chip bootrom itself. 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 # Documentation
See [Getting Started with the Raspberry Pi Pico](https://rptl.io/pico-get-started) for information on how to setup your 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 for how to build and debug software for the Raspberry Pi Pico hardware, IDE/environment and how to build and debug software for the Raspberry Pi Pico and other RP-series microcontroller based devices.
and other RP2040 based devices.
See [Pico C/C++ SDK](https://rptl.io/pico-c-sdk) to learn more about programming using the See [Connecting to the Internet with Raspberry Pi Pico W](https://rptl.io/picow-connect) to learn more about writing
Pico SDK, exploring more advanced features, and complete PDF based API documentation. 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 # Example code
See [pico-examples](https://github.com/raspberrypi/pico-examples) for example code you can build. 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
[develop](https://github.com/raspberrypi/pico-sdk/tree/develop/) branch instead.
# Quick-start your own project # Quick-start your own project
These instructions are exteremly terse, and Linux based only. For detailed steps, ## Using Visual Studio Code
instructions for other platforms, and just in general, we recommend you see [Pico C/C++ SDK](https://rptl.io/pico-c-sdk)
1. Install CMake (at least version 3.12), and GCC cross compiler 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.
```
sudo apt install cmake gcc-arm-none-eabi
```
1. Set up your project to point to use the Pico SDK
* By cloning the Pico SDK locally (most common) ## Unix command line
1. `git clone` this Pico SDK repository
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
```
sudo apt install cmake python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
```
1. Set up your project to point to use the Raspberry Pi Pico SDK
* Either by cloning the SDK locally (most common) :
1. `git clone` this Raspberry Pi Pico SDK repository
1. Copy [pico_sdk_import.cmake](https://github.com/raspberrypi/pico-sdk/blob/master/external/pico_sdk_import.cmake) 1. Copy [pico_sdk_import.cmake](https://github.com/raspberrypi/pico-sdk/blob/master/external/pico_sdk_import.cmake)
from the SDK into your project directory from the SDK into your project directory
2. Set `PICO_SDK_PATH` to the SDK location in your environment, or pass it (`-DPICO_SDK_PATH=`) to cmake later. 2. Set `PICO_SDK_PATH` to the SDK location in your environment, or pass it (`-DPICO_SDK_PATH=`) to cmake later.
3. Setup a `CMakeLists.txt` like: 3. Setup a `CMakeLists.txt` like:
```cmake ```cmake
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.13...3.27)
# initialize the SDK based on PICO_SDK_PATH # initialize the SDK based on PICO_SDK_PATH
# note: this must happen before project() # note: this must happen before project()
@ -58,42 +73,42 @@ instructions for other platforms, and just in general, we recommend you see [Pic
project(my_project) project(my_project)
# initialize the Pico SDK # initialize the Raspberry Pi Pico SDK
pico_sdk_init() pico_sdk_init()
# rest of your project # rest of your project
``` ```
* With Pico SDK as a submodule * Or with the Raspberry Pi Pico SDK as a submodule :
1. Clone the SDK as a submodule called `pico-sdk` 1. Clone the SDK as a submodule called `pico-sdk`
1. Setup a `CMakeLists.txt` like: 1. Setup a `CMakeLists.txt` like:
```cmake ```cmake
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.13...3.27)
# initialize pico_sdk from submodule # initialize pico-sdk from submodule
# note: this must happen before project() # note: this must happen before project()
include(pico-sdk/pico_sdk_init.cmake) include(pico-sdk/pico_sdk_init.cmake)
project(my_project) project(my_project)
# initialize the Pico SDK # initialize the Raspberry Pi Pico SDK
pico_sdk_init() pico_sdk_init()
# rest of your project # rest of your project
``` ```
* With automatic download from github * Or with automatic download from GitHub :
1. Copy [pico_sdk_import.cmake](https://github.com/raspberrypi/pico-sdk/blob/master/external/pico_sdk_import.cmake) 1. Copy [pico_sdk_import.cmake](https://github.com/raspberrypi/pico-sdk/blob/master/external/pico_sdk_import.cmake)
from the SDK into your project directory from the SDK into your project directory
1. Setup a `CMakeLists.txt` like: 1. Setup a `CMakeLists.txt` like:
```cmake ```cmake
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.13)
# initialize pico_sdk from GIT # initialize pico-sdk from GIT
# (note this can come from environment, CMake cache etc) # (note this can come from environment, CMake cache etc)
set(PICO_SDK_FETCH_FROM_GIT on) 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) project(my_project)
# initialize the Pico SDK # initialize the Raspberry Pi Pico SDK
pico_sdk_init() pico_sdk_init()
# rest of your project # rest of your project
``` ```
3. Setup a CMake build directory. * Or by cloning the SDK locally, but without copying `pico_sdk_import.cmake`:
For example, if not using an IDE: 1. `git clone` this Raspberry Pi Pico SDK repository
``` 2. Setup a `CMakeLists.txt` like:
$ mkdir build
$ cd build
$ cmake ..
```
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 ```cmake
for more information) 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) 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" #include "pico/stdlib.h"
int main() { int main() {
setup_default_uart(); stdio_init_all();
printf("Hello, world!\n"); printf("Hello, world!\n");
return 0; return 0;
} }
@ -148,13 +172,32 @@ for more information)
``` ```
Note this example uses the default UART for _stdout_; 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 ```sh
$ make hello_world $ make hello_world
``` ```
6. You now have `hello_world.elf` to load via a debugger, or `hello_world.uf2` that can be installed and 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.
run on your Raspberry Pi Pico 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.

0
WORKSPACE Normal file
View file

63
bazel/BUILD.bazel Normal file
View file

@ -0,0 +1,63 @@
load("@rules_python//python:defs.bzl", "py_binary")
package(default_visibility = ["//visibility:public"])
py_binary(
name = "generate_version_header",
srcs = ["generate_version_header.py"],
visibility = ["//:__subpackages__"],
)
# This isn't actually generated, it just uses the same name
# to make it show up easier in searches.
#
# Rather than generating lists of headers to match CMake, the Bazel build
# opts to have a static header that transitively include two known headers.
# By default, empty header files are included, and users/platforms are expected
# to specify an appropriate `cc_library` to replace them.
#
# You tell bazel which `cc_library` provides the respective headers by
# configuring these `label_flag`s:
#
# # Specify the library that provides "pico_config_extra_headers.h"
# --@pico-sdk//bazel/config:PICO_CONFIG_EXTRA_HEADER=//my_proj:my_custom_headers
#
# # Specify the library that provides "pico_config_platform_headers.h"
# --@pico-sdk//bazel/config:PICO_CONFIG_PLATFORM_HEADER=//my_proj:my_custom_platform_headers
cc_library(
name = "generate_config_header",
hdrs = ["include/pico/config_autogen.h"],
includes = ["include"],
visibility = ["//:__subpackages__"],
deps = [
"//bazel/config:PICO_CONFIG_EXTRA_HEADER",
"//bazel/config:PICO_CONFIG_PLATFORM_HEADER",
],
)
genrule(
name = "empty_extra_headers_file",
outs = ["generated_extra_include/pico_config_extra_headers.h"],
cmd = "echo > $@",
cmd_bat = "copy NUL $@",
visibility = ["//visibility:private"],
)
cc_library(
name = "no_extra_headers",
hdrs = ["generated_extra_include/pico_config_extra_headers.h"],
includes = ["generated_extra_include"],
visibility = ["//visibility:private"],
)
# An empty stub, useful for label_flag flags that need to point to a library,
# but for some purposes the library needs to be a no-op.
cc_library(
name = "empty_cc_lib",
)
# A library incompatible with everything. Use to mark an invalid configuration.
cc_library(
name = "incompatible_cc_lib",
target_compatible_with = ["@platforms//:incompatible"],
)

115
bazel/README.md Normal file
View file

@ -0,0 +1,115 @@
# Bazel build
## Using the Pico SDK in a Bazel project.
### Add pico-sdk as a dependency
First, in your `MODULE.bazel` file, add a dependency on the Pico SDK and
`rules_cc`:
```python
bazel_dep(name = "pico-sdk", version = "2.1.0")
```
### Register toolchains
These toolchains tell Bazel how to compile for ARM cores. Add the following
to the `MODULE.bazel` for your project:
```python
register_toolchains(
"@pico-sdk//bazel/toolchain:linux-x86_64-rp2040",
"@pico-sdk//bazel/toolchain:linux-x86_64-rp2350",
"@pico-sdk//bazel/toolchain:win-x86_64-rp2040",
"@pico-sdk//bazel/toolchain:win-x86_64-rp2350",
"@pico-sdk//bazel/toolchain:mac-x86_64-rp2040",
"@pico-sdk//bazel/toolchain:mac-x86_64-rp2350",
"@pico-sdk//bazel/toolchain:mac-aarch64-rp2040",
"@pico-sdk//bazel/toolchain:mac-aarch64-rp2350",
)
```
### Ready to build!
You're now ready to start building Pico Projects in Bazel! When building,
don't forget to specify `--platforms` so Bazel knows you're targeting the
Raspberry Pi Pico:
```console
$ bazelisk build --platforms=@pico-sdk//bazel/platform:rp2040 //...
```
## SDK configuration
An exhaustive list of build system configuration options is available in
`//bazel/config:BUILD.bazel`.
### Selecting a different board
A different board can be selected specifying `--@pico-sdk//bazel/config:PICO_BOARD`:
```console
$ bazelisk build --platforms=//bazel/platform:rp2040 --@pico-sdk//bazel/config:PICO_BOARD=pico_w //...
```
If you have a bespoke board definition, you can configure the Pico SDK to use it
by pointing `--@pico-sdk//bazel/config:PICO_CONFIG_HEADER` to a `cc_library`
that defines `PICO_BOARD` and either a `PICO_CONFIG_HEADER` define or a
`pico/config_autogen.h` header. Make sure any required `includes`, `hdrs`, and
`deps` are also provided.
## Generating UF2 firmware images
Creation of UF2 images can be done as explicit build steps on a per-binary
rule basis, or through an aspect. Running a wildcard build with the
`pico_uf2_aspect` enabled is the easiest way to create a UF2 for every ELF
firmware image.
```console
$ bazelisk build --platforms=@pico-sdk//bazel/platform:rp2040 \
--aspects @pico-sdk//tools:uf2_aspect.bzl%pico_uf2_aspect \
--output_groups=+pico_uf2_files \
//...
```
## Building the Pico SDK itself
### First time setup
You'll need Bazel (v7.0.0 or higher) or Bazelisk (a self-updating Bazel
launcher) to build the Pico SDK.
We strongly recommend you set up
[Bazelisk](https://bazel.build/install/bazelisk).
You will also need a working compiler configured if you wish to build Picotool
or pioasm.
* Linux: `sudo apt-get install build-essential` or similar.
* macOS: `xcode-select --install`
* Windows: [Install MSVC](https://visualstudio.microsoft.com/vs/features/cplusplus/)
### Building
To build all of the Pico SDK, run the following command:
```console
$ bazelisk build --platforms=//bazel/platform:rp2040 //...
```
## Known issues and limitations
The Bazel build for the Pico SDK is relatively new, but most features and
configuration options available in the CMake build are also available in Bazel.
You are welcome and encouraged to file issues for any problems and limitations
you encounter along the way.
Currently, the following features are not supported:
* Pico W wireless libraries work, but may not have complete feature parity with
the CMake build.
* Bazel does not yet provide RISC-V support for Pico 2/RP2350.
* The pioasm parser cannot be built from source via Bazel.
* Windows MSVC wildcard build (`bazel build //...`) does not work when targeting
host.
## Contributing
When making changes to the Bazel build, please run the Bazel validation script
to ensure all supported configurations build properly:
```console
$ ./tools/run_all_bazel_checks.py
```
If you need to check against a local version of Picotool, you can run the script
with `--picotool-dir`:
```console
$ ./tools/run_all_bazel_checks.py --picotool-dir=/path/to/picotool
```

290
bazel/config/BUILD.bazel Normal file
View file

@ -0,0 +1,290 @@
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "int_flag", "string_flag")
package(default_visibility = ["//visibility:public"])
# PICO_BAZEL_CONFIG: PICO_TOOLCHAIN, The toolchain to use, type=string, default=gcc, group=build
string_flag(
name = "PICO_TOOLCHAIN",
build_setting_default = "gcc",
values = [
"gcc",
"clang",
],
)
# PICO_BAZEL_CONFIG: PICO_BOARD, Board name being built for, type=string, default=pico or pico2, group=build, docref=cmake-platform-board-config
string_flag(
name = "PICO_BOARD",
build_setting_default = "pico",
)
# PICO_BAZEL_CONFIG: PICO_BARE_METAL, Flag to exclude anything except base headers from the build, type=bool, default=0, group=build
bool_flag(
name = "PICO_BARE_METAL",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_NO_GC_SECTIONS, Disable `-ffunction-sections` `-fdata-sections` and `--gc-sections`, type=bool, default=0, advanced=true, group=pico_standard_link
bool_flag(
name = "PICO_NO_GC_SECTIONS",
build_setting_default = False,
)
# 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
label_flag(
name = "PICO_DEFAULT_BOOT_STAGE2_FILE",
build_setting_default = "//src/rp2_common:build_selected_boot2",
)
# 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
label_flag(
name = "PICO_BOOT_STAGE2_LINK_IMAGE",
build_setting_default = "//src/rp2_common:boot_stage2",
)
# PICO_BAZEL_CONFIG: PICO_CXX_ENABLE_EXCEPTIONS, Enable CXX exception handling, type=bool, default=0, group=pico_cxx_options
bool_flag(
name = "PICO_CXX_ENABLE_EXCEPTIONS",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_CXX_ENABLE_RTTI, Enable CXX rtti, type=bool, default=0, group=pico_cxx_options
bool_flag(
name = "PICO_CXX_ENABLE_RTTI",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_CXX_ENABLE_CXA_ATEXIT, Enable cxa-atexit, type=bool, default=0, group=pico_cxx_options
bool_flag(
name = "PICO_CXX_ENABLE_CXA_ATEXIT",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_STDIO_UART, Option to globally enable stdio UART for all targets by default, type=bool, default=1, group=pico_stdlib
bool_flag(
name = "PICO_STDIO_UART",
build_setting_default = True,
)
# PICO_BAZEL_CONFIG: PICO_DEFAULT_UART_BAUD_RATE, Define the default UART baudrate, type=int, max=921600, default=115200, group=hardware_uart
int_flag(
name = "PICO_DEFAULT_UART_BAUD_RATE",
build_setting_default = 115200,
)
# 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
bool_flag(
name = "PICO_STDIO_RTT",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_MULTICORE_ENABLED, OPTION: Enable multicore handling, type=bool, default=1, group=pico_stdlib
bool_flag(
name = "PICO_MULTICORE_ENABLED",
build_setting_default = True,
)
# 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
label_flag(
name = "PICO_CMSIS_PATH",
build_setting_default = "//src/rp2_common/cmsis:cmsis_core",
)
# 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
label_flag(
name = "PICO_MBEDTLS_LIB",
build_setting_default = "//bazel:incompatible_cc_lib",
)
# 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
label_flag(
name = "PICO_DEFAULT_BINARY_INFO",
build_setting_default = "//src/rp2_common/pico_standard_binary_info:default_binary_info",
)
# 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
label_flag(
name = "PICO_DEFAULT_LINKER_SCRIPT",
build_setting_default = "//src/rp2_common/pico_crt0:default_linker_script",
)
# PICO_BAZEL_CONFIG: PICO_NO_TARGET_NAME, Don't define PICO_TARGET_NAME, type=bool, default=0, group=build
bool_flag(
name = "PICO_NO_TARGET_NAME",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_CONFIG_EXTRA_HEADER, [Bazel only] The cc_library that provides "pico_config_extra_headers.h", default=//bazel:no_extra_headers, group=pico_base
label_flag(
name = "PICO_CONFIG_EXTRA_HEADER",
build_setting_default = "//bazel:no_extra_headers",
)
# 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
label_flag(
name = "PICO_CONFIG_HEADER",
build_setting_default = "//bazel:generate_config_header",
)
# 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
label_flag(
name = "PICO_FREERTOS_LIB",
build_setting_default = "//bazel:empty_cc_lib",
)

View file

@ -0,0 +1,254 @@
load("//bazel/util:label_flag_matches.bzl", "label_flag_matches")
package(default_visibility = ["//visibility:public"])
# This constraint represents the dimension that guides the Pico SDK build. This
# constraint will only ever enumerate specific MCUs (and the host), and does NOT
# cover the differences from board-to-board.
constraint_setting(
name = "sdk_target",
default_constraint_value = "host",
)
# This constraint value is used to guide the host build.
constraint_value(
name = "host",
constraint_setting = ":sdk_target",
)
# This constraint value is used to guide parts of the build that are specific
# to the rp2040.
constraint_value(
name = "rp2040",
constraint_setting = ":sdk_target",
)
# This constraint value is used to guide parts of the build that are specific
# to the rp2350.
constraint_value(
name = "rp2350",
constraint_setting = ":sdk_target",
)
constraint_setting(
name = "wireless_support",
default_constraint_value = "no_wireless",
)
constraint_value(
name = "no_wireless",
constraint_setting = ":wireless_support",
)
constraint_value(
name = "cyw43_wireless",
constraint_setting = ":wireless_support",
)
config_setting(
name = "is_pico_w",
flag_values = {"//bazel/config:PICO_BOARD": "pico_w"},
)
config_setting(
name = "is_pico2_w",
flag_values = {"//bazel/config:PICO_BOARD": "pico2_w"},
)
config_setting(
name = "pico_toolchain_clang_enabled",
flag_values = {"//bazel/config:PICO_TOOLCHAIN": "clang"},
)
config_setting(
name = "pico_toolchain_gcc_enabled",
flag_values = {"//bazel/config:PICO_TOOLCHAIN": "gcc"},
)
config_setting(
name = "pico_baremetal_enabled",
flag_values = {"//bazel/config:PICO_BARE_METAL": "True"},
)
config_setting(
name = "pico_no_gc_sections_enabled",
flag_values = {"//bazel/config:PICO_NO_GC_SECTIONS": "True"},
)
config_setting(
name = "pico_cxx_enable_exceptions_enabled",
flag_values = {"//bazel/config:PICO_CXX_ENABLE_EXCEPTIONS": "True"},
)
config_setting(
name = "pico_cxx_enable_rtti_enabled",
flag_values = {"//bazel/config:PICO_CXX_ENABLE_RTTI": "True"},
)
config_setting(
name = "pico_cxx_enable_cxa_atexit_enabled",
flag_values = {"//bazel/config:PICO_CXX_ENABLE_RTTI": "True"},
)
config_setting(
name = "pico_stdio_uart_enabled",
flag_values = {"//bazel/config:PICO_STDIO_UART": "True"},
)
config_setting(
name = "pico_stdio_usb_enabled",
flag_values = {"//bazel/config:PICO_STDIO_USB": "True"},
)
config_setting(
name = "pico_stdio_semihosting_enabled",
flag_values = {"//bazel/config:PICO_STDIO_SEMIHOSTING": "True"},
)
config_setting(
name = "pico_stdio_rtt_enabled",
flag_values = {"//bazel/config:PICO_STDIO_RTT": "True"},
)
config_setting(
name = "pico_multicore_enabled",
flag_values = {"//bazel/config:PICO_MULTICORE_ENABLED": "True"},
)
config_setting(
name = "pico_float_auto_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "auto"},
)
config_setting(
name = "pico_float_compiler_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "compiler"},
)
config_setting(
name = "pico_float_dcp_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "dcp"},
)
config_setting(
name = "pico_float_rp2040_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "rp2040"},
)
config_setting(
name = "pico_float_vfp_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "vfp"},
)
config_setting(
name = "pico_double_auto_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_DOUBLE_IMPL": "auto"},
)
config_setting(
name = "pico_double_compiler_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_DOUBLE_IMPL": "compiler"},
)
config_setting(
name = "pico_double_dcp_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_DOUBLE_IMPL": "dcp"},
)
config_setting(
name = "pico_double_rp2040_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_DOUBLE_IMPL": "rp2040"},
)
config_setting(
name = "pico_divider_hardware_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_DIVIDER_IMPL": "hardware"},
)
config_setting(
name = "pico_divider_auto_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_DIVIDER_IMPL": "auto"},
)
config_setting(
name = "pico_printf_pico_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_PRINTF_IMPL": "pico"},
)
config_setting(
name = "pico_printf_compiler_enabled",
flag_values = {"//bazel/config:PICO_DEFAULT_PRINTF_IMPL": "compiler"},
)
config_setting(
name = "pico_async_context_poll_enabled",
flag_values = {"//bazel/config:PICO_ASYNC_CONTEXT_IMPL": "poll"},
)
config_setting(
name = "pico_async_context_threadsafe_background_enabled",
flag_values = {"//bazel/config:PICO_ASYNC_CONTEXT_IMPL": "threadsafe_background"},
)
config_setting(
name = "pico_async_context_freertos_enabled",
flag_values = {"//bazel/config:PICO_ASYNC_CONTEXT_IMPL": "freertos"},
)
config_setting(
name = "pico_use_default_max_page_size_enabled",
flag_values = {"//bazel/config:PICO_USE_DEFAULT_MAX_PAGE_SIZE": "True"},
)
config_setting(
name = "pico_no_target_name_enabled",
flag_values = {"//bazel/config:PICO_NO_TARGET_NAME": "True"},
)
config_setting(
name = "pico_clib_llvm_libc_enabled",
flag_values = {"//bazel/config:PICO_CLIB": "llvm_libc"},
)
config_setting(
name = "pico_clib_newlib_enabled",
flag_values = {"//bazel/config:PICO_CLIB": "newlib"},
)
config_setting(
name = "pico_clib_picolibc_enabled",
flag_values = {"//bazel/config:PICO_CLIB": "picolibc"},
)
config_setting(
name = "pico_bt_enable_ble_enabled",
flag_values = {"//bazel/config:PICO_BT_ENABLE_BLE": "True"},
)
config_setting(
name = "pico_bt_enable_classic_enabled",
flag_values = {"//bazel/config:PICO_BT_ENABLE_CLASSIC": "True"},
)
config_setting(
name = "pico_bt_enable_mesh_enabled",
flag_values = {"//bazel/config:PICO_BT_ENABLE_MESH": "True"},
)
label_flag_matches(
name = "pico_lwip_config_unset",
flag = "//bazel/config:PICO_LWIP_CONFIG",
value = "//bazel:empty_cc_lib",
)
label_flag_matches(
name = "pico_btstack_config_unset",
flag = "//bazel/config:PICO_BTSTACK_CONFIG",
value = "//bazel:empty_cc_lib",
)
label_flag_matches(
name = "pico_freertos_unset",
flag = "//bazel/config:PICO_FREERTOS_LIB",
value = "//bazel:empty_cc_lib",
)

117
bazel/defs.bzl Normal file
View file

@ -0,0 +1,117 @@
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@rules_cc//cc:defs.bzl", "cc_library")
def _pico_generate_pio_header_impl(ctx):
generated_headers = []
for f in ctx.files.srcs:
out = ctx.actions.declare_file(
"{}_pio_generated/{}.h".format(ctx.label.name, f.basename),
)
generated_headers.append(out)
ctx.actions.run(
executable = ctx.executable._pioasm_tool,
arguments = [
"-o",
"c-sdk",
f.path,
out.path,
],
inputs = [f],
outputs = [out],
)
cc_ctx = cc_common.create_compilation_context(
headers = depset(direct = generated_headers),
includes = depset(direct = [generated_headers[0].dirname]),
)
return [
DefaultInfo(files = depset(direct = generated_headers)),
CcInfo(compilation_context = cc_ctx),
]
pico_generate_pio_header = rule(
implementation = _pico_generate_pio_header_impl,
doc = """Generates a .h header file for each listed pio source.
Each source file listed in `srcs` will be available as `[pio file name].h` on
the include path if you depend on this rule from a `cc_library`.
pico_generate_pio_header(
name = "my_fun_pio",
srcs = ["my_fun_pio.pio"],
)
# This library can #include "my_fun_pio.pio.h".
cc_library(
name = "libfoo",
deps = [":my_fun_pio"],
srcs = ["libfoo.c"],
)
""",
attrs = {
"srcs": attr.label_list(mandatory = True, allow_files = True),
"_pioasm_tool": attr.label(
default = "@pico-sdk//tools/pioasm:pioasm",
cfg = "exec",
executable = True,
),
},
provides = [CcInfo],
)
# Because the syntax for target_compatible_with when used with config_setting
# rules is both confusing and verbose, provide some helpers that make it much
# easier and clearer to express compatibility.
#
# Context: https://github.com/bazelbuild/bazel/issues/12614
def compatible_with_config(config_label):
"""Expresses compatibility with a config_setting."""
return select({
config_label: [],
"//conditions:default": ["@platforms//:incompatible"],
})
def incompatible_with_config(config_label):
"""Expresses incompatibility with a config_setting."""
return select({
config_label: ["@platforms//:incompatible"],
"//conditions:default": [],
})
def compatible_with_rp2():
"""Expresses a rule is compatible with the rp2 family."""
return incompatible_with_config("//bazel/constraint:host")
def compatible_with_pico_w():
"""Expresses a rule is compatible a Pico W."""
return select({
"@pico-sdk//bazel/constraint:cyw43_wireless": [],
"@pico-sdk//bazel/constraint:is_pico_w": [],
"@pico-sdk//bazel/constraint:is_pico2_w": [],
"//conditions:default": ["@platforms//:incompatible"],
})
def pico_board_config(name, platform_includes, **kwargs):
"""A helper macro for declaring a Pico board to use with PICO_CONFIG_HEADER.
This generates pico_config_platform_headers.h using the list of
includes provided in `platform_includes`, and the final artifact is
a cc_library that you can configure //bazel/config:PICO_CONFIG_HEADER to
point to.
"""
_hdr_dir = "{}_generated_includes".format(name)
_hdr_path = "{}/pico_config_platform_headers.h".format(_hdr_dir)
write_file(
name = "{}_platform_headers_file".format(name),
out = _hdr_path,
content = ['#include "{}"'.format(inc) for inc in platform_includes],
)
kwargs.setdefault("hdrs", [])
kwargs["hdrs"].append(_hdr_path)
kwargs.setdefault("includes", [])
kwargs["includes"].append(_hdr_dir)
cc_library(
name = name,
**kwargs
)

View file

@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""Generate a version header for the Bazel build.
Splits a semantic version string into major, minor, and patch and uses the
provided template to produce a working version header.
"""
import argparse
import re
import sys
def _parse_args():
parser = argparse.ArgumentParser(
description=__doc__,
)
parser.add_argument(
"--version-string",
required=True,
help="SDK version string",
)
parser.add_argument(
"--template",
type=argparse.FileType("r"),
required=True,
help="Path to version.h.in",
)
parser.add_argument(
"-o",
"--output",
type=argparse.FileType("wb"),
default=sys.stdout.buffer,
help="Output file path. Defaults to stdout.",
)
return parser.parse_args()
_EXPANSION_REGEX = re.compile(r"(?:\$\{)([a-zA-Z]\w*)(?:\})")
def generate_version_header(version_string, template, output):
version_parts = version_string.split('.')
defines = {
"PICO_SDK_VERSION_MAJOR": version_parts[0],
"PICO_SDK_VERSION_MINOR": version_parts[1],
"PICO_SDK_VERSION_REVISION": version_parts[2].split('-')[0],
"PICO_SDK_VERSION_STRING": version_string,
}
output.write(
_EXPANSION_REGEX.sub(
lambda val: str(defines.get(val.group(1))),
template.read(),
).encode()
)
if __name__ == "__main__":
sys.exit(generate_version_header(**vars(_parse_args())))

View file

@ -0,0 +1,12 @@
// Rather than auto-generating as part of the build, this header
// is checked in directly.
//
// You can change what is included by configuring these `label_flag`s:
// --@pico-sdk//bazel/config:PICO_CONFIG_EXTRA_HEADER=//my_proj:my_custom_headers
// --@pico-sdk//bazel/config:PICO_CONFIG_PLATFORM_HEADER=//my_proj:my_custom_headers
// This header must be provided by //bazel/config:PICO_CONFIG_EXTRA_HEADER:
#include "pico_config_extra_headers.h"
// This header must be provided by //bazel/config:PICO_CONFIG_PLATFORM_HEADER:
#include "pico_config_platform_headers.h"

View file

@ -0,0 +1,59 @@
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cpp_toolchain", "use_cc_toolchain")
def _pico_btstack_make_gatt_header_impl(ctx):
cc_toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = cc_toolchain,
requested_features = ctx.features,
unsupported_features = ctx.disabled_features,
)
out = ctx.actions.declare_file(
"{}_gatt_generated/{}.h".format(ctx.label.name, ctx.file.src.basename.removesuffix(".gatt")),
)
ctx.actions.run(
executable = ctx.executable._make_gat_header_tool,
arguments = [
ctx.file.src.path,
out.path,
"-I",
ctx.file._btstack_hdr.dirname,
] + [
],
inputs = [
ctx.file.src,
ctx.file._btstack_hdr,
],
outputs = [out],
)
cc_ctx = cc_common.create_compilation_context(
headers = depset(direct = [out]),
includes = depset(direct = [out.dirname]),
)
return [
DefaultInfo(files = depset(direct = [out])),
CcInfo(compilation_context = cc_ctx)
]
pico_btstack_make_gatt_header = rule(
implementation = _pico_btstack_make_gatt_header_impl,
attrs = {
"src": attr.label(mandatory = True, allow_single_file = True),
"_btstack_hdr": attr.label(
default = "@btstack//:src/bluetooth_gatt.h",
allow_single_file = True,
),
"_make_gat_header_tool": attr.label(
default = "@btstack//:compile_gatt",
cfg = "exec",
executable = True,
),
},
fragments = ["cpp"],
toolchains = use_cc_toolchain(),
)

View file

@ -0,0 +1,17 @@
package(default_visibility = ["//visibility:public"])
platform(
name = "rp2040",
constraint_values = [
"@pico-sdk//bazel/constraint:rp2040",
"@platforms//cpu:armv6-m",
],
)
platform(
name = "rp2350",
constraint_values = [
"@pico-sdk//bazel/constraint:rp2350",
"@platforms//cpu:armv8-m",
],
)

291
bazel/toolchain/BUILD.bazel Normal file
View file

@ -0,0 +1,291 @@
load("@rules_cc//cc/toolchains:args.bzl", "cc_args")
load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
load("@rules_cc//cc/toolchains:feature.bzl", "cc_feature")
load("@rules_cc//cc/toolchains:toolchain.bzl", "cc_toolchain")
load("configurable_feature.bzl", "configurable_toolchain_feature")
package(default_visibility = ["//visibility:public"])
cc_args(
name = "armv6m-none-eabi",
actions = [
"@rules_cc//cc/toolchains/actions:compile_actions",
"@rules_cc//cc/toolchains/actions:link_actions",
],
args = ["--target=armv6m-none-eabi"],
)
cc_args(
name = "armv8m.main-none-eabi",
actions = [
"@rules_cc//cc/toolchains/actions:compile_actions",
"@rules_cc//cc/toolchains/actions:link_actions",
],
args = ["--target=armv8m.main-none-eabi"],
)
cc_args(
name = "cortex-m0",
actions = [
"@rules_cc//cc/toolchains/actions:compile_actions",
"@rules_cc//cc/toolchains/actions:link_actions",
],
args = [
"-mcpu=cortex-m0plus",
"-mthumb",
],
)
cc_args(
name = "cortex-m33",
actions = [
"@rules_cc//cc/toolchains/actions:compile_actions",
"@rules_cc//cc/toolchains/actions:link_actions",
],
args = [
"-mcpu=cortex-m33",
"-march=armv8-m.main+fp+dsp",
"-mfloat-abi=softfp",
"-mthumb",
"-mcmse",
],
)
# :no_canonical_system_headers and :no_canonical_prefixes both prevent built-in
# compiler include directories from resolving to absolute paths. Prefer to use
# :bazel_no_absolute_paths, since it correctly guides based on the current
# compiler type.
cc_args(
name = "no_canonical_system_headers",
actions = ["@rules_cc//cc/toolchains/actions:compile_actions"],
args = ["-fno-canonical-system-headers"],
)
cc_args(
name = "no_canonical_prefixes",
actions = ["@rules_cc//cc/toolchains/actions:compile_actions"],
args = ["-no-canonical-prefixes"],
)
cc_args_list(
name = "bazel_no_absolute_paths",
args = select({
"//bazel/constraint:pico_toolchain_clang_enabled": [],
"//conditions:default": [":no_canonical_system_headers"],
}) + [":no_canonical_prefixes"],
)
cc_args(
name = "llvm-libc_args",
actions = ["@rules_cc//cc/toolchains/actions:link_actions"],
args = [
"-nostdlib++",
"-nostartfiles",
"-Wl,-lc++",
],
visibility = ["//visibility:private"],
)
cc_args(
name = "opt_debug_args",
actions = [
"@rules_cc//cc/toolchains/actions:compile_actions",
"@rules_cc//cc/toolchains/actions:link_actions",
],
args = [
"-Og", # TODO: Make this configurable.
"-g3",
],
)
configurable_toolchain_feature(
name = "gc_sections",
copts = [
"-ffunction-sections",
"-fdata-sections",
],
linkopts = ["-Wl,--gc-sections"],
)
configurable_toolchain_feature(
name = "cxx_no_exceptions",
cxxopts = [
"-fno-exceptions",
"-fno-unwind-tables",
],
)
configurable_toolchain_feature(
name = "cxx_no_rtti",
cxxopts = ["-fno-rtti"],
)
configurable_toolchain_feature(
name = "cxx_no_cxa_atexit",
cxxopts = ["-fno-use-cxa-atexit"],
)
configurable_toolchain_feature(
name = "override_max_page_size",
linkopts = ["-Wl,-z,max-page-size=4096"],
)
# TODO: Make this shim unnecessary.
cc_args_list(
name = "all_opt_debug_args",
args = [":opt_debug_args"],
)
cc_feature(
name = "override_debug",
args = [":all_opt_debug_args"],
overrides = "@rules_cc//cc/toolchains/features:dbg",
)
HOSTS = (
("linux", "x86_64"),
("linux", "aarch64"),
("win", "x86_64"),
("mac", "x86_64"),
("mac", "aarch64"),
)
_HOST_OS_CONSTRAINTS = {
"linux": "@platforms//os:linux",
"win": "@platforms//os:windows",
"mac": "@platforms//os:macos",
}
_HOST_CPU_CONSTRAINTS = {
"x86_64": "@platforms//cpu:x86_64",
"aarch64": "@platforms//cpu:aarch64",
}
[cc_toolchain(
name = "arm_gcc_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
tool_map = "@arm_gcc_{}-{}//:all_tools".format(host_os, host_cpu),
args = select({
"//bazel/constraint:rp2040": [":cortex-m0"],
"//bazel/constraint:rp2350": [":cortex-m33"],
"//conditions:default": [],
}) + [
":bazel_no_absolute_paths",
],
exec_compatible_with = [
_HOST_CPU_CONSTRAINTS[host_cpu],
_HOST_OS_CONSTRAINTS[host_os],
],
tags = ["manual"], # Don't try to build this in wildcard builds.
known_features = [
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
"@pico-sdk//bazel/toolchain:override_debug",
"@pico-sdk//bazel/toolchain:gc_sections",
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
"@pico-sdk//bazel/toolchain:cxx_no_cxa_atexit",
"@pico-sdk//bazel/toolchain:override_max_page_size",
],
enabled_features = [
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
"@pico-sdk//bazel/toolchain:override_debug",
] + select({
"//bazel/constraint:pico_no_gc_sections_enabled": [],
"//conditions:default": [":gc_sections"],
}) + select({
"//bazel/constraint:pico_cxx_enable_exceptions_enabled": [],
"//conditions:default": [":cxx_no_exceptions"],
}) + select({
"//bazel/constraint:pico_cxx_enable_rtti_enabled": [],
"//conditions:default": [":cxx_no_rtti"],
}) + select({
"//bazel/constraint:pico_cxx_enable_cxa_atexit_enabled": [],
"//conditions:default": [":cxx_no_cxa_atexit"],
}) + select({
"//bazel/constraint:pico_use_default_max_page_size_enabled": [],
"//conditions:default": [":override_max_page_size"],
}),
) for host_os, host_cpu in HOSTS]
[cc_toolchain(
name = "clang_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
tool_map = "@clang_{}-{}//:all_tools".format(host_os, host_cpu),
args = select({
"//bazel/constraint:rp2040": [
":armv6m-none-eabi",
":cortex-m0",
],
"//bazel/constraint:rp2350": [
":armv8m.main-none-eabi",
":cortex-m33",
],
"//conditions:default": [],
}) + [
":bazel_no_absolute_paths",
":llvm-libc_args",
],
exec_compatible_with = [
_HOST_CPU_CONSTRAINTS[host_cpu],
_HOST_OS_CONSTRAINTS[host_os],
],
tags = ["manual"], # Don't try to build this in wildcard builds.
known_features = [
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
"@pico-sdk//bazel/toolchain:override_debug",
"@pico-sdk//bazel/toolchain:gc_sections",
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
"@pico-sdk//bazel/toolchain:cxx_no_cxa_atexit",
"@pico-sdk//bazel/toolchain:override_max_page_size",
],
enabled_features = [
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
"@pico-sdk//bazel/toolchain:override_debug",
] + select({
"//bazel/constraint:pico_no_gc_sections_enabled": [],
"//conditions:default": [":gc_sections"],
}) + select({
"//bazel/constraint:pico_cxx_enable_exceptions_enabled": [],
"//conditions:default": [":cxx_no_exceptions"],
}) + select({
"//bazel/constraint:pico_cxx_enable_rtti_enabled": [],
"//conditions:default": [":cxx_no_rtti"],
}) + select({
"//bazel/constraint:pico_cxx_enable_cxa_atexit_enabled": [],
"//conditions:default": [":cxx_no_cxa_atexit"],
}) + select({
"//bazel/constraint:pico_use_default_max_page_size_enabled": [],
"//conditions:default": [":override_max_page_size"],
}),
) for host_os, host_cpu in HOSTS]
[toolchain(
name = "{}-{}-rp2040".format(host_os, host_cpu),
exec_compatible_with = [
_HOST_CPU_CONSTRAINTS[host_cpu],
_HOST_OS_CONSTRAINTS[host_os],
],
target_compatible_with = [
"@pico-sdk//bazel/constraint:rp2040",
],
toolchain = select({
"//bazel/constraint:pico_toolchain_clang_enabled": "clang_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
"//conditions:default": ":arm_gcc_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
}),
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
) for host_os, host_cpu in HOSTS]
[toolchain(
name = "{}-{}-rp2350".format(host_os, host_cpu),
exec_compatible_with = [
_HOST_CPU_CONSTRAINTS[host_cpu],
_HOST_OS_CONSTRAINTS[host_os],
],
target_compatible_with = [
"@pico-sdk//bazel/constraint:rp2350",
],
toolchain = select({
"//bazel/constraint:pico_toolchain_clang_enabled": "clang_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
"//conditions:default": ":arm_gcc_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
}),
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
) for host_os, host_cpu in HOSTS]

152
bazel/toolchain/clang.BUILD Normal file
View file

@ -0,0 +1,152 @@
load("@bazel_skylib//rules/directory:directory.bzl", "directory")
load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory")
load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool")
load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map")
load("@rules_cc//cc/toolchains:args.bzl", "cc_args")
load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
# Directory-based rules in this toolchain only referece things in
# lib/ or include/ subdirectories.
directory(
name = "toolchain_root",
srcs = glob([
"lib/**",
"include/**",
]),
)
cc_tool_map(
name = "all_tools",
tools = {
"@rules_cc//cc/toolchains/actions:assembly_actions": ":asm",
"@rules_cc//cc/toolchains/actions:c_compile": ":clang",
"@rules_cc//cc/toolchains/actions:cpp_compile_actions": ":clang++",
"@rules_cc//cc/toolchains/actions:link_actions": ":lld",
"@rules_cc//cc/toolchains/actions:objcopy_embed_data": ":llvm-objcopy",
"@rules_cc//cc/toolchains/actions:strip": ":llvm-strip",
"@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-ar",
},
)
# TODO: https://github.com/bazelbuild/rules_cc/issues/235 - Workaround until
# Bazel has a more robust way to implement `cc_tool_map`.
alias(
name = "asm",
actual = ":clang",
)
cc_tool(
name = "clang",
src = select({
"@platforms//os:windows": "//:bin/clang.exe",
"//conditions:default": "//:bin/clang",
}),
data = glob([
"bin/llvm",
"lib/clang/*/include/**",
"include/armv*-unknown-none-eabi/**",
]),
)
cc_tool(
name = "clang++",
src = select({
"@platforms//os:windows": "//:bin/clang++.exe",
"//conditions:default": "//:bin/clang++",
}),
data = glob([
"bin/llvm",
"lib/clang/*/include/**",
"include/armv*-unknown-none-eabi/**",
"include/c++/v1/**",
]),
)
cc_tool(
name = "lld",
src = select({
"@platforms//os:windows": "//:bin/clang++.exe",
"//conditions:default": "//:bin/clang++",
}),
data = glob([
"bin/llvm",
"bin/lld*",
"bin/ld*",
"lib/**/*.a",
"lib/**/*.so*",
"lib/**/*.o",
"lib/armv*-unknown-none-eabi/**",
"lib/clang/*/lib/armv*-unknown-none-eabi/**",
]),
)
cc_tool(
name = "llvm-ar",
src = select({
"@platforms//os:windows": "//:bin/llvm-ar.exe",
"//conditions:default": "//:bin/llvm-ar",
}),
data = glob(["bin/llvm"]),
)
cc_tool(
name = "llvm-libtool-darwin",
src = select({
"@platforms//os:windows": "//:bin/llvm-libtool-darwin.exe",
"//conditions:default": "//:bin/llvm-libtool-darwin",
}),
data = glob(["bin/llvm"]),
)
cc_tool(
name = "llvm-objcopy",
src = select({
"@platforms//os:windows": "//:bin/llvm-objcopy.exe",
"//conditions:default": "//:bin/llvm-objcopy",
}),
data = glob(["bin/llvm"]),
)
cc_tool(
name = "llvm-objdump",
src = select({
"@platforms//os:windows": "//:bin/llvm-objdump.exe",
"//conditions:default": "//:bin/llvm-objdump",
}),
data = glob(["bin/llvm"]),
)
cc_tool(
name = "llvm-cov",
src = select({
"@platforms//os:windows": "//:bin/llvm-cov.exe",
"//conditions:default": "//:bin/llvm-cov",
}),
data = glob(["bin/llvm"]),
)
cc_tool(
name = "llvm-strip",
src = select({
"@platforms//os:windows": "//:bin/llvm-strip.exe",
"//conditions:default": "//:bin/llvm-strip",
}),
data = glob(["bin/llvm"]),
)
cc_tool(
name = "clang-tidy",
src = select({
"@platforms//os:windows": "//:bin/clang-tidy.exe",
"//conditions:default": "//:bin/clang-tidy",
}),
data = glob([
"bin/llvm",
"include/**",
"lib/clang/**/include/**",
]),
)

View file

@ -0,0 +1,42 @@
load("@rules_cc//cc/toolchains:args.bzl", "cc_args")
load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
load("@rules_cc//cc/toolchains:feature.bzl", "cc_feature")
def configurable_toolchain_feature(name, copts = [], cxxopts = [], linkopts = []):
all_args = []
if copts:
cc_args(
name = name + "_cc_args",
actions = ["@rules_cc//cc/toolchains/actions:compile_actions"],
args = copts,
)
all_args.append(name + "_cc_args")
if cxxopts:
cc_args(
name = name + "_cxx_args",
actions = ["@rules_cc//cc/toolchains/actions:cpp_compile_actions"],
args = cxxopts,
)
all_args.append(name + "_cxx_args")
if linkopts:
cc_args(
name = name + "_link_args",
actions = ["@rules_cc//cc/toolchains/actions:link_actions"],
args = linkopts,
)
all_args.append(name + "_link_args")
cc_args_list(
name = name + "_args",
args = all_args,
)
cc_feature(
name = name,
feature_name = name,
args = [":{}_args".format(name)],
)

View file

@ -0,0 +1,131 @@
load("@bazel_skylib//rules/directory:directory.bzl", "directory")
load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory")
load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool")
load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map")
load("@rules_cc//cc/toolchains:args.bzl", "cc_args")
load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
package(default_visibility = ["//visibility:public"])
cc_tool_map(
name = "all_tools",
tools = {
"@rules_cc//cc/toolchains/actions:assembly_actions": ":asm",
"@rules_cc//cc/toolchains/actions:c_compile": ":arm-none-eabi-gcc",
"@rules_cc//cc/toolchains/actions:cpp_compile_actions": ":arm-none-eabi-g++",
"@rules_cc//cc/toolchains/actions:link_actions": ":arm-none-eabi-ld",
"@rules_cc//cc/toolchains/actions:objcopy_embed_data": ":arm-none-eabi-objcopy",
"@rules_cc//cc/toolchains/actions:strip": ":arm-none-eabi-strip",
"@rules_cc//cc/toolchains/actions:ar_actions": ":arm-none-eabi-ar",
},
)
# TODO: https://github.com/bazelbuild/rules_cc/issues/235 - Workaround until
# Bazel has a more robust way to implement `cc_tool_map`.
alias(
name = "asm",
actual = ":arm-none-eabi-gcc",
)
cc_tool(
name = "arm-none-eabi-ar",
src = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-ar.exe",
"//conditions:default": "//:bin/arm-none-eabi-ar",
}),
)
cc_tool(
name = "arm-none-eabi-g++",
src = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-g++.exe",
"//conditions:default": "//:bin/arm-none-eabi-g++",
}),
data = glob([
"**/*.spec",
"**/*.specs",
"arm-none-eabi/include/**",
"lib/gcc/arm-none-eabi/*/include/**",
"lib/gcc/arm-none-eabi/*/include-fixed/**",
"libexec/**",
]),
)
cc_tool(
name = "arm-none-eabi-gcc",
src = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-gcc.exe",
"//conditions:default": "//:bin/arm-none-eabi-gcc",
}),
data = glob([
"**/*.spec",
"**/*.specs",
"arm-none-eabi/include/**",
"lib/gcc/arm-none-eabi/*/include/**",
"lib/gcc/arm-none-eabi/*/include-fixed/**",
"libexec/**",
]) +
# The assembler needs to be explicitly added. Note that the path is
# intentionally different here as `as` is called from arm-none-eabi-gcc.
# `arm-none-eabi-as` will not suffice for this context.
select({
"@platforms//os:windows": ["//:arm-none-eabi/bin/as.exe"],
"//conditions:default": ["//:arm-none-eabi/bin/as"],
}),
)
# This tool is actually just g++ under the hood, but this specifies a
# different set of data files to pull into the sandbox at runtime.
cc_tool(
name = "arm-none-eabi-ld",
src = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-g++.exe",
"//conditions:default": "//:bin/arm-none-eabi-g++",
}),
data = glob([
"**/*.a",
"**/*.ld",
"**/*.o",
"**/*.spec",
"**/*.specs",
"**/*.so",
"libexec/**",
]),
)
cc_tool(
name = "arm-none-eabi-objcopy",
src = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-objcopy.exe",
"//conditions:default": "//:bin/arm-none-eabi-objcopy",
}),
)
cc_tool(
name = "arm-none-eabi-strip",
src = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-strip.exe",
"//conditions:default": "//:bin/arm-none-eabi-strip",
}),
)
cc_tool(
name = "arm-none-eabi-objdump",
src = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-objdump.exe",
"//conditions:default": "//:bin/arm-none-eabi-objdump",
}),
)
# There is not yet a well-known action type for objdump.
cc_tool(
name = "arm-none-eabi-gcov",
src = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-gcov.exe",
"//conditions:default": "//:bin/arm-none-eabi-gcov",
}),
)
# There is not yet a well-known action type for gcov.

View file

@ -0,0 +1,46 @@
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "OBJ_COPY_ACTION_NAME")
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cpp_toolchain", "use_cc_toolchain")
def _objcopy_to_bin_impl(ctx):
cc_toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = cc_toolchain,
requested_features = ctx.features,
unsupported_features = ctx.disabled_features,
)
objcopy_tool_path = cc_common.get_tool_for_action(
feature_configuration = feature_configuration,
action_name = OBJ_COPY_ACTION_NAME,
)
ctx.actions.run(
inputs = depset(
direct = [ctx.file.src],
transitive = [cc_toolchain.all_files],
),
executable = objcopy_tool_path,
outputs = [ctx.outputs.out],
arguments = [
ctx.file.src.path,
"-Obinary",
ctx.outputs.out.path,
],
)
objcopy_to_bin = rule(
implementation = _objcopy_to_bin_impl,
attrs = {
"src": attr.label(
allow_single_file = True,
mandatory = True,
doc = "File to use as input to objcopy command",
),
"out": attr.output(
mandatory = True,
doc = "Destination file for objcopy command",
),
},
fragments = ["cpp"],
toolchains = use_cc_toolchain(),
)

1
bazel/util/BUILD.bazel Normal file
View file

@ -0,0 +1 @@
package(default_visibility = ["//visibility:public"])

View file

@ -0,0 +1,37 @@
"""A wrapper that enables a `config_setting` matcher for label_flag flags."""
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
def _match_label_flag_impl(ctx):
matches = str(ctx.attr.expected_value.label) == str(ctx.attr.flag.label)
return [
config_common.FeatureFlagInfo(value = str(matches)),
BuildSettingInfo(value = matches),
]
_match_label_flag = rule(
implementation = _match_label_flag_impl,
attrs = {
"expected_value": attr.label(
mandatory = True,
doc = "The expected flag value",
),
"flag": attr.label(
mandatory = True,
doc = "The flag to extract a value from",
),
},
)
def label_flag_matches(*, name, flag, value):
_match_label_flag(
name = name + "._impl",
expected_value = native.package_relative_label(value),
flag = flag,
)
native.config_setting(
name = name,
flag_values = {":{}".format(name + "._impl"): "True"},
)

View file

@ -0,0 +1,38 @@
def declare_flag_choices(flag, choices):
"""Declares a `config_setting` for each known choice for the provided flag.
The name of each config setting uses the name of the `config_setting` is:
[flag label name]_[choice]
This can be used with select_choice() to map `config_setting`s to values.
Args:
flag: The flag that guides the declared `config_setting`s.
pkg: The package that declare_flag_choices() was declared in.
choice_map: A mapping of distinct choices to
"""
flag_name = flag.split(":")[1]
[
native.config_setting(
name = "{}_{}".format(flag_name, choice),
flag_values = {flag: choice},
)
for choice in choices
]
def flag_choice(flag, pkg, choice_map):
"""Creates a `select()` based on choices declared by `declare_choices()`.
Args:
flag: The flag that guides the select.
pkg: The package that `declare_flag_choices()` was called in.
choice_map: A mapping of distinct choices to the final intended value.
"""
return {
"{}:{}_{}".format(
pkg.split(":")[0],
flag.split(":")[1],
choice,
): val
for choice, val in choice_map.items()
}

43
bazel/util/sdk_define.bzl Normal file
View file

@ -0,0 +1,43 @@
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
def _pico_sdk_define_impl(ctx):
val = ctx.attr.from_flag[BuildSettingInfo].value
if type(val) == "string":
# Strings need quotes.
val = "\"{}\"".format(val)
elif type(val) == "bool":
# Convert bools to 0 or 1.
val = 1 if val else 0
cc_ctx = cc_common.create_compilation_context(
defines = depset(
direct = ["{}={}".format(ctx.attr.define_name, val)],
),
)
return [CcInfo(compilation_context = cc_ctx)]
pico_sdk_define = rule(
implementation = _pico_sdk_define_impl,
doc = """A simple rule that offers a skylib flag as a define.
These can be listed in the `deps` attribute of a `cc_library` to get access
to the value of a define.
Example:
bool_flag(
name = "my_flag",
build_setting_default = False,
)
pico_sdk_define(
name = "flag_define",
define_name = "MY_FLAG_DEFINE",
from_flag = ":my_flag",
)
""",
attrs = {
"define_name": attr.string(mandatory = True),
"from_flag": attr.label(mandatory = True),
},
)

167
bazel/util/transition.bzl Normal file
View file

@ -0,0 +1,167 @@
def _normalize_flag_value(val):
"""Converts flag values to transition-safe primitives."""
if type(val) == "label":
return str(val)
return val
def declare_transtion(attrs, flag_overrides = None, append_to_flags = None, executable = True):
"""A helper that drastically simplifies declaration of a transition.
A transition in Bazel is a way to force changes to the way the build is
evaluated for all dependencies of a given rule.
Imagine the following simple dependency graph:
->: depends on
a -> b -> c
Normally, if you set `defines` on a, they couldn't apply to b or c because
they are dependencies of a. There's no way for b or c to know about a's
settings, because they don't even know a exists!
We can fix this via a transition! If we put a transition in front of `a`
that sets --copts=-DFOO=42, we're telling Bazel to build a and all of its
dependencies under that configuration.
Note: Flags must be referenced as e.g. `//command_line_option:copt` in
transitions.
`declare_transition()` eliminates the frustrating amount of boilerplate. All
you need to do is provide a set of attrs, and then a `flag_overrides`
dictionary that tells `declare_transition()` which attrs to pull flag values
from. The common `src` attr tells the transition which build rule to apply
the transition to.
"""
def _flag_override_impl(settings, attrs):
final_overrides = {}
if flag_overrides != None:
final_overrides = {
key: _normalize_flag_value(getattr(attrs, value))
for key, value in flag_overrides.items()
}
if append_to_flags != None:
for flag, field in append_to_flags.items():
accumulated_flags = final_overrides.get(flag, settings.get(flag, []))
accumulated_flags.extend(
[str(val) for val in getattr(attrs, field)],
)
final_overrides[flag] = accumulated_flags
return final_overrides
output_flags = []
if flag_overrides != None:
output_flags.extend(flag_overrides.keys())
if append_to_flags != None:
output_flags.extend(append_to_flags.keys())
_transition = transition(
implementation = _flag_override_impl,
inputs = append_to_flags.keys() if append_to_flags != None else [],
outputs = output_flags,
)
def _symlink_artifact_impl(ctx):
out = ctx.actions.declare_file(ctx.label.name)
if executable:
ctx.actions.symlink(output = out, target_file = ctx.executable.src)
return [DefaultInfo(files = depset([out]), executable = out)]
ctx.actions.symlink(
output = out,
target_file = ctx.attr.src[0][DefaultInfo].files.to_list()[0],
)
return [DefaultInfo(files = depset([out]))]
return rule(
implementation = _symlink_artifact_impl,
executable = executable,
attrs = {
"src": attr.label(
cfg = _transition,
executable = executable,
mandatory = True,
),
} | attrs,
)
# This transition is applied before building the boot_stage2 image.
rp2040_bootloader_binary = declare_transtion(
attrs = {
"_malloc": attr.label(default = "//bazel:empty_cc_lib"),
# This could be shared, but we don't in order to make it clearer that
# a transition is in use.
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
"_link_extra_libs": attr.label(default = "//bazel:empty_cc_lib"),
},
flag_overrides = {
# We don't want --custom_malloc to ever apply to the bootloader, so
# always explicitly override it here.
"//command_line_option:custom_malloc": "_malloc",
# Platforms will commonly depend on bootloader components in every
# binary via `link_extra_libs`, so we must drop these deps when
# building the bootloader binaries themselves in order to avoid a
# circular dependency.
"@bazel_tools//tools/cpp:link_extra_libs": "_link_extra_libs",
},
)
# This transition sets SDK configuration options required to build test binaries
# for the kitchen_sink suite of tests.
kitchen_sink_test_binary = declare_transtion(
attrs = {
"bt_stack_config": attr.label(mandatory = True),
"lwip_config": attr.label(mandatory = True),
"enable_ble": attr.bool(default = False),
"enable_bt_classic": attr.bool(default = False),
# This could be shared, but we don't in order to make it clearer that
# a transition is in use.
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
},
flag_overrides = {
"@pico-sdk//bazel/config:PICO_BTSTACK_CONFIG": "bt_stack_config",
"@pico-sdk//bazel/config:PICO_LWIP_CONFIG": "lwip_config",
"@pico-sdk//bazel/config:PICO_BT_ENABLE_BLE": "enable_ble",
"@pico-sdk//bazel/config:PICO_BT_ENABLE_CLASSIC": "enable_bt_classic",
},
)
# This transition sets SDK configuration options required to build test binaries
# for the pico_float_test suite of tests.
pico_float_test_binary = declare_transtion(
attrs = {
"pico_printf_impl": attr.string(),
"extra_copts": attr.string_list(),
# This could be shared, but we don't in order to make it clearer that
# a transition is in use.
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
},
flag_overrides = {
"@pico-sdk//bazel/config:PICO_DEFAULT_PRINTF_IMPL": "pico_printf_impl",
},
append_to_flags = {
"//command_line_option:copt": "extra_copts",
},
)
# This is a general purpose transition that applies the listed copt flags to
# all transitive dependencies.
extra_copts_for_all_deps = declare_transtion(
attrs = {
"extra_copts": attr.string_list(),
# This could be shared, but we don't in order to make it clearer that
# a transition is in use.
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
},
append_to_flags = {
"//command_line_option:copt": "extra_copts",
},
)

View file

@ -2,3 +2,10 @@
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
set(CMAKE_EXECUTABLE_SUFFIX .elf) set(CMAKE_EXECUTABLE_SUFFIX .elf)
# include paths to find installed tools
if(CMAKE_HOST_WIN32)
include(Platform/WindowsPaths)
else()
include(Platform/UnixPaths)
endif()

41
cmake/generic_board.cmake Normal file
View file

@ -0,0 +1,41 @@
# For boards without their own cmake file, we look for a header file
cmake_minimum_required(VERSION 3.15)
# PICO_CMAKE_CONFIG: PICO_BOARD_HEADER_DIRS, List of directories to look for <PICO_BOARD>.h in. This may be specified the user environment, type=list, group=build
if (DEFINED ENV{PICO_BOARD_HEADER_DIRS})
set(PICO_BOARD_HEADER_DIRS $ENV{PICO_BOARD_HEADER_DIRS})
message("Using PICO_BOARD_HEADER_DIRS from environment ('${PICO_BOARD_HEADER_DIRS}')")
endif()
set(PICO_BOARD_HEADER_DIRS ${PICO_BOARD_HEADER_DIRS} CACHE STRING "PICO board header directories" FORCE)
list(APPEND PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}/../src/boards/include/boards)
pico_find_in_paths(PICO_BOARD_HEADER_FILE PICO_BOARD_HEADER_DIRS ${PICO_BOARD}.h)
if (EXISTS ${PICO_BOARD_HEADER_FILE})
message("Using board configuration from ${PICO_BOARD_HEADER_FILE}")
list(APPEND PICO_CONFIG_HEADER_FILES ${PICO_BOARD_HEADER_FILE})
# we parse the header file to configure the defaults
file(STRINGS ${PICO_BOARD_HEADER_FILE} HEADER_FILE_CONTENTS)
while(HEADER_FILE_CONTENTS)
list(POP_FRONT HEADER_FILE_CONTENTS LINE)
if (LINE MATCHES "^[ \t\]*//[ \t\]*pico_cmake_set[ \t\]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t\]*=[ \t\]*(.*)")
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
endif()
if (LINE MATCHES "^[ \t\]*//[ \t\]*pico_cmake_set_default[ \t\]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t\]*=[ \t\]*(.*)")
if (NOT DEFINED "${CMAKE_MATCH_1}")
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
else()
list(APPEND PICO_BOARD_CMAKE_OVERRIDES ${CMAKE_MATCH_1})
endif()
endif()
endwhile()
else()
set(msg "Unable to find definition of board '${PICO_BOARD}' (specified by PICO_BOARD):\n")
list(JOIN PICO_BOARD_HEADER_DIRS ", " DIRS)
string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.h in ${DIRS} (additional paths specified by PICO_BOARD_HEADER_DIRS)\n")
list(JOIN PICO_BOARD_CMAKE_DIRS ", " DIRS)
string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.cmake in ${DIRS} (additional paths specified by PICO_BOARD_CMAKE_DIRS)")
message(FATAL_ERROR ${msg})
endif()

View file

@ -1,21 +1,135 @@
# PICO_CMAKE_CONFIG: PICO_PLATFORM, platform to build for e.g. rp2040/host, default=rp2040 or environment value, group=build # PICO_BOARD is the root of config as it can define PICO_PLATFORM and other build vars
if (DEFINED ENV{PICO_PLATFORM} AND (NOT PICO_PLATFORM))
# PICO_CMAKE_CONFIG: PICO_BOARD, Board name being built for. This may be specified in the user environment, type=string, default=pico or pico2, group=build, docref=cmake-platform-board-config
if (DEFINED ENV{PICO_BOARD} AND NOT PICO_BOARD)
set(PICO_BOARD $ENV{PICO_BOARD})
message("Initializing PICO_BOARD from environment ('${PICO_BOARD}')")
endif()
# PICO_CMAKE_CONFIG: PICO_PLATFORM, Platform to build for e.g. rp2040/rp2350/rp2350-arm-s/rp2350-riscv/host. This may be specified in the user environment, type=string, default=based on PICO_BOARD or environment value, group=build, docref=cmake-platform-board-config
if (DEFINED ENV{PICO_PLATFORM} AND NOT PICO_PLATFORM)
set(PICO_PLATFORM $ENV{PICO_PLATFORM}) set(PICO_PLATFORM $ENV{PICO_PLATFORM})
message("Using PICO_PLATFORM from environment ('${PICO_PLATFORM}')") message("Initializing PICO_PLATFORM from environment ('${PICO_PLATFORM}')")
else() endif()
set(PICO_SAVED_PLATFORM "${PICO_PLATFORM}")
# If PICO_PLATFORM is specified but not PICO_BOARD, we'll make a stab at defaulting
if (NOT PICO_DEFAULT_BOARD_rp2040)
set(PICO_DEFAULT_BOARD_rp2040 "pico")
endif()
if (NOT PICO_DEFAULT_BOARD_rp2350)
set(PICO_DEFAULT_BOARD_rp2350 "pico2")
endif()
if (NOT PICO_DEFAULT_BOARD_rp2350-arm-s)
set(PICO_DEFAULT_BOARD_rp2350-arm-s "pico2")
endif()
if (NOT PICO_DEFAULT_BOARD_rp2350-riscv)
set(PICO_DEFAULT_BOARD_rp2350-riscv "pico2")
endif()
if (NOT PICO_DEFAULT_BOARD_host)
set(PICO_DEFAULT_BOARD_host "none")
endif()
if (NOT PICO_DEFAULT_PLATFORM)
set(PICO_DEFAULT_PLATFORM "rp2040")
endif()
if (NOT PICO_BOARD)
if (NOT PICO_PLATFORM) if (NOT PICO_PLATFORM)
set(PICO_PLATFORM "rp2040") # if we have neither BOARD nor PLATFORM default PLATFORM silently, so we don't end up with a board of "none"
pico_message("Defaulting PICO_PLATFORM to ${PICO_PLATFORM} since not specified.") # on platform that does have a default board (we want default PLATFORM and BOARD in that case)
set(PICO_PLATFORM ${PICO_DEFAULT_PLATFORM})
# set PICO_SAVED_PLATFORM so we don't print "Defaulting" again below
set(PICO_SAVED_PLATFORM ${PICO_DEFAULT_PLATFORM})
pico_message("Defaulting platform (PICO_PLATFORM) to '${PICO_PLATFORM}' since not specified.")
endif()
if (PICO_DEFAULT_BOARD_${PICO_PLATFORM})
set(PICO_BOARD ${PICO_DEFAULT_BOARD_${PICO_PLATFORM}})
else() else()
message("PICO platform is ${PICO_PLATFORM}.") set(PICO_BOARD "none")
endif() endif()
pico_message("Defaulting target board (PICO_BOARD) to '${PICO_BOARD}' since not specified.")
else()
message("Target board (PICO_BOARD) is '${PICO_BOARD}'.")
endif()
set(PICO_BOARD ${PICO_BOARD} CACHE STRING "PICO target board (e.g. pico, pico2)" FORCE)
# PICO_CMAKE_CONFIG: PICO_BOARD_CMAKE_DIRS, List of directories to look for <PICO_BOARD>.cmake in. This may be specified in the user environment, type=list, group=build
if (DEFINED ENV{PICO_BOARD_CMAKE_DIRS})
set(PICO_BOARD_CMAKE_DIRS $ENV{PICO_BOARD_CMAKE_DIRS})
message("Using PICO_BOARD_CMAKE_DIRS from environment ('${PICO_BOARD_CMAKE_DIRS}')")
endif() endif()
set(PICO_PLATFORM ${PICO_PLATFORM} CACHE STRING "PICO Build platform (e.g. rp2040, host)") list(APPEND PICO_BOARD_CMAKE_DIRS ${CMAKE_CURRENT_LIST_DIR}/../src/boards)
# PICO_CMAKE_CONFIG: PICO_CMAKE_RELOAD_PLATFORM_FILE, custom CMake file to use to set up the platform environment, default=none, group=build pico_find_in_paths(PICO_BOARD_CMAKE_FILE PICO_BOARD_CMAKE_DIRS ${PICO_BOARD}.cmake)
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE "" CACHE INTERNAL "") if (EXISTS "${PICO_BOARD_CMAKE_FILE}")
set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/platforms" CACHE INTERNAL "") message("Using CMake board configuration from ${PICO_BOARD_CMAKE_FILE}")
include(${PICO_BOARD_CMAKE_FILE} board_config)
else()
include(generic_board)
endif()
list(APPEND PICO_INCLUDE_DIRS ${PICO_SDK_PATH}/src/boards/include) # so boards/foo.h can be explicitly included
# PICO_CMAKE_CONFIG: PICO_DEFAULT_RP2350_PLATFORM, Default actual platform to build for if rp2350 is specified for PICO_PLATFORM e.g. rp2350-arm-s/rp2350-riscv, type=string, default=rp2350-arm-s, group=build
if (DEFINED ENV{PICO_DEFAULT_RP2350_PLATFORM} AND NOT PICO_DEFAULT_RP2350_PLATFORM)
set(PICO_DEFAULT_RP2350_PLATFORM $ENV{PICO_DEFAULT_RP2350_PLATFORM})
endif()
if (NOT PICO_DEFAULT_RP2350_PLATFORM)
set(PICO_DEFAULT_RP2350_PLATFORM "rp2350-arm-s")
endif()
if (NOT COMMAND pico_expand_pico_platform)
function(pico_expand_pico_platform FUNC DO_MESSAGE)
if (${FUNC} STREQUAL "rp2350")
if (DO_MESSAGE)
message("Auto-converting non-specific PICO_PLATFORM='rp2350' to '${PICO_DEFAULT_RP2350_PLATFORM}'")
endif()
set(${FUNC} "${PICO_DEFAULT_RP2350_PLATFORM}" PARENT_SCOPE)
endif()
endfunction()
endif()
if (NOT PICO_PLATFORM)
set(PICO_PLATFORM ${PICO_DEFAULT_PLATFORM})
pico_message("Defaulting platform (PICO_PLATFORM) to '${PICO_PLATFORM}' since not specified.")
else()
if (NOT PICO_SAVED_PLATFORM)
pico_expand_pico_platform(PICO_PLATFORM 1)
pico_message("Defaulting platform (PICO_PLATFORM) to '${PICO_PLATFORM}' based on PICO_BOARD setting.")
else()
string(REGEX REPLACE "-.*" "" PICO_PLATFORM_PREFIX ${PICO_PLATFORM})
string(REGEX REPLACE "-.*" "" PICO_SAVED_PLATFORM_PREFIX ${PICO_SAVED_PLATFORM})
if (PICO_PLATFORM_PREFIX STREQUAL PICO_SAVED_PLATFORM_PREFIX)
# the PICO_PLATFORM specified based on the board is compatible based on the one we were
# already using, so use that
pico_expand_pico_platform(PICO_SAVED_PLATFORM 0)
set(PICO_PLATFORM ${PICO_SAVED_PLATFORM})
message("Pico Platform (PICO_PLATFORM) is '${PICO_PLATFORM}'.")
else()
message(FATAL_ERROR "PICO_PLATFORM is specified to be '${PICO_SAVED_PLATFORM}', but PICO_BOARD='${PICO_BOARD}' uses \
'${PICO_PLATFORM}' which is incompatible. You need to delete the CMake cache or build directory and reconfigure to proceed. \
The best practice is to use separate build directories for different platforms.")
endif()
endif()
endif()
unset(PICO_SAVED_PLATFORM)
if (PICO_PREVIOUS_PLATFORM AND NOT PICO_PREVIOUS_PLATFORM STREQUAL PICO_PLATFORM)
message(FATAL_ERROR "PICO_PLATFORM has been modified from '${PICO_SAVED_PLATFORM}' to '${PICO_PLATFORM}.\
You need to delete the CMake cache or build directory and reconfigure to proceed.\
The best practice is to use separate build directories for different platforms.")
endif()
set(PICO_PLATFORM ${PICO_PLATFORM} CACHE STRING "PICO Build platform (e.g. rp2040, rp2350, rp2350-riscv, host)" FORCE)
set(PICO_PREVIOUS_PLATFORM ${PICO_PLATFORM} CACHE STRING "Saved PICO Build platform (e.g. rp2040, rp2350, rp2350-riscv, host)" INTERNAL)
# PICO_CMAKE_CONFIG: PICO_CMAKE_PRELOAD_PLATFORM_FILE, Custom CMake file to use to set up the platform environment, type=string, group=build
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_FILE} CACHE INTERNAL "")
if (NOT PICO_CMAKE_PRELOAD_PLATFORM_DIR)
set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/platforms")
endif()
set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${PICO_CMAKE_PRELOAD_PLATFORM_DIR}" CACHE INTERNAL "")
if (NOT PICO_CMAKE_PRELOAD_PLATFORM_FILE) if (NOT PICO_CMAKE_PRELOAD_PLATFORM_FILE)
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "") set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "")

View file

@ -1,10 +1,11 @@
# PICO_CMAKE_CONFIG: PICO_TOOLCHAIN_PATH, Path to search for compiler, default=none (i.e. search system paths), group=build # PICO_CMAKE_CONFIG: PICO_TOOLCHAIN_PATH, Path to search for compiler, type=string, default=none (i.e. search system paths), group=build, docref=cmake-toolchain-config
# Set your compiler path here if it's not in the PATH environment variable. set(PICO_TOOLCHAIN_PATH "${PICO_TOOLCHAIN_PATH}" CACHE INTERNAL "")
set(PICO_TOOLCHAIN_PATH "" CACHE INTERNAL "")
# Set a default build type if none was specified # Set a default build type if none was specified
set(default_build_type "Release") set(default_build_type "Release")
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_PREFIX_PATH)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Defaulting build type to '${default_build_type}' since not specified.") message(STATUS "Defaulting build type to '${default_build_type}' since not specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build, options are: 'Debug', 'Release', 'MinSizeRel', 'RelWithDebInfo'." FORCE) set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build, options are: 'Debug', 'Release', 'MinSizeRel', 'RelWithDebInfo'." FORCE)
@ -17,28 +18,59 @@ if (CMAKE_BUILD_TYPE STREQUAL "Default")
error("Default build type is NOT supported") error("Default build type is NOT supported")
endif() endif()
# PICO_CMAKE_CONFIG: PICO_COMPILER, Optionally specifies a different compiler (other than pico_arm_gcc.cmake) - this is not yet fully supported, default=none, group=build if (NOT (DEFINED PICO_COMPILER OR DEFINED CMAKE_TOOLCHAIN_FILE))
if (DEFINED PICO_DEFAULT_COMPILER)
pico_message("Defaulting compiler (PICO_COMPILER) to '${PICO_DEFAULT_COMPILER}' since not specified.")
set(PICO_COMPILER ${PICO_DEFAULT_COMPILER})
endif()
endif ()
# PICO_CMAKE_CONFIG: PICO_COMPILER, Specifies the compiler family to use, type=string, group=build, default=PICO_DEFAULT_COMPILER which is set based on PICO_PLATFORM, docref=cmake-toolchain-config
# If PICO_COMPILER is specified, set toolchain file to ${PICO_COMPILER}.cmake. # If PICO_COMPILER is specified, set toolchain file to ${PICO_COMPILER}.cmake.
if (DEFINED PICO_COMPILER) if (DEFINED PICO_COMPILER)
if (DEFINED CMAKE_TOOLCHAIN_FILE) # maintain backwards compatibility with RP2040 SDK compilers
get_filename_component(toolchain "${CMAKE_TOOLCHAIN_FILE}" NAME_WE) set(ORIG_PICO_COMPILER "${PICO_COMPILER}")
if (NOT "${PICO_COMPILER}" STREQUAL "${toolchain}") if (PICO_COMPILER STREQUAL "pico_arm_gcc")
message(WARNING "CMAKE_TOOLCHAIN_FILE is already defined to ${toolchain}.cmake, you\ if (PICO_PLATFORM STREQUAL "rp2040")
need to delete cache and reconfigure if you want to switch compiler.") set(PICO_COMPILER "pico_arm_cortex_m0plus_gcc")
elseif(PICO_PLATFORM STREQUAL "rp2350")
set(PICO_COMPILER "pico_arm_cortex_m33_gcc")
endif() endif()
else () elseif(PICO_COMPILER STREQUAL "pico_arm_clang")
set(toolchain_dir "${CMAKE_CURRENT_LIST_DIR}/preload/toolchains") if (PICO_PLATFORM STREQUAL "rp2040")
set(toolchain_file "${toolchain_dir}/${PICO_COMPILER}.cmake") set(PICO_COMPILER "pico_arm_cortex_m0plus_clang")
elseif(PICO_PLATFORM STREQUAL "rp2350-arm-s")
set(PICO_COMPILER "pico_arm_cortex_m33_clang")
elseif(PICO_PLATFORM STREQUAL "rp2350-arm-ns")
set(PICO_COMPILER "pico_arm_cortex_m33_clang")
endif()
endif()
if (NOT PICO_COMPILER STREQUAL ORIG_PICO_COMPILER)
message("Accepting PICO_COMPILER value '${ORIG_PICO_COMPILER}' for compatibility, but using '${PICO_COMPILER}' instead")
endif()
if (NOT DEFINED PICO_TOOLCHAIN_DIR)
set(PICO_TOOLCHAIN_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/toolchains")
endif()
set(toolchain_file "${PICO_TOOLCHAIN_DIR}/${PICO_COMPILER}.cmake")
if (EXISTS "${toolchain_file}") if (EXISTS "${toolchain_file}")
set(CMAKE_TOOLCHAIN_FILE "${toolchain_file}" CACHE INTERNAL "") set(CMAKE_TOOLCHAIN_FILE "${toolchain_file}")
else () else ()
# todo improve message # todo improve message
message(FATAL_ERROR "Toolchain file \"${PICO_COMPILER}.cmake\" does not exist, please\ message(FATAL_ERROR "Toolchain file \"${PICO_COMPILER}.cmake\" does not exist, please\
select one from \"cmake/toolchains\" folder.") select one from \"cmake/toolchains\" folder.")
endif () endif ()
message("Configuring toolchain based on PICO_COMPILER '${PICO_COMPILER}'")
endif ()
if (PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE)
if (NOT "${PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE}" STREQUAL "${CMAKE_TOOLCHAIN_FILE}")
message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE was previously defined to ${PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE}, and now\
is being changed to ${CMAKE_TOOLCHAIN_FILE}. You\
need to delete the CMake cache and reconfigure if you want to switch compiler.\
The best practice is to use separate build directories for different platforms or compilers.")
endif () endif ()
endif () endif ()
message("PICO compiler is ${PICO_COMPILER}") set(PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE} CACHE INTERNAL "Saved CMAKE_TOOLCHAIN_FILE" FORCE)
unset(PICO_COMPILER CACHE) unset(PICO_COMPILER CACHE)

View file

@ -0,0 +1,3 @@
set(PICO_DEFAULT_COMPILER "pico_arm_cortex_m33_gcc")
set(PICO_CHIP rp2350)

View file

@ -1,7 +0,0 @@
if (NOT (DEFINED PICO_COMPILER OR DEFINED CMAKE_TOOLCHAIN_FILE))
pico_message("Defaulting PICO platform compiler to pico_arm_gcc since not specified.")
set(PICO_COMPILER "pico_arm_gcc")
endif ()

View file

@ -1 +1,2 @@
include(${CMAKE_CURRENT_LIST_DIR}/pico/pico.cmake) set(PICO_DEFAULT_COMPILER "pico_arm_cortex_m0plus_gcc")
set(PICO_CHIP rp2040)

View file

@ -0,0 +1,3 @@
set(PICO_DEFAULT_COMPILER "pico_arm_cortex_m33_gcc")
set(PICO_CHIP rp2350)

View file

@ -0,0 +1,3 @@
set(PICO_DEFAULT_COMPILER "pico_riscv_gcc")
set(PICO_CHIP rp2350)

View file

@ -1,53 +0,0 @@
# NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
# i.e. CMake<Lang>Information and whatnot
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
# include our Platform/pico.cmake
set(CMAKE_SYSTEM_NAME PICO)
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
# Find CLANG
pico_find_compiler(PICO_COMPILER_CC clang)
pico_find_compiler(PICO_COMPILER_CXX clang)
#pico_find_compiler(PICO_COMPILER_ASM armasm)
set(PICO_COMPILER_ASM "${PICO_COMPILER_CC}" CACHE INTERNAL "")
pico_find_compiler(PICO_OBJCOPY llvm-objcopy)
pico_find_compiler(PICO_OBJDUMP llvm-objdump)
# Specify the cross compiler.
set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
set(CMAKE_C_OUTPUT_EXTENSION .o)
# todo should we be including CMakeASMInformation anyway - i guess that is host side
set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
set(CMAKE_INCLUDE_FLAG_ASM "-I")
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
# Disable compiler checks.
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)
# Add target system root to cmake find path.
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
# Look for includes and libraries only in the target system prefix.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
include_directories(/usr/include/newlib)
# todo move to platform/Generix-xxx
set(ARM_CLANG_COMMON_FLAGS " --target=arm-none-eabi -mcpu=cortex-m0plus -mthumb")
set(CMAKE_C_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
set(CMAKE_ASM_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og")

View file

@ -1,7 +1,7 @@
# NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED # NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform # todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
# i.e. CMake<Lang>Information and whatnot # i.e. CMake<Lang>Information and whatnot
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake) include(${CMAKE_CURRENT_LIST_DIR}/util/find_compiler.cmake)
# include our Platform/PICO.cmake # include our Platform/PICO.cmake
set(CMAKE_SYSTEM_NAME PICO) set(CMAKE_SYSTEM_NAME PICO)
@ -27,10 +27,6 @@ set(CMAKE_INCLUDE_FLAG_ASM "-I")
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "") set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "") set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
# Disable compiler checks.
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)
# Add target system root to cmake find path. # Add target system root to cmake find path.
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY) get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY) get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
@ -41,12 +37,5 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# todo move to platform/Generix-xxx set(ARM_TOOLCHAIN_COMMON_FLAGS " --cpu=Cortex-M0plus")
set(ARM_CLANG_COMMON_FLAGS " --cpu=Cortex-M0plus") include(${CMAKE_CURRENT_LIST_DIR}/util/set_flags.cmake)
string(APPEND CMAKE_C_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
string(APPEND CMAKE_ASM_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og")
string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og")

View file

@ -0,0 +1,8 @@
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
# these are all the directories under LLVM embedded toolchain for ARM (newlib or pibolibc) and under llvm_libc
set(PICO_CLANG_RUNTIMES armv6m_soft_nofp armv6m-unknown-none-eabi)
set(PICO_COMMON_LANG_FLAGS "--target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m")
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_clang_common.cmake)

View file

@ -0,0 +1,7 @@
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
set(PICO_DEFAULT_GCC_TRIPLE arm-none-eabi)
# on ARM -mcpu should not be mixed with -march
set(PICO_COMMON_LANG_FLAGS " -mcpu=cortex-m0plus -mthumb")
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)

View file

@ -0,0 +1,15 @@
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
# i.e. CMake<Lang>Information and whatnot
set(CMAKE_SYSTEM_PROCESSOR cortex-m23)
set(PICO_DEFAULT_GCC_TRIPLE arm-none-eabi)
# todo amy should this be -mfloat-abi=hard?
set(PICO_COMMON_LANG_FLAGS " -mcpu=cortex-m23 -mthumb -march=armv8-m.base")
# todo probably need a setting here, also do we want `softfp`?
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mfloat-abi=softfp")
if (NOT PICO_NO_CMSE)
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mcmse")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)

View file

@ -0,0 +1,8 @@
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
# these are all the directories under LLVM embedded toolchain for ARM (newlib or pibolibc) and under llvm_libc
set(PICO_CLANG_RUNTIMES armv8m.main_soft_nofp armv8m.main-unknown-none-eabi)
set(PICO_COMMON_LANG_FLAGS "-mcpu=cortex-m33 --target=armv8m.main-none-eabi -mfloat-abi=softfp -march=armv8m.main+fp+dsp")
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_clang_common.cmake)

View file

@ -0,0 +1,10 @@
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
set(PICO_DEFAULT_GCC_TRIPLE arm-none-eabi)
set(PICO_COMMON_LANG_FLAGS " -mcpu=cortex-m33 -mthumb -march=armv8-m.main+fp+dsp")
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mfloat-abi=softfp")
if (NOT PICO_NO_CMSE)
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mcmse")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)

View file

@ -1,66 +0,0 @@
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
# i.e. CMake<Lang>Information and whatnot
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
# include our Platform/PICO.cmake
set(CMAKE_SYSTEM_NAME PICO)
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
if (NOT PICO_GCC_TRIPLE)
if (DEFINED ENV{PICO_GCC_TRIPLE})
set(PICO_GCC_TRIPLE $ENV{PICO_GCC_TRIPLE})
message("PICO_GCC_TRIPLE set from environment: $ENV{PICO_GCC_TRIPLE}")
else()
set(PICO_GCC_TRIPLE arm-none-eabi)
message("PICO_GCC_TRIPLE defaulted to arm-none-eabi")
endif()
endif()
# Find GCC for ARM.
pico_find_compiler(PICO_COMPILER_CC ${PICO_GCC_TRIPLE}-gcc)
pico_find_compiler(PICO_COMPILER_CXX ${PICO_GCC_TRIPLE}-g++)
set(PICO_COMPILER_ASM "${PICO_COMPILER_CC}" CACHE INTERNAL "")
pico_find_compiler(PICO_OBJCOPY ${PICO_GCC_TRIPLE}-objcopy)
pico_find_compiler(PICO_OBJDUMP ${PICO_GCC_TRIPLE}-objdump)
# Specify the cross compiler.
set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
set(CMAKE_C_OUTPUT_EXTENSION .o)
# todo should we be including CMakeASMInformation anyway - i guess that is host side
set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
set(CMAKE_INCLUDE_FLAG_ASM "-I")
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
# Disable compiler checks.
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)
# Add target system root to cmake find path.
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
# Look for includes and libraries only in the target system prefix.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
option(PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
# todo move to platform/Generix-xxx
set(ARM_GCC_COMMON_FLAGS " -march=armv6-m -mcpu=cortex-m0plus -mthumb")
#set(ARM_GCC_COMMON_FLAGS " -mcpu=cortex-m0plus -mthumb")
foreach(LANG IN ITEMS C CXX ASM)
set(CMAKE_${LANG}_FLAGS_INIT "${ARM_GCC_COMMON_FLAGS}")
if (PICO_DEOPTIMIZED_DEBUG)
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
else()
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-Og")
endif()
set(CMAKE_${LANG}_LINK_FLAGS "-Wl,--build-id=none")
endforeach()

View file

@ -0,0 +1,7 @@
set(CMAKE_SYSTEM_PROCESSOR hazard3)
set(PICO_DEFAULT_GCC_TRIPLE riscv32-unknown-elf riscv32-corev-elf)
set(PICO_COMMON_LANG_FLAGS " -march=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb -mabi=ilp32")
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)

View file

@ -0,0 +1,10 @@
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
# i.e. CMake<Lang>Information and whatnot
set(CMAKE_SYSTEM_PROCESSOR hazard3)
set(PICO_DEFAULT_GCC_TRIPLE riscv32-unknown-elf riscv32-corev-elf)
set(PICO_COMMON_LANG_FLAGS " -march=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp -mabi=ilp32")
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)

View file

@ -7,10 +7,10 @@ endif ()
# Find the compiler executable and store its path in a cache entry ${compiler_path}. # Find the compiler executable and store its path in a cache entry ${compiler_path}.
# If not found, issue a fatal message and stop processing. PICO_TOOLCHAIN_PATH can be provided from # If not found, issue a fatal message and stop processing. PICO_TOOLCHAIN_PATH can be provided from
# commandline as additional search path. # commandline as additional search path.
function(pico_find_compiler compiler_path compiler_exe) function(pico_find_compiler compiler_path compiler_exes)
# Search user provided path first. # Search user provided path first.
find_program( find_program(
${compiler_path} ${compiler_exe} ${compiler_path} NAMES ${compiler_exes}
PATHS ENV PICO_TOOLCHAIN_PATH PATHS ENV PICO_TOOLCHAIN_PATH
PATH_SUFFIXES bin PATH_SUFFIXES bin
NO_DEFAULT_PATH NO_DEFAULT_PATH
@ -21,11 +21,21 @@ function(pico_find_compiler compiler_path compiler_exe)
if (DEFINED ENV{PICO_TOOLCHAIN_PATH}) if (DEFINED ENV{PICO_TOOLCHAIN_PATH})
message(WARNING "PICO_TOOLCHAIN_PATH specified ($ENV{PICO_TOOLCHAIN_PATH}), but ${compiler_exe} not found there") message(WARNING "PICO_TOOLCHAIN_PATH specified ($ENV{PICO_TOOLCHAIN_PATH}), but ${compiler_exe} not found there")
endif() endif()
find_program(${compiler_path} ${compiler_exe}) find_program(${compiler_path} NAMES ${compiler_exes})
endif () endif ()
if ("${${compiler_path}}" STREQUAL "${compiler_path}-NOTFOUND") if ("${${compiler_path}}" STREQUAL "${compiler_path}-NOTFOUND")
set(PICO_TOOLCHAIN_PATH "" CACHE PATH "Path to search for compiler.") set(PICO_TOOLCHAIN_PATH "" CACHE PATH "Path to search for compiler.")
message(FATAL_ERROR "Compiler '${compiler_exe}' not found, you can specify search path with\ list(JOIN compiler_exes " / " compiler_exes)
message(FATAL_ERROR "Compiler '${compiler_exes}' not found, you can specify search path with\
\"PICO_TOOLCHAIN_PATH\".") \"PICO_TOOLCHAIN_PATH\".")
endif () endif ()
endfunction() endfunction()
# Find the compiler executable and store its path in a cache entry ${compiler_path}.
# If not found, issue a fatal message and stop processing. PICO_TOOLCHAIN_PATH can be provided from
# commandline as additional search path.
function(pico_find_compiler_with_triples compiler_path triples compiler_suffix)
list(TRANSFORM triples APPEND "-${compiler_suffix}")
pico_find_compiler(${compiler_path} "${triples}")
set(${compiler_path} ${${compiler_path}} PARENT_SCOPE)
endfunction()

View file

@ -0,0 +1,97 @@
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
# include our Platform/PICO.cmake
set(CMAKE_SYSTEM_NAME PICO)
# Find Clang
pico_find_compiler(PICO_COMPILER_CC clang)
pico_find_compiler(PICO_COMPILER_CXX clang++)
set(PICO_COMPILER_ASM "${PICO_COMPILER_CC}" CACHE INTERNAL "")
pico_find_compiler(PICO_OBJCOPY llvm-objcopy)
pico_find_compiler(PICO_OBJDUMP llvm-objdump)
# Specify the cross compiler.
set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
# workaround for projects that don't enable ASM
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
set(CMAKE_INCLUDE_FLAG_ASM "-I")
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
foreach(LANG IN ITEMS C CXX ASM)
set(CMAKE_${LANG}_OUTPUT_EXTENSION .o)
endforeach()
# Add target system root to cmake find path.
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
# Look for includes and libraries only in the target system prefix.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Oz is preferred for Clang (verses CMake default -Os) see also https://gitlab.kitware.com/cmake/cmake/-/issues/22458
foreach(LANG IN ITEMS C CXX ASM)
set(CMAKE_${LANG}_FLAGS_MINSIZEREL_INIT "-Oz -DNDEBUG")
endforeach()
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES PICO_CLIB)
foreach(PICO_CLANG_RUNTIME IN LISTS PICO_CLANG_RUNTIMES)
# LLVM embedded-toolchain for ARM style
find_path(PICO_COMPILER_SYSROOT NAMES include/stdio.h
HINTS
${PICO_COMPILER_DIR}/../lib/clang-runtimes/arm-none-eabi/${PICO_CLANG_RUNTIME}
${PICO_COMPILER_DIR}/../lib/clang-runtimes/${PICO_CLANG_RUNTIME}
)
if (PICO_COMPILER_SYSROOT)
if (NOT PICO_CLIB)
# this is a bit of a hack; to try to autodetect the C library used:
# `picolibc.h` seems to exist on the newer versions of LLVM embedded toolchain for ARM using picolibc whereas
# `newlib.h` appears in all versions, so isn't very useful
if (EXISTS "${PICO_COMPILER_SYSROOT}/include/picolibc.h")
message("Setting default C library to picolibc as LLVM appears to be using it")
set(PICO_CLIB "picolibc" CACHE INTERNAL "")
endif()
endif()
break()
endif()
# llvm_libc style
find_path(PICO_COMPILER_SYSROOT NAMES stdio.h
HINTS
${PICO_COMPILER_DIR}/../include/${PICO_CLANG_RUNTIME}
)
if (PICO_COMPILER_SYSROOT)
if (NOT PICO_CLIB)
message("Setting default C library to llvm_libc as LLVM appears to be using it")
set(PICO_CLIB "llvm_libc" CACHE INTERNAL "")
endif()
break()
endif()
endforeach()
# moving this here as a reminder from pico_standard_link; it was commented out theee, but if ever needed,
# it belongs here as part of LINKER_FLAGS_INIT
#target_link_options(pico_standard_link INTERFACE "LINKER:-fuse-ld=lld")
if (PICO_CLIB STREQUAL "llvm_libc")
# TODO: Remove -nostdlib++ once we include libc++ in the toolchain.
# TODO: Move -nostartfiles to the appropriate library.
foreach(TYPE IN ITEMS EXE SHARED MODULE)
set(CMAKE_${TYPE}_LINKER_FLAGS_INIT "-nostdlib++ -nostartfiles")
endforeach()
else()
if (NOT PICO_COMPILER_SYSROOT)
message(FATAL_ERROR "Could not find an llvm runtime for '${PICO_CLANG_RUNTIME}'")
endif()
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} --sysroot ${PICO_COMPILER_SYSROOT}")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)

View file

@ -0,0 +1,57 @@
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
# include our Platform/PICO.cmake
set(CMAKE_SYSTEM_NAME PICO)
# PICO_CMAKE_CONFIG: PICO_GCC_TRIPLE, List of GCC_TRIPLES -- usually only one -- to try when searching for a compiler. This may be specified the user environment, type=int, default=PICO_DEFAULT_GCC_TRIPLE which is set based on PICO_COMPILER, group=pico_base, docref=cmake-toolchain-config
if (NOT PICO_GCC_TRIPLE)
if (DEFINED ENV{_SAVED_PICO_GCC_TRIPLE})
# saved within the same cmake invocation
set(PICO_GCC_TRIPLE $ENV{_SAVED_PICO_GCC_TRIPLE})
elseif (DEFINED ENV{PICO_GCC_TRIPLE})
set(PICO_GCC_TRIPLE $ENV{PICO_GCC_TRIPLE})
message("Initializing PICO_GCC_TRIPLE from environment ('${PICO_GCC_TRIPLE}')")
elseif(DEFINED PICO_DEFAULT_GCC_TRIPLE)
message("Defaulting PICO_GCC_TRIPLE to '${PICO_DEFAULT_GCC_TRIPLE}'")
set(PICO_GCC_TRIPLE ${PICO_DEFAULT_GCC_TRIPLE})
else()
message(FATAL_ERROR "PICO_DEFAULT_GCC_TRIPLE is not defined")
endif()
endif()
set(PICO_GCC_TRIPLE "${PICO_GCC_TRIPLE}" CACHE INTERNAL "")
set(ENV{_SAVED_PICO_GCC_TRIPLE} "${PICO_GCC_TRIPLE}")
# Find GCC
pico_find_compiler_with_triples(PICO_COMPILER_CC "${PICO_GCC_TRIPLE}" gcc)
pico_find_compiler_with_triples(PICO_COMPILER_CXX "${PICO_GCC_TRIPLE}" g++)
set(PICO_COMPILER_ASM "${PICO_COMPILER_CC}" CACHE INTERNAL "")
pico_find_compiler_with_triples(PICO_OBJCOPY "${PICO_GCC_TRIPLE}" objcopy)
pico_find_compiler_with_triples(PICO_OBJDUMP "${PICO_GCC_TRIPLE}" objdump)
# Specify the cross compiler.
set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
# workaround for projects that don't enable ASM
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
set(CMAKE_INCLUDE_FLAG_ASM "-I")
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
foreach(LANG IN ITEMS C CXX ASM)
set(CMAKE_${LANG}_OUTPUT_EXTENSION .o)
endforeach()
# Add target system root to cmake find path.
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
# Look for includes and libraries only in the target system prefix.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)

View file

@ -0,0 +1,26 @@
option(PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
option(PICO_DEBUG_INFO_IN_RELEASE "Include debug info in release builds" 1)
get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
foreach(LANG IN ITEMS C CXX ASM)
set(CMAKE_${LANG}_FLAGS_INIT "${PICO_COMMON_LANG_FLAGS}")
unset(CMAKE_${LANG}_FLAGS_DEBUG CACHE)
if (PICO_DEOPTIMIZED_DEBUG)
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
else()
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-Og")
endif()
if (PICO_DEBUG_INFO_IN_RELEASE)
set(CMAKE_${LANG}_FLAGS_RELEASE_INIT "-g")
set(CMAKE_${LANG}_FLAGS_MINSIZEREL_INIT "-g")
endif()
set(CMAKE_${LANG}_LINK_FLAGS "-Wl,--build-id=none")
# try_compile is where the feature testing is done, and at that point,
# pico_standard_link is not ready to be linked in to provide essential
# functions like _exit. So pass -nostdlib so it doesn't link in an exit()
# function at all.
if(IS_IN_TRY_COMPILE)
set(CMAKE_${LANG}_LINK_FLAGS "${CMAKE_${LANG}_LINK_FLAGS} -nostdlib")
endif()
endforeach()

View file

@ -1,4 +1,4 @@
find_package(Doxygen) find_package(Doxygen QUIET)
if (PICO_SDK_TOP_LEVEL_PROJECT AND ${DOXYGEN_FOUND}) if (PICO_SDK_TOP_LEVEL_PROJECT AND ${DOXYGEN_FOUND})
set(PICO_BUILD_DOCS_DEFAULT 1) set(PICO_BUILD_DOCS_DEFAULT 1)
endif() endif()
@ -26,7 +26,7 @@ if(PICO_BUILD_DOCS)
add_custom_target(doc-pico-examples) add_custom_target(doc-pico-examples)
else() else()
ExternalProject_Add(doc-pico-examples ExternalProject_Add(doc-pico-examples
GIT_REPOSITORY git@github.com:raspberrypi/pico-examples.git GIT_REPOSITORY https://github.com/raspberrypi/pico-examples
GIT_TAG master GIT_TAG master
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
@ -40,13 +40,26 @@ if(PICO_BUILD_DOCS)
endif() endif()
set(DOXY_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen") set(DOXY_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen")
set(DOXY_INPUT_DIRS "${PICO_DOXYGEN_PATHS}") string(REPLACE ";" " " DOXY_INPUT_DIRS "${PICO_DOXYGEN_PATHS}")
set(DOXY_EXCLUDE_DIRS "${PICO_DOXYGEN_EXCLUDE_PATHS}") string(REPLACE ";" " " DOXY_EXCLUDE_DIRS "${PICO_DOXYGEN_EXCLUDE_PATHS}")
string(REPLACE ";" " " DOXY_PREDEFINED "${PICO_DOXYGEN_PRE_DEFINES}")
string(REPLACE ";" " " DOXY_ENABLED_SECTIONS "${PICO_DOXYGEN_ENABLED_SECTIONS}")
set(DOXY_EXAMPLE_DIR "${PICO_EXAMPLES_PATH}") set(DOXY_EXAMPLE_DIR "${PICO_EXAMPLES_PATH}")
# auto genereate additional section enables from library paths
foreach (DIR IN LISTS PICO_DOXYGEN_PATHS)
get_filename_component(NAME "${DIR}" NAME)
if (NOT DIR STREQUAL "src")
set(DOXY_ENABLED_SECTIONS "${DOXY_ENABLED_SECTIONS} ${NAME}")
endif()
endforeach ()
set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
if (PICO_PLATFORM STREQUAL "rp2040")
set(PICO_DOXYGEN_TAG "(RP2040)")
elseif (PICO_PLATFORM STREQUAL "rp2350-arm-s" OR PICO_PLATFORM STREQUAL "rp2350-riscv")
set(PICO_DOXYGEN_TAG "(RP2350)")
endif()
configure_file(${doxyfile_in} ${doxyfile} @ONLY) configure_file(${doxyfile_in} ${doxyfile} @ONLY)
add_custom_target(docs add_custom_target(docs

View file

@ -1,5 +1,6 @@
PROJECT_NAME = "Pico SDK" PROJECT_NAME = "Raspberry Pi Pico SDK"
PROJECT_NUMBER = @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ PROJECT_BRIEF = "Raspberry Pi Pico SDK documentation"
PROJECT_NUMBER = @PICO_SDK_VERSION_STRING@ @PICO_DOXYGEN_TAG@
#STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ #STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
STRIP_FROM_PATH = @DOXY_INPUT_DIRS@ STRIP_FROM_PATH = @DOXY_INPUT_DIRS@
@ -20,8 +21,6 @@ LAYOUT_FILE = @PROJECT_SOURCE_DIR@/docs/DoxygenLayout.xml
HTML_FOOTER = @PROJECT_SOURCE_DIR@/docs/footer.html HTML_FOOTER = @PROJECT_SOURCE_DIR@/docs/footer.html
HTML_HEADER = @PROJECT_SOURCE_DIR@/docs/header.html HTML_HEADER = @PROJECT_SOURCE_DIR@/docs/header.html
PROJECT_BRIEF = "Pico SDK documentation"
PROJECT_NUMBER = 1.0
OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_FOR_C = YES
# HTML_EXTRA_STYLESHEET = @PROJECT_SOURCE_DIR@/docs/customdoxygen.css # HTML_EXTRA_STYLESHEET = @PROJECT_SOURCE_DIR@/docs/customdoxygen.css
HTML_EXTRA_STYLESHEET = @PROJECT_SOURCE_DIR@/docs/normalise.css @PROJECT_SOURCE_DIR@/docs/main.css @PROJECT_SOURCE_DIR@/docs/styles.css HTML_EXTRA_STYLESHEET = @PROJECT_SOURCE_DIR@/docs/normalise.css @PROJECT_SOURCE_DIR@/docs/main.css @PROJECT_SOURCE_DIR@/docs/styles.css
@ -53,12 +52,17 @@ EXTRACT_ALL = NO
ALWAYS_DETAILED_SEC = NO ALWAYS_DETAILED_SEC = NO
#REPEAT_BRIEF = NO #REPEAT_BRIEF = NO
ENABLE_PREPROCESSING = YES
# Need these next options to ensure that functions with modifiers do not confuse the Doxygen parser. # Need these next options to ensure that functions with modifiers do not confuse the Doxygen parser.
# And any further function modifiers here. # And any further function modifiers here.
MACRO_EXPANSION = YES MACRO_EXPANSION = YES
PREDEFINED = __not_in_flash_func(x) \ PREDEFINED = __not_in_flash_func(x)= \
__time_critical_func(x) \ __time_critical_func(x)= \
__not_in_flash(x)= \ __not_in_flash(x)= \
__no_inline_not_in_flash(x)= \ __no_inline_not_in_flash(x)= \
__attribute__(x)= __attribute__(x)= \
DOXYGEN_GENERATION= \
@DOXY_PREDEFINED@
ENABLED_SECTIONS = @DOXY_ENABLED_SECTIONS@

View file

@ -2,26 +2,28 @@
<!-- Generated by doxygen 1.8.17 --> <!-- Generated by doxygen 1.8.17 -->
<!-- Navigation index tabs for HTML output --> <!-- Navigation index tabs for HTML output -->
<navindex> <navindex>
<tab type="mainpage" visible="yes" title="Pico SDK Introduction"></tab> <tab type="mainpage" visible="yes" title="Introduction"></tab>
<tab type="modules" visible="yes" title="SDK API Documentation" intro="These are the libraries supplied in the Pico SDK"/> <tab type="modules" visible="yes" title="API Documentation" intro="These are the libraries supplied in the Raspberry Pi Pico SDK"/>
<tab type="user" url="@ref examples_page" visible="yes" title="Examples" intro="Links to SDK examples"/> <tab type="user" url="@ref examples_page" visible="yes" title="Examples" intro="Links to SDK examples"/>
<tab type="usergroup" url="@ref weblinks_page" visible="yes" title="Additional Documentation" intro="Links to datasheets and documentation"> <tab type="usergroup" url="@ref weblinks_page" visible="yes" title="Additional Documentation" intro="Links to datasheets and documentation">
<tab type="user" url="https://rptl.io/pico-datasheet" visible="yes" title="Raspberry Pi Pico Datasheet" intro=""/> <tab type="user" url="https://rptl.io/pico-datasheet" visible="yes" title="Raspberry Pi Pico Datasheet" intro=""/>
<tab type="user" url="https://rptl.io/picow-datasheet" visible="yes" title="Raspberry Pi Pico W Datasheet" intro=""/>
<tab type="user" url="https://rptl.io/rp2040-datasheet" visible="yes" title="RP2040 Datasheet" intro=""/> <tab type="user" url="https://rptl.io/rp2040-datasheet" visible="yes" title="RP2040 Datasheet" intro=""/>
<tab type="user" url="https://rptl.io/rp2040-design" visible="yes" title="Hardware design with RP2040" intro=""/> <tab type="user" url="https://rptl.io/rp2040-design" visible="yes" title="Hardware design with RP2040" intro=""/>
<tab type="user" url="https://rptl.io/pico-c-sdk" visible="yes" title="Pico C/C++ SDK" intro=""/> <tab type="user" url="https://rptl.io/pico-c-sdk" visible="yes" title="Raspberry Pi Pico C/C++ SDK" intro=""/>
<tab type="user" url="https://rptl.io/pico-micropython" visible="yes" title="Pico Python SDK" intro=""/> <tab type="user" url="https://rptl.io/pico-micropython" visible="yes" title="Raspberry Pi Pico Python SDK" intro=""/>
<tab type="user" url="https://rptl.io/pico-get-started" visible="yes" title="Getting started with Raspberry Pi Pico" intro=""/> <tab type="user" url="https://rptl.io/pico-get-started" visible="yes" title="Getting started with Raspberry Pi Pico" intro=""/>
<tab type="user" url="https://rptl.io/picow-connect" visible="yes" title="Connecting to the Internet with Raspberry Pi Pico W" intro=""/>
</tab> </tab>
<tab type="usergroup" url="@ref weblinks_page" visible="yes" title="Web" intro="useful weblinks"> <tab type="usergroup" url="@ref weblinks_page" visible="yes" title="Web" intro="useful weblinks">
<tab type="user" url="https://www.raspberrypi.org/" visible="yes" title="Raspberry Pi Site" intro=""/> <tab type="user" url="https://www.raspberrypi.com/" visible="yes" title="Raspberry Pi Site" intro=""/>
<tab type="user" url="https://rptl.io/rp2040-get-started" visible="yes" title="Raspberry Pi Pico Page" intro=""/> <tab type="user" url="https://rptl.io/rp2040-get-started" visible="yes" title="Raspberry Pi Pico Page" intro=""/>
<tab type="user" url="https://www.raspberrypi.org/forums" visible="yes" title="Raspberry Pi Forums" intro=""/> <tab type="user" url="https://forums.raspberrypi.com/" visible="yes" title="Raspberry Pi Forums" intro=""/>
<tab type="user" url="https://github.com/raspberrypi/pico-sdk" visible="yes" title="Pico SDK on Github" intro=""/> <tab type="user" url="https://github.com/raspberrypi/pico-sdk" visible="yes" title="Raspberry Pi Pico SDK on GitHub" intro=""/>
<tab type="user" url="https://github.com/raspberrypi/pico-examples" visible="yes" title="Pico Examples on Github" intro=""/> <tab type="user" url="https://github.com/raspberrypi/pico-examples" visible="yes" title="Pico Examples on GitHub" intro=""/>
<tab type="user" url="https://github.com/raspberrypi/pico-extras" visible="yes" title="Pico Extras on Github" intro=""/> <tab type="user" url="https://github.com/raspberrypi/pico-extras" visible="yes" title="Pico Extras on GitHub" intro=""/>
<tab type="user" url="https://github.com/raspberrypi/pico-playground" visible="yes" title="Pico Playground on Github" intro=""/> <tab type="user" url="https://github.com/raspberrypi/pico-playground" visible="yes" title="Pico Playground on GitHub" intro=""/>
<tab type="user" url="https://github.com/raspberrypi/pico-bootrom" visible="yes" title="Pico Bootrom on Github" intro=""/> <tab type="user" url="https://github.com/raspberrypi/pico-bootrom" visible="yes" title="Pico Bootrom on GitHub" intro=""/>
</tab> </tab>
<tab type="pages" visible="no" title="" intro=""/> <tab type="pages" visible="no" title="" intro=""/>
<tab type="namespaces" visible="yes" title=""> <tab type="namespaces" visible="yes" title="">
@ -146,8 +148,7 @@
</namespace> </namespace>
<!-- Layout definition for a file page --> <!-- Layout definition for a file page -->
<file> <tab type="modules" visible="yes" title="Libraries" intro="Here is a list of all the libraries supported in the Pico SDK"/> <file>
<briefdescription visible="yes"/> <briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/> <includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/> <includegraph visible="$INCLUDE_GRAPH"/>

View file

@ -1,6 +1,6 @@
## Examples Index {#examples_page} ## Examples Index {#examples_page}
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.
- [RTC example](@ref rtc_example) - [RTC example](@ref rtc_example)
- [UART example](@ref uart_example) - [UART example](@ref uart_example)

View file

@ -46,12 +46,15 @@
<div class="logo"> <div class="logo">
<a href="$relpath^index.html"> <img src="logo.svg" alt="Raspberry Pi"></a> <a href="$relpath^index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
<span style="display: inline-block; margin-top: 10px;">
v$projectnumber
</span>
</div> </div>
<div class="navigation-footer"> <div class="navigation-footer">
<img src="logo-mobile.svg" alt="Raspberry Pi"> <img src="logo-mobile.svg" alt="Raspberry Pi">
<a href="https://www.raspberrypi.org/" target="_blank">By Raspberry Pi (Trading) Ltd</a> <a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
</div> </div>
<!-- <div class="search"> <!-- <div class="search">
<form> <form>

View file

@ -6,52 +6,89 @@
// Here to organize documentation order // Here to organize documentation order
// for some reason cond/endcond work better here than if/endif
/** /**
* \defgroup hardware Hardware APIs * \defgroup hardware Hardware APIs
* This group of libraries provides a thin and efficient C API / abstractions to access the RP2040 hardware without having to read and write * This group of libraries provides a thin and efficient C API / abstractions to access the RP-series microcontroller hardware without having to read and write
* hardware registers directly. * hardware registers directly.
* @{ * @{
* \defgroup hardware_adc hardware_adc * \cond hardware_adc \defgroup hardware_adc hardware_adc \endcond
* \defgroup hardware_base hardware_base * \cond hardware_base \defgroup hardware_base hardware_base \endcond
* \defgroup hardware_claim hardware_claim * \cond hardware_bootlock \defgroup hardware_bootlock hardware_bootlock \endcond
* \defgroup hardware_clocks hardware_clocks * \cond hardware_claim \defgroup hardware_claim hardware_claim \endcond
* \defgroup hardware_divider hardware_divider * \cond hardware_clocks \defgroup hardware_clocks hardware_clocks \endcond
* \defgroup hardware_dma hardware_dma * \cond hardware_divider \defgroup hardware_divider hardware_divider \endcond
* \defgroup hardware_flash hardware_flash * \cond hardware_dcp \defgroup hardware_dcp hardware_dcp \endcond
* \defgroup hardware_gpio hardware_gpio * \cond hardware_dma \defgroup hardware_dma hardware_dma \endcond
* \defgroup hardware_i2c hardware_i2c * \cond hardware_exception \defgroup hardware_exception hardware_exception \endcond
* \defgroup hardware_interp hardware_interp * \cond hardware_flash \defgroup hardware_flash hardware_flash \endcond
* \defgroup hardware_irq hardware_irq * \cond hardware_gpio \defgroup hardware_gpio hardware_gpio \endcond
* \defgroup hardware_pio hardware_pio * \cond hardware_hazard3 \defgroup hardware_hazard3 hardware_hazard3 \endcond
* \defgroup hardware_pll hardware_pll * \cond hardware_i2c \defgroup hardware_i2c hardware_i2c \endcond
* \defgroup hardware_pwm hardware_pwm * \cond hardware_interp \defgroup hardware_interp hardware_interp \endcond
* \defgroup hardware_resets hardware_resets * \cond hardware_irq \defgroup hardware_irq hardware_irq \endcond
* \defgroup hardware_rtc hardware_rtc * \cond hardware_pio \defgroup hardware_pio hardware_pio \endcond
* \defgroup hardware_spi hardware_spi * \cond hardware_pll \defgroup hardware_pll hardware_pll \endcond
* \defgroup hardware_sync hardware_sync * \cond hardware_powman \defgroup hardware_powman hardware_powman \endcond
* \defgroup hardware_timer hardware_timer * \cond hardware_pwm \defgroup hardware_pwm hardware_pwm \endcond
* \defgroup hardware_uart hardware_uart * \cond hardware_pwm \defgroup hardware_pwm hardware_pwm \endcond
* \defgroup hardware_vreg hardware_vreg * \cond hardware_resets \defgroup hardware_resets hardware_resets \endcond
* \defgroup hardware_watchdog hardware_watchdog * \cond hardware_riscv \defgroup hardware_riscv hardware_riscv \endcond
* \defgroup hardware_xosc hardware_xosc * \cond hardware_riscv_platform_timer \defgroup hardware_riscv_platform_timer hardware_riscv_platform_timer \endcond
* \cond hardware_rtc \defgroup hardware_rtc hardware_rtc \endcond
* \cond hardware_rcp \defgroup hardware_rcp hardware_rcp \endcond
* \cond hardware_spi \defgroup hardware_spi hardware_spi \endcond
* \cond hardware_sha256 \defgroup hardware_sha256 hardware_sha256 \endcond
* \cond hardware_sync \defgroup hardware_sync hardware_sync \endcond
* \cond hardware_ticks \defgroup hardware_ticks hardware_ticks \endcond
* \cond hardware_timer \defgroup hardware_timer hardware_timer \endcond
* \cond hardware_uart \defgroup hardware_uart hardware_uart \endcond
* \cond hardware_vreg \defgroup hardware_vreg hardware_vreg \endcond
* \cond hardware_watchdog \defgroup hardware_watchdog hardware_watchdog \endcond
* \cond hardware_xip_cache \defgroup hardware_xip_cache hardware_xip_cache \endcond
* \cond hardware_xosc \defgroup hardware_xosc hardware_xosc \endcond
* \cond hardware_powman hardware_powman
* \cond hardware_hazard3 hardware_hazard3
* \cond hardware_riscv hardware_riscv
* @} * @}
* *
* \defgroup high_level High Level APIs * \defgroup high_level High Level APIs
* This group of libraries provide higher level functionality that isn't hardware related or provides a richer * This group of libraries provide higher level functionality that isn't hardware related or provides a richer
* set of functionality above the basic hardware interfaces * set of functionality above the basic hardware interfaces
* @{ * @{
* \defgroup pico_multicore pico_multicore * \cond pico_aon_timer \defgroup pico_aon_timer pico_aon_timer \endcond
* \defgroup pico_stdlib pico_stdlib * \cond pico_async_context \defgroup pico_async_context pico_async_context \endcond
* \defgroup pico_sync pico_sync * \cond pico_bootsel_via_double_reset \defgroup pico_bootsel_via_double_reset pico_bootsel_via_double_reset \endcond
* \defgroup pico_time pico_time * \cond pico_flash \defgroup pico_flash pico_flash \endcond
* \defgroup pico_util pico_util * \cond pico_i2c_slave \defgroup pico_i2c_slave pico_i2c_slave \endcond
* \cond pico_multicore \defgroup pico_multicore pico_multicore \endcond
* \cond pico_rand \defgroup pico_rand pico_rand \endcond
* \cond pico_sha256 \defgroup pico_sha256 pico_sha256 \endcond
* \cond pico_stdlib \defgroup pico_stdlib pico_stdlib \endcond
* \cond pico_sync \defgroup pico_sync pico_sync \endcond
* \cond pico_time \defgroup pico_time pico_time \endcond
* \cond pico_unique_id \defgroup pico_unique_id pico_unique_id \endcond
* \cond pico_util \defgroup pico_util pico_util \endcond
* @} * @}
* *
* \defgroup third_party Third-party Libraries * \defgroup third_party Third-party Libraries
* Third party libraries for implementing high level functionality. * Third party libraries for implementing high level functionality.
* @{ * @{
* \cond tinyusb
* \defgroup tinyusb_device tinyusb_device * \defgroup tinyusb_device tinyusb_device
* \defgroup tinyusb_host tinyusb_host * \defgroup tinyusb_host tinyusb_host
* \endcond
* @}
*
* \defgroup networking Networking Libraries
* Functions for implementing networking
* @{
* \cond pico_btstack \defgroup pico_btstack pico_btstack \endcond
* \cond pico_lwip \defgroup pico_lwip pico_lwip \endcond
* \cond pico_cyw43_driver \defgroup pico_cyw43_driver pico_cyw43_driver \endcond
* \cond pico_cyw43_arch \defgroup pico_cyw43_arch pico_cyw43_arch \endcond
* @} * @}
* *
* \defgroup runtime Runtime Infrastructure * \defgroup runtime Runtime Infrastructure
@ -59,28 +96,36 @@
* language level and C library functions, as well as CMake INTERFACE libraries * language level and C library functions, as well as CMake INTERFACE libraries
* abstracting the compilation and link steps in the SDK * abstracting the compilation and link steps in the SDK
* @{ * @{
* \defgroup boot_stage2 boot_stage2 * \cond boot_stage2 \defgroup boot_stage2 boot_stage2 \endcond
* \defgroup pico_base pico_base * \cond pico_atomic \defgroup pico_atomic pico_atomic \endcond
* \defgroup pico_bit_ops pico_bit_ops * \cond pico_base_headers \defgroup pico_base pico_base \endcond
* \defgroup pico_bootrom pico_bootrom * \cond pico_binary_info \defgroup pico_binary_info pico_binary_info \endcond
* \defgroup pico_cxx_options pico_cxx_options * \cond pico_bootrom \defgroup pico_bootrom pico_bootrom \endcond
* \defgroup pico_divider pico_divider * \cond pico_bit_ops \defgroup pico_bit_ops pico_bit_ops \endcond
* \defgroup pico_double pico_double * \cond pico_cxx_options \defgroup pico_cxx_options pico_cxx_options \endcond
* \defgroup pico_float pico_float * \cond pico_clib_interface \defgroup pico_clib_interface pico_clib_interface \endcond
* \defgroup pico_int64_ops pico_int64_ops * \cond pico_crt0 \defgroup pico_crt0 pico_crt0 \endcond
* \defgroup pico_malloc pico_malloc * \cond pico_divider \defgroup pico_divider pico_divider \endcond
* \defgroup pico_mem_ops pico_mem_ops * \cond pico_double \defgroup pico_double pico_double \endcond
* \defgroup pico_platform pico_platform * \cond pico_float \defgroup pico_float pico_float \endcond
* \defgroup pico_printf pico_printf * \cond pico_int64_ops \defgroup pico_int64_ops pico_int64_ops \endcond
* \defgroup pico_runtime pico_runtime * \cond pico_malloc \defgroup pico_malloc pico_malloc \endcond
* \defgroup pico_stdio pico_stdio * \cond pico_mem_ops \defgroup pico_mem_ops pico_mem_ops \endcond
* \defgroup pico_standard_link pico_standard_link * \cond pico_platform \defgroup pico_platform pico_platform \endcond
* \cond pico_printf \defgroup pico_printf pico_printf \endcond
* \cond pico_runtime \defgroup pico_runtime pico_runtime \endcond
* \cond pico_runtime_init \defgroup pico_runtime_init pico_runtime_init \endcond
* \cond pico_stdio \defgroup pico_stdio pico_stdio \endcond
* \cond pico_standard_binary_info \defgroup pico_standard_binary_info pico_standard_binary_info \endcond
* \cond pico_standard_link \defgroup pico_standard_link pico_standard_link \endcond
* @} * @}
* *
* \defgroup misc External API Headers * \defgroup misc External API Headers
* Headers for interfaces that are shared with code outside of the SDK * Headers for interfaces that are shared with code outside of the SDK
* @{ * @{
* \defgroup boot_picoboot boot_picoboot * \cond boot_picobin_headers \defgroup boot_picobin_headers boot_picobin_headers \endcond
* \defgroup boot_uf2 boot_uf2 * \cond boot_picoboot_headers \defgroup boot_picoboot_headers boot_picoboot_headers \endcond
* \cond boot_uf2_headers \defgroup boot_uf2_headers boot_uf2_headers \endcond
* \cond pico_usb_reset_interface_headers \defgroup pico_usb_reset_interface_headers pico_usb_reset_interface_headers \endcond
* @} * @}
*/ */

View file

@ -1,17 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="50mm" height="50mm" viewBox="0 0 141.73228 141.73228">
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="570" height="720"> <defs>
<path d="m 158.375,1.65625 c -3.6193,0.1123192 -7.51715,1.4493266 -11.9375,4.9375 C 135.61054,2.4174496 125.11041,0.9665612 115.71875,9.46875 101.22489,7.5879922 96.508461,11.469494 92.9375,16 89.754953,15.934135 69.118652,12.72793 59.65625,26.84375 35.874602,24.030329 28.359472,40.831625 36.875,56.5 c -4.856911,7.518955 -9.889503,14.947226 1.46875,29.28125 -4.018006,7.983514 -1.527431,16.64403 7.9375,27.125 -2.497857,11.2226 2.412077,19.14086 11.21875,25.3125 -1.64709,15.35756 14.083505,24.28743 18.78125,27.46875 1.803677,8.94868 5.56291,17.3927 23.53125,22.0625 2.96323,13.3361 13.76206,15.63906 24.21875,18.4375 -34.561929,20.08954 -64.20067,46.52266 -64,111.375 l -5.0625,9.03125 C 15.337882,350.69604 -20.316547,428.16001 35.4375,491.125 c 3.641871,19.70838 9.749589,33.86396 15.1875,49.53125 8.133834,63.13058 61.21763,92.69161 75.21875,96.1875 20.51653,15.62812 42.36818,30.45672 71.9375,40.84375 27.87515,28.74946 58.07388,39.7064 88.4375,39.6875 0.44515,-2.8e-4 0.89853,0.005 1.34375,0 30.36363,0.0189 60.56235,-10.93804 88.4375,-39.6875 29.56932,-10.38703 51.42097,-25.21563 71.9375,-40.84375 14.00112,-3.49589 67.08492,-33.05692 75.21875,-96.1875 5.43791,-15.66729 11.54562,-29.82287 15.1875,-49.53125 55.75404,-62.96499 20.09961,-140.42896 -19.53125,-164.53125 L 513.75,317.5625 c 0.20067,-64.85234 -29.43807,-91.28546 -64,-111.375 10.45669,-2.79844 21.25552,-5.1014 24.21875,-18.4375 17.96834,-4.6698 21.72758,-13.11382 23.53125,-22.0625 4.69775,-3.18132 20.42834,-12.11119 18.78125,-27.46875 8.80668,-6.17164 13.71661,-14.0899 11.21875,-25.3125 9.46494,-10.48097 11.9555,-19.141487 7.9375,-27.125 C 546.79575,71.447226 541.76316,64.018955 536.90625,56.5 545.42178,40.831625 537.90665,24.030329 514.125,26.84375 504.6626,12.72793 484.0263,15.934135 480.84375,16 477.27279,11.469494 472.55636,7.587992 458.0625,9.46875 448.67084,0.96656132 438.17071,2.41745 427.34375,6.59375 414.48455,-3.5536631 405.97149,4.580454 396.25,7.65625 380.67615,2.568472 377.11698,9.5371578 369.46875,12.375 352.4935,8.7869238 347.33315,16.598532 339.1875,24.84375 l -9.46875,-0.1875 c -25.61054,15.093115 -38.33378,45.825501 -42.84375,61.625 -4.51206,-15.801979 -17.20647,-46.534542 -42.8125,-61.625 l -9.46875,0.1875 C 226.4481,16.598532 221.28775,8.7869235 204.3125,12.375 196.66427,9.5371583 193.1051,2.5684729 177.53125,7.65625 c -6.37973,-2.0184911 -12.24667,-6.2144276 -19.15625,-6 z" style="fill:#000000" /> <style>
<path d="m 107.39184,68.055583 c 67.94767,35.031357 107.44689,63.368967 129.08717,87.504467 -11.08235,44.41759 -68.89638,46.44464 -90.03559,45.19858 4.32842,-2.01474 7.93988,-4.42778 9.22051,-8.13574 -5.30449,-3.76981 -24.11289,-0.39719 -37.24363,-7.77416 5.04407,-1.04499 7.40348,-2.06302 9.76289,-5.78542 -12.40571,-3.9567 -25.76862,-7.36642 -33.627746,-13.92116 4.241253,0.0524 8.201156,0.9488 13.740366,-2.89271 -11.111694,-5.98819 -22.969108,-10.73351 -32.18139,-19.88738 5.745213,-0.14063 11.939452,-0.0568 13.740371,-2.16953 -10.17044,-6.30068 -18.751242,-13.30787 -25.853592,-20.97215 8.039979,0.97052 11.435284,0.13478 13.378782,-1.26556 -7.687795,-7.87419 -17.417559,-14.52319 -22.056911,-24.22644 5.969606,2.057484 11.431249,2.84506 15.36752,-0.180795 -2.612365,-5.893453 -13.805413,-9.369618 -20.248967,-23.141676 6.284359,0.609377 12.949606,1.371108 14.282753,0 C 61.802068,58.517346 56.796919,51.835885 51.887978,44.913906 65.338021,44.714177 85.715734,44.966253 84.792549,43.82914 l -8.31654,-8.497335 c 13.137617,-3.537241 26.580651,0.568164 36.339661,3.615887 4.38186,-3.457681 -0.0776,-7.82998 -5.42383,-12.294015 11.16496,1.490646 21.25382,4.057389 30.37345,7.593362 4.87238,-4.399329 -3.16389,-8.798658 -7.05098,-13.197987 17.24936,3.272568 24.55716,7.87068 31.81981,12.47481 5.26935,-5.050799 0.30166,-9.343299 -3.2543,-13.740371 13.00566,4.817048 19.70478,11.035551 26.75756,17.175463 2.39119,-3.227053 6.07494,-5.592408 1.62715,-13.378781 9.23416,5.322725 16.18926,11.59506 21.33374,18.621817 5.71336,-3.637941 3.40387,-8.613023 3.43509,-13.197987 9.59665,7.806516 15.68687,16.11395 23.14168,24.226443 1.50169,-1.093437 2.81661,-4.80171 3.97747,-10.666867 22.89539,22.211815 55.24591,78.158241 8.31654,100.340861 C 207.95028,109.95728 160.25292,86.016909 107.39184,68.055583 z" style="fill:#75a928" /> .cls-1 {
<path d="M 467.92487,68.055583 C 399.9772,103.08694 360.47798,131.42455 338.8377,155.56005 c 11.08235,44.41759 68.89638,46.44464 90.03559,45.19858 -4.32842,-2.01474 -7.93988,-4.42778 -9.22051,-8.13574 5.30449,-3.76981 24.11289,-0.39719 37.24363,-7.77416 -5.04407,-1.04499 -7.40348,-2.06302 -9.76289,-5.78542 12.40571,-3.9567 25.76862,-7.36642 33.62775,-13.92116 -4.24126,0.0524 -8.20116,0.9488 -13.74037,-2.89271 11.11169,-5.98819 22.96911,-10.73351 32.18139,-19.88738 -5.74521,-0.14063 -11.93945,-0.0568 -13.74037,-2.16953 10.17044,-6.30068 18.75124,-13.30787 25.85359,-20.97215 -8.03998,0.97052 -11.43528,0.13478 -13.37878,-1.26556 7.68779,-7.87419 17.41756,-14.52319 22.05691,-24.22644 -5.96961,2.057484 -11.43125,2.84506 -15.36752,-0.180795 2.61237,-5.893453 13.80541,-9.369618 20.24897,-23.141676 -6.28436,0.609377 -12.94961,1.371108 -14.28276,0 2.92231,-11.888563 7.92746,-18.570024 12.8364,-25.492003 -13.45004,-0.199729 -33.82775,0.05235 -32.90457,-1.084766 l 8.31654,-8.497335 c -13.13762,-3.537241 -26.58065,0.568164 -36.33966,3.615887 -4.38186,-3.457681 0.0776,-7.82998 5.42383,-12.294015 -11.16496,1.490646 -21.25382,4.057389 -30.37345,7.593362 -4.87238,-4.399329 3.16389,-8.798658 7.05098,-13.197987 -17.24936,3.272568 -24.55716,7.87068 -31.81981,12.47481 -5.26935,-5.050799 -0.30166,-9.343299 3.2543,-13.740371 -13.00566,4.817048 -19.70478,11.035551 -26.75756,17.175463 -2.39119,-3.227053 -6.07494,-5.592408 -1.62715,-13.378781 -9.23416,5.322725 -16.18926,11.59506 -21.33374,18.621817 -5.71336,-3.637941 -3.40387,-8.613023 -3.43509,-13.197987 -9.59665,7.806516 -15.68687,16.11395 -23.14168,24.226443 -1.50169,-1.093437 -2.81661,-4.80171 -3.97747,-10.666867 -22.89539,22.211815 -55.24591,78.158241 -8.31654,100.340861 39.91877,-32.94716 87.61613,-56.887531 140.47721,-74.848857 z" style="fill:#75a928" /> fill: #46af4b;
<path d="m 365.2046,521.84937 a 71.956154,66.532318 0 1 1 -143.91231,0 71.956154,66.532318 0 1 1 143.91231,0 z" transform="matrix(1.131107,0,0,1.1280497,-43.139135,-68.310983)" style="fill:#bc1142" /> }
<path d="m 262.84091,276.64774 a 61.875,28.125 0 1 1 -123.75,0 61.875,28.125 0 1 1 123.75,0 z" transform="matrix(0.76741684,-1.1613112,2.171115,1.4224368,-560.88858,217.68859)" style="fill:#bc1142" />
<path d="m 262.84091,276.64774 a 61.875,28.125 0 1 1 -123.75,0 61.875,28.125 0 1 1 123.75,0 z" transform="matrix(-0.76741684,-1.1613112,-2.171115,1.4224368,1134.8288,213.68859)" style="fill:#bc1142" /> .cls-2 {
<path d="M 72.910253,342.0878 C 109.32447,332.33088 85.201845,492.72431 55.576871,479.56357 22.990103,453.35089 12.493801,376.58814 72.910253,342.0878 z" style="fill:#bc1142" /> fill: #cd2355;
<path d="m 493.67828,340.0878 c -36.41422,-9.75692 -12.2916,150.63651 17.33338,137.47577 32.58677,-26.21268 43.08307,-102.97543 -17.33338,-137.47577 z" style="fill:#bc1142" /> }
<path d="m 369.97158,220.6534 c 62.83486,-10.61013 115.11594,26.72229 113.01138,94.85796 -2.06693,26.12112 -136.15872,-90.96907 -113.01138,-94.85796 z" style="fill:#bc1142" /> </style>
<path d="M 196.35975,218.6534 C 133.52489,208.04327 81.24381,245.37569 83.34837,313.51136 85.4153,339.63248 219.50709,222.54229 196.35975,218.6534 z" style="fill:#bc1142" /> </defs>
<path d="m 286.61932,202.75568 c -37.50259,-0.97548 -73.49548,27.83418 -73.58158,44.54443 -0.10462,20.30426 29.6512,41.09266 73.83726,41.62035 45.12305,0.32321 73.91561,-16.64049 74.0611,-37.59409 0.16484,-23.73996 -41.03879,-48.93744 -74.31678,-48.57069 z" style="fill:#bc1142" /> <g>
<path d="m 288.90937,619.11675 c 32.69744,-1.42711 76.57083,10.53196 76.6568,26.39598 0.5427,15.4052 -39.78969,50.21055 -78.82634,49.53765 -40.42729,1.74391 -80.06908,-33.11559 -79.54951,-45.19859 -0.60506,-17.71593 49.226,-31.54796 81.71905,-30.73504 z" style="fill:#bc1142" /> <path d="M120.397,80.45865c-.56815-5.90742-3.22385-11.16309-6.995-13.93267a17.27379,17.27379,0,0,0-3.24656-6.31353,19.36966,19.36966,0,0,0-6.892-13.02018,7.27722,7.27722,0,0,0,1.59572-1.944c4.57759-2.04455,7.80508-6.33776,8.1794-9.53072a12.5259,12.5259,0,0,0,3.95675-8.20484,7.846,7.846,0,0,0-.69989-3.69357,7.01847,7.01847,0,0,0,1.82922-7.2442c-1.36677-3.95887-6.15514-6.52856-12.58679-6.80113A10.13626,10.13626,0,0,0,98.52937,7.374a16.203,16.203,0,0,0-3.78352.46578,8.61261,8.61261,0,0,0-3.719-.75319,14.555,14.555,0,0,0-7.0952,1.934,6.5202,6.5202,0,0,0-.85646-.05542c-3.193-.0003-6.38471,2.19991-8.00284,3.51125a24.2642,24.2642,0,0,0-4.2063,4.38226,24.27017,24.27017,0,0,0-4.206-4.38195c-1.61814-1.31135-4.80988-3.51126-8.00254-3.51156a6.525,6.525,0,0,0-.85677.05542,14.55806,14.55806,0,0,0-7.09489-1.934,8.614,8.614,0,0,0-3.71931.75319A16.201,16.201,0,0,0,43.203,7.374a10.13676,10.13676,0,0,0-7.00858,2.39979c-6.432.27257-11.22033,2.84226-12.5871,6.80143a7.018,7.018,0,0,0,1.82922,7.2439A7.84794,7.84794,0,0,0,24.737,27.513a12.52529,12.52529,0,0,0,3.95675,8.20454c.37432,3.19326,3.60181,7.48617,8.1794,9.53072a7.27538,7.27538,0,0,0,1.59542,1.944,19.37028,19.37028,0,0,0-6.89168,13.02018A17.27118,17.27118,0,0,0,28.33031,66.526c-3.77111,2.76958-6.42681,8.02525-6.99495,13.93236-.56482,5.87168,1.046,11.35328,4.32471,14.82547a20.99222,20.99222,0,0,0,3.56516,8.18667,21.30368,21.30368,0,0,0,5.378,12.42629,22.01533,22.01533,0,0,0,11.859,7.04734,28.71359,28.71359,0,0,0,9.48469,5.87137A20.881,20.881,0,0,0,70.866,134.64567a20.8833,20.8833,0,0,0,14.91936-5.83019,28.72034,28.72034,0,0,0,9.48469-5.87137,22.01559,22.01559,0,0,0,11.85873-7.04734,21.3036,21.3036,0,0,0,5.378-12.426,20.98659,20.98659,0,0,0,3.56517-8.187C119.35068,91.81162,120.96155,86.33,120.397,80.45865Z"/>
<path d="m 168.13874,525.10369 c 23.2791,28.04573 33.89066,77.31899 14.46355,91.84353 -18.37917,11.08784 -63.01228,6.52162 -94.736237,-39.05157 -21.395052,-38.24168 -18.637584,-77.15663 -3.615887,-88.58924 22.464424,-13.68429 57.173424,4.79902 83.888574,35.79728 z" style="fill:#bc1142" /> <path class="cls-1" d="M82.88834,15.64565a.50715.50715,0,0,1,.64431.53875c-.16085,1.517.75688,1.32594.97375,1.05634,2.38917-2.97065,4.91974-3.64653,7.18552-3.447a.5073.5073,0,0,1,.347.81808c-.90026,1.33535.06917,1.58923.42806,1.34935,3.67706-2.299,7.18462-2.30316,8.53087-1.33751a.50652.50652,0,0,1,.03017.78741c-1.36075,1.15928-.599,1.73636-.11843,1.56042,3.73308-1.31743,8.88679-.15193,10.68462,1.36809a.511.511,0,0,1,.01278.77323,10.12618,10.12618,0,0,0-3.89825,6.80014c-.10141.89409,1.38228.706,2.00839.54492a.50694.50694,0,0,1,.63161.47341c.05646,2.14911-1.97606,4.51144-5.00017,6.53158-.405.27055-.34746.91972.57694.94363a.50088.50088,0,0,1,.43014.75445c-1.0784,2.00172-2.545,3.88636-7.54009,5.18055a.51181.51181,0,0,0-.07052.96565.48972.48972,0,0,1,.15941.86532c-4.97342,4.27273-17.58014,2.58829-19.18036-4.603a.50477.50477,0,0,1,.09069-.4114A47.92158,47.92158,0,0,1,100.721,21.25148a.3975.3975,0,0,0-.19687-.76539,34.186,34.186,0,0,0-22.704,13.68742.512.512,0,0,1-.65061.14752C69.08866,30.14885,75.72444,17.82948,82.88834,15.64565Z"/>
<path d="m 405.0209,516.21177 c -25.18682,29.50165 -39.21227,83.30951 -20.83785,100.6428 17.56828,13.46361 64.7292,11.58162 99.56566,-36.75574 25.29599,-32.46471 16.82013,-86.68225 2.37077,-101.07511 -21.46408,-16.60213 -52.27691,4.64489 -81.09858,37.18805 z" style="fill:#bc1142" /> <path class="cls-1" d="M35.37668,35.161a.50084.50084,0,0,1,.43005-.75445c.92449-.02391.982-.67308.57694-.94363-3.02411-2.02014-5.05663-4.38247-5.00007-6.53158a.5069.5069,0,0,1,.6316-.47341c.626.16108,2.10971.34917,2.0083-.54492a10.126,10.126,0,0,0-3.89816-6.80014.51094.51094,0,0,1,.0127-.77323c1.79782-1.52,6.95154-2.68552,10.6847-1.36809.48048.17594,1.24223-.40114-.11843-1.56042a.50652.50652,0,0,1,.03008-.78741c1.34634-.96565,4.85381-.96146,8.53087,1.33751.3589.23988,1.32833-.014.42815-1.34935a.5073.5073,0,0,1,.34692-.81808c2.26588-.19954,4.79644.47634,7.18561,3.447.21678.2696,1.13461.46062.97375-1.05634a.50711.50711,0,0,1,.64422-.53875c7.164,2.18383,13.79977,14.5032,5.71877,18.67538a.512.512,0,0,1-.65061-.14752A34.18579,34.18579,0,0,0,41.20821,20.48609a.3975.3975,0,0,0-.19688.76539,47.92145,47.92145,0,0,1,20.90622,15.9066.50472.50472,0,0,1,.0906.4114c-1.60022,7.19128-14.20694,8.87572-19.18035,4.603a.48975.48975,0,0,1,.15941-.86532.51183.51183,0,0,0-.07043-.96565C37.92166,39.04731,36.455,37.16267,35.37668,35.161Z"/>
<path class="cls-2" d="M102.70391,57.14512c2.07215,5.51262.45788,8.1631-4.45781,5.35681a35.23186,35.23186,0,0,1-10.324-8.6538c-3.70264-4.39923-1.29618-6.3588,4.53643-5.30214A15.74307,15.74307,0,0,1,102.70391,57.14512Z"/>
<path class="cls-2" d="M80.656,50.9434c7.02971,5.84278-1.02445,9.97893-9.78984,9.97893s-16.81947-4.13615-9.78976-9.97893a15.62992,15.62992,0,0,1,19.5796,0Z"/>
<path class="cls-2" d="M39.02843,57.14512A15.74294,15.74294,0,0,1,49.27372,48.546c5.83261-1.05666,8.23916.90291,4.53644,5.30214a35.232,35.232,0,0,1-10.324,8.6538C38.57056,65.30822,36.95628,62.65774,39.02843,57.14512Z"/>
<path class="cls-2" d="M28.86006,87.77634a15.73764,15.73764,0,0,1,1.16828-13.39206c2.59721-4.419,5.21118-4.2431,6.24869-.49944a23.47909,23.47909,0,0,1-1.35309,15.47529C33.00057,93.18313,30.595,91.89119,28.86006,87.77634Z"/>
<path class="cls-2" d="M47.58848,116.39963A15.64491,15.64491,0,0,1,35.82,102.43657C36.79507,79.749,69.49268,120.26554,47.58848,116.39963Z"/>
<path class="cls-2" d="M48.254,88.14263c-5.48323-3.16572-6.9343-10.91794-3.24093-17.31507s11.13243-9.01664,16.61566-5.85087c5.48323,3.16572,6.9343,10.918,3.24094,17.31507S53.73709,91.3084,48.254,88.14263Z"/>
<path class="cls-2" d="M80.0159,125.05829a15.6584,15.6584,0,0,1-18.29955,0c-5.43318-3.75194.03278-8.06894,9.14978-8.06894S85.44917,121.30635,80.0159,125.05829Z"/>
<ellipse class="cls-2" cx="70.86613" cy="100.39562" rx="12.72753" ry="10.90937"/>
<path class="cls-2" d="M76.86255,82.29176c-3.69336-6.39709-2.24229-14.14935,3.24094-17.31507,5.48323-3.16577,12.9223-.54622,16.61567,5.85087s2.24229,14.14935-3.24094,17.31507C87.99516,91.3084,80.55592,88.68885,76.86255,82.29176Z"/>
<path class="cls-2" d="M94.14377,116.39963c-21.9042,3.86591,10.79341-36.65066,11.7686-13.96306A15.64488,15.64488,0,0,1,94.14377,116.39963Z"/>
<path class="cls-2" d="M112.87229,87.77634c-1.73505,4.11485-4.14061,5.40679-6.064,1.58379a23.47913,23.47913,0,0,1-1.353-15.47529c1.03742-3.74366,3.65139-3.9196,6.2486.49944A15.73769,15.73769,0,0,1,112.87229,87.77634Z"/>
</g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Before After
Before After

View file

@ -7,7 +7,7 @@ body {
} }
h1, h2, h3, h4, h5, h6, p, a, li, span, blockquote, input, textarea, select, label { h1, h2, h3, h4, h5, h6, p, a, li, span, blockquote, input, textarea, select, label {
font-family: 'Roboto', sans-serif !important; font-family: 'Roboto', sans-serif;
} }
p { p {
@ -97,5 +97,9 @@ a {
display: none !important; display: none !important;
} }
div.line,
div.line a,
div.line span {
font-family: monospace;
}

View file

@ -1,31 +1,28 @@
# Pico SDK # Raspberry Pi Pico SDK
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 RP2040s 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 RP2040s 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 ## 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 higher level 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 fine tune 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 widely used 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 ## Examples
This SDK documentation contains a number of example code fragments. An index of these examples can be found [here](@ref examples_page). These examples, and any other source code included in this documentation, is Copyright &copy; 2020 Raspberry Pi Ltd and licensed under the [3-Clause BSD](https://opensource.org/licenses/BSD-3-Clause) license.
This SDK contains a number of example code fragments. An index of these examples can be found [here](@ref examples_page)

View file

@ -99,8 +99,8 @@
} }
#MSearchSelectWindow { #MSearchSelectWindow {
position: fixed; position: fixed;
top: 145px !important; top: 178px !important;
left: 35px !important; left: 49px !important;
border: solid 1px #d4d4d4; border: solid 1px #d4d4d4;
border-radius: 0; border-radius: 0;
box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.25); box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.25);
@ -118,8 +118,8 @@
} }
#MSearchResultsWindow { #MSearchResultsWindow {
position: fixed; position: fixed;
top: 145px !important; top: 178px !important;
left: 35px !important; left: 49px !important;
border: solid 1px #d4d4d4; border: solid 1px #d4d4d4;
border-radius: 0; border-radius: 0;
box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.25); box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.25);

View file

@ -3,27 +3,31 @@
The full documentation for the RP2040 and Raspberry Pi Pico board can be found at the following links The full documentation for the RP2040 and Raspberry Pi Pico board can be found at the following links
- [RP2040 Datasheet](https://rptl.io/rp2040-datasheet) - [RP2040 Datasheet](https://rptl.io/rp2040-datasheet)
- [Raspberry Pi Pico datasheet](https://rptl.io/pico-datasheet) - [Raspberry Pi Pico Datasheet](https://rptl.io/pico-datasheet)
- [Hardware Design with the RP2040](https://rptl.io/rp2040-design) - [RP235x Datasheet](https://rptl.io/rp2040-datasheet)
- [Pico C/C++ SDK](https://rptl.io/pico-c-sdk) - [Raspberry Pi Pico2 Datasheet](https://rptl.io/pico-datasheet)
- [Pico Python SDK](https://rptl.io/pico-micropython) - [Raspberry Pi Pico W Datasheet](https://rptl.io/picow-datasheet)
- [Getting Started with Raspberry Pi Pico](https://rptl.io/pico-get-started) - [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 ### 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) 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.
- [Pico C/C++ SDK](https://github.com/raspberrypi/pico-sdk) - [Raspberry Pi Pico SDK](https://github.com/raspberrypi/pico-sdk)
- [Pico Examples](https://github.com/raspberrypi/pico-examples) - [Pico Examples](https://github.com/raspberrypi/pico-examples)
- [Pico Extras - Libraries under development](https://github.com/raspberrypi/pico-extras) - [Pico Extras - Libraries under development](https://github.com/raspberrypi/pico-extras)
- [Pico Playground - Examples that use Pico Extras](https://github.com/raspberrypi/pico-playground) - [Pico Playground - Examples that use Pico Extras](https://github.com/raspberrypi/pico-playground)

View file

@ -18,9 +18,20 @@ if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_P
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif () endif ()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
endif ()
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
endif()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
if (NOT PICO_SDK_PATH) if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT) if (PICO_SDK_FETCH_FROM_GIT)
@ -29,20 +40,31 @@ if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT_PATH) if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif () endif ()
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare( FetchContent_Declare(
pico_sdk pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
GIT_SUBMODULES_RECURSE FALSE
) )
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
)
endif ()
if (NOT pico_sdk) if (NOT pico_sdk)
message("Downloading PICO SDK") message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk) FetchContent_Populate(pico_sdk)
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif () endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
else () else ()
message(FATAL_ERROR message(FATAL_ERROR
"PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
) )
endif () endif ()
endif () endif ()
@ -54,9 +76,9 @@ endif ()
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
endif () endif ()
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
include(${PICO_SDK_INIT_CMAKE_FILE}) include(${PICO_SDK_INIT_CMAKE_FILE})

1
lib/btstack Submodule

@ -0,0 +1 @@
Subproject commit 2b49e57bd1fae85ac32ac1f41cdb7c794de335f6

1
lib/cyw43-driver Submodule

@ -0,0 +1 @@
Subproject commit cf924bb04c8984675ca0fc2178f082e404e048c3

1
lib/lwip Submodule

@ -0,0 +1 @@
Subproject commit 0a0452b2c39bdd91e252aef045c115f88f6ca773

1
lib/mbedtls Submodule

@ -0,0 +1 @@
Subproject commit 5a764e5555c64337ed17444410269ff21cb617b1

@ -1 +1 @@
Subproject commit e0aa405d19e35dbf58cf502b8106455c1a3c2a5c Subproject commit 5217cee5de4cd555018da90f9f1bcc87fb1c1d3a

View file

@ -1,10 +1,12 @@
# Initialize the PICO SDK # Pre-initialize the Raspberry Pi Pico SDK, setting up the platform and toolchain and some CMake utility functions
# This file must be included prior to the project() call # This file must be included prior to the project() call
if (_PICO_SDK_INIT) # Note: this file is perhaps named badly, as it provides a method pico_sdk_init which
return() # the enclosing project calls LATER to actually "initialize" the SDK (by including the CMakeLists.txt from this
endif () # same directory)
set(_PICO_SDK_INIT 1)
if (NOT TARGET _pico_sdk_pre_init_marker)
add_library(_pico_sdk_pre_init_marker INTERFACE)
function(pico_is_top_level_project VAR) function(pico_is_top_level_project VAR)
string(TOLOWER ${CMAKE_CURRENT_LIST_DIR} __list_dir) string(TOLOWER ${CMAKE_CURRENT_LIST_DIR} __list_dir)
@ -16,39 +18,76 @@ function(pico_is_top_level_project VAR)
endif() endif()
endfunction() endfunction()
function(pico_message_debug MESSAGE)
# The log-level system was added in CMake 3.15.
if(${CMAKE_VERSION} VERSION_LESS "3.15.0")
message(${MESSAGE})
else()
message(DEBUG ${MESSAGE})
endif()
endfunction()
if (NOT PICO_SDK_PATH) if (NOT PICO_SDK_PATH)
set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}) set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR})
endif () endif ()
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Path to the Pico SDK" FORCE) set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
list(APPEND CMAKE_MODULE_PATH ${PICO_SDK_PATH}/cmake) list(APPEND CMAKE_MODULE_PATH ${PICO_SDK_PATH}/cmake)
include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_version.cmake) include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_version.cmake)
include(pico_utils) include(pico_utils)
message("Pico SDK is located at ${CMAKE_CURRENT_LIST_DIR}") message("PICO_SDK_PATH is ${CMAKE_CURRENT_LIST_DIR}")
include(pico_pre_load_platform)
# todo perhaps this should be included by the platform instead?
# We want to configure correct toolchain prior to project load
include(pico_pre_load_toolchain)
macro(pico_sdk_init) macro(pico_sdk_init)
if (NOT CMAKE_PROJECT_NAME) if (NOT CMAKE_PROJECT_NAME)
message(WARNING "pico_sdk_init() should be called after the project is created (and languages added)") message(WARNING "pico_sdk_init() should be called after the project is created (and languages added)")
endif() endif()
add_subdirectory(${PICO_SDK_PATH} pico_sdk) add_subdirectory(${PICO_SDK_PATH} pico-sdk)
endmacro() endmacro()
macro(add_sub_list_dirs var) macro(add_sub_list_dirs var)
foreach(LIST_DIR IN LISTS ${var}) foreach(LIST_DIR IN LISTS ${var})
get_filename_component(SHORT_NAME "${LIST_DIR}" NAME) get_filename_component(SHORT_NAME "${LIST_DIR}" NAME)
message("Including custom CMakeLists.txt ${SHORT_NAME}") pico_message_debug("Including custom CMakeLists.txt ${SHORT_NAME}")
add_subdirectory(${LIST_DIR} ${SHORT_NAME}) add_subdirectory(${LIST_DIR} ${SHORT_NAME})
endforeach() endforeach()
endmacro() endmacro()
macro(add_sub_list_files var)
foreach(LIST_FILE IN LISTS ${var})
pico_message_debug("Including custom CMake file ${LIST_FILE}")
include(${LIST_FILE})
endforeach()
endmacro()
macro(pico_register_common_scope_var NAME)
if (NOT ${NAME} IN_LIST PICO_PROMOTE_COMMON_SCOPE_VARS)
list(APPEND PICO_PROMOTE_COMMON_SCOPE_VARS ${NAME})
endif()
endmacro()
set(PICO_PROMOTE_COMMON_SCOPE_VARS
PICO_INCLUDE_DIRS
PICO_SDK_POST_LIST_DIRS
PICO_SDK_POST_LIST_FILES
PICO_CONFIG_HEADER_FILES
PICO_RP2040_CONFIG_HEADER_FILES
PICO_BOARD_CMAKE_OVERRIDES
)
macro(pico_promote_common_scope_vars)
set(PICO_PROMOTE_COMMON_SCOPE_VARS ${PICO_PROMOTE_COMMON_SCOPE_VARS} PARENT_SCOPE)
foreach(VAR IN LISTS PICO_PROMOTE_COMMON_SCOPE_VARS)
SET(${VAR} ${${VAR}} PARENT_SCOPE)
endforeach()
endmacro()
include(pico_pre_load_platform)
# We want to configure correct toolchain prior to project load
# todo perhaps this should be included by the platform instead?
include(pico_pre_load_toolchain)
endif()

View file

@ -1,12 +1,20 @@
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, pico_base # PICO_BUILD_DEFINE: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, default=Current SDK major version, group=pico_base
# PICO_CONFIG: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, pico_base # PICO_CMAKE_CONFIG: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, default=Current SDK major version, group=pico_base
set(PICO_SDK_VERSION_MAJOR 1) set(PICO_SDK_VERSION_MAJOR 2)
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, pico_base # PICO_BUILD_DEFINE: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, default=Current SDK minor version, group=pico_base
# PICO_CONFIG: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, pico_base # PICO_CMAKE_CONFIG: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, default=Current SDK minor version, group=pico_base
set(PICO_SDK_VERSION_MINOR 0) set(PICO_SDK_VERSION_MINOR 1)
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, pico_base # PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
# PICO_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, pico_base # PICO_CMAKE_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
set(PICO_SDK_VERSION_REVISION 0) set(PICO_SDK_VERSION_REVISION 0)
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_STRING, SDK version, type=string, group=pico_base # PICO_BUILD_DEFINE: PICO_SDK_VERSION_PRE_RELEASE_ID, Optional SDK pre-release version identifier, default=Current SDK pre-release identifier, type=string, group=pico_base
# PICO_CONFIG: PICO_SDK_VERSION_STRING, SDK version, type=string, group=pico_base # PICO_CMAKE_CONFIG: PICO_SDK_VERSION_PRE_RELEASE_ID, Optional SDK pre-release version identifier, default=Current SDK pre-release identifier, type=string, group=pico_base
#set(PICO_SDK_VERSION_PRE_RELEASE_ID develop)
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_STRING, SDK version string, type=string, default=Current SDK version string, group=pico_base
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_STRING, SDK version string, type=string, default=Current SDK version string, group=pico_base
set(PICO_SDK_VERSION_STRING "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}") set(PICO_SDK_VERSION_STRING "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}")
if (PICO_SDK_VERSION_PRE_RELEASE_ID)
set(PICO_SDK_VERSION_STRING "${PICO_SDK_VERSION_STRING}-${PICO_SDK_VERSION_PRE_RELEASE_ID}")
endif()

31
src/BUILD.bazel Normal file
View file

@ -0,0 +1,31 @@
package(default_visibility = ["//visibility:public"])
# This shim exists as a way to break internal header dependency cycles
# that occur within the dependency chain of the pico_platform target below.
alias(
name = "pico_platform_internal",
actual = select({
"//bazel/constraint:host": "//src/host/pico_platform:pico_platform_internal",
"//conditions:default": "//src/rp2_common:pico_platform_internal",
}),
visibility = [
"//src/common/boot_picobin_headers:__pkg__",
"//src/common/boot_picoboot_headers:__pkg__",
"//src/common/hardware_claim:__pkg__",
"//src/common/pico_base_headers:__pkg__",
"//src/common/pico_binary_info:__pkg__",
# These libraries sometimes need the host version even though they live
# in rp2_common.
"//src/rp2_common/boot_bootrom_headers:__pkg__",
"//src/rp2_common/hardware_boot_lock:__pkg__",
"//src/rp2_common/pico_flash:__pkg__",
],
)
alias(
name = "pico_platform",
actual = select({
"//bazel/constraint:host": "//src/host/pico_platform",
"//conditions:default": "//src/rp2_common:pico_platform",
}),
)

View file

@ -1,9 +1,15 @@
cmake_policy(SET CMP0079 NEW) # allow inserting of dependencies into our INTERFACE libraries cmake_policy(SET CMP0079 NEW) # allow inserting of dependencies into our INTERFACE libraries
set(PICO_PLATFORM_CMAKE_FILE "" CACHE INTERNAL "") set(PICO_PLATFORM_CMAKE_FILE "${PICO_PLATFORM_CMAKE_FILE}" CACHE INTERNAL "")
set(PICO_DOXYGEN_PATHS "" CACHE INTERNAL "") # generated each time set(PICO_DOXYGEN_PATHS "" CACHE INTERNAL "") # generated each time
set(PICO_DOXYGEN_EXCLUDE_PATHS "" CACHE INTERNAL "") # generated each time
set(PICO_DOXYGEN_PRE_DEFINES "" CACHE INTERNAL "") # generated each time
set(PICO_DOXYGEN_ENABLED_SECTIONS "" CACHE INTERNAL "") # generated each time
if (NOT PICO_PLATFORM_CMAKE_DIR)
set(PICO_PLATFORM_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()
if (NOT PICO_PLATFORM_CMAKE_FILE) if (NOT PICO_PLATFORM_CMAKE_FILE)
set(PICO_PLATFORM_CMAKE_FILE ${CMAKE_CURRENT_LIST_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "") set(PICO_PLATFORM_CMAKE_FILE ${PICO_PLATFORM_CMAKE_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "")
endif () endif ()
if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}") if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}")
@ -11,79 +17,187 @@ if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}")
Either specify a valid PICO_PLATFORM (or PICO_PLATFORM_CMAKE_FILE).") Either specify a valid PICO_PLATFORM (or PICO_PLATFORM_CMAKE_FILE).")
endif () endif ()
include(${CMAKE_CURRENT_LIST_DIR}/board_setup.cmake) # call add_subdirectory(subdir) unless SKIP_SUBDIR evaluates to true
# second argument is optional path
# todo add option to disable skip flag
function(pico_add_subdirectory subdir) function(pico_add_subdirectory subdir)
# todo add option to disable skip flag
string(TOUPPER ${subdir} subdir_upper) string(TOUPPER ${subdir} subdir_upper)
# we do not include any path part of the subdir
get_filename_component(subdir_upper ${subdir_upper} NAME)
set(replace_flag SKIP_${subdir_upper}) set(replace_flag SKIP_${subdir_upper})
if (NOT ${replace_flag}) if (NOT ${replace_flag})
string(TOUPPER ${subdir} subdir_upper)
set(replace_flag SKIP_${subdir_upper})
if (${ARGC} GREATER 1)
# argv1 is the root where the subdir is relative to
add_subdirectory(${ARGV1}/${subdir} ${subdir})
# todo make this optional?
pico_add_doxygen(${ARGV1}/${subdir})
else()
add_subdirectory(${subdir}) add_subdirectory(${subdir})
# todo make this optional?
pico_add_doxygen(${subdir})
endif()
else() else()
message("Not including ${subdir} because ${replace_flag} defined.") message("Not including ${subdir} because ${replace_flag} defined.")
endif () endif ()
pico_promote_common_scope_vars()
endfunction() endfunction()
# takes dependencies after the target
function(pico_mirrored_target_link_libraries TARGET SCOPE)
if (${ARGC} LESS 3)
message(FATAL_ERROR "expected a target, scope and at least one dependency")
endif()
if (NOT TARGET ${TARGET}_headers)
message(FATAL_ERROR "${TARGET} does not have headers")
endif()
# library should depend on its own header
target_link_libraries(${TARGET} ${SCOPE} ${TARGET}_headers)
foreach(DEPENDENCY IN LISTS ARGN)
if (DEPENDENCY MATCHES ".*_headers")
message(FATAL_ERROR "should not use headers with pico_mirrored_target_link_libraries")
endif()
# note, it would be nice to only add the dependency if it exists, but we do
# not necessarily add libraries in reverse dependency order, so we do this
# unconditionally, so this function should only be passed dependencies that
# have headers, or link will fail with a missing library -lfoo_headers
target_link_libraries(${TARGET}_headers ${SCOPE} ${DEPENDENCY}_headers)
target_link_libraries(${TARGET} ${SCOPE} ${DEPENDENCY})
endforeach()
endfunction()
# add a link option to wrap the given function name; i.e. -Wl:wrap=FUNCNAME for gcc
function(pico_wrap_function TARGET FUNCNAME) function(pico_wrap_function TARGET FUNCNAME)
target_link_options(${TARGET} INTERFACE "LINKER:--wrap=${FUNCNAME}") target_link_options(${TARGET} INTERFACE "LINKER:--wrap=${FUNCNAME}")
endfunction() endfunction()
# add map file generation for the given target
function(pico_add_map_output TARGET) function(pico_add_map_output TARGET)
pico_get_runtime_output_directory(${TARGET} output_path)
get_target_property(target_type ${TARGET} TYPE) get_target_property(target_type ${TARGET} TYPE)
if ("EXECUTABLE" STREQUAL "${target_type}") if ("EXECUTABLE" STREQUAL "${target_type}")
target_link_options(${TARGET} PRIVATE "LINKER:-Map=$<TARGET_PROPERTY:NAME>${CMAKE_EXECUTABLE_SUFFIX}.map") target_link_options(${TARGET} PRIVATE "LINKER:-Map=${output_path}$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map")
else () else ()
target_link_options(${TARGET} INTERFACE "LINKER:-Map=$<TARGET_PROPERTY:NAME>${CMAKE_EXECUTABLE_SUFFIX}.map") target_link_options(${TARGET} INTERFACE "LINKER:-Map=${output_path}$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map")
endif () endif ()
endfunction() endfunction()
# create a hardware_NAME_headers target (see pico_simple_hardware_headers_target)
# create a hardware_NAME target (see pico_simple_hardware_target)
macro(pico_simple_hardware_target NAME) macro(pico_simple_hardware_target NAME)
pico_simple_hardware_headers_target(${NAME}) pico_simple_hardware_headers_target(${NAME})
pico_simple_hardware_impl_target(${NAME}) pico_simple_hardware_impl_target(${NAME})
endmacro() endmacro()
# create an INTERFACE library named target, and define LIB_TARGET=1 (upper case) as a compile option
# and make it dependent on a pre-existing corresponding _headers library
# optional arg NOFLAG will skip the LIB_TARGET definition
function(pico_add_impl_library target)
add_library(${target} INTERFACE)
string(TOUPPER ${target} TARGET_UPPER)
if (${ARGC} GREATER 1)
if (NOT "${ARGV1}" STREQUAL "NOFLAG")
message(FATAL_ERROR "Unknown parameter ${ARGV1}")
endif()
else()
target_compile_definitions(${target} INTERFACE LIB_${TARGET_UPPER}=1)
endif()
target_link_libraries(${target} INTERFACE ${target}_headers)
endfunction()
# create an INTERFACE library named target along with associated header, and define LIB_TARGET=1 (upper case) as a compile option
# optional arg NOFLAG will skip the LIB_TARGET definition
function(pico_add_library target)
add_library(${target}_headers INTERFACE)
pico_add_impl_library(${target} ${ARGN})
endfunction()
# create an INTERFACE library named hardware_NAME_headers INTERFACE library if it doesn't already exist,
# and add include/ relative to the calling directory to the includes.
# and hardware_structs and hardware_claim as dependencies of the library
macro(pico_simple_hardware_headers_target NAME) macro(pico_simple_hardware_headers_target NAME)
if (NOT TARGET hardware_${NAME}_headers) if (NOT TARGET hardware_${NAME}_headers)
add_library(hardware_${NAME}_headers INTERFACE) add_library(hardware_${NAME}_headers INTERFACE)
target_include_directories(hardware_${NAME}_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) target_include_directories(hardware_${NAME}_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(hardware_${NAME}_headers INTERFACE pico_base_headers) target_link_libraries(hardware_${NAME}_headers INTERFACE pico_base_headers)
if (NOT PICO_NO_HARDWARE) if (NOT PICO_NO_HARDWARE)
target_link_libraries(hardware_${NAME}_headers INTERFACE hardware_structs hardware_claim) target_link_libraries(hardware_${NAME}_headers INTERFACE hardware_structs hardware_claim_headers)
endif() endif()
endif() endif()
endmacro() endmacro()
# create an INTERFACE library named hardware_NAME if it doesn't exist, along with a hardware_NAME_headers
# INTERFACE library that it depends on. The hardware_NAME_headers library add include/ relative to
# and pico_base_headers, and harddware_structs as a dependency of the library
macro(pico_simple_hardware_headers_only_target NAME) macro(pico_simple_hardware_headers_only_target NAME)
if (NOT TARGET hardware_${NAME}) if (NOT TARGET hardware_${NAME})
add_library(hardware_${NAME} INTERFACE) # Choosing not to add LIB_HARDWARE_ defines to avoid command line bloat pending a need (they aren't
# super interesting except to determine functionality as they are mostly passive accessors, however
# they could be useful to determine if the header is available.
# pico_add_sdk_impl_library(hardware_${NAME})
add_library(hardware_${NAME}_headers INTERFACE)
target_include_directories(hardware_${NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) # a headers only target should still have an explicit _headers library for consistency
target_link_libraries(hardware_${NAME} INTERFACE pico_base_headers) target_include_directories(hardware_${NAME}_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(hardware_${NAME}_headers INTERFACE pico_base_headers)
if (NOT PICO_NO_HARDWARE) if (NOT PICO_NO_HARDWARE)
target_link_libraries(hardware_${NAME} INTERFACE hardware_structs) target_link_libraries(hardware_${NAME}_headers INTERFACE hardware_structs)
endif() endif()
add_library(hardware_${NAME} INTERFACE)
target_link_libraries(hardware_${NAME} INTERFACE hardware_${NAME}_headers)
endif() endif()
endmacro() endmacro()
# create an INTERFACE library named hardware_NAME if it doesn't exist, dependent on a pre-existing hardware_NAME_headers
# INTERFACE library and pico_platform. The file NAME.c relative to the caller is added to the C sources for the hardware_NAME
macro(pico_simple_hardware_impl_target NAME) macro(pico_simple_hardware_impl_target NAME)
if (NOT TARGET hardware_${NAME}) if (NOT TARGET hardware_${NAME})
# Choosing not to add LIB_HARDWARE_ defines to avoid command line bloat pending a need (they aren't
# super interesting except to determine functionality as they are mostly passive accessors, however
# they could be useful to determine if the header is available.
# pico_add_sdk_impl_library(hardware_${NAME})
add_library(hardware_${NAME} INTERFACE) add_library(hardware_${NAME} INTERFACE)
target_sources(hardware_${NAME} INTERFACE target_sources(hardware_${NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${NAME}.c ${CMAKE_CURRENT_LIST_DIR}/${NAME}.c
) )
target_link_libraries(hardware_${NAME} INTERFACE hardware_${NAME}_headers pico_platform) pico_mirrored_target_link_libraries(hardware_${NAME} INTERFACE pico_platform)
if (NOT PICO_NO_HARDWARE)
target_link_libraries(hardware_${NAME} INTERFACE hardware_claim)
endif()
endif() endif()
endmacro() endmacro()
function(pico_add_doxygen_pre_define PRE_DEFINE)
list(APPEND PICO_DOXYGEN_PRE_DEFINES "${PRE_DEFINE}")
set(PICO_DOXYGEN_PRE_DEFINES "${PICO_DOXYGEN_PRE_DEFINES}" CACHE INTERNAL "")
endfunction()
function(pico_add_doxygen_enabled_section ENABLED_SECTION)
list(APPEND PICO_DOXYGEN_ENABLED_SECTIONS "${ENABLED_SECTION}")
set(PICO_DOXYGEN_ENABLED_SECTIONS "${PICO_DOXYGEN_ENABLED_SECTIONS}" CACHE INTERNAL "")
endfunction()
function(pico_add_doxygen SOURCE_DIR) function(pico_add_doxygen SOURCE_DIR)
set(PICO_DOXYGEN_PATHS "${PICO_DOXYGEN_PATHS} ${SOURCE_DIR}" CACHE INTERNAL "") if (NOT IS_ABSOLUTE "${SOURCE_DIR}")
get_filename_component(SOURCE_DIR "${SOURCE_DIR}" ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
list(APPEND PICO_DOXYGEN_PATHS "${SOURCE_DIR}")
set(PICO_DOXYGEN_PATHS "${PICO_DOXYGEN_PATHS}" CACHE INTERNAL "")
endfunction() endfunction()
function(pico_add_doxygen_exclude SOURCE_DIR) function(pico_add_doxygen_exclude SOURCE_DIR)
set(PICO_DOXYGEN_EXCLUDE_PATHS "${PICO_DOXYGEN_EXCLUDE_PATHS} ${SOURCE_DIR}" CACHE INTERNAL "") if (NOT IS_ABSOLUTE "${SOURCE_DIR}")
get_filename_component(SOURCE_DIR "${SOURCE_DIR}" ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
list(APPEND PICO_DOXYGEN_EXCLUDE_PATHS "${SOURCE_DIR}")
set(PICO_DOXYGEN_EXCLUDE_PATHS "${PICO_DOXYGEN_EXCLUDE_PATHS}" CACHE INTERNAL "")
endfunction() endfunction()
include(${PICO_PLATFORM_CMAKE_FILE}) include(${PICO_PLATFORM_CMAKE_FILE})
pico_promote_common_scope_vars()

View file

@ -1,31 +0,0 @@
# PICO_CMAKE_CONFIG: PICO_BOARD, The board name being built for. This is overridable from the user environment, type=string, default=rp2040, group=build
if (DEFINED ENV{PICO_BOARD})
set(PICO_BOARD $ENV{PICO_BOARD})
message("Using PICO_BOARD from environment ('${PICO_BOARD}')")
else()
if (NOT PICO_BOARD)
set(PICO_BOARD "pico")
pico_message("Defaulting PICO target board to ${PICO_BOARD} since not specified.")
else()
message("PICO target board is ${PICO_BOARD}.")
endif()
endif()
set(PICO_BOARD ${PICO_BOARD} CACHE STRING "PICO target board (e.g. pico)")
# PICO_CMAKE_CONFIG: PICO_BOARD_CMAKE_DIRS, Directors to look for <PICO_BOARD>.cmake in. This is overridable from the user environment, type=list, default="", group=build
if (DEFINED ENV{PICO_BOARD_CMAKE_DIRS})
set(PICO_BOARD_CMAKE_DIRS $ENV{PICO_BOARD_CMAKE_DIRS})
message("Using PICO_BOARD_CMAKE_DIRS from environment ('${PICO_BOARD_CMAKE_DIRS}')")
endif()
list(APPEND PICO_BOARD_CMAKE_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards)
pico_find_in_paths(PICO_BOARD_CMAKE_FILE PICO_BOARD_CMAKE_DIRS ${PICO_BOARD}.cmake)
if (EXISTS "${PICO_BOARD_CMAKE_FILE}")
message("Using CMake board configuration from ${PICO_BOARD_CMAKE_FILE}")
include(${PICO_BOARD_CMAKE_FILE} board_config)
else()
include(boards/generic_board.cmake)
endif()
list(APPEND PICO_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards/include) # so boards/foo.h can be explicitly included

54
src/boards/BUILD.bazel Normal file
View file

@ -0,0 +1,54 @@
load("//bazel:defs.bzl", "pico_board_config")
load("//bazel/util:multiple_choice_flag.bzl", "declare_flag_choices", "flag_choice")
package(default_visibility = ["//visibility:public"])
# Find all boards.
BOARD_CHOICE_FILES = glob(["include/boards/*.h"])
# Extract just the name of the board.
BOARD_CHOICES = [
path.removeprefix("include/boards/").removesuffix(".h")
for path in BOARD_CHOICE_FILES
]
BOARD_CHOICE_MAP = {c: [":{}".format(c)] for c in BOARD_CHOICES}
# PICO_BUILD_DEFINE: PICO_BOARD, Name of board, type=string, default=CMake PICO_BOARD variable, group=pico_base
[
pico_board_config(
name = board,
hdrs = BOARD_CHOICE_FILES,
defines = [
'PICO_BOARD=\\"{}\\"'.format(board),
],
includes = ["include"],
platform_includes = [
"cmsis/rename_exceptions.h",
"boards/{}.h".format(board),
],
deps = ["//src/rp2_common/cmsis:rename_exceptions"],
)
for board in BOARD_CHOICES
]
# Creates a config_setting for each known board option with the name:
# PICO_BOARD_[choice]
declare_flag_choices(
"//bazel/config:PICO_BOARD",
BOARD_CHOICES,
)
cc_library(
name = "default",
deps = select(
flag_choice(
"//bazel/config:PICO_BOARD",
":__pkg__",
BOARD_CHOICE_MAP,
) | {
"//bazel/constraint:host": [":none"],
"//conditions:default": [":none"],
},
),
)

View file

@ -1,23 +0,0 @@
# For boards without their own cmake file, simply include a header
# PICO_CMAKE_CONFIG: PICO_BOARD_HEADER_DIRS, Directors to look for <PICO_BOARD>.h in. This is overridable from the user environment, type=list, default="", group=build
if (DEFINED ENV{PICO_BOARD_HEADER_DIRS})
set(PICO_BOARD_HEADER_DIRS $ENV{PICO_BOARD_HEADER_DIRS})
message("Using PICO_BOARD_HEADER_DIRS from environment ('${PICO_BOARD_HEADER_DIRS}')")
endif()
set(PICO_BOARD_HEADER_DIRS ${PICO_BOARD_HEADER_DIRS} CACHE STRING "PICO board header directories")
list(APPEND PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}/include/boards)
pico_find_in_paths(PICO_BOARD_HEADER_FILE PICO_BOARD_HEADER_DIRS ${PICO_BOARD}.h)
if (EXISTS ${PICO_BOARD_HEADER_FILE})
message("Using board configuration from ${PICO_BOARD_HEADER_FILE}")
list(APPEND PICO_CONFIG_HEADER_FILES ${PICO_BOARD_HEADER_FILE})
else()
set(msg "Unable to find definition of board '${PICO_BOARD}' (specified by PICO_BOARD):\n")
list(JOIN PICO_BOARD_HEADER_DIRS ", " DIRS)
string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.h in ${DIRS} (additional paths specified by PICO_BOARD_HEADER_DIRS)\n")
list(JOIN PICO_BOARD_CMAKE_DIRS ", " DIRS)
string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.cmake in ${DIRS} (additional paths specified by PICO_BOARD_CMAKE_DIRS)")
message(FATAL_ERROR ${msg})
endif()

View file

@ -0,0 +1,86 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
//
//------------------------------------------------------------------------------------------
// Board definition for the 0xCB Helios
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_0XCB_HELIOS_H
#define _BOARDS_0XCB_HELIOS_H
// For board detection
#define _0XCB_HELIOS
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
// User LED and level shifted PIN
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 17
#endif
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 25
#endif
// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 2
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 3
#endif
// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 22
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 23
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 20
#endif
#ifndef PICO_DEFAULT_SPI_CSN_PIN
#define PICO_DEFAULT_SPI_CSN_PIN 21
#endif
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// board has 16M onboard flash
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,95 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2040_H
#define _BOARDS_ADAFRUIT_FEATHER_RP2040_H
// For board detection
#define ADAFRUIT_FEATHER_RP2040
// On some samples, the xosc can take longer to stabilize than is usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
//------------- UART -------------//
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
//------------- LED -------------//
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 13
#endif
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 16
#endif
//------------- I2C -------------//
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 2
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 3
#endif
//------------- SPI -------------//
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 19
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 20
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 18
#endif
//------------- FLASH -------------//
// Use slower generic flash access
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 4
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,92 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2040_USB_HOST_H
#define _BOARDS_ADAFRUIT_FEATHER_RP2040_USB_HOST_H
// For board detection
#define ADAFRUIT_FEATHER_RP2040_USB_HOST
// On some samples, the xosc can take longer to stabilize than is usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
//------------- UART -------------//
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
//------------- LED -------------//
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 13
#endif
//------------- I2C -------------//
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 2
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 3
#endif
//------------- SPI -------------//
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 1
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 15
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 8
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 14
#endif
//------------- FLASH -------------//
// Use slower generic flash access
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 4
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,86 @@
/*
* Copyright (c) 2024 Scott Shawcroft for Adafruit Industries
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// This header may be included by other board headers as "boards/adafruit_feather_rp2350.h"
// pico_cmake_set PICO_PLATFORM=rp2350
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2350_H
#define _BOARDS_ADAFRUIT_FEATHER_RP2350_H
// For board detection
#define ADAFRUIT_FEATHER_RP2350
// --- RP2350 VARIANT ---
#define PICO_RP2350A 1
// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 7
#endif
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 21
#endif
// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 2
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 3
#endif
// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 22
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 23
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 20
#endif
// --- FLASH ---
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif
#endif

View file

@ -0,0 +1,98 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
#define _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
// For board detection
#define ADAFRUIT_ITSYBITSY_RP2040
// On some samples, the xosc can take longer to stabilize than is usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
//------------- UART -------------//
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
//------------- LED -------------//
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 11
#endif
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 17
#endif
#ifndef PICO_DEFAULT_WS2812_POWER_PIN
#define PICO_DEFAULT_WS2812_POWER_PIN 16
#endif
//------------- I2C -------------//
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 2
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 3
#endif
//------------- SPI -------------//
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 19
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 20
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 18
#endif
//------------- FLASH -------------//
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,90 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_ADAFRUIT_KB2040_H
#define _BOARDS_ADAFRUIT_KB2040_H
// For board detection
#define ADAFRUIT_KB2040
// On some samples, the xosc can take longer to stabilize than is usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
//------------- UART -------------//
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
//------------- LED -------------//
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 17
#endif
//------------- I2C -------------//
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 12
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 13
#endif
//------------- SPI -------------//
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 19
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 20
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 18
#endif
//------------- FLASH -------------//
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,189 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
#ifndef _BOARDS_ADAFRUIT_MACROPAD_RP2040_H
#define _BOARDS_ADAFRUIT_MACROPAD_RP2040_H
// pico_cmake_set PICO_PLATFORM=rp2040
// For board detection
#define ADAFRUIT_MACROPAD_RP2040
// On some samples, the xosc can take longer to stabilize than is usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
// --- BOARD SPECIFIC ---
#ifndef ADAFRUIT_MACROPAD_KEY1_PIN
#define ADAFRUIT_MACROPAD_KEY1_PIN 1
#endif
#ifndef ADAFRUIT_MACROPAD_KEY2_PIN
#define ADAFRUIT_MACROPAD_KEY2_PIN 2
#endif
#ifndef ADAFRUIT_MACROPAD_KEY3_PIN
#define ADAFRUIT_MACROPAD_KEY3_PIN 3
#endif
#ifndef ADAFRUIT_MACROPAD_KEY4_PIN
#define ADAFRUIT_MACROPAD_KEY4_PIN 4
#endif
#ifndef ADAFRUIT_MACROPAD_KEY5_PIN
#define ADAFRUIT_MACROPAD_KEY5_PIN 5
#endif
#ifndef ADAFRUIT_MACROPAD_KEY6_PIN
#define ADAFRUIT_MACROPAD_KEY6_PIN 6
#endif
#ifndef ADAFRUIT_MACROPAD_KEY7_PIN
#define ADAFRUIT_MACROPAD_KEY7_PIN 7
#endif
#ifndef ADAFRUIT_MACROPAD_KEY8_PIN
#define ADAFRUIT_MACROPAD_KEY8_PIN 8
#endif
#ifndef ADAFRUIT_MACROPAD_KEY9_PIN
#define ADAFRUIT_MACROPAD_KEY9_PIN 9
#endif
#ifndef ADAFRUIT_MACROPAD_KEY10_PIN
#define ADAFRUIT_MACROPAD_KEY10_PIN 10
#endif
#ifndef ADAFRUIT_MACROPAD_KEY11_PIN
#define ADAFRUIT_MACROPAD_KEY11_PIN 11
#endif
#ifndef ADAFRUIT_MACROPAD_KEY12_PIN
#define ADAFRUIT_MACROPAD_KEY12_PIN 12
#endif
#ifndef ADAFRUIT_MACROPAD_LED_PIN
#define ADAFRUIT_MACROPAD_LED_PIN 13
#endif
#ifndef ADAFRUIT_MACROPAD_SPEAKER_ENABLE_PIN
#define ADAFRUIT_MACROPAD_SPEAKER_ENABLE_PIN 14
#endif
#ifndef ADAFRUIT_MACROPAD_SPEAKER_PIN
#define ADAFRUIT_MACROPAD_SPEAKER_PIN 16
#endif
#ifndef ADAFRUIT_MACROPAD_BUTTON_PIN
#define ADAFRUIT_MACROPAD_BUTTON_PIN 0
#endif
#ifndef ADAFRUIT_MACROPAD_ROTA_PIN
#define ADAFRUIT_MACROPAD_ROTA_PIN 17
#endif
#ifndef ADAFRUIT_MACROPAD_ROTB_PIN
#define ADAFRUIT_MACROPAD_ROTB_PIN 18
#endif
#ifndef ADAFRUIT_MACROPAD_NEOPIXEL_PIN
#define ADAFRUIT_MACROPAD_NEOPIXEL_PIN 19
#endif
#ifndef ADAFRUIT_MACROPAD_DISPLAY_OLED_CS_PIN
#define ADAFRUIT_MACROPAD_DISPLAY_OLED_CS_PIN 22
#endif
#ifndef ADAFRUIT_MACROPAD_DISPLAY_OLED_RESET_PIN
#define ADAFRUIT_MACROPAD_DISPLAY_OLED_RESET_PIN 23
#endif
#ifndef ADAFRUIT_MACROPAD_DISPLAY_OLED_DC_PIN
#define ADAFRUIT_MACROPAD_DISPLAY_OLED_DC_PIN 24
#endif
#ifndef ADAFRUIT_MACROPAD_DISPLAY_SCK_PIN
#define ADAFRUIT_MACROPAD_DISPLAY_SCK_PIN 26
#endif
#ifndef ADAFRUIT_MACROPAD_DISPLAY_MOSI_PIN
#define ADAFRUIT_MACROPAD_DISPLAY_MOSI_PIN 27
#endif
#ifndef ADAFRUIT_MACROPAD_DISPLAY_MISO_PIN
#define ADAFRUIT_MACROPAD_DISPLAY_MISO_PIN 28
#endif
// no PICO_DEFAULT_UART
//------------- LED -------------//
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN ADAFRUIT_MACROPAD_LED_PIN
#endif
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN ADAFRUIT_MACROPAD_NEOPIXEL_PIN
#endif
//------------- I2C -------------//
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 20
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 21
#endif
//------------- SPI -------------//
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 1
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 27
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 28
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 26
#endif
//------------- FLASH -------------//
// Use slower generic flash access
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 4
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_FLOAT_SUPPORT_ROM_V1
#define PICO_FLOAT_SUPPORT_ROM_V1 0
#endif
#ifndef PICO_DOUBLE_SUPPORT_ROM_V1
#define PICO_DOUBLE_SUPPORT_ROM_V1 0
#endif
#endif

View file

@ -0,0 +1,97 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_ADAFRUIT_QTPY_RP2040_H
#define _BOARDS_ADAFRUIT_QTPY_RP2040_H
// For board detection
#define ADAFRUIT_QTPY_RP2040
// On some samples, the xosc can take longer to stabilize than is usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
//------------- UART -------------//
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 1
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 20
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 5
#endif
//------------- LED -------------//
// No normal LED
// #define PICO_DEFAULT_LED_PIN 13
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 12
#endif
#ifndef PICO_DEFAULT_WS2812_POWER_PIN
#define PICO_DEFAULT_WS2812_POWER_PIN 11
#endif
//------------- I2C -------------//
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 24
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 25
#endif
//------------- SPI -------------//
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 3
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 4
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 6
#endif
//------------- FLASH -------------//
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,75 @@
/*
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_ADAFRUIT_TRINKEY_QT2040_H
#define _BOARDS_ADAFRUIT_TRINKEY_QT2040_H
// For board detection
#define ADAFRUIT_TRINKEY_QT2040
// On some samples, the xosc can take longer to stabilize than is usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
//------------- UART -------------//
// no PICO_DEFAULT_UART
// no PICO_DEFAULT_UART_TX_PIN
// no PICO_DEFAULT_UART_RX_PIN
//------------- LED -------------//
// No normal LED
// #define PICO_DEFAULT_LED_PIN 13
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 27
#endif
//------------- I2C -------------//
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 16
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 17
#endif
//------------- SPI -------------//
// no PICO_DEFAULT_SPI
// no PICO_DEFAULT_SPI_SCK_PIN
// no PICO_DEFAULT_SPI_TX_PIN
// no PICO_DEFAULT_SPI_RX_PIN
// no PICO_DEFAULT_SPI_CSN_PIN
//------------- FLASH -------------//
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,107 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// FIXME delete this file before release (board file for Amethyst FPGA platform)
// pico_cmake_set PICO_PLATFORM=rp2350
#ifndef _BOARDS_AMETHYST_FPGA_H
#define _BOARDS_AMETHYST_FPGA_H
#if !PICO_RP2350
#error "Invalid PICO_PLATFORM for amethyst_fpga.h: must be rp2350 or rp2350-riscv"
#endif
// For board detection
#define RASPBERRYPI_AMETHYST_FPGA
#define PICO_NO_FPGA_CHECK 0
// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 46
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 47
#endif
// Match bootrom UART baud rate of 1 Mbaud:
#ifndef PICO_DEFAULT_UART_BAUD_RATE
#define PICO_DEFAULT_UART_BAUD_RATE 1000000
#endif
// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 25
#endif
// no PICO_DEFAULT_WS2812_PIN
// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 4
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 5
#endif
// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 18
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 19
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 16
#endif
#ifndef PICO_DEFAULT_SPI_CSN_PIN
#define PICO_DEFAULT_SPI_CSN_PIN 17
#endif
#define PICO_SD_CLK_PIN 18
#define PICO_SD_CMD_PIN 19
#define PICO_SD_DAT0_PIN 20
#define PICO_ON_FPGA 1
#define PICO_SCANVIDEO_COLOR_PIN_COUNT 16
#define PICO_SCANVIDEO_DPI_PIXEL_RSHIFT 0u
#define PICO_SCANVIDEO_DPI_PIXEL_GSHIFT 6u
#define PICO_SCANVIDEO_DPI_PIXEL_BSHIFT 11u
#define PICO_SCANVIDEO_48MHZ 1
#define PICO_AUDIO_I2S_DATA_PIN 29
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 30
#define PICO_AUDIO_PWM_L_PIN 28
#define PICO_AUDIO_PWM_R_PIN 27
// --- FLASH ---
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif
#endif

View file

@ -0,0 +1,112 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// This header may be included by other board headers as "boards/archi.h"
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_ARCHI_H
#define _BOARDS_ARCHI_H
// For board detection
#define ARCHI
// On some samples, the xosc can take longer to stabilize than is usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
// --- BOARD SPECIFIC ---
#ifndef ARCHI_BUTTON1_PIN
#define ARCHI_BUTTON1_PIN 23
#endif
#ifndef ARCHI_BUTTON2_PIN
#define ARCHI_BUTTON2_PIN 10
#endif
#ifndef ARCHI_BUTTON3_PIN
#define ARCHI_BUTTON3_PIN 25
#endif
#ifndef ARCHI_BUTTON4_PIN
#define ARCHI_BUTTON4_PIN 19
#endif
#ifndef ARCHI_BUZZER_PIN
#define ARCHI_BUZZER_PIN 22
#endif
#ifndef ARCHI_NEOPIXEL_PIN
#define ARCHI_NEOPIXEL_PIN 24
#endif
// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 16
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 17
#endif
// --- LED ---
// no PICO_DEFAULT_LED_PIN
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN ARCHI_NEOPIXEL_PIN
#endif
// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 14
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 15
#endif
// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 2
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 3
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 4
#endif
#ifndef PICO_DEFAULT_SPI_CSN_PIN
#define PICO_DEFAULT_SPI_CSN_PIN 5
#endif
// --- FLASH ---
// Use slower generic flash access
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 4
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (4 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024)
#endif
#endif

View file

@ -0,0 +1,86 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_ARDUINO_NANO_RP2040_CONNECT_H
#define _BOARDS_ARDUINO_NANO_RP2040_CONNECT_H
// For board detection
#define ARDUINO_NANO_RP2040_CONNECT
//------------- UART -------------//
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
//------------- LED -------------//
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 6
#endif
// no PICO_DEFAULT_WS2812_PIN
//------------- I2C -------------//
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 12
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 13
#endif
//------------- SPI -------------//
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 7
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 4
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 6
#endif
//------------- FLASH -------------//
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,191 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_CYTRON_MAKER_PI_RP2040_H
#define _BOARDS_CYTRON_MAKER_PI_RP2040_H
// For board detection
#define CYTRON_MAKER_PI_RP2040
// --- BOARD SPECIFIC ---
// Motor driver
#ifndef MAKER_PI_RP2040_M1A_PIN
#define MAKER_PI_RP2040_M1A_PIN 8
#endif
#ifndef MAKER_PI_RP2040_M1B_PIN
#define MAKER_PI_RP2040_M1B_PIN 9
#endif
#ifndef MAKER_PI_RP2040_M2A_PIN
#define MAKER_PI_RP2040_M2A_PIN 10
#endif
#ifndef MAKER_PI_RP2040_M2B_PIN
#define MAKER_PI_RP2040_M2B_PIN 11
#endif
// Grove ports
#ifndef MAKER_PI_RP2040_GROVE1A_PIN
#define MAKER_PI_RP2040_GROVE1A_PIN 0
#endif
#ifndef MAKER_PI_RP2040_GROVE1B_PIN
#define MAKER_PI_RP2040_GROVE1B_PIN 1
#endif
#ifndef MAKER_PI_RP2040_GROVE2A_PIN
#define MAKER_PI_RP2040_GROVE2A_PIN 2
#endif
#ifndef MAKER_PI_RP2040_GROVE2B_PIN
#define MAKER_PI_RP2040_GROVE2B_PIN 3
#endif
#ifndef MAKER_PI_RP2040_GROVE3A_PIN
#define MAKER_PI_RP2040_GROVE3A_PIN 4
#endif
#ifndef MAKER_PI_RP2040_GROVE3B_PIN
#define MAKER_PI_RP2040_GROVE3B_PIN 5
#endif
#ifndef MAKER_PI_RP2040_GROVE4A_PIN
#define MAKER_PI_RP2040_GROVE4A_PIN 16
#endif
#ifndef MAKER_PI_RP2040_GROVE4B_PIN
#define MAKER_PI_RP2040_GROVE4B_PIN 17
#endif
#ifndef MAKER_PI_RP2040_GROVE5A_PIN
#define MAKER_PI_RP2040_GROVE5A_PIN 6
#endif
#ifndef MAKER_PI_RP2040_GROVE5B_PIN
#define MAKER_PI_RP2040_GROVE5B_PIN 26
#endif
#ifndef MAKER_PI_RP2040_GROVE6A_PIN
#define MAKER_PI_RP2040_GROVE6A_PIN 26
#endif
#ifndef MAKER_PI_RP2040_GROVE6B_PIN
#define MAKER_PI_RP2040_GROVE6B_PIN 27
#endif
#ifndef MAKER_PI_RP2040_GROVE7A_PIN
#define MAKER_PI_RP2040_GROVE7A_PIN 7
#endif
#ifndef MAKER_PI_RP2040_GROVE7B_PIN
#define MAKER_PI_RP2040_GROVE7B_PIN 28
#endif
// Buttons
#ifndef MAKER_PI_RP2040_BUTTON1_PIN
#define MAKER_PI_RP2040_BUTTON1_PIN 20
#endif
#ifndef MAKER_PI_RP2040_BUTTON2_PIN
#define MAKER_PI_RP2040_BUTTON2_PIN 21
#endif
// Servo headers
#ifndef MAKER_PI_RP2040_SERVO1_PIN
#define MAKER_PI_RP2040_SERVO1_PIN 12
#endif
#ifndef MAKER_PI_RP2040_SERVO2_PIN
#define MAKER_PI_RP2040_SERVO2_PIN 13
#endif
#ifndef MAKER_PI_RP2040_SERVO3_PIN
#define MAKER_PI_RP2040_SERVO3_PIN 14
#endif
#ifndef MAKER_PI_RP2040_SERVO4_PIN
#define MAKER_PI_RP2040_SERVO4_PIN 15
#endif
// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
// --- LED ---
#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 18
#endif
// This board has two WS2812 leds in series
#ifndef PICO_DEFAULT_WS2812_NUM_PIXELS
#define PICO_DEFAULT_WS2812_NUM_PIXELS 2
#endif
// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 6
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 7
#endif
// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 3
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 4
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 2
#endif
// --- FLASH ---
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (2 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
#endif
// All boards have B1 RP2040
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#endif

View file

@ -0,0 +1,62 @@
/*
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
//
//------------------------------------------------------------------------------------------
// Board definition for the DatanoiseTV RP2040 DSP Board
//
// This header may be included by other board headers as "boards/datanoisetv_rp2040_dsp.h"
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_DATANOISETV_RP2040_DSP_H
#define _BOARDS_DATANOISETV_RP2040_DSP_H
// For board detection
#define DATANOISETV_RP2040_DSP
// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 24
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 25
#endif
// -- FLASH --
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
// --- I2S ---
#ifndef PICO_AUDIO_I2S_DATA_PIN
#define PICO_AUDIO_I2S_DATA_PIN 16
#endif
#ifndef PICO_AUDIO_I2S_CLOCK_PIN_BASE
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 17
#endif
#include "boards/pico.h"
#endif

View file

@ -0,0 +1,64 @@
/*
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
//
//------------------------------------------------------------------------------------------
// Board definition for the DatanoiseTV RP2350 DSP Board
//
// This header may be included by other board headers as "boards/datanoisetv_rp2350_dsp.h"
// pico_cmake_set PICO_PLATFORM=rp2350
#ifndef _BOARDS_DATANOISETV_RP2350_DSP_H
#define _BOARDS_DATANOISETV_RP2350_DSP_H
// For board detection
#define DATANOISETV_RP2350_DSP
// --- RP2350 VARIANT ---
#define PICO_RP2350A 1
// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 24
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 25
#endif
// -- FLASH --
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif
// --- I2S ---
#ifndef PICO_AUDIO_I2S_DATA_PIN
#define PICO_AUDIO_I2S_DATA_PIN 16
#endif
#ifndef PICO_AUDIO_I2S_CLOCK_PIN_BASE
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 17
#endif
#endif

Some files were not shown because too many files have changed in this diff Show more