Skip to main content

chip_for

Function chip_for 

Source
pub fn chip_for(
    device_id: u16,
    flash_bytes: Option<u32>,
) -> Result<&'static str, String>
Expand description

Returns the probe-rs target name for a device, from its ID and the flash size its image was linked for (__flash0_end__ - __flash0_base__).

The device ID does not give the flash size, and probe-rs’s flash layout and chip erase depend on it (a KC target on a 128 KB KB would address flash that is not there), so the caller supplies the size – from the tag’s TagInfo.intflashsz or the image’s linker symbols – to choose the variant:

Deviceflash_bytesTarget
DEV_L432None or 256 KBSTM32L432KC
DEV_L432128 KBSTM32L432KB
DEV_U375None or 1 MBSTM32U375RG
DEV_U375512 KBSTM32U375RE

None (an image without the symbols, or no image at all) takes the larger part.

§Errors

A message naming the device ID, and the size if one was given, for any other combination; nothing is guessed.