PlatformIO Community

ST Nucleo F091RC Restart Failing With An Error

Hi, I’m using Core 6.0.0a1·Home 3.4.1. Every time I am debugging my ST Nucleo F091RC and I try to restart, I get the following error:

*** [.pio\build\debug\firmware.elf] C:\Users\username\Documents\PlatformIO\Projects\Embedded Drivers\.pio\build\debug\firmware.elf: The process cannot access the file 
because it is being used by another process

The full log:

> Executing task in folder Embedded Drivers: C:\Users\username\.platformio\penv\Scripts\platformio.exe debug <

Processing debug (platform: ststm32; board: nucleo_f091rc; framework: cmsis)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_f091rc.html
PLATFORM: ST STM32 (15.3.0) > ST Nucleo F091RC
HARDWARE: STM32F091RCT6 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, cmsis-dap, jlink)
PACKAGES:
 - framework-cmsis @ 2.50501.200527 (5.5.1)
 - framework-cmsis-stm32f0 @ 2.3.4
 - tool-ldscripts-ststm32 @ 0.2.0
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 3 compatible libraries
Scanning dependencies...
Dependency Graph
|-- GPIO_Driver(License: Unknown, Path: C:\Users\username\Documents\PlatformIO\Projects\Embedded Drivers\lib\GPIO_Driver)
|-- NOR_Flash_Driver(License: Unknown, Path: C:\Users\username\Documents\PlatformIO\Projects\Embedded Drivers\lib\NOR_Flash_Driver)
|   |-- GPIO_Driver(License: Unknown, Path: C:\Users\username\Documents\PlatformIO\Projects\Embedded Drivers\lib\GPIO_Driver)
|   |-- SPI_Driver(License: Unknown, Path: C:\Users\username\Documents\PlatformIO\Projects\Embedded Drivers\lib\SPI_Driver)
|-- SPI_Driver(License: Unknown, Path: C:\Users\username\Documents\PlatformIO\Projects\Embedded Drivers\lib\SPI_Driver)
Building in debug mode
*** [.pio\build\debug\firmware.elf] C:\Users\username\Documents\PlatformIO\Projects\Embedded Drivers\.pio\build\debug\firmware.elf: The process cannot access the file 
because it is being used by another process
==================================================================== [FAILED] Took 1.12 seconds ====================================================================
Environment    Status    Duration
-------------  --------  ------------
debug          FAILED    00:00:01.122
============================================================== 1 failed, 0 succeeded in 00:00:01.122 ============================================================== 
The terminal process "C:\Users\username\.platformio\penv\Scripts\platformio.exe 'debug'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

I’m not sure where to even start with this error. Any help would be appreciated. Thanks!

Either PIO / the debugger, or another VSCode extension, doesn’t “let go” of the firmware.elf file as it is held in the debug session while a new version of the firmware.elf is recompiled.

Please report to Issues · platformio/platformio-vscode-ide · GitHub with the offending project + reproduction instruction.

Ticket created here: ST Nucleo F091RC Restart Failing With An Error · Issue #3152 · platformio/platformio-vscode-ide · GitHub in case anyone else comes across this thread in the future.

I was directed back to the forum by @ivankravets . Not sure if I can bump this thread but any help would be greatly appreciated. Thanks!