## Customized platform.local.txt to compile for STM32 targets under Windows ## This recipe works around the Windows limit of 32k characters in a cmd line by calling .o files from a text file during linking ## Install: put file under your mbed sub-directory - ie: C:\Users\MYUSER\AppData\Local\Arduino15\packages\arduino\hardware\stm32\1.9.0 ## You can also find the local arduino folder in the IDE under File -> Preferences -> see preferences.txt location in the bottom part of the window ## hooks # create a txt file with all object file paths from libraries and sketch folders recipe.hooks.linking.prelink.1.pattern=cmd /c dir /b /s {build.path}\sketch\*.o > {build.path}\obj_files_tmp.txt recipe.hooks.linking.prelink.2.pattern=cmd /c "dir /b /s {build.path}\libraries\*.o >> {build.path}\obj_files_tmp.txt 2>nul & exit 0" recipe.hooks.linking.prelink.3.pattern=cmd /c echo "{build.path}\core\variant.cpp.o" >> {build.path}\obj_files_tmp.txt recipe.hooks.linking.prelink.4.pattern=cmd /c echo "{build.path}\core\PeripheralPins.c.o" >> {build.path}\obj_files_tmp.txt # replace \ by \\ in file paths (otherwise escaped by linker) and save in new txt file recipe.hooks.linking.prelink.5.pattern=cmd /v /c "@echo off && for /f %a in ({build.path}\obj_files_tmp.txt) do (set line=%a && set line=!line:\=\\! && echo !line! >> {build.path}\obj_files.txt)" # delete txt file after linking recipe.hooks.linking.postlink.1.pattern=cmd /c del {build.path}\obj_files.txt ## modify compile patterns (@{build.path}\obj_files.txt) recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} "-Wl,--default-script={build.variant.path}/{build.ldscript}" "-Wl,--script={build.system.path}/ldscript.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} {compiler.ldflags} {compiler.arm.cmsis.ldflags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -Wl,--start-group @{build.path}\obj_files.txt {compiler.libraries.ldflags} "{archive_file_path}" -lc -Wl,--end-group -lm -lgcc -lstdc++