Skip to content

Commit

Permalink
Update test system, tweak renode configs
Browse files Browse the repository at this point in the history
  • Loading branch information
jonlamb-gh committed Apr 3, 2024
1 parent 1fe0bf8 commit 9d2d30f
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 2 deletions.
6 changes: 6 additions & 0 deletions test_system/.gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target remote :3333

# print demangled symbols by default
set print asm-demangle on

monitor start
4 changes: 3 additions & 1 deletion test_system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ init-commands = [
'include @renode/RttReader.cs',
]
platform-descriptions = [
'@platforms/cpus/atsamd51g19a.repl',
'renode/atsamd51g19a.repl',
'''
sercom0: UART.SAMD5_UART @ sysbus 0x40003000
->nvic@48
''',
]
pre-start-commands = [
# NOTE: this is a bit of a hack to speed things up
'sysbus.nvic Frequency 10000000000',
'emulation CreateUARTHub "uarthub"',
'connector Connect sercom0 uarthub',
'connector Connect sercom3 uarthub',
Expand Down
33 changes: 33 additions & 0 deletions test_system/renode/atsamd51g19a.repl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cpu0: CPU.CortexM @ sysbus
cpuType: "cortex-m4f"
nvic: nvic

nvic: IRQControllers.NVIC @ sysbus 0xE000E000
-> cpu0@0

sercom3: UART.SAMD5_UART @ sysbus 0x41014000
->nvic@58

sram0: Memory.MappedMemory @ sysbus 0x20000000
size: 0x30000

flash0: Memory.MappedMemory @ sysbus 0x0
size: 0x80000

dwt: Miscellaneous.DWT @ sysbus 0xE0001000
frequency: 1000000

gclk_phctrl1: Python.PythonPeripheral @ sysbus 0x40001c84
size: 0x4
initable: true
filename: "scripts/pydev/flipflop.py"

pac_intflag: Python.PythonPeripheral @ sysbus 0x40001010
size: 0x4
initable: true
filename: "scripts/pydev/flipflop.py"

pac_status: Python.PythonPeripheral @ sysbus 0x40001040
size: 0x4
initable: true
filename: "scripts/pydev/counter.py"
10 changes: 9 additions & 1 deletion test_system/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mod app {
type Uart3Pads = uart::Pads<Sercom3, IoSet3, Pin<PA16, AlternateD>, Pin<PA17, AlternateD>>;
type Uart3 = uart::Uart<uart::Config<Uart3Pads>, uart::Duplex>;

const SYSFREQ: u32 = 72_000_000;
const SYSFREQ: u32 = 1_000_000;
#[monotonic(binds = SysTick, default = true)]
type Mono = DwtSystick<SYSFREQ>;

Expand Down Expand Up @@ -95,6 +95,14 @@ mod app {
(Shared {}, Local { uart0, uart3 }, init::Monotonics(mono))
}

#[idle]
fn idle(_ctx: idle::Context) -> ! {
info!("Starting idle task");
loop {
cortex_m::asm::wfi();
}
}

#[task(local = [uart3, var: u32 = 0])]
fn blinky(ctx: blinky::Context) {
let uart = ctx.local.uart3;
Expand Down
1 change: 1 addition & 0 deletions test_system/view_expansion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rustfmt --emit stdout target/rtic-expansion.rs | vim +':setlocal buftype=nofile filetype=rust' -
1 change: 1 addition & 0 deletions test_system/view_rtt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cat /tmp/rtt_log.bin | defmt-print -e target/thumbv7em-none-eabihf/release/atsamd-rtic-firmware

0 comments on commit 9d2d30f

Please sign in to comment.