1- # http://www.pjrc.com/teensy/teensyduino.html
21name=Teensyduino
32version=1.8.5
43rewriting=disabled
54
6- compiler.path={runtime.hardware.path}/../tools/
5+ # Teensyduino Installer
6+ #compiler.path={runtime.hardware.path}/../tools/
7+ #teensytools.path={runtime.hardware.path}/../tools/
8+
9+ # Arduino Boards Manager
10+ compiler.path={runtime.tools.teensy-compile.path}/
11+ teensytools.path={runtime.tools.teensy-tools.path}/
12+
13+
14+
15+ ## EEPROM Data
716compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
817compiler.elf2hex.flags=-O ihex -R .eeprom
918compiler.libraries.ldflags=
@@ -20,7 +29,7 @@ tools.arduino-preprocessor.cmd.path={path}/arduino-preprocessor
2029tools.arduino-preprocessor.pattern="{cmd.path}" "{source_file}" "{codecomplete}" -- -std=gnu++14
2130
2231## Precompile Arduino.h header
23- recipe.hooks.sketch.prebuild.1.pattern="{compiler .path}precompile_helper" "{runtime.platform.path}/cores/{build.core}" "{build.path}" "{compiler.path}{build.toolchain}{build.command.g++}" -x c++-header {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} "-I{runtime.platform.path}/cores/{build.core}" "{build.path}/pch/Arduino.h" -o "{build.path}/pch/Arduino.h.gch"
32+ recipe.hooks.sketch.prebuild.1.pattern="{teensytools .path}precompile_helper" "{runtime.platform.path}/cores/{build.core}" "{build.path}" "{compiler.path}{build.toolchain}{build.command.g++}" -x c++-header {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} "-I{runtime.platform.path}/cores/{build.core}" "{build.path}/pch/Arduino.h" -o "{build.path}/pch/Arduino.h.gch"
2433
2534## Compile c++ files
2635recipe.cpp.o.pattern="{compiler.path}{build.toolchain}{build.command.g++}" -c {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} "-I{build.path}/pch" {includes} "{source_file}" -o "{object_file}"
@@ -37,46 +46,74 @@ recipe.ar.pattern="{compiler.path}{build.toolchain}{build.command.ar}" rcs "{arc
3746## Link
3847recipe.c.combine.pattern="{compiler.path}{build.toolchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {compiler.libraries.ldflags} "-L{build.path}" {build.flags.libs}
3948
40- ## Patch ELF - TODO: not supported by Arduino 1.6.6 builder
41- recipe.elfpatch.pattern="{compiler .path}/hardware/tools /{build.elfpatch}" -mmcu={build.mcu} "{build.path}/{build.project_name}.elf" "{sketch_path}/disk"
49+ ## Patch ELF - TODO: not supported by modern Arduino... :(
50+ recipe.elfpatch.pattern="{teensytools .path}/{build.elfpatch}" -mmcu={build.mcu} "{build.path}/{build.project_name}.elf" "{sketch_path}/disk"
4251
4352## Create eeprom
4453recipe.objcopy.eep.pattern="{compiler.path}{build.toolchain}{build.command.objcopy}" {compiler.objcopy.eep.flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
4554
4655## Create hex
4756recipe.objcopy.hex.pattern="{compiler.path}{build.toolchain}{build.command.objcopy}" {compiler.elf2hex.flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
4857
58+ ## EHEX file - for Teensy 4.x secure mode
59+ recipe.hooks.objcopy.postobjcopy.1.pattern="{teensytools.path}teensy_secure" encrypthex {build.board} "{build.path}/{build.project_name}.hex"
60+
61+
4962## Post Build - inform Teensy Loader of new file
50- recipe.hooks.postbuild.1.pattern="{compiler.path}stdout_redirect" "{build.path}/{build.project_name}.lst" "{compiler.path}{build.toolchain}{build.command.objdump}" -d -S -C "{build.path}/{build.project_name}.elf"
51- recipe.hooks.postbuild.2.pattern="{compiler.path}stdout_redirect" "{build.path}/{build.project_name}.sym" "{compiler.path}{build.toolchain}{build.command.objdump}" -t -C "{build.path}/{build.project_name}.elf"
52- recipe.hooks.postbuild.3.pattern="{compiler.path}teensy_post_compile" "-file={build.project_name}" "-path={build.path}" "-tools={compiler.path}" "-board={build.board}"
63+ recipe.hooks.postbuild.1.pattern="{teensytools.path}teensy_post_compile" "-file={build.project_name}" "-path={build.path}" "-tools={teensytools.path}" "-board={build.board}"
64+ recipe.hooks.postbuild.2.pattern="{teensytools.path}stdout_redirect" "{build.path}/{build.project_name}.sym" "{compiler.path}{build.toolchain}{build.command.objdump}" -t -C "{build.path}/{build.project_name}.elf"
65+ recipe.hooks.postbuild.3.pattern="{teensytools.path}teensy_size" "{build.path}/{build.project_name}.elf"
66+ #
67+ # objdump to create .lst file is VERY SLOW for huge files
68+ # https://forum.pjrc.com/threads/68121?p=288306&viewfull=1#post288306
69+ #
70+ # recipe.hooks.postbuild.4.pattern="{teensytools.path}stdout_redirect" "{build.path}/{build.project_name}.lst" "{compiler.path}{build.toolchain}{build.command.objdump}" -d -S -C "{build.path}/{build.project_name}.elf"
71+
5372
5473## Compute size
5574recipe.size.pattern="{compiler.path}{build.toolchain}{build.command.size}" -A "{build.path}/{build.project_name}.elf"
56- recipe.size.regex=^(?:\.text|\.text\.progmem|\.text\.itcm|\.data)\s+([0-9]+).*
75+ recipe.size.regex=^(?:\.text|\.text\.progmem|\.text\.itcm|\.data|\.text\.csf )\s+([0-9]+).*
5776recipe.size.regex.data=^(?:\.usbdescriptortable|\.dmabuffers|\.usbbuffers|\.data|\.bss|\.noinit|\.text\.itcm|\.text\.itcm\.padding)\s+([0-9]+).*
5877recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
5978
60- ## Teensy Ports Discovery (Arduino 1.8.9 with pathPrefs patch)
61- discovery.teensy.pattern="{runtime.hardware.path}/../tools/teensy_ports" -J2
79+ ## Teensy Ports Discovery
80+ ## Arduino 1.8.9 requires pathPrefs patch
81+ ## discovery patters have only limited support for substitution macros,
82+ ## so we can not use {teensytools.path} or {compiler.path} here
83+
84+ # Teensyduino Installer
85+ #discovery.teensy.pattern="{runtime.hardware.path}/../tools/teensy_ports" -J2
86+
87+ # Arduino Boards Manager
88+ discovery.teensy.pattern="{runtime.tools.teensy-tools.path}/teensy_ports" -J2
89+ pluggable_discovery.required=teensy:teensy-discovery
90+ pluggable_monitor.required.teensy=teensy:teensy-monitor
6291
63- ## Teensy Ports Discovery (Arduino 1.8.9)
64- #discovery.teensy.pattern="{runtime.ide.path}/hardware/tools/teensy_ports" -J2
6592
6693## Teensy Loader
67- tools.teensyloader.cmd.path={runtime.hardware.path}/../tools
94+
95+ # Teensyduino Installer
96+ #tools.teensyloader.cmd.path={runtime.hardware.path}/../tools
97+
98+ # Arduino Boards Manager
99+ tools.teensyloader.cmd.path={runtime.tools.teensy-tools.path}
100+
68101tools.teensyloader.upload.params.quiet=
69102tools.teensyloader.upload.params.verbose=-verbose
70103tools.teensyloader.upload.pattern="{cmd.path}/teensy_post_compile" "-file={build.project_name}" "-path={build.path}" "-tools={cmd.path}" "-board={build.board}" -reboot "-port={serial.port}" "-portlabel={serial.port.label}" "-portprotocol={serial.port.protocol}"
71104
105+
106+
107+
72108## Export hex
73109recipe.output.tmp_file={build.project_name}.hex
74110recipe.output.save_file={build.project_name}.{build.board}.hex
111+ recipe.hooks.savehex.postsavehex.1.pattern="{teensytools.path}teensy_secure" encrypthex {build.board} "{sketch_path}/{build.project_name}.{build.board}.hex"
75112
76113# TODO: missing patch in 1.6.6...
77114recipe.output.tmp_file2={build.project_name}.elf
78115recipe.output.save_file2={build.project_name}.elf
79116
80117
81118# documentation on this file's format
82- # https://github.com /arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware- specification
119+ # https://arduino. github.io /arduino-cli/latest/platform- specification/
0 commit comments