Play the linker: place four sections in a small ROM and a small RAM, and find the numbers that start-up code needs.
Hardware context: Start-up code in Boot ROM on a small processor model, checked against the real ap_rv32. Bare-metal firmware start-up
A small chip has a ROM of 256 bytes at address 0 and a RAM of 256 bytes at 0x8000_0000. The linker script places .text, .rodata, .data and .bss in that order. The stack starts at the top of RAM and may use 64 bytes.
This worksheet uses named constants. The first three entries show how to record your decisions.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Section | .text | .rodata | .data | .bss |
|---|---|---|---|---|
| Size, in bytes | 96 | 16 | 12 | 20 |
| First values stored in ROM | yes | yes | yes | no |
With execute in place, .text and .rodata run in ROM, and .data and .bss run in RAM. With copy to RAM, all four run in RAM, in the same order, and ROM holds the stored copies. Enter ROM addresses as plain numbers. Enter RAM addresses as bytes from the first address of RAM. All answers are decimal.
| Entry | Your decision |
|---|---|
| RODATA_START | Address of .rodata, with execute in place. |
| DATA_LOAD | Load address of .data. |
| ROM_USED | Bytes of ROM in use. |
| BSS_START | Where .bss starts, in bytes from the first address of RAM, with execute in place. |
| BSS_END | Where .bss ends, in bytes from the first address of RAM. |
| COPY_WORDS | Words that start-up code copies, with execute in place. |
| CLEAR_WORDS | Words that start-up code clears. |
| STACK_BOTTOM | Lowest address the stack may reach, in bytes from the first address of RAM. |
| FREE_BYTES | Bytes between the end of .bss and the bottom of the stack, with execute in place. |
| COPY_ALL_WORDS | Words that start-up code copies with copy to RAM. |
| COPY_RAM_USED | Bytes of RAM in use with copy to RAM, the stack included. |
| COPY_FREE | Bytes between the end of .bss and the bottom of the stack, with copy to RAM. |
| BSS_START_AFTER | Where would .bss start, in bytes from the first address of RAM, if .data held N words in place of 3? Use execute in place. |
Examples
Example 1
RODATA START- Input
Address of .rodata, with execute in place.
- Output
matches = 1
.text takes addresses 0 to 95, so .rodata starts at 96.
Example 2
DATA LOAD- Input
Load address of .data.
- Output
matches = 1
The stored copy of .data follows .rodata: 96 + 16.
Example 3
ROM USED- Input
Bytes of ROM in use.
- Output
matches = 1
96 + 16 + 12. Nothing is stored for .bss.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For BSS_START_AFTER, enter a constant expression using N. Only this entry changes with the parameter. The supported integer range is 0 through 29, inclusive.
Hints
Hint 1
Add the sizes of the stored sections in order. Each sum is the address of the next one.
Hint 2
Do the same for the sections that run in RAM.
Hint 3
Take its size from the top of RAM, and compare its bottom with the end of the sections.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
13 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 problems on this path