Skip to content

Commit

Permalink
Merge pull request #14 from mbrossard/device-description
Browse files Browse the repository at this point in the history
Add feature to include FlashDevice device description
  • Loading branch information
9names authored Dec 20, 2024
2 parents f8ca8ec + 416e74a commit 65a59f9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
] }

Expand Down
22 changes: 21 additions & 1 deletion link.x
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SECTIONS {

*(.sdata)
*(.sdata.*)

*(.bss)
*(.bss.*)

Expand All @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 65a59f9

Please sign in to comment.