74 Commits (master)

Author SHA1 Message Date
James Zow 52b7ac9b2f
fix ci/cd error (#195)
* fix ci/cd error

* update copyright year

* Modify remaining years

* solve ci report settings.json code style

* update .prettierrc.json

* prettierrc fix code style

* fix rb file i.to_s and code style

* fix error Line is too long. [101/100]

* Modify the Ruby file format and restore other file formats

* update makefile and readme file space
8 months ago
Andre Richter 5e3af39bdc
Change to aarch64-cpu crate 2 years ago
Andre Richter 2e72a8408f
Rework driver subsystem
This update significantly decouples the generic kernel code
from the BSP code.
Prior to this patch, the BSP had way too much business logic
that should have always been the generic kernel's concern.
2 years ago
Andre Richter 7014c0cdfd
Bump dependencies 2 years ago
Andre Richter 2345214367
Various minor improvements 2 years ago
Andre Richter b7b2d31c24
Rewrite timer subsystem 2 years ago
Andre Richter e6c3790cac
Remove .got section again
It seems that whatever bug or config mistake gave us .got entries back then has
since been resolved. Also add a sanity check to recognize should this happen
again.
2 years ago
Andre Richter f452755919
Annotate sync functions 2 years ago
Andre Richter fec4f9b6f2
Rework driver subsystem
- Remove the panic version of the GPIO and UART driver. While they were a neat
  idea, it proved tedious to drag them along different tutorials where the
  virtual memory situation kept on changing. Actually, not much is lost, since
  the benefit was only of theoretical nature until now, since everything is
  still single-threaded with NullLocks. It is still possible to re-introduce
  them later.

- Refactor driver bringup starting with tutorial 14. Instantiating the drivers
  only when we are already capable of using the remapped MMIO address makes the
  kernel a lot more robust, and the drivers need not care whether their MMIO
  addresses are good to use already or not.

- Use console and irq_manager references from the generic kernel code. This
  improves decoupling from the BSP, and is needed as a basis for tutorial 14.
2 years ago
Andre Richter f6190f85b7
ASM: Remove use of .equ
The LLVM assembler apparently causes the .equ directive to create symbols
instead of just a local and temporary variable.

Work around this by using const operands with global_asm!.
2 years ago
Andre Richter 8513ccfd8d
Various minor fixes 2 years ago
Bryan Lee f4f02da28e chore: replace `git.io` link with the original URL 2 years ago
Pavel Shirshov 9250099090 Fix even more typos s/write:fmt/write_fmt/ 2 years ago
Andre Richter e9a3c4b489
Rename main LD script to kernel.ld 2 years ago
Andre Richter ad5a96db4c
Bump compiler version 2 years ago
Andre Richter 1581b26995
Panic: Print location 2 years ago
Andre Richter 68b81aa6a0
Panic: Guard against infinite panic loops 2 years ago
Andre Richter 722e8b7232
Print a timestamp on panic 2 years ago
Andre Richter d901ae6cfe
Update copyright 2 years ago
Andre Richter 7d02537515
Bump toolchain 2 years ago
Andre Richter 02c01c821b
Refactor memory subsystem code
This patch refactors big chunks of the memory subsystem code.

Most of all, it does away with the the design being based around the raw pointer
type "*const Page". While raw pointers to an actual page seemed like a
compelling idea, in practice it turned out difficult. Rust feels a bit
inconsistent with respect to raw pointers. While it is safe to create them out
of nowhere (only dereferencing is unsafe), it gets weird when multi-threading
comes into picture.

For example, wrapping them into synchronization primitives caused issues because
they don't implement Send. For this reason, we switch to the PageAddress type
which is based on usize, which makes things a lot easier.

Other changes/benefits include:

- Gets rid of unsafe code in the removed PageSlice type.

- Decouple the translation table code and MMIO VA allocation.

- For the translation table tool, make better use of what the ELF format already
  provides with respect to memory segmentation and translation. For example, the
  tool now queries the ELF file for VA->PA translations and other segment
  attributes. This has also the added benefit of reduced BSP code and more
  generic code in the tool.

- Packs rbelftools in the Docker image now (used by translation table tool).

- In tutorials 14/15/16, rearrange the PA and VA layout.
2 years ago
lightning1141 02937e8033 docs: Remove pl011_uart duplicate comments. 3 years ago
Andre Richter e1728636c1 Switch to tock-registers: Sources for tutorials 13..02 3 years ago
Andre Richter 8c2cec00be
Assembly: Use local label syntax for named labels
This prevents that they show up in the symbol table.
3 years ago
Andre Richter 7f666000ce
Init DRAM in assembly instead of Rust
See https://github.com/rust-embedded/cortex-m-rt/issues/300
3 years ago
Andre Richter f6f668c781
Fix misspelled clippy lint 3 years ago
Andre Richter c0da8ab1b7
Remove confusing statement 3 years ago
Andre Richter b4ed84dd77
Replace ldr pseudo-instruction with adrp/add 3 years ago
Andre Richter 2432c0d283
Revert to assembly boot code
It is too risky to rely on the compiler to not insert any operations using the
stack.

Having a stack-setting call in Rust using the cortex-a crate as the first action
in a Rust-only _start() function does not work if you're subsequently using the
stack, because the compiler often inserts the operations to make room on the
stack to prepare a function call BEFORE the call to set the stack, which crashes
the boot process.

Hence, keep on using a small piece of assembly boot code throughout.
3 years ago
Andre Richter 6a9af3c202
change static type 3 years ago
Andre Richter 223989adb9
Overhaul linker script 3 years ago
Andre Richter 6db8b2bc72
Update toolchain 3 years ago
Andre Richter a5884321a7
Fix rustdoc warnings 3 years ago
Andre Richter dc9b3c0f38
Add isb before timer read 3 years ago
Andre Richter 8324b1fdac
PL011: Use BUSY bit
Fixes #100
3 years ago
Andre Richter e7cb61b389
Refactoring
- Don't wildcard-import from arch modules. Make it explicit.
- Put translation table code into its own module.
- Put boot code in boot.rs instead of cpu.rs
- Other minor changes, most memory subsystem.
3 years ago
Andre Richter c35a30cd0b Bump UART to 921_600 baud + other bugfixes
Fixes #95
Fixes #98

Co-authored-by: Takumasa Sakao <sakataku7@gmail.com>
3 years ago
Andre Richter f2a891236e
Remove unused feature 3 years ago
Andre Richter ee52e8e288
Bump UART to 576000 baud 3 years ago
Andre Richter 44bb3f8942
Update copyright year 3 years ago
Andre Richter d212348931
Bump compiler version.
We have to remove the `#[naked]` attribute from `_start` for now, since it emits
a warning now when used with non-asm statements in the function body. For now,
just hope for the compiler's mercy to not emit code using the stack pointer
before we've actually set up a stack.
3 years ago
Andre Richter 5c193d5803
Change to a simpler mutex API 4 years ago
Andre Richter 02f9f34af3
More sound Phantom in MMIO deref wrapper 4 years ago
Andre Richter 163e2010ab
GPIO: Fix RPi4 driver init
The RPi4 GPIO pull-up/pull down sequence is done differently than on the
RPi3. Switch to using the correct way.

Also, configure pull-ups for both UART pins.

Fixes #81
4 years ago
Andre Richter 098e19ecc4
Fix zero-sized bss handling 4 years ago
Andre Richter e7a13e81b8
Upgrade to cortex-a 4.x.x 4 years ago
Andre Richter 27a1d10cc3
Remove UB in linker script symbol <-> Rust handover 4 years ago
Andre Richter 677b274a1f
Add a panic version of the GPIO to panic!() 4 years ago
Andre Richter 22faff5229
Various finetunings 4 years ago
Andre Richter 37b9d1435e
Move anything wrt linker symbols to bsp::memory
Also, some rewording of data types.
4 years ago