Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sw] cleanup and update software framework #478

Merged
merged 8 commits into from
Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ mimpid = 0x01040312 => Version 01.04.03.12 => v1.4.3.12

| Date (*dd.mm.yyyy*) | Version | Comment |
|:-------------------:|:-------:|:--------|
| 21.01.2023 | 1.7.9.10 | update software framework; :bug: fix bug in constructor calling in `crt0` start-up code; [#478](https://github.com/stnolting/neorv32/pull/478) |
| 15.01.2023 | 1.7.9.9 | :warning: rework **CPU counters**; remove `mtime_i/o` top entity ports; remove `time[h]` CSRs; [#477](https://github.com/stnolting/neorv32/pull/477) |
| 14.01.2023 | 1.7.9.8 | minor CPU control edits, optimizations and fixes; [#476](https://github.com/stnolting/neorv32/pull/476) |
| 10.01.2023 | 1.7.9.7 | :warning: rework **watchdog timer (WDT)**; [#474](https://github.com/stnolting/neorv32/pull/474) |
Expand Down
28 changes: 12 additions & 16 deletions docs/datasheet/software.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -482,25 +482,21 @@ and placed right before the actual application code so it gets executed right af
The `crt0.S` start-up performs the following operations:

[start=1]
. Disable interrupts globally by clearing <<_mstatus>> (including `mie`).
. Initialize all integer registers `x1 - x31` (or just `x1 - x15` when using the `E` CPU extension is enabled) to a defined value.
. Initialize all CPU core CSRs and also install a default "dummy" trap handler for _all_ exceptions. This is used for the very early boot
phase where the application might not provide a trap handling yet.
** Clear <<_mstatus>>`.
** Clear <<_mie>> disabling all interrupt sources and clearing all pending interrupts.
** Clear <<_cycleh>> and <<_instreth>> counter CSRs.
. Clear <<_mstatus>>.
. Clear <<_mie>> disabling all interrupt sources.
. Install an early-boot dummy trap handler to <<_mtvec>>.
. 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.
. 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.
. Call and execute all _constructors_ (if there are any).
. Initialize all integer register `x1 - x31` (only `x1 - x15` if the `E` CPU extension is enabled).
. Setup `.data` section to configure initialized variables.
. Clear the `.bss` section.
. Call all _constructors_ (if there are any).
. Call the application's `main` function (with no arguments: `argc` = `argv` = 0).
. If `main` returns:
** interrupts are disabled by clearing all IRQ sources <<_mie>.
** `mains`'s return value is copied to the <<_mscratch>> CSR to allow inspection by the on-chip debugger.
** call and execute all _destructors_ (if there are any).
** an optional <<_after_main_handler>> is called (if defined at all).
** the CPU enters sleep mode (using the `wfi` instruction) or remains in an endless loop (if `wfi` "returns").
** Tnterrupts are disabled by clearing <<_mie>>.
** `mains`'s return value is copied to the <<_mscratch>> CSR to allow inspection by the debugger.
** Call all _destructors_ (if there are any).
** An optional <<_after_main_handler>> is called (if defined at all).
** The CPU enters sleep mode (using the `wfi` instruction) or remains in an endless loop (if `wfi` "returns").

.Bootloader Start-Up Code
[NOTE]
Expand Down
100 changes: 59 additions & 41 deletions rtl/core/neorv32_application_image.vhd
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
-- The NEORV32 RISC-V Processor: https://github.com/stnolting/neorv32
-- Auto-generated memory initialization file (for APPLICATION) from source file <demo_blink_led/main.bin>
-- Size: 1004 bytes
-- Size: 1076 bytes
-- MARCH: default
-- Built: 09.01.2023 19:30:00
-- Built: 21.01.2023 15:20:33

-- prototype defined in 'neorv32_package.vhd'
package body neorv32_application_image is

constant application_init_image : mem32_t := (
x"30005073",
x"30401073",
x"00000097",
x"12408093",
x"30509073",
x"80002117",
x"ff810113",
x"fe810113",
x"80000197",
x"7f418193",
x"00000517",
x"12450513",
x"30551073",
x"30001073",
x"30401073",
x"b0001073",
x"b8001073",
x"b0201073",
x"b8201073",
x"7e418193",
x"00000213",
x"00000293",
x"00000313",
x"00000393",
x"00000413",
x"00000493",
x"00000813",
x"00000893",
x"00000913",
Expand All @@ -42,11 +39,11 @@ x"00000e13",
x"00000e93",
x"00000f13",
x"00000f93",
x"3ec00593",
x"43400593",
x"80000617",
x"f7460613",
x"f8060613",
x"80000697",
x"f6c68693",
x"f7868693",
x"00c58e63",
x"00d65c63",
x"0005a703",
Expand All @@ -55,17 +52,17 @@ x"00458593",
x"00460613",
x"fedff06f",
x"80000717",
x"f4870713",
x"f5470713",
x"80000797",
x"f4078793",
x"f4c78793",
x"00f75863",
x"00072023",
x"00470713",
x"ff5ff06f",
x"3ec00413",
x"3ec00493",
x"43400413",
x"43400493",
x"00945a63",
x"0009a083",
x"00042083",
x"000080e7",
x"00440413",
x"ff1ff06f",
Expand All @@ -74,8 +71,8 @@ x"00000593",
x"088000ef",
x"30401073",
x"34051073",
x"3ec00413",
x"3ec00493",
x"43400413",
x"43400493",
x"00945a63",
x"00042083",
x"000080e7",
Expand Down Expand Up @@ -110,45 +107,52 @@ x"00000513",
x"00000593",
x"00112623",
x"00812423",
x"0e0000ef",
x"134000ef",
x"00000513",
x"00150413",
x"00000593",
x"0ff57513",
x"0cc000ef",
x"120000ef",
x"0fa00513",
x"020000ef",
x"034000ef",
x"00040513",
x"fe5ff06f",
x"f9402583",
x"f9002503",
x"f9402783",
x"fef59ae3",
x"00008067",
x"c80027f3",
x"c0002573",
x"c80025f3",
x"fef59ae3",
x"00008067",
x"fe010113",
x"00a12623",
x"fe002503",
x"3e800593",
x"00112e23",
x"00812c23",
x"00912a23",
x"150000ef",
x"190000ef",
x"00c12603",
x"00000693",
x"00000593",
x"0ac000ef",
x"fe802783",
x"00020737",
x"0ec000ef",
x"00050413",
x"00e7f7b3",
x"00058493",
x"02078e63",
x"fa5ff0ef",
x"fc0027f3",
x"0807f793",
x"04078463",
x"320027f3",
x"0017f793",
x"02079e63",
x"f9dff0ef",
x"00850433",
x"00a43533",
x"009585b3",
x"00b504b3",
x"f91ff0ef",
x"f89ff0ef",
x"fe95eee3",
x"00b49463",
x"fe856ae3",
Expand All @@ -157,15 +161,29 @@ x"01812403",
x"01412483",
x"02010113",
x"00008067",
x"01c59493",
x"00455513",
x"00a4e533",
x"00050a63",
x"00050863",
x"fff50513",
x"fe802783",
x"00020737",
x"00e7f7b3",
x"02078663",
x"f41ff0ef",
x"00850433",
x"00a43533",
x"009585b3",
x"00b504b3",
x"f2dff0ef",
x"fe95eee3",
x"fcb490e3",
x"fe856ae3",
x"fb9ff06f",
x"01c49493",
x"00445413",
x"0084e433",
x"00040a63",
x"00040863",
x"fff40413",
x"00000013",
x"ff1ff06f",
x"fcdff06f",
x"f95ff06f",
x"fc000793",
x"00a7a423",
x"00b7a623",
Expand Down
Loading