Skip to content

Commit 5b96b6e

Browse files
committed
Added recipe.hooks feature to override gcc options
Fix stm32duino#41 Signed-off-by: Frederic Pillon <[email protected]>
1 parent b6a0250 commit 5b96b6e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

platform.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ compiler.c.elf.cmd=arm-none-eabi-gcc
3030
compiler.objcopy.cmd=arm-none-eabi-objcopy
3131
compiler.elf2hex.cmd=arm-none-eabi-objcopy
3232

33-
compiler.extra_flags=-mcpu={build.mcu} -DF_CPU={build.f_cpu} -mthumb
33+
compiler.extra_flags=-mcpu={build.mcu} -DF_CPU={build.f_cpu} -mthumb @{build.path}/build.opt
3434

3535
compiler.S.flags={compiler.extra_flags} -c -x assembler-with-cpp {compiler.stm.extra_include}
3636

@@ -78,6 +78,9 @@ build.enable_usb=
7878
build.flags.optimize=
7979
build.flags.ldspecs=
8080

81+
## Pre and post build hooks
82+
recipe.hooks.prebuild.1.pattern={tools.build_opt.path}/{tools.build_opt.cmd} {build.project_name} {build.source.path} {build.path}
83+
8184
# compile patterns
8285
# ---------------------
8386

@@ -109,6 +112,18 @@ recipe.size.regex=^(?:\.text|\.data|\.rodata)\s+([0-9]+).*
109112
recipe.size.regex.data=^(?:\.data|\.bss|\._user_heap_stack)\s+([0-9]+).*
110113
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
111114

115+
# Recipe tools
116+
# -------------------
117+
118+
# Copy build_opt file
119+
tools.build_opt.cmd=build_opt
120+
tools.build_opt.cmd.windows=build_opt.bat
121+
tools.build_opt.cmd.macosx=build_optMacOsX
122+
tools.build_opt.path={runtime.hardware.path}/tools/win
123+
tools.build_opt.path.macosx={runtime.hardware.path}/tools/macosx
124+
tools.build_opt.path.linux={runtime.hardware.path}/tools/linux
125+
tools.build_opt.path.linux64={runtime.hardware.path}/tools/linux
126+
112127

113128
# Uploader tool
114129
# -------------------

0 commit comments

Comments
 (0)