* Default to allocating spacer sections (stack & heap), with PICO_CRT0_ALLOCATE_SPACERS config option to disable the behaviour
* Add pico_check_linker_script function to check for compatibility of custom linker scripts
* tweak error message
---------
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
* Fix powman_timer_use_gpio
Fixes#2471
* Fix docs for clock_gpio_init etc for RP2350
You can also use gpios 13 and 15 on RP2350
* macro-ify the mapping from GPI to ext_time_ref_source - note i kept this private for now, as it's a bit murky
---------
Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
* add pioasm --version, and print version number in generated files
* Hook up pio version string in Bazel build
---------
Co-authored-by: Armando Montanez <amontanez@google.com>
* Update makefsdata.py to support content encoding
changed makefsdata.py slightly to allow it to recognize files that have been manually gzipped (e.g. "mysite.css.gz") to send the proper Content-Encoding information in the response headers.
* Code review fix
---------
Co-authored-by: Peter Harper <peter.harper@raspberrypi.com>
* Provide an easy way to disable cyw43 logging
All cyw43 logging uses CYW43_PRINTF by default. To disable logging you
have to define this to do nothing. There's no simple way to achieve
this. Make it easier by adding PICO_CYW43_LOGGING_ENABLED which can be
set to zero to disable CYW43_PRINTF.
Fixes#2523
* teensy style change
---------
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
* 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
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>
* 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
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.