Skip to content

Commit 29dccba

Browse files
committed
feat: add support for nrf52840, make clippy error only on main crate
Signed-off-by: Eva Cosma <eva.cosma.mail@gmail.com>
1 parent cfbabcf commit 29dccba

13 files changed

Lines changed: 64 additions & 21 deletions

File tree

tockloader-cli/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn get_subcommands() -> Vec<Command> {
3232
.about("Open a terminal to receive UART data")
3333
.args(get_channel_args())
3434
.args([
35-
// TODO(george-cosma): Change default to pconsole when new format is implemented and adopted into tock
35+
// TODO(eva-cosma): Change default to pconsole when new format is implemented and adopted into tock
3636
arg!(--protocol <PROTOCOL> "Choose between legacy and pconsole protocol")
3737
.default_value("legacy")
3838
.value_parser(["legacy", "pconsole"]),

tockloader-cli/src/known_boards.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
pub enum KnownBoardNames {
33
NucleoF4,
44
MicrobitV2,
5+
Nrf52840dk,
56
}
67

78
impl KnownBoardNames {
89
pub fn from_str(name: &str) -> Option<Self> {
910
match name {
1011
"nucleo-f4" => Some(Self::NucleoF4),
1112
"microbit-v2" => Some(Self::MicrobitV2),
13+
"nrf52840dk" => Some(Self::Nrf52840dk),
1214
_ => None,
1315
}
1416
}
@@ -17,12 +19,17 @@ impl KnownBoardNames {
1719
match &self {
1820
KnownBoardNames::NucleoF4 => "nucleo-f4",
1921
KnownBoardNames::MicrobitV2 => "microbit-v2",
22+
KnownBoardNames::Nrf52840dk => "nrf52840dk",
2023
}
2124
}
2225
}
2326

2427
pub fn list_known_board_names() -> Vec<KnownBoardNames> {
25-
vec![KnownBoardNames::NucleoF4, KnownBoardNames::MicrobitV2]
28+
vec![
29+
KnownBoardNames::NucleoF4,
30+
KnownBoardNames::MicrobitV2,
31+
KnownBoardNames::Nrf52840dk,
32+
]
2633
}
2734

2835
#[cfg(test)]
@@ -38,7 +45,11 @@ mod tests {
3845

3946
#[test]
4047
fn list_known_boards_updated() {
41-
let backup_list = vec![KnownBoardNames::NucleoF4, KnownBoardNames::MicrobitV2];
48+
let backup_list = vec![
49+
KnownBoardNames::NucleoF4,
50+
KnownBoardNames::MicrobitV2,
51+
KnownBoardNames::Nrf52840dk,
52+
];
4253

4354
assert_eq!(list_known_board_names(), backup_list, "If this fails it means that you likely forgot to update `list_known_boards`, and subsequently the `list_known_boards_updated` test");
4455
}

tockloader-cli/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ fn get_known_board(user_options: &ArgMatches) -> Option<Box<dyn KnownBoard>> {
9494
KnownBoardNames::MicrobitV2 => {
9595
Box::new(tockloader_lib::known_boards::MicrobitV2) as Box<dyn KnownBoard>
9696
}
97+
KnownBoardNames::Nrf52840dk => {
98+
Box::new(tockloader_lib::known_boards::Nrf52840dk) as Box<dyn KnownBoard>
99+
}
97100
}
98101
})
99102
}

tockloader-lib/src/attributes/app_attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl TbfFooter {
3939
}
4040
}
4141

42-
// TODO(george-cosma): Could take advantages of the trait rework
42+
// TODO(eva-cosma): Could take advantages of the trait rework
4343

4444
impl AppAttributes {
4545
pub(crate) fn new(

tockloader-lib/src/attributes/decode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub(crate) fn decode_attribute(step: &[u8]) -> Option<DecodedAttribute> {
6363
Some(DecodedAttribute::new(key, value))
6464
}
6565

66-
// TODO(george-cosma) replace this function with std::str::from_utf8(...). It
66+
// TODO(eva-cosma) replace this function with std::str::from_utf8(...). It
6767
// does the same thing.
6868

6969
/// Transform a byte-slice into a String.

tockloader-lib/src/attributes/system_attributes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl SystemAttributes {
122122
}
123123
}
124124

125-
// TODO(george-cosma): separate kernel attributes from kernel flags.
125+
// TODO(eva-cosma): separate kernel attributes from kernel flags.
126126

127127
let address = 0x40E;
128128
let mut buf = [0u8; 8];
@@ -241,7 +241,7 @@ impl SystemAttributes {
241241
}
242242
}
243243

