libc(picolibc): fix locks.c K_MUTEX and _LOCK_T incompatibilities#52
Closed
bhoot1234567890 wants to merge 10000 commits intozmkfirmware:mainfrom
Closed
libc(picolibc): fix locks.c K_MUTEX and _LOCK_T incompatibilities#52bhoot1234567890 wants to merge 10000 commits intozmkfirmware:mainfrom
bhoot1234567890 wants to merge 10000 commits intozmkfirmware:mainfrom
Conversation
A first stab at adding some highlights for the upcoming 4.1 release. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Removed config FP16 from kconfig.default as it is set by the arch/cpu. Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
Fix handling of poll setting socket error flag. In this case errno is no set, so should not be the return value either. Instead retrieve the socket error for SOCKERR and return EBADF for SOCKNVAL. Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Arduino Due uses Atmel SAM3X8E, not SAM3X8H, so pinctrl should call the appropriate header. Signed-off-by: Eve Redero <eve.redero@gmail.com>
native_posix is deprecated and will be removed in 4.2 Run this sample in native_sim instead. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This sample could not run on any target as it depedend on zms which is set by no board. But it seems to run just fine in both allowed platforms, so let's add a trivial twister check (so it actually passes instead of waiting for ever), and remove that `depends on`. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
native_posix is deprecated and will be removed in 4.2 Run this sample in native_sim instead. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
- Sets CONFIG_LOG_MODE_IMMEDIATE for the zms sample. - Fixes "--- 9999 messages dropped ---". Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
This test has been seen failing at random (though not often). A valgrind check showed the nvs_ate structures were being CRC'ed with not-initialized data, and checked later (assuming the CRC would be different than a constant). This maybe have been the cause of the test failures, so let's initialize the whole structure to prevent the CRC value from depending on random memory/stack content. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
s/expections/exceptions/ Signed-off-by: Jonas Spinner <jonas.spinner@burkert.com>
/s/expection/exception/ Signed-off-by: Jonas Spinner <jonas.spinner@burkert.com>
This reverts commit 63bb55e which causes failures in CI on qemu_x86/atom target. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Update version to include USBREG HAL driver fix. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The drivers still use the USBREG HAL driver which enables/disables the interrupt by itself. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The LPSPI FIFOs on this platform are 8 words long, not 16. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
On some platforms, the module is not getting clocked until call to LPSPI_MasterInit, this will be fixed soon with upcoming update to native driver and will clock the module in driver init instead of start of transfer, but for now, move this code within the condition check that already exists for this purpose. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Reintroduce the fast path that skips reconfiguring if we use the same configuration, this fixes regression that causes a lot of latency at the start of repeated transfers. Unfortuantely need to find alternative workaround for S32K3 in order to do this instead of module reset, so disable skipping for that platform. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Verify the output according to the description of the sample. fixes: zephyrproject-rtos#84156 Signed-off-by: Maciej Perkowski <maciej.perkowski@nordicsemi.no>
Fix board arguments to properly build runners.yaml and set esp-monitor-baud. Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
- adds ability to change the ZMS sample MAX_ITERATIONS and DELETE_ITERATION parameters via Kconfig without manually modifying the source code. - adds ability to reduce flash memory wear on real devices by reducing the number of write iterations. Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
The LPFlexcomm HAL driver should be included based on CONFIG_NXP_LP_FLEXCOMM config Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Commit c910dc8("sys_clock: header: minor cleanup and doxygenization") introduced a typo in the documentation comment above NSEC_PER_USEC. Fix that. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
The gatt docs are very sparce, this commit adds imrpovements for the GATT server API part. Others will follow. Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
Add logging of the values that cause LOG_ERR statements. This makes it easier to debug any issues that occur. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit alignes the timeout value for allocating buffers within att on the BT RX thread, making it consistent within att.c, see bt_att_req_alloc. We are inferring in many bt_gatt_* functions that if called from a BT RX thread (which is inherently the case if called from a callback when running a Bluetooth application), we don't block and instead return -ENOMEM when the ATT request queue is full, avoiding a deadlock. This promise is fulfilled within bt_att_req_alloc, where the timeout for allocation of the request slab is set to K_NO_WAIT if we are on the BT RX thread. Unfortunately, we break this promise in bt_att_chan_create_pdu, where the timeout for allocation of the att pool is still K_FOREVER and deadlocks can (and do) occur when too many requests are sent yet the pool is depleted. Note: Both req_slab and att_pool sizes are defined by CONFIG_BT_ATT_TX_COUNT. If applications start getting -ENOMEM with this change, they were at risk of such a deadlock, and may increase CONFIG_BT_ATT_TX_COUNT to allocate the att pool for their requests. Note: This possible deadlock has been flying under the radar, as att_pools are freed when the HCI driver has sent it to the controller (instead of when receiving the response, as it happens with req_slabs) and due to the att_pool and the req_slab being both sized by CONFIG_BT_ATT_TX_COUNT, and req_slab being allocated before and returning -ENOMEM already if there is no space, it takes a more specific situation to deplete the att_pool but not the req_slab pool at this point. Note: Ideally, we don't want functions to behave differently depending on which thread they are running, and while this commit makes it more consistent, it should be considered a workaround solution. Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
Enhance the zephyr_file link role to support referencing specific lines or line ranges in files. This change allows users to link to exact locations within a file using GitHub-style line references. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The day alarm was not being set correctly. The day alarm should be set using the WADA bit in the control register. This patch fixes the issue by setting the WADA bit in the control register when setting the day alarm. Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
We need to track the self-powered status of the device independently of the D6 bit in the bmAttributes value of the configuration descriptor because the Get Status request about the self-powered status is valid in address state and we support multiple configurations. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add a notice to the 4.1 release notes that CONFIG_PIPES k_pipe implementation is deprecated from 4.1. Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
Fixes a wrongly defined Kconfig Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add SparkFun Pro-Micro compatible RP2040 board. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Properly use EUSART1 for the XIAO connector serial device, and switch XIAO SPI to EUSART0 to allow simultaneous use. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Product photo from https://learn.adafruit.com/assets/123296 with the license CC BY-SA 3.0 Tested with the samples mentioned in the index.rst page. Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
Add an early init hook to check the boot mode and reset into the RP2 USB bootloader if requested. Includes a snippet to use with any RP2040/RP2350 board to enable the necessary DTS/Kconfig to use the functionality, and easy DTS includes for boards to use explicitly. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Add the ROM bootloader devicetree details for a stm32f072 SoC. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Add the STM32 bootloader details to the relevant STM32WB .dtsi file. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Setup a section of retained memory for boot mode retention on the Nucleo WB55RG board. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Add the ROM bootloader devicetree details for a stm32f411 SoC. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
For early boot mode checking during initalization, skip mutex lock/unlock if in pre-kernel state for the retention and retained mem zephyr ram driver. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Add jump to ROM bootloader for STM32 when bootmode is set via retention boot mode feature. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Don't rely on power-on-reset for the connected device, issue a software reset on init to be sure we're reset before continuing. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Make the UF2 runner the default for the XIAO BLE, since it doesn't have a hardware programmer connected by default, and remove the UF2 board ID match, since the same board definition is used for several variants with different IDs in the INFO.TXT. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Despite the datasheet stating otherwise, the Pinnacle based trackpads can have their X/Y data inverted when operating in relative mode, so set those configs in all modes during init. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Adds a non-initialised BBRAM-based retained memory driver. Based on the RAM-based retained memory driver (`zephyr,retained-ram`). Signed-off-by: Samuel Coleman <samuel.coleman@rbr-global.com>
Fixes the compilation error:
error: 'static' is not at beginning of declaration
[-Werror=old-style-declaration]
Signed-off-by: Samuel Coleman <samuel.coleman@rbr-global.com>
Tests the BBRAM-backed retained memory driver on the native simulator and on ST NUCLEO-L476RE and NUCLEO-L452RE. Signed-off-by: Samuel Coleman <samuel.coleman@rbr-global.com>
multiprocessing no longer defaults to fork, so force it to maintain pre 3.14 behavior. We will need to revisit the implementation and at some point move to forkserver Fixes zephyrproject-rtos#95058 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a new sleep-mode-enable property for the Cirque Pinnacle input driver, to enable the sleep-mode for those peripherals, which will go into a lower power state after 5 seconds with no fingers detected. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
When reconfiguring the SSP, some changes do not immediately take effect in particular changes to the clock polarity are not applied. Disabling and re-enabling the SSP forces the new configuration to take effect immediately. Signed-off-by: George Norton <george_norton_uk@hotmail.com>
Set the chosen flash controller, for flash device support. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Added USB device node with compatible "st,stm32-usb". Added usb_fs_phy node with compatible "usb-nop-xceiv". Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
- Defined CCIPR2_REG offset. - Added USB_SEL(val) macro to support USB clock selection using CCIPR2_REG. Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
Selecting the clock source for USB is only a bit value in the CCIPR2 register. See RM0490 Rev 5 chapter 6.4.21 page 159. Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
STM32C071 have USB peripheral which can be clocked from HSI (HSIUSB48). Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
Allow to use internal HSI to clock the USB bus if HSE is not available. Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
Allows enabling the Clock Recovery System (CRS) for HSI48 to achieve the expected accuracy for USB transfers. Uses USB SOF packet by default. Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
Implementation based on STM32G4 series. This is a preparation to enable reading and writing the RDP bits. Signed-off-by: Martin Jäger <martin@libre.solar>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This patch fixes several issues in zephyr/lib/libc/picolibc/locks.c discovered when building ZMK with picolibc enabled. The changes make the file compatible with newlib/newlib-style expectations and Zephyr userspace handling.
Problems found:
K_MUTEX_DEFINE(__lock___libc_recursive_mutex)conflicts with newlib'sstruct __lockand Zephyr iterable section macros, causing "conflicting types" compilation errors._LOCK_Tpreviously defined asvoid *mismatched newlib expectations (newlib expects_LOCK_Tto be a pointer tostruct __lock). This caused conflicting function signatures for__retarget_lock_*.K_MUTEX_DEFINE, which cannot be granted properly as an object pointer in userspace contexts.struct k_mutexpointers (or returned raw k_mutex pointers), which didn’t match newlib's_LOCK_Tusage.What this patch does:
struct __lockwrapper matching newlib expectations and typedefs_LOCK_Tasstruct __lock *so signatures match newlib.K_MUTEX_DEFINEstatic declaration with astruct __lock __lock___libc_recursive_mutexwrapper and initializes the embedded mutex in aSYS_INIThandler.CONFIG_USERSPACEis enabled, the static wrapper allocates a kernel mutex object, initializes it, and grants access withk_object_access_all_grant.struct __lockwrappers and to allocate/initialize the underlying k_mutex appropriately for both kernel and userspace builds.__retarget_lock_acquire/_release/_try_acquireto operate on the wrapper correctly in both userspace and non-userspace builds.Testing performed:
zephyr/zmk.elfis generated.CONFIG_NEWLIB_LIBCswitches the build to newlib (no longer uses this file), and observed expected size differences.Notes:
K_MUTEX_DEFINEapproach, an alternate patch could expose the object properly to userspace; this patch prefers an explicit wrapper to match newlib ABI expectations.Files changed:
Please review for style and userspace semantics; happy to adjust to match upstream conventions.