Skip to content

Commit 85c8d1e

Browse files
committed
Update FLC tests to use both UART and semihosting
1 parent e38bf9b commit 85c8d1e

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

tests/src/main.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@ fn main() -> ! {
5858
.configure_timer_2(Oscillator::ISO, Prescaler::_4096)
5959
.build();
6060

61+
// run FLC tests with semi-hosting
62+
flc_tests::run_flc_tests(
63+
&mut stdout,
64+
manager.flash_controller().unwrap(),
65+
manager.system_clock().unwrap(),
66+
);
67+
68+
{
69+
let mut uart = manager.build_uart().unwrap().build(115200);
70+
71+
// run FLC tests with UART
72+
flc_tests::run_flc_tests(
73+
&mut uart,
74+
manager.flash_controller().unwrap(),
75+
manager.system_clock().unwrap(),
76+
);
77+
78+
// UART instance is tossed here
79+
}
80+
6181
flc_tests::run_flc_tests(
6282
&mut stdout,
6383
manager.flash_controller().unwrap(),

tests/src/tests/flc_tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Flash controller tests
22
33
use core::fmt::Write;
4-
use cortex_m_semihosting::hio;
54
use max78000_hal::peripherals::flash_controller::{FlashController, FlashErr};
65
use max78000_hal::peripherals::oscillator::{
76
Ibro, IbroDivider, IbroFrequency, Iso, IsoDivider, IsoFrequency, Oscillator, SystemClock,
@@ -14,8 +13,8 @@ use max78000_hal::peripherals::PeripheralHandle;
1413
/// [`flash_write_full_outbounds`],
1514
/// [`flash_write_partially_outbound_beginning`],
1615
/// [`flash_write_full_partially_outbound_end`].
17-
pub fn run_flc_tests(
18-
stdout: &mut hio::HostStream,
16+
pub fn run_flc_tests<T: Write>(
17+
stdout: &mut T,
1918
flash_controller: PeripheralHandle<'_, FlashController<'_, '_>>,
2019
mut sys_clk: PeripheralHandle<'_, SystemClock<'_, '_>>,
2120
) {

0 commit comments

Comments
 (0)