Skip to content

Instantly share code, notes, and snippets.

@siedentop
Created July 19, 2020 17:48
Show Gist options
  • Save siedentop/33db9d1e0025aeb6f38ac8bbce11d050 to your computer and use it in GitHub Desktop.
Save siedentop/33db9d1e0025aeb6f38ac8bbce11d050 to your computer and use it in GitHub Desktop.
Oxidize Workshop 2020 - Issue with incomplete execution
DEBUG:dk -- Initializing the board
DEBUG:dk -- Clocks configured
DEBUG:dk -- RTC started
DEBUG:dk -- I/O pins have been configured for digital output
DEBUG:dk -- Radio initialized and configured with TX power set to the maximum value
INFO:radio_debug -- 78 - 41 - 1114111 - false - false
INFO:radio_debug -- 75 - 70 - 1114111 - false - false
INFO:radio_debug -- 98 - 73 - 1114111 - false - false
INFO:radio_debug -- 101 - 88 - 1114111 - false - false
INFO:radio_debug -- 126 - 83 - 1114111 - false - false
INFO:radio_debug -- 106 - 108 - 1114111 - false - false
INFO:radio_debug -- 68 - 51 - 1114111 - false - false
INFO:radio_debug -- 34 - 93 - 1114111 - false - false
INFO:radio_debug -- 39 - 100 - 1114111 - false - false
INFO:radio_debug -- 125 - 90 - 1114111 - false - false
INFO:radio_debug -- 68 - 51 - 1114111 - false - false
INFO:radio_debug -- 95 - 57 - 1114111 - false - false
INFO:radio_debug -- 98 - 73 - 1114111 - false - false
INFO:radio_debug -- 125 - 90 - 1114111 - false - false
INFO:radio_debug -- 67 - 89 - 1114111 - false - false
INFO:radio_debug -- 38 - 109 - 1114111 - false - false
INFO:radio_debug -- 81 - 35 - 1114111 - false - false
INFO:radio_debug -- 38 - 109 - 1114111 - false - false
INFO:radio_debug -- 95 - 57 - 1114111 - false - false
INFO:radio_debug -- 98 - 73 - 1114111 - false - false
INFO:radio_debug -- 67 - 89 - 1114111 - false - false
INFO:radio_debug -- 38 - 109 - 1114111 - fastack backtrace:
0: 0x00002b3c - __bkpt
1: 0x000025ee - dk::exit
2: 0x00000538 - radio_debug::__cortex_m_rt_main
3: 0x00000508 - main
4: 0x00002132 - Reset
#![deny(unused_must_use)]
#![no_main]
#![no_std]
use core::char;
use cortex_m_rt::entry;
use heapless::{consts, LinearMap};
use panic_log as _; // the panicking behavior
fn make_dict() -> LinearMap<u8, u8, consts::U128> {
let mut dict = LinearMap::<u8, u8, consts::U128>::new();
dict.insert(78, 41).unwrap();
dict.insert(75, 70).unwrap();
dict.insert(98, 73).unwrap();
dict.insert(101, 88).unwrap();
dict.insert(126, 83).unwrap();
dict.insert(106, 108).unwrap();
dict.insert(68, 51).unwrap();
dict.insert(34, 93).unwrap();
dict.insert(39, 100).unwrap();
dict.insert(125, 90).unwrap();
dict.insert(95, 57).unwrap();
dict.insert(67, 89).unwrap();
dict.insert(38, 109).unwrap();
dict.insert(81, 35).unwrap();
dict.insert(55, 94).unwrap();
dict.insert(88, 45).unwrap();
dict.insert(122, 40).unwrap();
dict.insert(43, 112).unwrap();
dict.insert(79, 122).unwrap();
dict.insert(40, 82).unwrap();
dict.insert(91, 92).unwrap();
dict.insert(53, 85).unwrap();
dict.insert(73, 123).unwrap();
dict.insert(110, 101).unwrap();
dict.insert(44, 124).unwrap();
dict
}
fn run() {
let secret = b"NKbe~jD\"'}D_b}C&Q&_bC&e7D&eDCKXDz+&O&(XD[5'Ib5Dn'}~jK'_,";
let dict = make_dict();
for &c in secret.iter() {
let val = dict.get(&c).expect("Failed to extract");
log::info!(
"{} - {} - {} - {} - {}",
c,
*val,
char::MAX as u32,
c > char::MAX as u8,
*val > char::MAX as u8
);
// log::info!("{} - {} / {} - {}", c as char, *val as char, c, *val);
}
log::error!("END!");
}
#[entry]
fn main() -> ! {
log::set_max_level(log::LevelFilter::Trace);
let _board = dk::init().unwrap();
run();
dk::exit()
}
@siedentop
Copy link
Author

Solution: Make sure the log buffer can clear before exiting. I solve it with a timer.wait just before dk::exit(). Also, don't log too much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment