diff --git a/.vscode/launch.json b/.vscode/launch.json index d97d76836e1a496ec47a54adac4b71e44d73d67d..00aed0115ea78cc3f9cdb66d53b2f3fdd8824688 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -26,15 +26,16 @@ "request": "attach", "name": "Debug nested", "gdbpath": "/usr/bin/arm-none-eabi-gdb", - "executable": "./target/thumbv7em-none-eabihf/debug/examples/nested", + "executable": "./target/thumbv7m-none-eabi/debug/examples/nested", "target": ":3333", "remote": true, "autorun": [ "monitor reset init", + "monitor adapter_khz 5000", "monitor arm semihosting enable", - "monitor tpiu config internal /tmp/itm.log uart off 16000000", - "monitor itm port 0 on", - "load" + "monitor reset init", + "load", + "monitor reset init" ], "cwd": "${workspaceRoot}" }, @@ -117,6 +118,8 @@ "autorun": [ "monitor reset init", "monitor adapter_khz 5000", + "monitor tpiu config internal /tmp/itm.log uart off 4000000", + "monitor itm port 0 on", "monitor arm semihosting enable", "monitor reset init", "load", diff --git a/Cargo.toml b/Cargo.toml index 0853def083cf88c0e1d15e85856d77ac2700ead8..85bacb8ad67e4ce80ab7d185c43f065a061ccf0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,16 @@ git = "https://gitlab.henriktjader.com/pln/STM32F40x" features = ["rt"] version = "0.1.0" +[dev-dependencies.lpc176x5x] +path = "../lpc176x5x" +features = ["rt"] +version = "0.1.0" + + +[dependencies.cortex-m-semihosting] +version = "0.2.0" + + [features] wcet_bkpt = [] wcet_nop = [] diff --git a/doc.md b/doc.md index 4dad768399765e84699a69ae0580df47a6d940f0..e33a016be9abd02f0b8adafad3d512681a6a509d 100644 --- a/doc.md +++ b/doc.md @@ -24,15 +24,16 @@ Jumper j4, (desoldered) nucleo lpc -1 VDD_TARGET - White - 2 VIO_3V3X (not used) +1 VDD_TARGET - - 2 VIO_3V3X (not used) 2 SWCLK - Pink - 6 TCLK_SWCLKX 3 GND - Black - 16 GNDX 4 SWDIO - Grey - 4 TMS_SWDIOX -5 NRST - Blue - 12 RESETX +5 NRST - - 12 RESETX (not used) +6 SWO - Blue - 8 TDO_SWOX on the lpc, j4, power is provided from the usb, pin 1-2 bridged NRST, should it be connected? openocd -f interface/stlink-v2-1.cfg -f target/lpc17xx.cfg -c "init; reset halt" - +* UM10360 diff --git a/examples/zero-tasks.rs b/examples/zero-tasks.rs index 9b2dd270f62d90044331b2c9e9e583066f763d28..bcc3bc31c36b252d3fdda1df389ae2463b5e2b97 100644 --- a/examples/zero-tasks.rs +++ b/examples/zero-tasks.rs @@ -4,9 +4,12 @@ #![feature(proc_macro)] #![no_std] +#[macro_use] +extern crate cortex_m; + extern crate cortex_m_rtfm as rtfm; // IMPORTANT always do this rename -extern crate stm32f40x; // the device crate +extern crate lpc176x5x; // the device crate // import the procedural macro use rtfm::app; @@ -17,7 +20,7 @@ use rtfm::app; // `main` yourself. app! { // this is the path to the device crate - device: stm32f40x, + device: lpc176x5x, } // The initialization phase. @@ -25,9 +28,18 @@ app! { // This runs first and within a *global* critical section. Nothing can preempt // this function. fn init(p: init::Peripherals) { + use lpc176x5x::syscon::clksrcsel::*; + // This function has access to all the peripherals of the device - p.GPIOA; - p.RCC; + let itm = p.ITM; + iprintln!(&itm.stim[0], "Hello, world!"); + let r = p.SYSCON.clksrcsel.read().clksrc(); + match r { + CLKSRCR::SELECTS_THE_INTERNAL => rtfm::bkpt(), + _ => rtfm::bkpt(), + } + //iprintln!(&itm.stim[0], "{:?}", p.SYSCON.clksrcsel.read()); + // .. }