Skip to content

Use linker symbols for mtvec instead of hardcoded addresses#17

Open
aq1018 wants to merge 2 commits intoch32-rs:mainfrom
OpenServoCore:fix-mtvec-use-linker-symbols
Open

Use linker symbols for mtvec instead of hardcoded addresses#17
aq1018 wants to merge 2 commits intoch32-rs:mainfrom
OpenServoCore:fix-mtvec-use-linker-symbols

Conversation

@aq1018
Copy link
Copy Markdown

@aq1018 aq1018 commented Mar 28, 2026

I have a bootloader running before the real application. This means the application code starts at an offset instead of the default 0x00 location. This PR allows the proper resolution of the vector table for chain loaded applications.

Changes:

  • Use linker script symbols: _start and _highcode_vma_start as the mtvec address.
  • Added ASSERT linker script assertions to ensure vector tables align to 1024 bytes.

@aq1018
Copy link
Copy Markdown
Author

aq1018 commented Mar 28, 2026

p.s. I tested this locally and it works for both default use cases and chain loaded apps. I also tested the linker script asserts by messing with memory.x FLASH and RAM addresses and the assertions stops compilation properly, the error message might be a bit vague, and feel free to ask me to modify if it's not sufficient.

I also noticed that 0.6.1 code has not been synced to main branch yet. I filed a separate issue (#18). Feel free to let me know if I need rebasing if / when you add 0.6.1 change sets.

Thank you for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant