Skip to content
Snippets Groups Projects
Commit 692c71db authored by Per's avatar Per
Browse files

clocking 4Mhz, itm in zero-tasks

parent 454e26fa
No related branches found
No related tags found
No related merge requests found
...@@ -26,15 +26,16 @@ ...@@ -26,15 +26,16 @@
"request": "attach", "request": "attach",
"name": "Debug nested", "name": "Debug nested",
"gdbpath": "/usr/bin/arm-none-eabi-gdb", "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", "target": ":3333",
"remote": true, "remote": true,
"autorun": [ "autorun": [
"monitor reset init", "monitor reset init",
"monitor adapter_khz 5000",
"monitor arm semihosting enable", "monitor arm semihosting enable",
"monitor tpiu config internal /tmp/itm.log uart off 16000000", "monitor reset init",
"monitor itm port 0 on", "load",
"load" "monitor reset init"
], ],
"cwd": "${workspaceRoot}" "cwd": "${workspaceRoot}"
}, },
...@@ -117,6 +118,8 @@ ...@@ -117,6 +118,8 @@
"autorun": [ "autorun": [
"monitor reset init", "monitor reset init",
"monitor adapter_khz 5000", "monitor adapter_khz 5000",
"monitor tpiu config internal /tmp/itm.log uart off 4000000",
"monitor itm port 0 on",
"monitor arm semihosting enable", "monitor arm semihosting enable",
"monitor reset init", "monitor reset init",
"load", "load",
......
...@@ -30,6 +30,16 @@ git = "https://gitlab.henriktjader.com/pln/STM32F40x" ...@@ -30,6 +30,16 @@ git = "https://gitlab.henriktjader.com/pln/STM32F40x"
features = ["rt"] features = ["rt"]
version = "0.1.0" version = "0.1.0"
[dev-dependencies.lpc176x5x]
path = "../lpc176x5x"
features = ["rt"]
version = "0.1.0"
[dependencies.cortex-m-semihosting]
version = "0.2.0"
[features] [features]
wcet_bkpt = [] wcet_bkpt = []
wcet_nop = [] wcet_nop = []
......
...@@ -24,15 +24,16 @@ Jumper j4, (desoldered) ...@@ -24,15 +24,16 @@ Jumper j4, (desoldered)
nucleo lpc 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 2 SWCLK - Pink - 6 TCLK_SWCLKX
3 GND - Black - 16 GNDX 3 GND - Black - 16 GNDX
4 SWDIO - Grey - 4 TMS_SWDIOX 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 on the lpc, j4, power is provided from the usb, pin 1-2 bridged
NRST, should it be connected? NRST, should it be connected?
openocd -f interface/stlink-v2-1.cfg -f target/lpc17xx.cfg -c "init; reset halt" openocd -f interface/stlink-v2-1.cfg -f target/lpc17xx.cfg -c "init; reset halt"
* UM10360
...@@ -4,9 +4,12 @@ ...@@ -4,9 +4,12 @@
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std] #![no_std]
#[macro_use]
extern crate cortex_m;
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
// IMPORTANT always do this rename // IMPORTANT always do this rename
extern crate stm32f40x; // the device crate extern crate lpc176x5x; // the device crate
// import the procedural macro // import the procedural macro
use rtfm::app; use rtfm::app;
...@@ -17,7 +20,7 @@ use rtfm::app; ...@@ -17,7 +20,7 @@ use rtfm::app;
// `main` yourself. // `main` yourself.
app! { app! {
// this is the path to the device crate // this is the path to the device crate
device: stm32f40x, device: lpc176x5x,
} }
// The initialization phase. // The initialization phase.
...@@ -25,9 +28,18 @@ app! { ...@@ -25,9 +28,18 @@ app! {
// This runs first and within a *global* critical section. Nothing can preempt // This runs first and within a *global* critical section. Nothing can preempt
// this function. // this function.
fn init(p: init::Peripherals) { fn init(p: init::Peripherals) {
use lpc176x5x::syscon::clksrcsel::*;
// This function has access to all the peripherals of the device // This function has access to all the peripherals of the device
p.GPIOA; let itm = p.ITM;
p.RCC; 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());
// .. // ..
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment