Skip to content

Commit f09a3a6

Browse files
committed
Add support for customized text start address
1 parent 40ed039 commit f09a3a6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

config/src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub struct Config {
1212
pub memory: Memory,
1313
pub heap: Heap,
1414
pub linker: Linker,
15+
pub text: Option<Text>,
1516
pub probe: Option<Probe>,
1617
pub log: Option<Log>,
1718
}
@@ -71,6 +72,13 @@ pub struct HeapPool {
7172
pub capacity: u32,
7273
}
7374

75+
#[non_exhaustive]
76+
#[derive(Clone, Debug, Serialize, Deserialize)]
77+
#[serde(rename_all = "kebab-case")]
78+
pub struct Text {
79+
pub start: u32,
80+
}
81+
7482
#[non_exhaustive]
7583
#[derive(Clone, Debug, Serialize, Deserialize)]
7684
#[serde(rename_all = "kebab-case")]

src/templates/layout.ld.hbs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ SECTIONS
3030
} > FLASH
3131
{{~ /if}}
3232

33-
.text :
33+
{{~ #if config.text.start }}
34+
_stext = {{addr config.text.start}};
35+
{{~ else}}
36+
_stext = ADDR(.vtable) + SIZEOF(.vtable);
37+
{{~ /if}}
38+
39+
.text _stext:
3440
{
3541
*(.text.reset);
3642
*(.text.*);

0 commit comments

Comments
 (0)