Skip to main content

read_memory

Function read_memory 

Source
pub fn read_memory(
    usbdev: &UsbDev,
    driver: Driver,
    chip: &str,
    addr: u64,
    len: usize,
) -> Result<Vec<u8>, String>
Expand description

Reads len bytes of tag memory at addr in a session under reset (the core is held at its reset vector, so nothing runs while it is read).

addr is an absolute target address (flash at 0x0800_0000, SRAM, or a register), at any alignment; chip comes from chip_for. Because the core is halted at the reset vector, SRAM holds what survived the reset, not what the firmware would initialise. Through Driver::FieldSafe, unaligned edges are read as whole words, so reading a peripheral register with read side effects can disturb its neighbours.

When the session closes the core is released and the tag boots its firmware, as STM32_Programmer_CLI leaves it; the call waits 50 ms after that before returning.

ยงErrors

A message if the attach fails or the read faults (an unmapped address, for example).