[platform][arm-qemu] fix issue with uart driver on KVM

The accessing method the compiler is emitting for the *REG32 macros on
arm32 and arm64 is occasionally generating load/stores with writeback.
Though this has worked before, it seems to be rejected with whatever
combination of qemu + linux + hardware on this Raspberry Pi 5.

Convert the register accessors to inline asm that uses basic load/store
instructions, which is really the only correct thing to do now and in
the long run. Add a TODO to move this to reg.h and start to revamp how
registers are accessed across LK, but for now keep it just here to fix
things.
1 file changed
tree: 9dcffbca409f908090c9c8369b362e9f2c49cd70
  1. .github/
  2. app/
  3. arch/
  4. dev/
  5. docs/
  6. external/
  7. kernel/
  8. lib/
  9. make/
  10. platform/
  11. project/
  12. scripts/
  13. target/
  14. tools/
  15. top/
  16. .gitignore
  17. engine.mk
  18. LICENSE
  19. lk_inc.mk.example
  20. makefile
  21. README.md
README.md

The Little Kernel Embedded Operating System

The LK kernel is an SMP-aware kernel designed for small systems ported to a variety of platforms and cpu architectures.

See https://github.com/littlekernel/lk for the latest version.

High Level Features

  • Fully-reentrant multi-threaded preemptive kernel
  • Portable to many 32 and 64 bit architectures
  • Support for wide variety of embedded and larger platforms
  • Powerful modular build system
  • Large number of utility components selectable at build time

Supported architectures

  • ARM32
    • Cortex-M class cores (armv6m - armv8m)
    • ARMv7+ Cortex-A class cores
  • ARM64
    • ARMv8 and ARMv9 cores
  • RISC-V 32 and 64bit bit in machine and supervisor mode
  • x86-32 and x86-64 386 up through modern cores
  • Motorola 68000
  • Microblaze
  • MIPS
  • OpenRISC 1000
  • VAX (experimental)

TODO

To build and test for ARM on linux

  1. install or build qemu. v2.4 and above is recommended.
  2. install gcc for embedded arm (see note 1)
  3. run scripts/do-qemuarm (from the lk directory)
  4. you should see ‘welcome to lk/MP’

This will get you a interactive prompt into LK which is running in qemu arm machine ‘virt’ emulation. type ‘help’ for commands.

Note: for ubuntu x86-64: sudo apt-get install gcc-arm-none-eabi or fetch a prebuilt toolchain from https://newos.org/toolchains/x86_64-elf-13.2.0-Linux-x86_64.tar.xz