I’m having some issues using the build_unflags directive. In my case I’m generating code for the STM32F4DISCO, and have the following configuration in a platformio.ini file;
In other words, the build_unflags directive seems to be ignored for the linker’s script, which is a deal-breaker for me as I really need to modify the linker’s flags.
On a related note, might it be better to separate compiler and linker flags? IE. using something like build_flags_compiler, build_flags_linker, build_unflags_compiler, and build_unflags_linker? It’s possible there are use-cases where someone would want to modify the compiler and linker flags separately =)
It’s possible (read: likely) that I’ve made some simple mistake, but after switching to the development version I can’t initialize the workspace using my previous configuration;
stm32dev@stm32dev-VirtualBox:~/Desktop/stm32_project/pio_test$ pio init -b disco_f407vg --ide eclipse
*********************************************************************************************************************************************************************************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for IoT development > http://platformio.org/platformio-ide
- donate to keep PlatformIO alive! > http://platformio.org/donate
*********************************************************************************************************************************************************************************************************************************************
Please wait while upgrading PlatformIO ...
Platform ststm32
--------
Updating toolchain-gccarmnoneeabi package:
Versions: Current=2, Latest=2 [Up-to-date]
Updating tool-stlink package:
Versions: Current=2, Latest=2 [Up-to-date]
Updating framework-spl package:
Versions: Current=2, Latest=3 [Out-of-date]
Uninstalling framework-spl package: [OK]
Installing framework-spl package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
Updating framework-cmsis package:
Versions: Current=3, Latest=3 [Up-to-date]
Updating framework-mbed package:
Versions: Current=13, Latest=14 [Out-of-date]
Uninstalling framework-mbed package: [OK]
Installing framework-mbed package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
Updating ldscripts package:
Versions: Current=21, Latest=21 [Up-to-date]
PlatformIO has been successfully upgraded to 2.10.2.dev0!
The current working directory /home/stm32dev/Desktop/stm32_project/pio_test will be used for project.
You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
The next files/directories will be created in /home/stm32dev/Desktop/stm32_project/pio_test
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source files here
lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y
Error: [Wed Jun 15 13:33:56 2016] Processing disco_f407vg (platform: ststm32, build_unflags: -nostdlib -nostartfiles, board: disco_f407vg, framework: spl, build_flags: -lPDMFilter_GCC -L$PROJECT_DIR/lib_ext -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000ULL -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -D__FPU_USED --specs=nano.specs)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AttributeError: 'list' object has no attribute 'replace':
File "/usr/local/lib/python2.7/dist-packages/platformio/builder/main.py", line 172:
print json.dumps(env.DumpIDEData())
File "/home/stm32dev/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
return self.method(*nargs, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/platformio/builder/tools/piomisc.py", line 225:
"defines": get_defines(env_),
File "/usr/local/lib/python2.7/dist-packages/platformio/builder/tools/piomisc.py", line 208:
defines.append(env_.subst(item).replace('\\"', '"'))
======================================================================================================== [ ERROR ] Took 0.51 seconds ========================================================================================================
My configuration file is unchanged and identical to the configuration I posted in the first post in this thread =)
Well, I can see how that would work for adding linker flags, but how would I use that to remove linker flags from the default set of flags? (In my case, removing ‘-nostdlib’ and ‘-nostartfiles’)
That source listing does explain the behavior I’m getting, (hopefully) knowing the cause of an issue certainly helps when it comes to finding a solution. TBH I really don’t know any python – C and matlab are really all I’m comfortable with – so extra_script isn’t really a reasonable option for me. Is there any chance that there’ll be a bug report generated for this issue and a patch issued at some point?