set exception vector table addr to 0x100000 and add FIQ dummy handler #288

Merged
sb10q merged 2 commits from morgan/artiq-zynq:vector_fix into master 2024-03-07 15:42:32 +08:00

Prerequisite

Summary

  • add dummy fiq handler to fix the compilation error after flake update (see zynq-rs/110)
  • use set_vector_table to configure the base address of the vector table to 0x100000 (the start of SDRAM)

Testing

  • Standlone with Urukul: pass sinara tester
  • Master -> Satellite with Urukul: pass sinara tester
## Prerequisite - flake update for [zynq-rs/#112](https://git.m-labs.hk/M-Labs/zynq-rs/pulls/112) and [zynq-rs/#111](https://git.m-labs.hk/M-Labs/zynq-rs/pulls/111) ## Summary - add dummy fiq handler to fix the compilation error after flake update (see [zynq-rs/110](https://git.m-labs.hk/M-Labs/zynq-rs/pulls/110)) - use `set_vector_table` to configure the base address of the vector table to `0x100000` (the start of SDRAM) - fix #287 ## Testing - Standlone with Urukul: pass sinara tester - Master -> Satellite with Urukul: pass sinara tester
morgan added 2 commits 2024-03-07 12:56:17 +08:00

add dummy fiq handler to fix the compilation error after flake update (see zynq-rs/110)

Why can't it use the default handler in zynq-rs like it does for others?

> add dummy fiq handler to fix the compilation error after flake update (see zynq-rs/110) Why can't it use the default handler in zynq-rs like it does for others?
morgan force-pushed vector_fix from eee45ff828 to 9763a30ed2 2024-03-07 13:27:12 +08:00 Compare
sb10q reviewed 2024-03-07 13:27:46 +08:00
@ -77,6 +77,7 @@ static mut LOG_BUFFER: [u8; 1 << 17] = [0; 1 << 17];
#[no_mangle]
pub fn main_core0() {
exception_vectors::set_vector_table(0x100000);

Where is this number coming from?

Where is this number coming from?

Maybe obtain from linker?

Maybe obtain from linker?
Poster
Owner

From the link.x, I also checked it with .elf dump


runtime.elf:     file format elf32-littlearm


Disassembly of section .text:

00100000 <exception_vector>:
  100000:	ea000036 	b	1000e0 <Reset>
  100004:	ea000045 	b	100120 <UndefinedInstruction>
  100008:	ea000054 	b	100160 <SoftwareInterrupt>
  10000c:	ea000063 	b	1001a0 <PrefetchAbort>
  100010:	ea000072 	b	1001e0 <DataAbort>
  100014:	ea000081 	b	100220 <ReservedException>
  100018:	ea000010 	b	100060 <IRQ>
  10001c:	eaffffff 	b	100020 <FIQ>

From the [link.x](https://git.m-labs.hk/M-Labs/artiq-zynq/src/commit/cf0b83c3f968833d410060a9ad981ad822c3690a/src/libbuild_zynq/link.x#L5), I also checked it with .elf dump ``` runtime.elf: file format elf32-littlearm Disassembly of section .text: 00100000 <exception_vector>: 100000: ea000036 b 1000e0 <Reset> 100004: ea000045 b 100120 <UndefinedInstruction> 100008: ea000054 b 100160 <SoftwareInterrupt> 10000c: ea000063 b 1001a0 <PrefetchAbort> 100010: ea000072 b 1001e0 <DataAbort> 100014: ea000081 b 100220 <ReservedException> 100018: ea000010 b 100060 <IRQ> 10001c: eaffffff b 100020 <FIQ> ```

So use __text_start then?

So use __text_start then?
Poster
Owner

Force push to use the dummy_fiq_handler feature from zynq-rs

Force push to use the `dummy_fiq_handler` feature from zynq-rs
morgan force-pushed vector_fix from 9763a30ed2 to 4455f740d2 2024-03-07 15:38:57 +08:00 Compare
Poster
Owner

Force push to use linker symbol. __exception_start is added and used instead of __text_start. As it's pointing at the start of .text (0x0)

[     0.035728s]  INFO(runtime): __exception_start = 0x100000
[     0.040936s]  INFO(runtime): __text_start = 0x0
[     0.045276s]  INFO(runtime): __text_end = 0x1afde8

Force push to use linker symbol. `__exception_start` is added and used instead of `__text_start`. As it's pointing at the start of .text (0x0) ```bash [ 0.035728s] INFO(runtime): __exception_start = 0x100000 [ 0.040936s] INFO(runtime): __text_start = 0x0 [ 0.045276s] INFO(runtime): __text_end = 0x1afde8 ```

Hmm, the __text_start symbol looks wrong then. It should not be 0. Maybe it's not used anywhere and could simply be removed?

Hmm, the __text_start symbol looks wrong then. It should not be 0. Maybe it's not used anywhere and could simply be removed?
sb10q merged commit 4455f740d2 into master 2024-03-07 15:42:32 +08:00
Poster
Owner

__text_start is used in the core1.rs file. Removing it or making it point to the right address may cause some unknown side effect

`__text_start` is used in the [core1.rs](https://git.m-labs.hk/M-Labs/artiq-zynq/src/commit/4455f740d2f8477ef94eff24cac2b68dd5fdfd57/src/libksupport/src/kernel/core1.rs#L215) file. Removing it or making it point to the right address may cause some unknown side effect

If code works correctly with incorrect values, then the code is buggy and should be fixed.

If code works correctly with incorrect values, then the code is buggy and should be fixed.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/artiq-zynq#288
There is no content yet.