Skip to content

Commit 9c44d17

Browse files
Update cortex-m dependency
This requires removing the lpc55-rtic which is not in use anymore anyway
1 parent e8554f0 commit 9c44d17

File tree

21 files changed

+108
-246
lines changed

21 files changed

+108
-246
lines changed

Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ digest = "0.10"
2323
embedded-hal = { version = "0.2", features = ["unproven"] }
2424
embedded-time = "0.12"
2525
generic-array = "1.0.0"
26-
lpc55-pac = "0.4"
26+
lpc55-pac = "0.5"
2727
nb = "1"
2828
rand_core = "0.6"
2929
usb-device = "0.2"
@@ -32,14 +32,13 @@ void = { version = "1", default-features = false }
3232

3333
# optional dependencies
3434
# cortex-m-rtic = { version = "0.5", optional = true }
35-
lpc55-rtic = { version = "0.5.7", optional = true }
3635
littlefs2 = { version = "0.5", optional = true }
3736

3837
[dev-dependencies]
3938
aes = "0.8"
40-
cortex-m-rt = "0.6"
39+
cortex-m-rt = "0.7"
4140
rtic = { package = "cortex-m-rtic", version = "1" }
42-
cortex-m-semihosting = "0.3"
41+
cortex-m-semihosting = "0.5"
4342
heapless = "0.7"
4443
panic-halt = "0.2"
4544
panic-semihosting = { version = "0.5", features = ["jlink-quirks"] }
@@ -53,7 +52,6 @@ usbd-serial = "0.1"
5352
default = ["rt"]
5453
littlefs = ["littlefs2"]
5554
rt = ["lpc55-pac/rt"]
56-
rtic-peripherals = ["lpc55-rtic"]
5755
# no longer a HAL feature, just for the usb examples
5856
highspeed-usb-example = []
5957

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ rustup:
4141
rustup target add thumbv8m.main-none-eabihf
4242
rustup update
4343

44+
build-examples:
45+
cargo build --examples
46+
cargo build --examples --release
47+
4448
build-examples-verbosely:
4549
cargo build --verbose --examples
4650
cargo build --verbose --examples --release

