Update libfdt from https://github.com/dgibson/dtc at revision
855c934e26aeadb5bab878d1b148090af2480c90
Source is verbatim except moving headers into an include directory added
to the path.
Using 2-clause BSD option.
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.
More code is using it, so try to build a more standardized version of
it. For now, since most of the defines that are needed are similar to
lk/compiler.h, mostly reimplement in terms of those.
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.
Currently, clang does not support the -Wno-nonnull-compare and
-Wmaybe-uninitialized warning flags so this adds lots of unknown warning
flag output for each compile job when not using GCC.
This commit adds a makefile macro to check for supported warning flags
and only adds them if the compiler actually supports them.
Arithmetic on a NULL pointer is undefined behaviour and could be used by
the compiler to optimize out the arithmetic. Use the integer expansion of
chunk2mem(0) instead to silence this warning:
`arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]`
Update libfdt from https://github.com/dgibson/dtc at revision
73590342fc85ca207ca1e6cbc110179873a96962
Source is verbatim except moving headers into an include directory added
to the path.
Using 2-clause BSD option.
Have the arch define additional compiler flags to explicit support or
not support a floating point unit.
Add ability for modules to per file or for the whole module mark code
as needing floating point support.
Add default flags for arm64, riscv, and x86 toolchains.
Needed because gcc 12 is getting much more aggressive about using vector
instructions for non float code, so getting away with avoiding it was
no longer working.
Still not perfect: printf code is being compiled with float, so it's
possible to use floating point instructions inside core kernel or
interrupt handling code if a printf is used.
Possibly will have problems on architectures where mixing float and non
float code at the linker generates issues, but so far seems to be okay.
SysTick_Config() tries to set the systick priority to max. Comment out
this line since arch/arm/arm-m/arch.c sets the priority to medium to
compete with the rest of the exceptions in the system.
Also include lk/compiler.h to avoid redundant cmsis macros.
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.
Mostly just a few warnings where things are promoted via passing floats to
printf. Those we should generally remove anyway because they're just
benchmarking code. Most things LK runs on either doesn't have float or
doesn't have double sized floats.
Some of the structures, notably 'cmd', in the lib console stuff are a
little too generically named and have collided with some other code
so prefix the names a bit more cleanly with console_
The change is largely mechanical, and folks with out of tree code can
easily switch by renaming:
cmd -> console_cmd
cmd_args -> console_cmd_args
cmd_block -> console_cmd_block
console_cmd -> console_cmd_func
Apologies if this breaks you but it should be pretty easy to fix.
Now you need to include arch/atomic.h to get to the atomic routines.
This simplifies a recusion issue in the way arch/ops.h included
arch_ops. Also just generally makes things cleaner.
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.
TL;DR most uses of lib/console.h -> lk/console_cmd.h
Move the part that lets a piece of code somewhere in the system to
define a console command from the actual lib/console api to start an
instance of the console. Move in almost every place the user of the
console command definition to the new header, lk/console_cmd.h which is
always in the include path.
Also remove most uses of testing for WITH_LIB_CONSOLE since you can
almost always just safely define it and then let the linker remove it.
SysTick_Config() tries to set the systick priority to max. Comment out
this line since arch/arm/arm-m/arch.c sets the priority to medium to
compete with the rest of the exceptions in the system.