Skip to content

Commit 2f02c3b

Browse files
sirhcelSh3Rm4n
authored andcommitted
Use verbose keywords in linker fragments
When using flip-link for stack overflow protection, it parses the linker scripts/fragments for RAM memory addresses and expects the keywords 'ORIGIN' and 'LENGTH' to be used in its verbose form. Allow friction-less integration of flip-link and this crate by using the verbose form.
1 parent 0d35695 commit 2f02c3b

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

build.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,26 @@ This may be due to incorrect feature configuration in Cargo.toml or stm32f3xx-ha
169169
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
170170
let mut file = File::create(out_dir.join("memory.x")).unwrap();
171171
writeln!(file, "MEMORY {{").unwrap();
172-
writeln!(file, " FLASH (rx) : o = 0x8000000, l = {}K", flash).unwrap();
172+
writeln!(
173+
file,
174+
" FLASH (rx) : ORIGIN = 0x8000000, LENGTH = {}K",
175+
flash
176+
)
177+
.unwrap();
173178
if ccmram > 0 {
174-
writeln!(file, " CCMRAM (rwx) : o = 0x10000000, l = {}K", ccmram).unwrap();
179+
writeln!(
180+
file,
181+
" CCMRAM (rwx) : ORIGIN = 0x10000000, LENGTH = {}K",
182+
ccmram
183+
)
184+
.unwrap();
175185
}
176-
writeln!(file, " RAM (rwx) : o = 0x20000000, l = {}K", ram).unwrap();
186+
writeln!(
187+
file,
188+
" RAM (rwx) : ORIGIN = 0x20000000, LENGTH = {}K",
189+
ram
190+
)
191+
.unwrap();
177192
writeln!(file, "}}").unwrap();
178193
println!("cargo:rustc-link-search={}", out_dir.display());
179194
}

0 commit comments

Comments
 (0)