Bump to version 1.5.1 from
https://github.com/raspberrypi/pico-sdk
6a7db34ff63345a7badec79ebea3aaef1712f374
All code verbatim with the exception of the removal of CmakeList.txt
files and a tweak to platform.h.
Clang's assembler rejects expressions containing e.g. (1u << N) in the
assembler. Instead using numeric expressions for per-privilege level
CSRs, we can prepend `m` or `s`. This also lets the compiler assign the
CSR encoding instead of having to hardcode it in the source code.
Forgot to test at DEBUG=0. Both of these are basically cases where
the new DEBUG_ASSERT_COND should be used, since the default DEBUG_ASSERT
will now always emit code that gets cleaned up in the optimizer.
Origin: https://github.com/raspberrypi/pico-sdk
Branch: develop
Change: ebb228bfeaec81dce3b8ebdbf6c7f5fd580e2e2f
This is the contents of src/boads, src/common,
src/rp2040, and src/rp2_common, excluding cmake
goop.
I suspect we'll trim it back closer to just the
register definitions, but for now leave it mostly
as-is to simplify updating as the pico sdk updates
and we figure out how deeply (or not) to integrate
it with lk.
Using Nordic's nrfx driver for the clock control peripheral since
it address a handful of errata and abstracts some differences
in the nrf52 family of parts.
Use twim(i2c) driver from nrfx library. See comments and patterns in
target/nrf-pca10056 for info on how to properly utilize driver as it
requires some GLOBAL_DEFINES and gpio defines.
Fixes a race in the STM USB driver which can lead to the device seeing
only 0-length SETUP transfers. The bug ultimately leads to a failed
USB enumeration. The race condition is described in further detail
below.
The current behavior of the IRQ handler for received OUT transfers is
as such:
- Clear RX_CTR bit (at this point, HW sees that SW has acknowledged
previous SETUP/OUT transfer, and the HW will now accept new STATUS
transfers)
- Call out to the client OutStageCallback (nothing significant here)
- Set EP_RX_CNT back to size of max_packet (was previously set to 0 as
we expect to receive 0-length OUT transfer from host. HW uses this
value to limit the amount of data it can receive)
- Set RX_STAT back to VALID (the HW can now receive new STATUS/OUT
transfers)
The important thing to note here is that even before RX_STAT is set to
VALID in the last step, the HW can still receive and process a new
SETUP transfer as long as RX_CTR is cleared (the spec has some detail
about this under section "Control Transfers" on page 867:
https://www.st.com/resource/en/reference_manual/dm00031936.pdf). The
race will occur if we receive a SETUP transfer after clearing RX_CTR
but before adjusting EP_RX_CNT back to max_packet. In this case, the
IRQ handler will run for the newly received SETUP transfer, but the
transfer will have no data associated with it (the driver ends up
using the previous transfer data which was cached).
We can eliminate the race window by waiting to clear RX_CTR only after
we've reset EP_RX_CNT. In this case the HW will ignore any new SETUP
transfers until after the EP_RX_CNT is reset back to the desired
value.