Commit ccddbada authored by Per's avatar Per

example using new "cortex debug" plugin,

built in ITM dump, works with both 16 and 64Mhz
(simplified launch script, now builds all examples)
parent cda88cc2
......@@ -355,11 +355,38 @@
"interface/stlink.cfg",
"target/stm32f4x.cfg"
],
"cwd": "${workspaceRoot}",
"postLaunchCommands": [
"monitor arm semihosting enable"
],
"swoConfig": {
"enabled": true,
"cpuFrequency": 16000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "Name",
"port": 0
}
]
},
"cwd": "${workspaceRoot}"
},
{
"type": "cortex-debug",
"request": "launch",
"servertype": "openocd",
"name": "c bare6 16Mhz",
"executable": "./target/thumbv7em-none-eabihf/debug/examples/bare6",
"configFiles": [
"interface/stlink.cfg",
"target/stm32f4x.cfg"
],
"swoConfig": {
"enabled": true,
"cpuFrequency": 16000000,
"swoFrequency": 1000000,
"swoFrequency": 2000000, // you may try 1000000 if not working
"source": "probe",
"decoders": [
{
......@@ -368,26 +395,26 @@
"port": 0
}
]
}
},
"cwd": "${workspaceRoot}"
},
{
"type": "cortex-debug",
"request": "launch",
"servertype": "openocd",
"name": "c bare6",
"name": "c bare6 64Mhz",
"executable": "./target/thumbv7em-none-eabihf/debug/examples/bare6",
"configFiles": [
"interface/stlink.cfg",
"target/stm32f4x.cfg"
],
"postLaunchCommands": [
"monitor tpiu config internal /tmp/itm.log uart off 16000000",
"monitor itm port 0 on"
"monitor reset init"
],
"swoConfig": {
"enabled": true,
"cpuFrequency": 16000000,
"swoFrequency": 1000000,
"cpuFrequency": 64000000,
"swoFrequency": 2000000, // you may try 1000000 if not working
"source": "probe",
"decoders": [
{
......
......@@ -5,8 +5,8 @@
"tasks": [
{
"type": "shell",
"label": "xargo build",
"command": "xargo build",
"label": "xargo build --examples",
"command": "xargo build --examples",
"problemMatcher": [
"$rustc"
],
......@@ -17,128 +17,8 @@
},
{
"type": "shell",
"label": "xargo build --release",
"command": "xargo build --release",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example loop",
"command": "xargo build --example loop",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example gpio",
"command": "xargo build --example gpio",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example gpio_raw",
"command": "xargo build --example gpio_raw",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example bare0",
"command": "xargo build --example bare0",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example bare1",
"command": "xargo build --example bare1",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example bare2",
"command": "xargo build --example bare2",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example bare3",
"command": "xargo build --example bare3",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example bare4",
"command": "xargo build --example bare4",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example bare5",
"command": "xargo build --example bare5",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "xargo build --example bare6",
"command": "xargo build --example bare6",
"label": "xargo build --examples --release",
"command": "xargo build --examples --release",
"problemMatcher": [
"$rustc"
],
......
......@@ -39,15 +39,17 @@ fn idle(dwt: &mut DWT, rcc: &mut RCC, gpioa: &mut GPIOA) {
// configure PA5 as output, RM0368 8.4.1
gpioa.moder.modify(|_, w| w.moder5().bits(1));
// at 16 Mhz, 8000_0000 cycles = 0.5s
// at 64 Mhz, 8000_0000 cycles = 0.125s
loop {
ipln!("led on");
// set PA5 high, RM0368 8.4.7
gpioa.bsrr.write(|w| w.bs5().set_bit());
wait_cycles(dwt, 10_000);
wait_cycles(dwt, 8000_000);
ipln!("idle off");
ipln!("led off");
// set PA5 low, RM0368 8.4.7
gpioa.bsrr.write(|w| w.br5().set_bit());
wait_cycles(dwt, 10_000);
wait_cycles(dwt, 8000_000);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment