Skip to content

Commit

Permalink
Add support for customized text start address
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuchengxuan committed Mar 30, 2021
1 parent 40ed039 commit f09a3a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub struct Config {
pub memory: Memory,
pub heap: Heap,
pub linker: Linker,
pub text: Option<Text>,
pub probe: Option<Probe>,
pub log: Option<Log>,
}
Expand Down Expand Up @@ -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")]
Expand Down
8 changes: 7 additions & 1 deletion src/templates/layout.ld.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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.*);
Expand Down

0 comments on commit f09a3a6

Please sign in to comment.