244-
// TODO(george-cosma): separate kernel attributes from kernel flags.
244+
// TODO(eva-cosma): separate kernel attributes from kernel flags.
245245

246246
let mut pkt = (0x40E_u32).to_le_bytes().to_vec();
247247
let length = (8_u16).to_le_bytes().to_vec();

tockloader-lib/src/board_settings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub struct BoardSettings {
33
pub start_address: u64,
44
}
55

6-
// TODO(george-cosma): Does a default implementation make sense for this? Is a
6+
// TODO(eva-cosma): Does a default implementation make sense for this? Is a
77
// 'None' architechture a sane idea?
88
impl Default for BoardSettings {
99
fn default() -> Self {

tockloader-lib/src/bootloader_serial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ pub async fn issue_command(
222222

223223
// De-escape and add array of read in the bytes
224224

225-
// TODO(george-cosma): Extract this into a function and unit test this.
225+
// TODO(eva-cosma): Extract this into a function and unit test this.
226226
let mut i = 0;
227227
while i < input.len() {
228228
if i + 1 < input.len() && input[i] == ESCAPE_CHAR && input[i + 1] == ESCAPE_CHAR {

tockloader-lib/src/command_impl/probers/info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl CommandInfo for ProbeRSConnection {
2121

2222
let mut core = session.core(self.target_info.core)?;
2323

24-
// TODO(george-cosma): extract these informations without bootloader
24+
// TODO(eva-cosma): extract these informations without bootloader
2525
let system_attributes = SystemAttributes::read_system_attributes_probe(&mut core)?;
2626
let app_attributes =
2727
AppAttributes::read_apps_data_probe(&mut core, settings.start_address)?;

tockloader-lib/src/command_impl/probers/install.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ impl CommandInstall for ProbeRSConnection {
2323

2424
let mut core = session.core(self.target_info.core)?;
2525

26-
// TODO(george-cosma): extract these informations without bootloader
27-
// TODO(george-cosma): extract board name and kernel version to verify app compatability
26+
// TODO(eva-cosma): extract these informations without bootloader
27+
// TODO(eva-cosma): extract board name and kernel version to verify app compatability
2828

2929
let mut address = settings.start_address;
3030

31-
// TODO(george-cosma): double-check/rework this
31+
// TODO(eva-cosma): double-check/rework this
3232

3333
// Read a block of 200 8-bit words// Loop to check if there are another apps installed
3434
loop {
@@ -46,8 +46,8 @@ impl CommandInstall for ProbeRSConnection {
4646
address += whole_len as u64;
4747
}
4848

49-
// TODO(george-cosma): extract arch(?)
50-
// TODO(george-cosma): THIS IS NOT A TOCK ERROR, this is an error due to invalid board settings.
49+
// TODO(eva-cosma): extract arch(?)
50+
// TODO(eva-cosma): THIS IS NOT A TOCK ERROR, this is an error due to invalid board settings.
5151
let arch = settings
5252
.arch
5353
.as_ref()
@@ -69,7 +69,7 @@ impl CommandInstall for ProbeRSConnection {
6969
(address, 0)
7070
};
7171

72-
// TODO(george-cosma): This point MIGHT mark a good point to split
72+
// TODO(eva-cosma): This point MIGHT mark a good point to split
7373
// this function (for probe-rs).
7474

7575
// At this point we no longer need to hold the probe-rs connection
@@ -78,7 +78,7 @@ impl CommandInstall for ProbeRSConnection {
7878

7979
// Make sure the binary is a multiple of the page size by padding 0xFFs
8080

81-
// TODO(george-cosma): check if the page-size differs + support
81+
// TODO(eva-cosma): check if the page-size differs + support
8282
// multiple types of page sizes. Possibly make page size a board
8383
// setting.
8484
let page_size = 512;
@@ -152,7 +152,7 @@ impl CommandInstall for ProbeRSConnection {
152152
options.keep_unwritten_bytes = true;
153153

154154
// Finally, the data can be programmed
155-
// TODO(george-cosma): Can we move this outside the loop? Commit once?
155+
// TODO(eva-cosma): Can we move this outside the loop? Commit once?
156156
loader.commit(session, options)?;
157157
}
158158

0 commit comments

Comments
 (0)