examples/adc.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn autocal(adc: &hal::raw::ADC0) {
3939

4040
#[entry]
4141
fn main() -> ! {
42-
heprintln!("Hello ADC").unwrap();
42+
heprintln!("Hello ADC");
4343

4444
// Get pointer to all device peripherals.
4545
let mut hal = hal::new();
@@ -81,7 +81,7 @@ fn main() -> ! {
8181
// turn on!
8282
adc.ctrl.modify(|_, w| w.adcen().set_bit());
8383

84-
heprintln!("Auto calibrating..").unwrap();
84+
heprintln!("Auto calibrating..");
8585
autocal(&adc);
8686

8787
// channel 13 (1V ref), single ended A, high res
@@ -110,9 +110,9 @@ fn main() -> ! {
110110
.bits(1)
111111
});
112112

113-
heprintln!("ADC CTRL. {:02X}", adc.ctrl.read().bits()).unwrap();
114-
heprintln!("ADC CFG. {:02X}", adc.cfg.read().bits()).unwrap();
115-
heprintln!("ADC stat: {:02X}", adc.stat.read().bits()).unwrap();
113+
heprintln!("ADC CTRL. {:02X}", adc.ctrl.read().bits());
114+
heprintln!("ADC CFG. {:02X}", adc.cfg.read().bits());
115+
heprintln!("ADC stat: {:02X}", adc.stat.read().bits());
116116

117117
// SW trigger the trigger event 0
118118
adc.swtrig.write(|w| unsafe { w.bits(1) });
@@ -121,16 +121,16 @@ fn main() -> ! {
121121

122122
let count0 = adc.fctrl[0].read().fcount().bits();
123123

124-
heprintln!("FIFO0 conversions {}", count0).unwrap();
124+
heprintln!("FIFO0 conversions {}", count0);
125125

126126
let result = adc.resfifo[0].read().bits();
127127
let valid = result & 0x80000000;
128128
let sample = (result & 0xffff) as u16;
129129

130130
if valid != 0 {
131-
heprintln!("sample = {:02x}", sample).unwrap();
131+
heprintln!("sample = {:02x}", sample);
132132
} else {
133-
heprintln!("No result from ADC!").unwrap();
133+
heprintln!("No result from ADC!");
134134
}
135135

136136
for i in 0..10 {
@@ -139,11 +139,11 @@ fn main() -> ! {
139139
let result = adc.resfifo[0].read().bits();
140140
assert!((result & 0x80000000) != 0);
141141
let sample = (result & 0xffff) as u16;
142-
heprintln!("sample{} = {:02x}", i, sample).unwrap();
142+
heprintln!("sample{} = {:02x}", i, sample);
143143
}
144144

145-
heprintln!("looping").unwrap();
145+
heprintln!("looping");
146146
loop {
147-
heprintln!("looping").unwrap();
147+
heprintln!("looping");
148148
}
149149
}

examples/aes.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ fn main() -> ! {
4141
let (sw_cyc_enc, _) = hal::count_cycles(|| {
4242
cipher.encrypt_block(&mut sw_block);
4343
});
44-
hprintln!("encrypting with aes-soft took {} cycles", sw_cyc_enc).unwrap();
44+
hprintln!("encrypting with aes-soft took {} cycles", sw_cyc_enc);
4545

4646
let sw_encrypted_block: [u8; 16] = sw_block[..].try_into().unwrap();
4747

4848
let (sw_cyc_dec, _) = hal::count_cycles(|| {
4949
cipher.decrypt_block(&mut sw_block);
5050
});
51-
hprintln!("decrypting with aes-soft took {} cycles", sw_cyc_dec).unwrap();
51+
hprintln!("decrypting with aes-soft took {} cycles", sw_cyc_dec);
5252

5353
// check sw decrypt⚬encrypt = id
5454
assert_eq!(sw_block, block);
@@ -64,8 +64,8 @@ fn main() -> ! {
6464
let (hw_cyc_enc, _) = hal::count_cycles(|| {
6565
cipher.encrypt_block(&mut hw_block);
6666
});
67-
hprintln!("encrypting with hashcrypt took {} cycles", hw_cyc_enc).unwrap();
68-
hprintln!("speedup: {}x", sw_cyc_enc / hw_cyc_enc).unwrap();
67+
hprintln!("encrypting with hashcrypt took {} cycles", hw_cyc_enc);
68+
hprintln!("speedup: {}x", sw_cyc_enc / hw_cyc_enc);
6969
// dbg!(hw_block);
7070

7171
let hw_encrypted_block: [u8; 16] = hw_block.as_slice().try_into().unwrap();
@@ -78,8 +78,8 @@ fn main() -> ! {
7878
let (hw_cyc_dec, _) = hal::count_cycles(|| {
7979
cipher.decrypt_block(&mut hw_block);
8080
});
81-
hprintln!("decrypting with hashcrypt took {} cycles", hw_cyc_dec).unwrap();
82-
hprintln!("speedup: {}x", sw_cyc_dec / hw_cyc_dec).unwrap();
81+
hprintln!("decrypting with hashcrypt took {} cycles", hw_cyc_dec);
82+
hprintln!("speedup: {}x", sw_cyc_dec / hw_cyc_dec);
8383

8484
// check hw decrypt⚬encrypt = id
8585
assert_eq!(hw_block, block);

examples/ctimer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use hal::drivers::Timer;
2020

2121
#[entry]
2222
fn main() -> ! {
23-
heprintln!("Hello ctimer").unwrap();
23+
heprintln!("Hello ctimer");
2424

2525
// Get pointer to all device peripherals.
2626
let mut hal = hal::new();
@@ -36,7 +36,7 @@ fn main() -> ! {
3636
.enabled(&mut hal.syscon, clocks.support_1mhz_fro_token().unwrap());
3737
let mut cdriver = Timer::new(ctimer);
3838

39-
heprintln!("looping 1 Hz").unwrap();
39+
heprintln!("looping 1 Hz");
4040
let mut c = 0;
4141
loop {
4242
cdriver.start(1_000_000.microseconds());

examples/external_interrupts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use lpc55_hal as hal;
1919

2020
#[entry]
2121
fn main() -> ! {
22-
heprintln!("External interrupts").unwrap();
22+
heprintln!("External interrupts");
2323

2424
let mut hal = hal::new();
2525

@@ -58,12 +58,12 @@ fn main() -> ! {
5858
loop {
5959
if (pint.rise.read().bits() & 1) != 0 {
6060
pint.rise.write(|w| unsafe { w.bits(1) });
61-
heprintln!("Rising edge detected").unwrap();
61+
heprintln!("Rising edge detected");
6262
}
6363

6464
if (pint.fall.read().bits() & 1) != 0 {
6565
pint.fall.write(|w| unsafe { w.bits(1) });
66-
heprintln!("Falling edge detected").unwrap();
66+
heprintln!("Falling edge detected");
6767
}
6868
}
6969
}

examples/flash.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -133,39 +133,39 @@ fn main() -> ! {
133133
// debug_assert!(flash.int_status.read().fail().bit_is_clear());
134134

135135
// let x: u8 = unsafe { core::ptr::read_volatile(0x0004_0000 as *const u8) } ;
136-
// hprintln!("{:x}", x).ok();
136+
// hprintln!("{:x}", x);
137137
// let x: u32 = unsafe { core::ptr::read_volatile(0x0004_0004 as *const u32) } ;
138-
// hprintln!("{:x}", x).ok();
138+
// hprintln!("{:x}", x);
139139

140140
dbg!("before erasing");
141-
hprintln!("{:#034x}", flash.read_u128(0x4_0000)).ok();
141+
hprintln!("{:#034x}", flash.read_u128(0x4_0000));
142142
const WHERE: usize = 0x0004_0000; // 256kB offset
143143

144144
dbg!("after erasing");
145145
flash.erase_page(WHERE >> 4).unwrap();
146-
hprintln!("{:#034x}", flash.read_u128(0x4_0000)).ok();
146+
hprintln!("{:#034x}", flash.read_u128(0x4_0000));
147147

148148
dbg!("after writing");
149149
flash.write_u32(WHERE, 0x1234_5678).unwrap();
150-
hprintln!("{:#034x}", flash.read_u128(0x4_0000)).ok();
150+
hprintln!("{:#034x}", flash.read_u128(0x4_0000));
151151

152152
dbg!("after erasing again");
153153
flash.erase_page(WHERE >> 4).unwrap();
154-
hprintln!("{:#034x}", flash.read_u128(0x4_0000)).ok();
154+
hprintln!("{:#034x}", flash.read_u128(0x4_0000));
155155

156156
dbg!("after writing with offset 4");
157157
flash.write_u32(WHERE + 4, 0x1234_5678).unwrap();
158-
hprintln!("{:#034x}", flash.read_u128(0x4_0000)).ok();
158+
hprintln!("{:#034x}", flash.read_u128(0x4_0000));
159159

160-
hprintln!("{:#034x}", flash.read_u128(0x4_0010)).ok();
161-
hprintln!("{:#034x}", flash.read_u128(0x4_0020)).ok();
160+
hprintln!("{:#034x}", flash.read_u128(0x4_0010));
161+
hprintln!("{:#034x}", flash.read_u128(0x4_0020));
162162

163163
let mut read_buf = [0u8; 16];
164164
flash.read(WHERE, &mut read_buf);
165165
// dbg!(read_buf);
166166

167167
flash.erase_page(0x4_0200).unwrap();
168-
hprintln!("supposedly erased").ok();
168+
hprintln!("supposedly erased");
169169
// dbg!(flash.status());
170170
flash.read(WHERE, &mut read_buf);
171171
// dbg!(read_buf);
@@ -192,32 +192,32 @@ fn main() -> ! {
192192
// flash.read(0x4_0200, &mut read_buf);
193193
// dbg!(read_buf);
194194
// flash.write_u32(0x4_0200, 32).ok();
195-
// hprintln!("{:#x}", flash.read_u128(0x4_0200)).ok();
195+
// hprintln!("{:#x}", flash.read_u128(0x4_0200));
196196
// flash.read(0x4_0200, &mut read_buf);
197197
// dbg!(read_buf);
198198
// // flash.write_u8(0x4_0206, 64).ok();
199199
// flash.write_u32(0x4_0204, 128).ok();
200-
// hprintln!("{:#x}", flash.read_u128(0x4_0200)).ok();
200+
// hprintln!("{:#x}", flash.read_u128(0x4_0200));
201201
// flash.read(0x4_0200, &mut read_buf);
202202
// dbg!(read_buf);
203203
// // flash.read(0x4_0210, &mut read_buf);
204204
// // dbg!(read_buf);
205205

206-
hprintln!("{:#034x}", flash.read_u128(0x4_0200)).ok();
207-
hprintln!("{:#034x}", flash.read_u128(0x4_0210)).ok();
208-
hprintln!("{:#034x}", flash.read_u128(0x4_0220)).ok();
206+
hprintln!("{:#034x}", flash.read_u128(0x4_0200));
207+
hprintln!("{:#034x}", flash.read_u128(0x4_0210));
208+
hprintln!("{:#034x}", flash.read_u128(0x4_0220));
209209

210210
flash.write_u128(0x4_0200, 0x1234567).unwrap();
211211
// hal::wait_at_least(1_000_000);
212212
flash.write_u128(0x4_0210, 0x7654321).unwrap();
213213
// hal::wait_at_least(1_000_000);
214214
// flash.write_u128(0x4_0200, 0x1234567).unwrap();
215215

216-
hprintln!("{:#034x}", flash.read_u128(0x4_0200)).ok();
217-
hprintln!("{:#034x}", flash.read_u128(0x4_0210)).ok();
218-
hprintln!("{:#034x}", flash.read_u128(0x4_0220)).ok();
216+
hprintln!("{:#034x}", flash.read_u128(0x4_0200));
217+
hprintln!("{:#034x}", flash.read_u128(0x4_0210));
218+
hprintln!("{:#034x}", flash.read_u128(0x4_0220));
219219

220-
hprintln!("loop-continue").ok();
220+
hprintln!("loop-continue");
221221
loop {
222222
continue;
223223
}

examples/i2c.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn main() -> ! {
3232
.configure(&mut anactrl, &mut pmc, &mut syscon)
3333
.unwrap();
3434

35-
// cortex_m_semihosting::hprintln!("clocks = {:?}", &clocks).ok();
35+
// cortex_m_semihosting::hprintln!("clocks = {:?}", &clocks);
3636

3737
let token = clocks.support_flexcomm_token().unwrap();
3838

@@ -60,7 +60,7 @@ fn main() -> ! {
6060
for c in (97..123).chain(65..91) {
6161
if let Err(_err) = display.write_str(unsafe { core::str::from_utf8_unchecked(&[c]) }) {
6262
// use cortex_m_semihosting::hprintln;
63-
// hprintln!("error {}, resetting display", err).ok();
63+
// hprintln!("error {}, resetting display", err);
6464
// display.init().unwrap();
6565
// display.clear().unwrap();
6666
}

examples/itm.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,22 @@ fn main() -> ! {
2121
let mut cp = unsafe { hal::raw::CorePeripherals::steal() };
2222
let dp = unsafe { hal::raw::Peripherals::steal() };
2323

24-
hprintln!("traceclksel = {:x?}", dp.SYSCON.traceclksel.read().bits()).ok();
25-
hprintln!("traceclkdiv = {:x?}", dp.SYSCON.traceclkdiv.read().bits()).ok();
24+
hprintln!("traceclksel = {:x?}", dp.SYSCON.traceclksel.read().bits());
25+
hprintln!("traceclkdiv = {:x?}", dp.SYSCON.traceclkdiv.read().bits());
2626
hprintln!(
2727
"traceclkdiv.div = {:x?}",
2828
dp.SYSCON.traceclkdiv.read().div().bits()
29-
)
30-
.ok();
29+
);
3130
hprintln!(
3231
"traceclkdiv.halt = {:x?}",
3332
dp.SYSCON.traceclkdiv.read().halt().bits()
34-
)
35-
.ok();
33+
);
3634
// unsafe { dp.SYSCON.traceclksel.write(|w| w.sel().bits(0)); }
3735
// unsafe { dp.SYSCON.traceclkdiv.write(|w| w.div().bits(1)); }
3836

3937
// iocon.set_pio_0_8_swo_func();
4038
iocon.set_pio_0_10_swo_func();
39+
4140
// hprintln!("pio_0_8 = {:?}", iocon.get_pio_0_8_func());
4241
// hprintln!("pio_0_10 = {:?}", iocon.get_pio_0_10_func());
4342
// hprintln!("traceclkdiv = {:?}", dp.SYSCON.traceclkdiv.read().bits());

examples/late.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mod app {
4848
fn idle(ctx: idle::Context) -> ! {
4949
loop {
5050
if let Some(byte) = ctx.local.c.dequeue() {
51-
hprintln!("received message: {}", byte).unwrap();
51+
hprintln!("received message: {}", byte);
5252
// cortex_m::asm::wfi();
5353
} else {
5454
rtic::pend(Interrupt::ADC0);

0 commit comments

Comments
 (0)