Skip to content

Commit

Permalink
runs again! and defmt output with gdb
Browse files Browse the repository at this point in the history
  • Loading branch information
sky-dragn committed Feb 22, 2024
1 parent 52157f6 commit 9828584
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion gdb.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define flash
end

define rebuild
shell cargo build
shell DEFMT_LOG=info cargo build
end

target remote localhost:1337
Expand Down
5 changes: 5 additions & 0 deletions openocd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ transport select hla_swd
source [find target/stm32l4x.cfg]

reset_config srst_only

rtt server start 8765 0
rtt setup 0x20004b20 0x30 "SEGGER RTT"
init
rtt start
47 changes: 23 additions & 24 deletions src/bin/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ mod app {
fn init(mut cx: init::Context) -> (Shared, Local) {
trace!("init enter");

// #[cfg(debug_assertions)]
// {
// // Enable debugging while the processor is sleeping
// cx.device.DBGMCU.cr.write(|w| w
// .dbg_sleep().set_bit()
// .dbg_standby().set_bit()
// .dbg_stop().set_bit()
// );
// cx.device.RCC.ahb1enr.write(|w| w.dma1en().set_bit());
// }

// const _: () = [][core::mem::size_of::<Shared>()];

// Configure clocks
// unsafe {
// // MSI is already on
Expand Down Expand Up @@ -108,7 +121,7 @@ mod app {
&mut rcc.apb2
);

let display = SharpMemDisplay::new(spi1, cs);
// let display = SharpMemDisplay::new(spi1, cs);

// Initialize RTC and interrupts
// let mut rtc = hal::rtc::Rtc::rtc(
Expand Down Expand Up @@ -136,17 +149,15 @@ mod app {
gps_uart.listen(serial::Event::Rxne);
rtic::pend(Interrupt::USART1);

let gps = Gps::new(gps_uart);

// Spawn tasks
display_task::spawn().unwrap();

info!("done initializing!");
trace!("init exit");
(
Shared {
display,
gps
display: SharpMemDisplay::new(spi1, cs),
gps: Gps::new(gps_uart)
},
Local {
// Initialization of local resources go here
Expand All @@ -159,31 +170,19 @@ mod app {
fn idle(_: idle::Context) -> ! {
trace!("idle enter");

// let device_stolen = unsafe { pac::Peripherals::steal() };

loop {
trace!("idle spin");
trace!("sleep");
// Only sleep in release mode, since the debugger doesn't interact with sleep very nice
#[cfg(debug_assertions)]
core::hint::spin_loop();
#[cfg(not(debug_assertions))]
rtic::export::wfi();

// Sleep
// rtic::export::wfi();
// defmt::info!("hewo 1");
// unsafe {
// device_stolen.RCC.cr.write(|w| w.msirange().bits(0b0001).msirgsel().set_bit());
// }
// defmt::info!("hewo 2");
// // Return to our previously-selected MSI frequency
// device_stolen.RCC.cr.write(|w| w.msirgsel().set_bit());
// defmt::info!("hewo 3");
// unsafe {
// device_stolen.RCC.cfgr.write(|w| w.sw().bits(0b00));
// }
// defmt::info!("hewo 4");
}
}

#[task(binds = USART1, shared = [gps])]
fn on_uart(mut cx: on_uart::Context) {
info!("hewwo");
cx.shared.gps.lock(|gps| gps.handle());
}

Expand Down Expand Up @@ -211,7 +210,7 @@ mod app {
display.flush();
});
Systick::delay(500.millis()).await;
// info!("loop {}", i.0);
info!("loop {}", i.0);
i += 1;
}
}
Expand Down

0 comments on commit 9828584

Please sign in to comment.