cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F446RE Debugger Termination (Exit Value 0) and .elf File Permission Denied

SalaiSanjayS
Associate II

1. Environment Details

  • Board: NUCLEO-F446RE (Cortex-M4)

  • IDE: STM32CubeIDE Version 2.0.0

  • Debugger: Integrated ST-LINK/V2-1

  • Firmware Version: V2J46M33

  • OS: Windows (Process path: C:\Users\salai\...)

2. Problem Description

I am encountering a persistent debugger crash where the session terminates immediately after launch. Additionally, I am unable to rebuild the project due to a file lock on the .elf binary.

Symptom A: Debugger Disconnection Upon clicking the "Debug" button, the console shows the GDB server starting, but it immediately terminates with: arm-none-eabi-gdb <terminated, exit value: 0> ST-LINK (ST-LINK GDB server) <terminated, exit value: 0>

Symptom B: Build Error When attempting a "Clean" or "Build," the console reports: rm: can't remove '1_SYSTICK_TIMER.elf': Permission denied make: [makefile:79: clean] Error 1 (ignored)

Symptom C: No Source Available After a full chip erase, the debugger points to 0xfffffffe with the message: No source available for "<signal handler called>() at 0xfffffffe"

3. Steps Taken to Resolve

  • Updated ST-LINK firmware to the latest version.

  • Attempted "Connect Under Reset" in the Debug Configuration settings.

  • Performed a "Full Chip Erase" using STM32CubeProgrammer.

  • Disabled "Parallel Build" to avoid race conditions during the make process.

  • Verified hardware jumpers are in the default positions.

    Current Issues:

    • Debugger: Terminates instantly upon launch.

    • Build: Receiving Permission denied errors for the .elf file during Clean/Build.

    • Recovery: After a full chip erase, the debugger points to 0xfffffffe.

    What I need help with:

    1. How can I reset all my Debug/Run configurations to the default state?

    2. Why is my GDB server shutting down immediately after a successful verify?

    3. How do I break the "Permission Denied" lock on my build files?

12 REPLIES 12
mƎALLEm
ST Employee

Hello,

Try one of the projects available on STM32 Cube F4.

Example: https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32446E-Nucleo/Examples/GPIO/GPIO_IOToggle

Do you face the same issue? just to ensure there is no issue with your project configuration.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hi Abhijeet,

Thank you for the suggestion.

Regarding the STM32CubeF4 example provided, I should mention that my expertise is currently focused on bare-metal programming. I haven't yet worked extensively with the HAL libraries, so navigating the abstraction layer in that specific project is a bit outside my current workflow.

To help me rule out the configuration issues you mentioned, would you be able to provide a bare-metal version of a basic toggle script (direct register access)? Alternatively, I can provide my own bare-metal initialization code for your review to ensure my clock and GPIO register configurations align with the hardware.

I appreciate your patience as we narrow down the cause!

Best regards,
Salai Sanjay S

My suggestion is to test if the MCU is not broken and your IDE project is good.

So please do the suggested test. If it works well, that means there is somthing wrong in your project. So need to start with a project available on Cube and do what you want to do with a direct access to the register.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
SalaiSanjayS
Associate II

13:09:38 **** Incremental Build of configuration Debug for project error debug ****

make -j12 all

arm-none-eabi-gcc "../Src/main.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32 -DSTM32F4 -DSTM32F446RETx -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/main.d" -MT"Src/main.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/main.o"

arm-none-eabi-gcc "../Src/stm32f4xx_it.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32 -DSTM32F4 -DSTM32F446RETx -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/stm32f4xx_it.d" -MT"Src/stm32f4xx_it.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/stm32f4xx_it.o"

arm-none-eabi-gcc "../Src/system_stm32f4xx.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32 -DSTM32F4 -DSTM32F446RETx -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/system_stm32f4xx.d" -MT"Src/system_stm32f4xx.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/system_stm32f4xx.o"

../Src/system_stm32f4xx.c:48:10: fatal error: stm32f4xx.h: No such file or directory

48 | #include "stm32f4xx.h"

| ^~~~~~~~~~~~~

compilation terminated.

In file included from ../Src/stm32f4xx_it.c:22:

../Inc/main.h:24:10: fatal error: stm32f4xx_hal.h: No such file or directory

24 | #include "stm32f4xx_hal.h"

| ^~~~~~~~~~~~~~~~~

compilation terminated.

make: *** [Src/subdir.mk:31: Src/stm32f4xx_it.o] Error 1

make: *** Waiting for unfinished jobs....

In file included from ../Src/main.c:21:

../Inc/main.h:24:10: fatal error: stm32f4xx_hal.h: No such file or directory

24 | #include "stm32f4xx_hal.h"

| ^~~~~~~~~~~~~~~~~

compilation terminated.

make: *** [Src/subdir.mk:31: Src/system_stm32f4xx.o] Error 1

make: *** [Src/subdir.mk:31: Src/main.o] Error 1

"make -j12 all" terminated with exit code 2. Build might be incomplete.

 

13:09:38 Build Failed. 7 errors, 0 warnings. (took 370ms)

 

this is the thing I'm getting in the console when I tried it to run, I copied all the files in the source and inclusion file

Sorry I didn't understand.. Did you try the test I requested before?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Sorry, I was busy with personal work, I have never used HAL library and don't know how to use it, i have error on the inclusion file I've mentioned below... can you please give me some bare-metal code or with CMSIS?

#include "stm32f4xx_hal.h"

#include "stm32f4

Screenshot 2026-02-22 222028.png
Screenshot 2026-02-22 221954.png

Hello,

Please use the project attached to test your board. It toggles the LED on the board.

Sorry I don't have any example in bare metal. The idea to answer your original question is to test your board not to provide baremetal project.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
TDK
Super User

fatal error: stm32f4xx.h: No such file or directory

> fatal error: stm32f4xx_hal.h: No such file or directory

Is it really so hard to troubleshoot this error? Does the file exist? Is it within the include paths?

If you're not using HAL, you shouldn't be including HAL files anywhere.

If you can't troubleshoot this, you may not be successful programming bare metal.

If you feel a post has answered your question, please click "Accept as Solution".

I'm saying that I don't even have those files and don't know where to get it,
as I have never used HAL, I asked for a bare-metal code or a code with CMSIS 
I don't want to use HAL, They asked me to use HAL, as they said They don't have code other then the HAL library.
Please read the above situation and I did mention I just started using STM32.