Skip to content

Commit

Permalink
Custom memory layout for Stax and Flex (44k ram compared to 30k for n…
Browse files Browse the repository at this point in the history
…ano s plus)
  • Loading branch information
agrojean-ledger committed May 27, 2024
1 parent d690db9 commit d82d610
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ledger_device_sdk/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ fn main() -> Result<(), Box<dyn Error>> {
let linkerscript = match device {
NanoS => "nanos_layout.ld",
NanoX => "nanox_layout.ld",
NanoSPlus | Stax | Flex => "nanosplus_layout.ld",
NanoSPlus => "nanosplus_layout.ld",
Stax | Flex => "stax_flex_layout.ld",
};
std::fs::copy(linkerscript, out_dir.join(linkerscript))?;
std::fs::copy("link.ld", out_dir.join("link.ld"))?;
Expand Down
4 changes: 2 additions & 2 deletions ledger_device_sdk/flex.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"panic-strategy": "abort",
"pre-link-args": {
"ld.lld": [
"-Tnanosplus_layout.ld",
"-Tstax_flex_layout.ld",
"-Tlink.ld"
],
"ld": [
"-Tnanosplus_layout.ld",
"-Tstax_flex_layout.ld",
"-Tlink.ld"
]
},
Expand Down
4 changes: 2 additions & 2 deletions ledger_device_sdk/stax.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"panic-strategy": "abort",
"pre-link-args": {
"ld.lld": [
"-Tnanosplus_layout.ld",
"-Tstax_flex_layout.ld",
"-Tlink.ld"
],
"ld": [
"-Tnanosplus_layout.ld",
"-Tstax_flex_layout.ld",
"-Tlink.ld"
]
},
Expand Down
10 changes: 10 additions & 0 deletions ledger_device_sdk/stax_flex_layout.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0xc0de0000, LENGTH = 400K
DATA (r) : ORIGIN = 0xc0de0000, LENGTH = 400K
SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 44K
}

PAGE_SIZE = 512;
STACK_SIZE = 1500;
END_STACK = ORIGIN(SRAM) + LENGTH(SRAM);

0 comments on commit d82d610

Please sign in to comment.