Crates.io | ld-memory |
lib.rs | ld-memory |
version | 0.2.9 |
source | src |
created_at | 2021-03-16 11:35:18.890125 |
updated_at | 2023-06-29 13:12:36.59829 |
description | Helper crate to programmatically create GNU ld MEMORY blocks |
homepage | |
repository | https://github.com/kaspar030/ld-memory |
max_upload_size | |
id | 369653 |
size | 12,566 |
This crate allows creating MEMORY
blocks programmatically.
It is supposed to be used in build.rs of crates that now ship memory.x files, which don't easily allow specifying offsets and limits as needed for e.g., a bootloader taking space in front of the application binary.
This code:
use ld_memory::{Memory, MemorySection};
pub fn main() {
let memory = Memory::new()
.add_section(MemorySection::new("FLASH", 0, 0x40000))
.add_section(MemorySection::new("RAM", 0x20000000, 0x10000));
println!("{}", memory.to_string());
}
... will print this:
MEMORY
{
FLASH : ORIGIN = 0x00000000, LENGTH = 262144
RAM : ORIGIN = 0x20000000, LENGTH = 65536
}
This work is licensed under either of
at your option.