# Unable to run/debug on Nucleo STMF401RE with embedded-nucleo\_f401re runtime

**URL:** https://forum.ada-lang.io/t/unable-to-run-debug-on-nucleo-stmf401re-with-embedded-nucleo-f401re-runtime/4077
**Category:** General
**Tags:** embedded, bare-board, gnat, bug
**Created:** [December 23, 2025, 9:15pm UTC](https://forum.ada-lang.io/t/unable-to-run-debug-on-nucleo-stmf401re-with-embedded-nucleo-f401re-runtime/4077 "2025-12-23T21:15:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![BottCode](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/bottcode/32/823_2.png) [@BottCode](https://forum.ada-lang.io/u/BottCode)
#### Post date: [December 23, 2025, 9:15pm UTC](https://forum.ada-lang.io/t/unable-to-run-debug-on-nucleo-stmf401re-with-embedded-nucleo-f401re-runtime/4077/1 "2025-12-23T21:15:15Z")

</div>

I am trying to run and debug a simple program on the Nucleo-F401RE. The toolchain is GNAT ARM elf 15.2.1. The runtime is `embedded-nucleo_f401re`. For flash and debug, I’m using GNAT Studio 26.0 and the following is the Ide configuration in the project file:

```
package Ide is
  for Program_Host use “localhost:4242”;
  for Communication_Protocol use “remote”;
  for Connection_Tool use “st-util”;
end Ide;

```

The build and flash on MCU process works, while the execution and debugging not.  
When I start the debugger, the program is waiting in `_start_rom ()`, which is correct.

 ![image](https://forum.ada-lang.io/uploads/default/original/1X/cfdb8866cfe489ac2f7374b72f425806d8bac672.png)

When I run the program, the program execution stops on its own after about ten seconds in the same function.

 ![image](https://forum.ada-lang.io/uploads/default/original/1X/ce31712d045a19ab305e35857438cf7e5b805d72.png)

If I put the following breakpoint, it is never hit.

![image](https://forum.ada-lang.io/uploads/default/original/1X/2c04ab5b74cc7b15fec1339ae939dc4e1c627372.png)

You can see the full alire project here: [GitHub - BottCode/porting\_blink\_f401re](https://github.com/BottCode/porting_blink_f401re).

Is there a problem with the `embedded-nucleo_f401re` runtime implementation? If I switch to another MCU (light-stm32f429disco), everithing works.

---

<div class="post-metadata">

### Author: ![godunko](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/godunko/32/22_2.png) [@godunko](https://forum.ada-lang.io/u/godunko)
#### Post date: [December 24, 2025, 6:08am UTC](https://forum.ada-lang.io/t/unable-to-run-debug-on-nucleo-stmf401re-with-embedded-nucleo-f401re-runtime/4077/2 "2025-12-24T06:08:40Z")

</div>

You can try to execute program at CPU instructions level and look what happened. Giving the “empty” application main it should be doable.

You can check CPU/MPU registers to find why and probably where application fails.

You can set catch point on exceptions.

PS. Did you enable semihosting in GDB?

---

<div class="post-metadata">

### Author: ![BottCode](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/bottcode/32/823_2.png) [@BottCode](https://forum.ada-lang.io/u/BottCode)
#### Post date: [December 24, 2025, 2:53pm UTC](https://forum.ada-lang.io/t/unable-to-run-debug-on-nucleo-stmf401re-with-embedded-nucleo-f401re-runtime/4077/3 "2025-12-24T14:53:52Z")

</div>

> You can try to execute program at CPU instructions level and look what happened. Giving the “empty” application main it should be doable.

I have the same problem when I try to execute the assembly instructions.

> You can check CPU/MPU registers to find why and probably where application fails.

There’s no any useful information. It looks like the execution never begins.

> You can set catch point on exceptions.

Done, but no excpetions detected.

> PS. Did you enable semihosting in GDB?

Yes, moreover if I switch to light-stm32f429disco runtime and I flash the related MCU with the same application source code, the debugging works as expected.

---

<div class="post-metadata">

### Author: ![BottCode](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/bottcode/32/823_2.png) [@BottCode](https://forum.ada-lang.io/u/BottCode)
#### Post date: [December 24, 2025, 3:00pm UTC](https://forum.ada-lang.io/t/unable-to-run-debug-on-nucleo-stmf401re-with-embedded-nucleo-f401re-runtime/4077/4 "2025-12-24T15:00:57Z")

</div>

In addition, I’m trying to switching to embedded-stm32f4 runtime using the nucleo-f401re board. The execution is stucked is `setup_pll` function.

 ![image](https://forum.ada-lang.io/uploads/default/original/1X/28bedd34c6601ed53bf814693c8afe8c90a96476.png)

---

<div class="post-metadata">

### Author: ![godunko](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/godunko/32/22_2.png) [@godunko](https://forum.ada-lang.io/u/godunko)
#### Post date: [December 24, 2025, 3:25pm UTC](https://forum.ada-lang.io/t/unable-to-run-debug-on-nucleo-stmf401re-with-embedded-nucleo-f401re-runtime/4077/5 "2025-12-24T15:25:46Z")

</div>

If I remember correctly, RCC is not compatible between F401 and F407 (as well as some peripherals). Thus, startup code is not compatible too.

I suggest to try to use `light` runtime to check setup. Or try following example, it known to work on F401/F411 on boards with HSE crystall.

> **[a0b-examples/blink\_led/blackpill\_stm32f401 at main · godunko/a0b-examples](https://github.com/godunko/a0b-examples/tree/main/blink_led/blackpill_stm32f401)**
>
> A0B examples. Contribute to godunko/a0b-examples development by creating an account on GitHub.

Another way is to run

```ada
monitor reset halt
si
info register

```

and check stack pointer/command pointer registers

---

<div class="post-metadata">

### Author: ![DrPi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/drpi/32/225_2.png) [@DrPi](https://forum.ada-lang.io/u/DrPi)
#### Post date: [December 25, 2025, 1:25am UTC](https://forum.ada-lang.io/t/unable-to-run-debug-on-nucleo-stmf401re-with-embedded-nucleo-f401re-runtime/4077/6 "2025-12-25T01:25:02Z")

</div>

> When I run the program, the program execution stops on its own after about ten seconds in the same function.

10s could be the timeout of a watchdog.

> If I put the following breakpoint, it is never hit.

You try to put a breakpoint on a line which does nothing. It is more than likely this line has been optimized out by the compiler, so the breakpoint is not set.
