reimer
December 29, 2022, 2:46pm
#1
Hi all,
I’d like to generate dependency files (and src listings later…) which can be accomplished in gcc by
-MFfilename
I can use
build_flags = -MF"${TARGET}.d"
which seems to work but since TARGET already contains an “.o” suffix, the dependency file gets “.o.d”
I was just thinking if there is an easy solution (w/o extra_scripts).
The cariables are parsed somehow, since
${_concat(INCPREFIX, CPPPATH, INCSUFFIX, env }
is used in the environment, and silly things like
${12 + 4}
also work…
With what platformio.ini
does that work? I tried with an Uno and STM32 bluepill project and neither compiler accepted it.
cc1.exe: error: to generate dependencies you must specify either ‘-M’ or ‘-MM’
It just generated the compiler option
-MF.pio\build\bluepill\FrameworkArduinoVariant\PeripheralPins.c.o.d
And btw regular python code evaluations and string splicing works.
build_flags = -MF"${str(TARGET)[:-2]}.d"
generates the compiler option
-MF.pio\build\bluepill\FrameworkArduinoVariant\PeripheralPins.c.d
(but the compiler still rejects this ofc)
reimer
December 29, 2022, 4:13pm
#4
yes, the full flags will be:
build_flags =
-MMD -MP -MF"${TARGET}.d
or/and for source listings replace/add
-Wa,-a,-ad,-alms=${TARGET}.lst
both options are working in e.g. arm-none-eabi-gcc.
But both generated files does’nt replace the “.o” extention. Its more a cosmetic thing, but I was wondering if this could be easily changed…
So
build_flags = -MMD -MP -MF"${str(TARGET)[:-4]}.d"
resulting in
-MMD -MP -MF.pio\build\bluepill\SrcWrapper\src\HAL\stm32yyxx_hal_adc_ex.d
would be working right? I.e. just the last 4 characters of the target path removed, then .d
appended.
Well okay it works for .c.o
→ .d
replacment but not for .cpp.o
. Do you want to retain the .c/.cpp extension? If yes [:-2]
should work everywhere.
1 Like