Skip to content

Commit 65a59f9

Browse files
authored
Merge pull request #14 from mbrossard/device-description
Add feature to include FlashDevice device description
2 parents f8ca8ec + 416e74a commit 65a59f9

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ rustflags = [
55
"-C", "link-arg=-Tlink.x",
66

77
# Code-size optimizations.
8-
"-C", "inline-threshold=5",
8+
"-Cllvm-args=--inline-threshold=5",
99
"-C", "no-vectorize-loops",
1010
"-C", "force-frame-pointers=no",
1111

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version = "0.1.0"
77

88
[dependencies]
99
cortex-m = "0.7.0"
10-
flash-algorithm = { version = "0.4.0", default-features = false, features = [
10+
flash-algorithm = { version = "0.5.0", default-features = false, features = [
1111
"panic-handler",
1212
] }
1313

link.x

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SECTIONS {
2525

2626
*(.sdata)
2727
*(.sdata.*)
28-
28+
2929
*(.bss)
3030
*(.bss.*)
3131

@@ -35,6 +35,26 @@ SECTIONS {
3535
. = ALIGN(4);
3636
}
3737

38+
/*
39+
* Adding PrgData section in order to satisfy tools that need it.
40+
*/
41+
PrgData : {
42+
KEEP(*(.PrgData))
43+
KEEP(*(.PrgData.*))
44+
45+
. = ALIGN(4);
46+
}
47+
48+
/* Description of the flash algorithm */
49+
DeviceData . : {
50+
/* The device data content is only for external tools,
51+
* and usually not referenced by the code.
52+
*
53+
* The KEEP statement ensures it's not removed by accident.
54+
*/
55+
KEEP(*(DeviceData))
56+
}
57+
3858
/DISCARD/ : {
3959
/* Unused exception related info that only wastes space */
4060
*(.ARM.exidx);

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,14 @@ struct RP2Algo {
139139
}
140140

141141
algorithm!(RP2Algo, {
142+
device_name: "Raspberry Pi RP2",
143+
device_type: DeviceType::ExtSpi,
142144
flash_address: 0x1000_0000,
143145
flash_size: 0x0100_0000,
144146
page_size: 0x100,
145147
empty_value: 0xFF,
148+
program_time_out: 500, // 500 ms
149+
erase_time_out: 5000, // 5 s
146150
sectors: [{
147151
size: 0x1000,
148152
address: 0x10000000,

0 commit comments

Comments
 (0)