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

Embedded and Nucleo_64

parent 0d8b2421
Branches
No related tags found
No related merge requests found
...@@ -73,7 +73,7 @@ Install the latest version of Visual Studio Code using your packet manager, unde ...@@ -73,7 +73,7 @@ Install the latest version of Visual Studio Code using your packet manager, unde
"request": "attach", "request": "attach",
"name": "Debug", "name": "Debug",
"gdbpath": "/usr/bin/arm-none-eabi-gdb", "gdbpath": "/usr/bin/arm-none-eabi-gdb",
"executable": "./target/thumbv7em-none-eabihf/debug/bluepill", "executable": "./target/thumbv7m-none-eabi/debug/bluepill",
"target": ":3333", "target": ":3333",
"remote": true, "remote": true,
"autorun": [ "autorun": [
...@@ -82,7 +82,7 @@ Install the latest version of Visual Studio Code using your packet manager, unde ...@@ -82,7 +82,7 @@ Install the latest version of Visual Studio Code using your packet manager, unde
"set mem inaccessible-by-default off", "set mem inaccessible-by-default off",
"d breakpoints", "d breakpoints",
"set remotetimeout 300", "set remotetimeout 300",
"load ./target/thumbv7em-none-eabihf/debug/bluepill", "load ./target/thumbv7m-none-eabi/debug/bluepill",
"step", "step",
"monitor reset halt" "monitor reset halt"
], ],
...@@ -104,7 +104,7 @@ Similarly a launch confirguration for release (optimised) builds: ...@@ -104,7 +104,7 @@ Similarly a launch confirguration for release (optimised) builds:
"request": "attach", "request": "attach",
"name": "Debug", "name": "Debug",
"gdbpath": "/usr/bin/arm-none-eabi-gdb", "gdbpath": "/usr/bin/arm-none-eabi-gdb",
"executable": "./target/thumbv7em-none-eabihf/release/bluepill", "executable": "./target/thumbv7m-none-eabi/release/bluepill",
"target": ":3333", "target": ":3333",
"remote": true, "remote": true,
"autorun": [ "autorun": [
...@@ -113,7 +113,7 @@ Similarly a launch confirguration for release (optimised) builds: ...@@ -113,7 +113,7 @@ Similarly a launch confirguration for release (optimised) builds:
"set mem inaccessible-by-default off", "set mem inaccessible-by-default off",
"d breakpoints", "d breakpoints",
"set remotetimeout 300", "set remotetimeout 300",
"load ./target/thumbv7em-none-eabihf/release/bluepill", "load ./target/thumbv7m-none-eabi/release/bluepill",
"step", "step",
"monitor reset halt" "monitor reset halt"
], ],
...@@ -126,3 +126,46 @@ An optimized build is generated by ...@@ -126,3 +126,46 @@ An optimized build is generated by
``` ```
You may set specific settings in the `Cargo.toml` for each build type (`dev` for debug, `release` for release). Notice debugging of optimized code may be difficult as many symbols are *optimised out* and setting breakpoints may not give the desired results. To that end you may choose to use `asm::bkpt()` (defined in the [contex-m](https://github.com/japaric/cortex-m) crate) in the code instead of breakpoints in the debugger. You may set specific settings in the `Cargo.toml` for each build type (`dev` for debug, `release` for release). Notice debugging of optimized code may be difficult as many symbols are *optimised out* and setting breakpoints may not give the desired results. To that end you may choose to use `asm::bkpt()` (defined in the [contex-m](https://github.com/japaric/cortex-m) crate) in the code instead of breakpoints in the debugger.
## Compilation and Linking
The `xargo/cargo` build system will look into your `.cargo/config` for flags. The first example builds for the `m3` architecture while the second for the `m4` with *hard float* code. Notice, to use the *hard floats*, they need to be enabled in the ARM-core (not enabled at reset by default to save power...). You may have several configurations in the `.cargo/config`, and the `[build] = "..."` determintes the default configuration, it may be overridden e.g, by
```
> xargo build ... --target thumbv7m-none-eabi
```
```
[target.thumbv7m-none-eabi]
runner = 'arm-none-eabi-gdb'
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=arm-none-eabi-ld",
"-Z", "linker-flavor=ld",
]
[build]
target = "thumbv7m-none-eabi"
```
```
[target.thumbv7em-none-eabihf]
runner = 'arm-none-eabi-gdb'
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=arm-none-eabi-ld",
"-Z", "linker-flavor=ld",
]
[build]
target = "thumbv7em-none-eabihf"
```
## A note on WFI
If your code hits a `WFI` (Wait For Interrupt), the MCU is put into a low power mode, and by default not accepting new debug request. Thus if trying to connect a new `gdb` session, it will fail (or even worse partially work, while not behaving correctly). To remedy this you may try:
* close `openocd` and restart it
* unplug the the debugger (`stlink` probe), and re-plug it, you may need to hold the `reset` at startup to force the debugger and MCU into a correct state
If we want to overcome this problem alltogether, there is a setting in the ARM-core debug unit that allows incoming connections on `WFI` (this feature is disabled by defauld to save power).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment