Skip to content

Commit 261000f

Browse files
authored
Merge pull request #23 from us-irs/configurable-vector-end-addr
Configurable vector end addr
2 parents 0eedf02 + bdaf580 commit 261000f

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

.cargo/config.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build]
2+
# Only one target to support for all chips!
3+
target = "msp430-none-elf"
4+
5+
[unstable]
6+
# MSP430 doesn't come with libcore compiled already. But when it does, this
7+
# key can be removed.
8+
build-std = ["core"]

link.x.in

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ EXTERN(__RESET_VECTOR);
99
object file that's passed to the linker *before* this crate */
1010
EXTERN(__INTERRUPTS);
1111

12+
/* Provide a default for __VECTORS_END_ADDR. Can be overriden in the user memory.x file */
13+
PROVIDE(__VECTORS_END_ADDR = 0x10000);
14+
1215
/* # Pre-initialization function */
1316
/* If the user overrides this using the `pre_init!` macro or by creating a `__pre_init` function,
1417
then the function this points to will be called before the RAM is initialized. */
@@ -78,17 +81,18 @@ SECTIONS
7881
}
7982

8083
/* Do not exceed this mark in the error messages below | */
81-
ASSERT(ORIGIN(VECTORS) + LENGTH(VECTORS) == 0x10000, "
84+
ASSERT(ORIGIN(VECTORS) + LENGTH(VECTORS) == __VECTORS_END_ADDR, "
8285
ERROR(msp430-rt): The VECTORS memory region must end at address 0x10000. Check memory.x");
8386

84-
ASSERT(ADDR(.vector_table) + SIZEOF(.vector_table) == 0x10000, "
87+
ASSERT(ADDR(.vector_table) + SIZEOF(.vector_table) == __VECTORS_END_ADDR, "
8588
ERROR(msp430-rt): .vector_table is shorter than expected.
8689
Possible solutions, from most likely to less likely:
8790
- Link to a svd2rust generated pac crate, if you are not
8891
- Fix _sinterrupts in memory.x; it doesn't match the number of interrupts provided by the
8992
pac crate
9093
- Disable the 'device' feature of msp430-rt to build a generic application; a dependency
9194
may be enabling it
95+
- Override __VECTORS_END_ADDR if your vector table is not placed at the regular vector location
9296
");
9397

9498
ASSERT(_sgot == _egot, "

rust-toolchain.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "nightly-2025-04-29"
3+
components = ["rust-src"]

src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
//! }
6464
//! ```
6565
//!
66+
//! By default, the linker will check that the address after the vector table is 0x10000 to
67+
//! ensure that the vector table is placed correctly. For special cases like bootloader
68+
//! setups, you might want to place the vector table somewhere else. For theses cases,
69+
//! you can re-configure the expected end address by setting `__VECTORS_END_ADDR` in your
70+
//! `memory.x` file.
71+
//!
6672
//! # An example
6773
//!
6874
//! This section presents a minimal application built on top of `msp430-rt`.

0 commit comments

Comments
 (0)