Skip to content

Commit 54586d1

Browse files
committed
build.rs: update to new linker format
1 parent b981572 commit 54586d1

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

runtime/build.rs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,23 @@ fn auto_layout() {
3838
// Create a valid linker file with the specified flash and ram locations.
3939
//
4040
// ```
41-
// MEMORY {
42-
// FLASH (X) : ORIGIN = $LINKER_FLASH, LENGTH = 0x000D0000
43-
// RAM (W) : ORIGIN = $LINKER_RAM, LENGTH = 46K
44-
// }
4541
// TBF_HEADER_SIZE = 0x60;
42+
//
43+
// FLASH_START = 0x00040000;
44+
// FLASH_LENGTH = 0x00040000;
45+
//
46+
// RAM_START = 0x20008000;
47+
// RAM_LENGTH = 62K;
48+
//
4649
// INCLUDE libtock_layout.ld
4750
// ```
4851
let out_platform_path: PathBuf = [out_dir, "layout.ld"].iter().collect();
4952
let mut file = File::create(out_platform_path).expect("Could not create linker file");
50-
write!(file, "MEMORY {{\n").expect("Could not write linker file");
51-
write!(
52-
file,
53-
" FLASH (X) : ORIGIN = {}, LENGTH = 0x000D0000\n",
54-
linker_flash
55-
)
56-
.expect("Could not write linker file");
57-
write!(
58-
file,
59-
" RAM (X) : ORIGIN = {}, LENGTH = 46k\n",
60-
linker_ram
61-
)
62-
.expect("Could not write linker file");
63-
write!(file, "}}\n").expect("Could not write linker file");
6453
write!(file, "TBF_HEADER_SIZE = 0x60;\n").expect("Could not write linker file");
54+
write!(file, "FLASH_START = {};\n", linker_flash).expect("Could not write linker file");
55+
write!(file, "FLASH_LENGTH = 0x000D0000;\n",).expect("Could not write linker file");
56+
write!(file, "RAM_START = {};\n", linker_ram).expect("Could not write linker file");
57+
write!(file, "RAM_LENGTH = 46K;\n",).expect("Could not write linker file");
6558
write!(file, "INCLUDE libtock_layout.ld\n").expect("Could not write linker file");
6659

6760
// Copy the generic layout file into OUT_DIR.

0 commit comments

Comments
 (0)