How do I fix failure to remove .elf file?
Hello,
I'm relatively new to embedded development and have been taking a driver development course that uses STM32CubeIDE. The the board I am using is STM32F407VG Discovery Kit. Basically, I have been creating multiple src main files to test out my driver code and have been using the Properties->C/C++ Build-> "Exclude resource from build" to decide which code to use.
My issue started when I forgot to remove one of the src files and tried to build the project with 2 src files with a lot of overlapping code. After I removed one of them from the build, I started getting the follow message during attempts to build:
12:37:34 **** Clean-only build of configuration Debug for project stm32f4xx_drivers ****
make clean
rm -rf *
rm: can't remove 'stm32f4xx_drivers.elf': Permission denied
make: [makefile:65: clean] Error 1 (ignored)
When I try to interact with the stm32f4xx_drivers.elf file outside of the IDE, it appears that it is open somewhere. I am able to fix the problem temporarily by closing the IDE and then removing the file. But after the first subsequent build, I am getting the same error. I also noticed that the stm32f4xx_drivers.elf appears as a drop down that contains all .h and .c files. When I try to exclude a resource, let's say fileA, from the build and include fileB, I can see that fileA is no longer included in the drop down (it's grayed out), but it appears that fileB is not added.
I'm not extremely familiar with the compile process or make files, and I don't really know what the .elf file is used for or if what I am seeing is related to the error I am getting.
I'm looking to understand what's going on, what might have caused it, and/or how I can fix the problem so that I don't have to close and re-open the IDE every time I want to use a new src file.
Thank you!
UPDATE/SOLVED: It seems like after deleting the .elf file again and rebuilding, it appears to be working again. I'm not exactly sure what I did differently, however, previously, I was able to use Process Hacker to locate a handle to the .elf file, meaning that it was open somewhere. Now the file is handle can't be found. All this to say, it seems like the file was in fact open somehow. Thanks to TDK for the help.
