diff --git a/config/src/config.rs b/config/src/config.rs index 8eba894..9e66549 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -12,6 +12,7 @@ pub struct Config { pub memory: Memory, pub heap: Heap, pub linker: Linker, + pub text: Option, pub probe: Option, pub log: Option, } @@ -71,6 +72,13 @@ pub struct HeapPool { pub capacity: u32, } +#[non_exhaustive] +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] +pub struct Text { + pub start: u32, +} + #[non_exhaustive] #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] diff --git a/src/templates/layout.ld.hbs b/src/templates/layout.ld.hbs index 58c751a..753cd0a 100644 --- a/src/templates/layout.ld.hbs +++ b/src/templates/layout.ld.hbs @@ -30,7 +30,13 @@ SECTIONS } > FLASH {{~ /if}} - .text : +{{~ #if config.text.start }} + _stext = {{addr config.text.start}}; +{{~ else}} + _stext = ADDR(.vtable) + SIZEOF(.vtable); +{{~ /if}} + + .text _stext: { *(.text.reset); *(.text.*);