> For the complete documentation index, see [llms.txt](https://pinloon.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pinloon.gitbook.io/wiki/microcontroller-single-board-computer/debugger-compiler.md).

# Debugger / Compiler

## OpenOCD

* Installation

```
$ sudo apt update
$ sudo apt install openocd
```

* You can refer to directory to get some configuration file for debugger

  ```
  $ cd /usr/local/share/openocd/scripts/board
  $ cat stm32h7x3i_eval.cfg
  ```
* You should see something like this:

```
source [find interface/stlink.cfg]

transport select hla_swd

source [find target/stm32h7x_dual_bank.cfg]

reset_config srst_only
```

## Compiler's option

* When we are linking libary for stm32 target, we may need to set the flag by ourselves, we can refer Makefile generated by CubeMX
* For example

```
-mthumb -mabi=aapcs
## For cortex M4
-mcpu=cortex-m4
-mfpu=fpv4-sp-d16
-mfloat-abi=hard

## For cortex M7
-mcpu=cortex-m7
-mfpu=fpv5-sp-d16
-mfloat-abi=hard
```

## References

1. <https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pinloon.gitbook.io/wiki/microcontroller-single-board-computer/debugger-compiler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
