Import verbatim at fuchsia repository at commit 645dbffdfbf52f72491187a1c59af1a677e3dd00
which is the initial commit before it was more excessively converted to
fuchsia style C++.
Issue #310
--include is not a real gcc flag. Maybe it exists for other compilers
or I'm just bad at reading docs though.
Anyway, now that this uses the expected gcc flag, `ccache` works when
added to this build system. Without this, `ccache` thinks there's
multiple input files and refuses to cache results. Now, it works and has
a great hit rate.
This is a useful warning to have on, but keep it off for now since there
are a ton of warnings here, and probably in external projects that use
LK.
CLs incoming to fix the most egregious warning violations this uncovers.
The pendsv_ asm handler has been pushing 9 words on the stack prior to
calling into C code. This violates the ABI which requires 8 byte
alignment. It has worked mostly fine and thus hasn't been caught before.
Add an extra bump of the stack to align it after pushing the registers.
Release the thread lock before context switching to a thread that was
preempted and thus not holding the thread lock. Add a few asserts to
make sure this invariant is maintained in the context switch and PENDSV
handler.
This has never mattered before because the thread lock (and other
spinlocks) were not being tested for validity on by definition single
processor cortex-m systems. After adding some code to test the
spinlocks' values this discrepancy was uncovered.
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.
arch_mmu_map was failing hard, because the identity mapping does not fall within the `vmm_get_kernel_aspace`
this creates a new aspace covering the loader, so it can identity map
linux is also unable to use the FPU if lazy FPU context switching had turned it off prior to the chainload, `arm_fpu_set_enable()` is used to turn it back on
Switch to a more proper matrix. Build each of the projects in a list
with DEBUG=0 and DEBUG=2 and with two versions of the toolchain (7.5.0
and 11.2.0).
Sets things up to be easier to run things like unit tests in a later
patch.
Previously if they couldn't find the toolchain they would full stop the
build. Change to print a warning and then go with the default prefix.
Hopefully this doesn't break anyone downstream but it's helpful for the
CI builder which wants to read from the build system which toolchain to
grab prior to having it in the path.
list-arch and list-toolchain will compute and print the architecture and
toolchain needed to build the project the build is set to.
Used by the CI builder to decide what toolchain to grab.
It seems to be in the case of a string op against a raw address, the
compiler decides the destination object is 0 bytes long and throws a
particular warning. Work around it by not using memcpy in one case and
by disabling the warning in the other.
Both are fairly benign code that basically operates in a hard coded way
that knows the destination buffer is valid.
It's non ideal, since there's no relaxation done in the linker so we
have to assume the branch target is > 16 bits away and do what the
compiler usually does and emit a full 32bit jsr.
Mostly rewrote to be cleaner and more obvious what it's doing, but turns
out the real problem was a lack of "memory" and/or volatile. In one of
the test cases the compiler was rearranging the arch_ints_disabled()
check.
Uses the QEMU virt machine for 68k defined in qemu 6.0+.
Basic support that boots, prints to the console, takes input from
console, and context switches.
TODO: interrupt support, timer support.