Skip to content

Add feature to include FlashDevice device description #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading