Add phase-by-phase tutorial notes
Add a Tutorial tree that mirrors the roadmap from Phase 0 through Linux bring-up. Each phase and subphase gets a short learning note with consistent sections for context, goals, new concepts, mental model, learning tasks, pitfalls, tooling, testing, and references. The tutorial material is intentionally explanatory rather than implementation code. It gives a systems-oriented learner enough FPGA, SystemVerilog, RISC-V, firmware, and Linux bring-up context to approach each roadmap phase without turning the notes into copy-paste RTL.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# Phase 8 - GCC Toolchain Integration
|
||||
|
||||
## Context
|
||||
|
||||
This phase moves from hand-written assembly to compiled C. The CPU must now satisfy the
|
||||
expectations of a real compiler, linker, and runtime startup.
|
||||
|
||||
## Goals
|
||||
|
||||
- Create linker script and startup code.
|
||||
- Compile simple C programs for the implemented ISA.
|
||||
- Run RISC-V compliance-style tests.
|
||||
|
||||
## New Concepts
|
||||
|
||||
- Linker script: file controlling where sections are placed in memory.
|
||||
- crt0: startup code that prepares stack and globals before `main`.
|
||||
- ELF: executable/linkable file format used by toolchains.
|
||||
- ABI: software binary contract for registers, stack, calls, and data layout.
|
||||
|
||||
## How To Think About It
|
||||
|
||||
GCC is an unforgiving test generator. It will use legal instruction combinations you did
|
||||
not think to test manually. That is exactly why this phase matters.
|
||||
|
||||
## Learning Tasks
|
||||
|
||||
- Understand sections: `.text`, `.rodata`, `.data`, `.bss`, and stack.
|
||||
- Learn how ELF becomes a BRAM initialization image.
|
||||
- Compare disassembly with your implemented instruction list.
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- Advertising ISA extensions before hardware decodes them.
|
||||
- Forgetting to initialize stack or zero `.bss`.
|
||||
- Assuming "simple C" means "simple instruction stream."
|
||||
|
||||
## Tooling And Testing
|
||||
|
||||
- Use objdump for every early firmware image.
|
||||
- Keep `-nostdlib` until you deliberately provide runtime support.
|
||||
- Run compliance tests before adding traps and privilege complexity.
|
||||
|
||||
## References
|
||||
|
||||
- RISC-V ELF psABI: https://github.com/riscv-non-isa/riscv-elf-psabi-doc
|
||||
- GNU linker scripts: https://sourceware.org/binutils/docs/ld/Scripts.html
|
||||
- riscv-tests: https://github.com/riscv-software-src/riscv-tests
|
||||
|
||||
Reference in New Issue
Block a user