Line 400... |
Line 400... |
is used to implement all the standard input, output and error consoles (`STDIN`, `STDOUT` and `STDERR`).
|
is used to implement all the standard input, output and error consoles (`STDIN`, `STDOUT` and `STDERR`).
|
|
|
.Newlib Test/Demo Program
|
.Newlib Test/Demo Program
|
[TIP]
|
[TIP]
|
A simple test and demo program, which uses some of newlib's core functions (like `malloc`/`free` and `read`/`write`)
|
A simple test and demo program, which uses some of newlib's core functions (like `malloc`/`free` and `read`/`write`)
|
is available in `sw/example_newlib_demo`
|
is available in `sw/example/demo_newlib`
|
|
|
|
|
:sectnums:
|
:sectnums:
|
==== Executable Image Generator
|
==== Executable Image Generator
|
|
|
Line 443... |
Line 443... |
and placed right before the actual application code so it gets executed right after reset.
|
and placed right before the actual application code so it gets executed right after reset.
|
|
|
The `crt0.S` start-up performs the following operations:
|
The `crt0.S` start-up performs the following operations:
|
|
|
[start=1]
|
[start=1]
|
|
. Disable interrupts globally by clearing <<_mstatus>>`.mie`.
|
. Initialize all integer registers `x1 - x31` (or just `x1 - x15` when using the `E` CPU extension) to a defined value.
|
. Initialize all integer registers `x1 - x31` (or just `x1 - x15` when using the `E` CPU extension) to a defined value.
|
. Initialize the global pointer `gp` and the stack pointer `sp` according to the <<_ram_layout>> provided by the linker script.
|
|
. Initialize all CPU core CSRs and also install a default "dummy" trap handler for _all_ traps. This handler catches all traps
|
. Initialize all CPU core CSRs and also install a default "dummy" trap handler for _all_ traps. This handler catches all traps
|
|
** All interrupt sources are disabled and all pending interrupts are cleared.
|
|
. Initialize the global pointer `gp` and the stack pointer `sp` according to the <<_ram_layout>> provided by the linker script.
|
during the early boot phase.
|
during the early boot phase.
|
. All interrupt sources are disabled and all pending interrupts are cleared.
|
|
. Clear all counter CSRs and stop auto-increment.
|
. Clear all counter CSRs and stop auto-increment.
|
. Clear IO area: Write zero to all memory-mapped registers within the IO region (`iodev` section). If certain devices have not
|
. Clear IO area: Write zero to all memory-mapped registers within the IO region (`iodev` section). If certain devices have not
|
been implemented, a bus access fault exception will occur. This exception is captured by the dummy trap handler.
|
been implemented, a bus access fault exception will occur. This exception is captured by the dummy trap handler.
|
. Clear the `.bss` section defined by the linker script.
|
. Clear the `.bss` section defined by the linker script.
|
. Copy read-only data from the `.text` section to the `.data` section to set initialized variables.
|
. Copy read-only data from the `.text` section to the `.data` section to set initialized variables.
|