diff --git a/.cargo/config.toml b/.cargo/config.toml index 8b2fc36..649d486 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,7 +5,7 @@ rustflags = [ "-C", "link-arg=-Tlink.x", # Code-size optimizations. - "-C", "inline-threshold=5", + "-Cllvm-args=--inline-threshold=5", "-C", "no-vectorize-loops", "-C", "force-frame-pointers=no", diff --git a/Cargo.toml b/Cargo.toml index 6a8e4e8..d0684b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ version = "0.1.0" [dependencies] cortex-m = "0.7.0" -flash-algorithm = { version = "0.4.0", default-features = false, features = [ +flash-algorithm = { version = "0.5.0", default-features = false, features = [ "panic-handler", ] } diff --git a/link.x b/link.x index f2f2ee4..dd08a85 100644 --- a/link.x +++ b/link.x @@ -25,7 +25,7 @@ SECTIONS { *(.sdata) *(.sdata.*) - + *(.bss) *(.bss.*) @@ -35,6 +35,26 @@ SECTIONS { . = ALIGN(4); } + /* + * Adding PrgData section in order to satisfy tools that need it. + */ + PrgData : { + KEEP(*(.PrgData)) + KEEP(*(.PrgData.*)) + + . = ALIGN(4); + } + + /* Description of the flash algorithm */ + DeviceData . : { + /* The device data content is only for external tools, + * and usually not referenced by the code. + * + * The KEEP statement ensures it's not removed by accident. + */ + KEEP(*(DeviceData)) + } + /DISCARD/ : { /* Unused exception related info that only wastes space */ *(.ARM.exidx); diff --git a/src/main.rs b/src/main.rs index 0a3555c..690cdf2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -139,10 +139,14 @@ struct RP2Algo { } algorithm!(RP2Algo, { + device_name: "Raspberry Pi RP2", + device_type: DeviceType::ExtSpi, flash_address: 0x1000_0000, flash_size: 0x0100_0000, page_size: 0x100, empty_value: 0xFF, + program_time_out: 500, // 500 ms + erase_time_out: 5000, // 5 s sectors: [{ size: 0x1000, address: 0x10000000,