I reserved a memory section for my application non-volatile data. For this matter, I changed the “STM32F411_EVA_FLASH.ld” located in …platformio\packages\framework-stm32cube\platformio\ldscripts\.
However, I understand that new platformIO update will overwrite my changes. So I am trying to include the linker file into my project repo, and overwriting environment variable so the framework will have the correct pointer.
I created a pre_extra_script.py in the platformio.init:
extra_scripts = pre_extra_script.py
Inside the script I do the following:
The first line works ok, but the second one gives me other problems. As if that environmetn variable is used for multiple things other thatn pointing to the linker file.
Say again, you fear that
$PROJECT_DIR might change its meaning over time?
No. let me do one step back. When I use the LDSCRIPT_PATH=’$PROJECT_DIR\STM32F411_EVA_FLASH.ld’ , I get the following error: c:/users/led_c/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: cannot open linker script file c:\LocalRepo\eva-controller-ststm\STM32F411_EVA_FLASH.ld: Invalid argument
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\nucleo_f411re\firmware.elf] Error 1
However, the .ld file is the same in both locations:
I found the issue!!
I made so many things while dubugging other stuff, that in my last attempt I used an incorrect name of the .ld file.
Now, it works perfectly: