## # Attention! # # Replace YourUserId below with your Login UserID. This value should results # in "custom.ideglobal.source.path" pointing to your include directory, # which is located at the top level of your Sketchbook directory. # If you are not using default file names or locations, make updates as need. custom.userid=YourUserId custom.ideglbl_h.name=ide_globals.h custom.globals_h.name=globals.h custom.flags_txt.name=compiler_flags.txt #----- This Section can be deleted, it served as a reminder to --------------- #----- edit "custom.userid=YourUserId". #----- Starts Here --------------- recipe.hooks.prebuild.01.pattern.windows=cmd /c if z{custom.userid} == zYourUserId (echo You need to edit platform.local.txt and change, custom.userid=YourUserId, to be equal to your UserID. ) recipe.hooks.prebuild.01.pattern.linux=bash -c "if [ z{custom.userid} = zYourUserId ]; then echo You\ need\ to\ edit\ platform.local.txt\ and\ change,\ custom.userid=YourUserId,\ to\ be\ equal\ to\ your\ UserID.; fi;" #----- Stops Here --------------- # #------------- There is usually no need to edit below this line -------------- # custom.ideglobal.path.linux=/home/{custom.userid}/Arduino/include/ custom.ideglobal.path.windows=C:\Users\{custom.userid}\Documents\Arduino\include\ custom.source.path.linux={build.source.path}/ custom.source.path.windows={build.source.path}\ custom.ideglbl_h.source.pathname={custom.ideglobal.path}{custom.ideglbl_h.name} custom.globals_h.source.pathname={custom.source.path}{custom.globals_h.name} custom.flags_txt.source.pathname={custom.source.path}{custom.flags_txt.name} custom.build.path.linux={build.path}/custom/ custom.build.path.windows={build.path}\custom\ custom.globals_h.build.pathname={custom.build.path}{custom.globals_h.name} custom.ideglbl_h.build.pathname={custom.build.path}{custom.ideglbl_h.name} custom.flags_txt.build.pathname={custom.build.path}{custom.flags_txt.name} custom.globals_h.path.linux=/home/{custom.userid}/Arduino/include custom.globals_h.path.windows=C:\Users\{custom.userid}\Documents\Arduino\include compiler.global_flags=-include "{custom.ideglbl_h.build.pathname}" -include "{custom.globals_h.build.pathname}" -include "{custom.flags_txt.build.pathname}.h" @{custom.flags_txt.build.pathname} # These have to be defined here. They are set via boards.local.txt. build.my_project_flags= build.espurna_flags= build.espurna_ha_flags= build.my_project_name= compiler.c.extra_flags={compiler.global_flags} {build.espurna_flags} {build.espurna_ha_flags} {build.my_project_flags} {build.my_project_name} compiler.S.extra_flags={compiler.global_flags} {build.espurna_flags} {build.espurna_ha_flags} {build.my_project_flags} {build.my_project_name} compiler.cpp.extra_flags={compiler.global_flags} {build.espurna_flags} {build.espurna_ha_flags} {build.my_project_flags} {build.my_project_name} # # Here we handle the copying of global files, from their respective locations, # to the build tree. With attention to newness as needed. # compiler_flags.txt needs more attention because .txt files are not # tracked by the build dependencies. This is addressed by managing a ghost # file by its name with a .h extension. compiler_flags.txt's time stamp is # tracked and its ghost image is updated as needed. # ref https://stackoverflow.com/a/8055430 for && vs & usage in Windows cmd recipe.hooks.prebuild.11.pattern.windows=cmd /v:on /e:on /c "if not exist {custom.build.path} (mkdir {custom.build.path} )" recipe.hooks.prebuild.12.pattern.windows=cmd /v:on /e:on /c "if exist {custom.ideglbl_h.source.pathname} (copy {custom.ideglbl_h.source.pathname} {custom.ideglbl_h.build.pathname} )" recipe.hooks.prebuild.13.pattern.windows=cmd /v:on /e:on /c "if exist {custom.globals_h.source.pathname} (copy {custom.globals_h.source.pathname} {custom.globals_h.build.pathname} )" recipe.hooks.prebuild.14.pattern.windows=cmd /v:on /e:on /c "if exist {custom.flags_txt.source.pathname} (fc /b {custom.flags_txt.source.pathname} {custom.flags_txt.build.pathname} ) >nul 2>&1 || (copy {custom.flags_txt.source.pathname} {custom.flags_txt.build.pathname} & type NUL> {custom.flags_txt.build.pathname}.h )" recipe.hooks.prebuild.15.pattern.windows=cmd /v:on /e:on /c "if not exist {custom.ideglbl_h.source.pathname} (for %f in ( {custom.ideglbl_h.build.pathname} ) do set size=%~zf) & (if not defined size set size=0) & (if !size! NEQ 0 type NUL> {custom.ideglbl_h.build.pathname} )" recipe.hooks.prebuild.16.pattern.windows=cmd /v:on /e:on /c "if not exist {custom.globals_h.source.pathname} (for %f in ( {custom.globals_h.build.pathname} ) do set size=%~zf) & (if not defined size set size=0) & (if !size! NEQ 0 type NUL> {custom.globals_h.build.pathname} )" recipe.hooks.prebuild.17.pattern.windows=cmd /v:on /e:on /c "if not exist {custom.flags_txt.source.pathname} (for %f in ( {custom.flags_txt.build.pathname} ) do set size=%~zf) & (if not defined size set size=0) & (if !size! NEQ 0 (type NUL> {custom.flags_txt.build.pathname} & type NUL> {custom.flags_txt.build.pathname}.h ) )" recipe.hooks.prebuild.18.pattern.windows=cmd /v:on /e:on /c "if not exist {custom.ideglbl_h.build.pathname} (type NUL> {custom.ideglbl_h.build.pathname} )" recipe.hooks.prebuild.19.pattern.windows=cmd /v:on /e:on /c "if not exist {custom.globals_h.build.pathname} (type NUL> {custom.globals_h.build.pathname} )" recipe.hooks.prebuild.20.pattern.windows=cmd /v:on /e:on /c "if not exist {custom.flags_txt.build.pathname} (type NUL> {custom.flags_txt.build.pathname} )" recipe.hooks.prebuild.21.pattern.windows=cmd /v:on /e:on /c "if not exist {custom.flags_txt.build.pathname}.h (type NUL> {custom.flags_txt.build.pathname}.h )" recipe.hooks.prebuild.11.pattern.linux=mkdir -p "{custom.build.path}" recipe.hooks.prebuild.12.pattern.linux=bash -c "if [ -f {custom.ideglbl_h.source.pathname} ]; then cp -u {custom.ideglbl_h.source.pathname} {custom.ideglbl_h.build.pathname}; fi;" recipe.hooks.prebuild.13.pattern.linux=bash -c "if [ -f {custom.globals_h.source.pathname} ]; then cp -u {custom.globals_h.source.pathname} {custom.globals_h.build.pathname}; fi;" recipe.hooks.prebuild.14.pattern.linux=bash -c "if [ -f {custom.flags_txt.source.pathname} ]; then if [ {custom.flags_txt.source.pathname} -nt {custom.flags_txt.build.pathname} ]; then cp -u {custom.flags_txt.source.pathname} {custom.flags_txt.build.pathname}; touch {custom.flags_txt.build.pathname}.h; fi; fi;" recipe.hooks.prebuild.15.pattern.linux=bash -c "if [ ! -f {custom.ideglbl_h.source.pathname} ]; then if [ -s {custom.ideglbl_h.build.pathname} ]; then rm {custom.ideglbl_h.build.pathname}; touch {custom.ideglbl_h.build.pathname}; fi; fi;" recipe.hooks.prebuild.16.pattern.linux=bash -c "if [ ! -f {custom.globals_h.source.pathname} ]; then if [ -s {custom.globals_h.build.pathname} ]; then rm {custom.globals_h.build.pathname}; touch {custom.globals_h.build.pathname}; fi; fi;" recipe.hooks.prebuild.17.pattern.linux=bash -c "if [ ! -f {custom.flags_txt.source.pathname} ]; then if [ -s {custom.flags_txt.build.pathname} ]; then rm {custom.flags_txt.build.pathname}; touch {custom.flags_txt.build.pathname} {custom.flags_txt.build.pathname}.h; fi; fi;" recipe.hooks.prebuild.18.pattern.linux=bash -c "if [ ! -f {custom.ideglbl_h.build.pathname} ]; then touch -t 170001010000 {custom.ideglbl_h.build.pathname}; fi;" recipe.hooks.prebuild.19.pattern.linux=bash -c "if [ ! -f {custom.globals_h.build.pathname} ]; then touch -t 170001010000 {custom.globals_h.build.pathname}; fi;" recipe.hooks.prebuild.20.pattern.linux=bash -c "if [ ! -f {custom.flags_txt.build.pathname} ]; then touch -t 170001010000 {custom.flags_txt.build.pathname}; fi;" recipe.hooks.prebuild.21.pattern.linux=bash -c "if [ ! -f {custom.flags_txt.build.pathname}.h ]; then touch -t 170001010000 {custom.flags_txt.build.pathname}.h; fi;" # # This will print a summary report of sizes on some interesting sections. # For this to show, you need to check the box for "compilation" on the line # containing: "Show verbose output during: [] compilation [] upload" # in "Edit->File->Preferences". tools.elfsum.cmd=xtensa-lx106-elf-objdump tools.elfsum.path.linux={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/ tools.elfsum.path.windows={runtime.tools.xtensa-lx106-elf-gcc.path}\bin\ tools.elfsum.flags=-h -w --section=.text --section=.irom0.text --section=.data --section=.bss --section=.rodata tools.elfsum.extra_flags= recipe.hooks.linking.postlink.01.pattern.linux="{tools.elfsum.path}{tools.elfsum.cmd}" {tools.elfsum.flags} {tools.elfsum.extra_flags} "{build.path}/{build.project_name}.elf" recipe.hooks.linking.postlink.01.pattern.windows="{tools.elfsum.path}{tools.elfsum.cmd}" {tools.elfsum.flags} {tools.elfsum.extra_flags} "{build.path}\{build.project_name}.elf" # Alternative - reduces extra newlines on Windows, requires Git to be installed. # custom.gnutool.path.linux= # custom.gnutool.path.windows=C:\Program Files\Git\usr\bin\ # recipe.hooks.linking.postlink.01.pattern.windows=cmd /c "{tools.elfsum.path}{tools.elfsum.cmd}" {tools.elfsum.flags} {tools.elfsum.extra_flags} "{build.path}\{build.project_name}.elf" | "{custom.gnutool.path}tr" "\r" "\b" # # This will write a .map file in the build directory. compiler.c.elf.extra_flags.linux=-Wl,-Map,{build.path}/{build.project_name}.map compiler.c.elf.extra_flags.windows=-Wl,-Map,{build.path}\{build.project_name}.map # # from https://github.com/mhightower83/Arduino-IDE-Tweaks #