10 releases

0.2.9 Jun 29, 2023
0.2.7 Jun 2, 2023
0.2.3 May 30, 2023
0.2.2 Jul 5, 2021
0.1.0 Mar 16, 2021

#244 in Build Utils

Download history 526/week @ 2025-03-12 571/week @ 2025-03-19 448/week @ 2025-03-26 360/week @ 2025-04-02 250/week @ 2025-04-09 110/week @ 2025-04-16 132/week @ 2025-04-23 702/week @ 2025-04-30 558/week @ 2025-05-07 877/week @ 2025-05-14 1460/week @ 2025-05-21 986/week @ 2025-05-28 814/week @ 2025-06-04 849/week @ 2025-06-11 988/week @ 2025-06-18 253/week @ 2025-06-25

3,183 downloads per month
Used in ld-memory-cli

MIT/Apache

13KB
252 lines

ld-memory

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.

Example:

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
}

License

This work is licensed under either of

at your option.

No runtime deps

Features