/// Generates the `memory_map.rs` module, containing a description of the MCU
/// flash banks and, if applicable, external flash banks for a particular
/// Loadstone instance.
Generates the `memory_map.rs` module, containing a description of the MCU
flash banks and, if applicable, external flash banks for a particular
Loadstone instance.
Generates the ` memory_map . rs ` module containing a description of the MCU flash banks and if applicable external flash banks for a particular Loadstone instance .
pub fn generate<P: AsRef<Path>>(
    autogenerated_folder_path: P,
    memory_configuration: &MemoryConfiguration,
    port: &Port,
) -> Result<()> {
    let filename = autogenerated_folder_path.as_ref().join("memory_map.rs");
    let mut file = OpenOptions::new().write(true).create(true).truncate(true).open(&filename)?;
    let base_index = 1usize;
    let imports = generate_imports(&memory_configuration, port)?;
    let mcu_banks = generate_mcu_banks(
        base_index,
        &memory_configuration.internal_memory_map,
        memory_configuration.golden_index,
    )?;
    let external_banks = generate_external_banks(
        memory_configuration.internal_memory_map.banks.len() + base_index,
        &memory_configuration.external_memory_map,
        memory_configuration.golden_index,
    )?;
    file.write_all(imports.as_bytes())?;
    file.write_all(mcu_banks.as_bytes())?;
    file.write_all(external_banks.as_bytes())?;
    prettify_file(filename).ok();
    Ok(())
}
pub fn generate < P : AsRef < Path > > ( autogenerated_folder_path : P , memory_configuration : & MemoryConfiguration , port : & Port , ) -> Result < ( ) > { let filename = autogenerated_folder_path . as_ref ( ) . join ( " " ) ; let mut file = OpenOptions :: new ( ) . write ( true ) . create ( true ) . truncate ( true ) . open ( & filename ) ? ; let base_index = 1usize ; let imports = generate_imports ( & memory_configuration , port ) ? ; let mcu_banks = generate_mcu_banks ( base_index , & memory_configuration . internal_memory_map , memory_configuration . golden_index , ) ? ; let external_banks = generate_external_banks ( memory_configuration . internal_memory_map . banks . len ( ) + base_index , & memory_configuration . external_memory_map , memory_configuration . golden_index , ) ? ; file . write_all ( imports . as_bytes ( ) ) ? ; file . write_all ( mcu_banks . as_bytes ( ) ) ? ; file . write_all ( external_banks . as_bytes ( ) ) ? ; prettify_file ( filename ) . ok ( ) ; Ok ( ( ) ) }
Generates the `memory_map.rs` module, containing a description of the MCU
flash banks and, if applicable, external flash banks for a particular
Loadstone instance.
Generates the ` memory_map . rs ` module containing a description of the MCU flash banks and if applicable external flash banks for a particular Loadstone instance .
autogenerated_folder_path
P
memory_configuration
&MemoryConfiguration
port
&Port