* Use platform/generator agnostic CMake commands
Change the README to use platform/generator agnostic commands to create and build the CMake project
* review fixup
* Apply suggestions from code review
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
* Whitespace fix
---------
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
* Add action to check board headers when modified
* Fix invalid escape warning
* Check for more board header errors before exiting script
* Also run when action file changes
* Add back newline at end of check_all_board_headers.sh
* Remove python install step
* `e.__str__()` -> `str(e)`
* async_context_threadsafe_background: fix incorrect mutex assertion in cross-core execute_sync()
In multicore configurations, `async_context_threadsafe_background_execute_sync()`
contained an overly strict assertion used during cross-core calls:
```c
hard_assert(!recursive_mutex_enter_count(&self->lock_mutex));
```
This check fails whenever the `lock_mutex` is held — regardless of *who*
owns it — even in valid situations where the async core is processing background
work.
The assertion does **not check ownership**, only that the `enter_count` is zero,
which leads to false-positive failures on valid cross-core calls.
This patch replaces the enter-count check with a core-aware assertion:
```c
hard_assert(self->lock_mutex.owner != calling_core);
```
This ensures the current core does not recursively hold the mutex, preventing
deadlocks while allowing valid usage where the *other* core owns the lock.
The patch ensures that both `get_core_num()` and `hard_assert()` remain inlined
as in the original implementation, preserving the performance characteristics
under `-Os` and `RelWithDebInfo` builds.
Fixes#2527
Signed-off-by: Goran Mišković <schkovich@users.noreply.github.com>
* fix indents
* Update async_context_threadsafe_background.c
Use pre-existing mutex owner method; add a comment
* oops
* typo
* Update async_context_threadsafe_background.c
---------
Signed-off-by: Goran Mišković <schkovich@users.noreply.github.com>
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
* Add definition for the Waveshare RP2350-USB-A board
* Set XOSC startup delay multiplier for the RP2350-USB-A
* Update waveshare_rp2350_usb_a.h
Tweak to the PICO_DEFAULT_PIO_USB_DP_PIN define
---------
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
Add bin/uf2/dis/hex output files as byproducts, so they get cleaned up
This is only best-effort, because BYPRODUCTS doesn't support generator expressions, so everything must be evaluated at the time pico_add_extra_outputs is called
* async_context_freertos: Add support for configSUPPORT_STATIC_ALLOCATION
The implementation of async_context_freertos currently assumes that
FreeRTOS has been configured with `configSUPPORT_DYNAMIC_ALLOCATION`,
which causes it to allocate semaphores, timers and tasks from the heap.
However, some projects may prefer `configSUPPORT_STATIC_ALLOCATION`,
which requires memory to be allocated ahead of time. This change allows
async_context_freertos to support either static or dynamic allocation.
The way this works is when `configSUPPORT_STATIC_ALLOCATION` is enabled,
`async_context_freertos` struct will reserve extra space for the static
objects (e.g. `StaticSemaphore_t`) and it will prefer to use the static
creation functions (e.g. `xSemaphoreCreateBinaryStatic()`). For the task
creation, the user will be responsible for allocating the stack memory
and setting the task_stack field in `async_context_freertos_config_t`.
For convenience, The `cyw43_arch_init_default_async_context()` function
will reserve `CYW43_TASK_STACK_SIZE` words of stack space in static
memory.
* Assert that task_stack is set
* Add CYW43_NO_DEFAULT_TASK_STACK
In theory you can use your own async context therefore bypassing
cyw43_arch_init_default_async_context, which would leave
cyw43_async_context_freertos_task_stack unused.
Add a #define for this rare situation.
* Update documentaton for async_context_freertos_config.task_stack
---------
Co-authored-by: Peter Harper <peter.harper@raspberrypi.com>
* Adafruit Fruit Jam board
* add Adafruit Fruit Jam specific pins
* fix pin typos and errors
* update to Fruit Jam rev D, address #2510 review
* add additional PICO_DEFAULT_* pins
* add PICO_AUDIO_I2S_* pins
* Add action to check configs & defines
* Check for all errors before exiting scripts
* Add extract_cmake_functions to the checks
* Fix invalid escape sequence warning
* Bazel add default compliation args for opt and debug. Can be overriden
* Add docstrings for new compilation mode override flags
* Remove cc_args_list shims, which arent needed anymore for cc_feature
* Add Compilation mode overrides to the BAZEL_ONLY_ALLOWLIST, these dont exist in Cmake
* For completness add the fastbuild default options, and override flag
* Remove the default options for fastbuiild, as the bazel doc defaults didnt make much sense, nor work. Leaving these for completness and future addition
* Rename the config and constraint labels from OVERRIDE to REMOVE_DEFS
* Change naming of flags from PICO_COMPILATION_XXX_REMOVE_DEFS to PICO_COMPILATION_NO_XXX_ARGS for OPT, FASTBUILD & DEBUG variants
* Fixup spellling mistakes, and comments
* Fix typo PICO_COMPILATION_NO_FASBUILD_ARGS to FASTBUILD
Ensures the async worker is unregistered from the context before releasing the
blocking thread. This prevents the `sync_func_call_t` stack object from being
accessed after it goes out of scope, avoiding a use-after-return condition
in multicore `async_context_execute_sync()` scenarios.
Fixesraspberrypi/pico-sdk#2433
Signed-off-by: Goran Mišković <schkovich@users.noreply.github.com>
* Don't include the picobin end block when signing, as picotool will add a new end block anyway
* small whitespace fix
---------
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
This raises a warning with recent CMake versions, and isn't required due to the `pico_add_link_depend` already added for these files
Fixesraspberrypi/picotool#235
* Call enable_interrupts when initialising IRQs
Fixesraspberrypi/pico-examples#584, supercedes raspberrypi/pico-examples#588
* move enable_interrupts to the end though it doesn't make much difference
* guard enable_interrupts by !RP2040 as it isn't needed there
---------
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
* Fix issue 2454 flash safe execute lockout
The lockout state is controlled by a shared variable. The FIFO
is used to begin a lockout and acknowledge it (i.e.
multicore_lockout_handshake works as before) but the end
of the lockout is now signalled by updating the shared variable.
This ensures that timeouts are recognised reliably by the victim core.
__wfe and __sev are used to signal updates to the shared variable
in order to avoid polling.
* Update documentation for multicore_lockout_end functions
* Simplification, remove magic number (not required)
* Review improvements
* Restore use of non-zero magic number
* Add support for wiznet_w5100s_evb_pico2
This board has an RP2350 and a smaller 2MB flash
Signed-off-by: Sergio R. Caprile <scaprile@gmail.com>
* update to new syntax
Signed-off-by: Sergio R. Caprile <scaprile@gmail.com>
* fix missing definition
Signed-off-by: Sergio R. Caprile <scaprile@gmail.com>
---------
Signed-off-by: Sergio R. Caprile <scaprile@gmail.com>
* Minor fixups to compile with TF-M
TF-M requires c99 compatibility, which throws errors at these lines
This patch fixes those errors and is currently applied by TF-M when cloning the SDK, but it would be better to get it into the SDK by default so that patch isn't needed
* #ifdef only on __STRICT_ANSI__
Also fix devinfo type
This prints out the location of the picotool executable being used
For example:
* `Using picotool from /usr/local/bin/picotool` for a system install
* `Using picotool from /home/name/pico-examples/build/_deps/picotool/picotool` for a picotool fetched by the SDK
Since cyw43_spi_reset() may be executed from an async context, we
should use cyw43_delay_ms() instead of sleep_ms(). This is particularly
a problem when using the async_context_threadsafe_background backend,
because sleep_ms() will assert in an ISR.
The mbedtls methods have dropped the "_ret" from the function names in
mbedtls 3.x. Use the new function names but support the old names if
mbedtls 2.x is used.
You can deinitialise cyw43 and btstack by calling btstack_cyw43_deinit
but its pending and timeout workers are not removed which means they can
keep running, whcih causes a crash.
Add a btstack_run_loop_async_context_deinit method and call this from
btstack_cyw43_deinit.