Add -t none or -t binary

Well that was easy. Just copy the VerboseAction that the ElfToBin function would execute.

platformio.ini

[env:teensy31]
platform = teensy
board = teensy31
framework = arduino
extra_scripts = extra_script.py

extra_script.py

from os.path import join
Import("env", "projenv")

# Custom BIN from ELF
env.AddPostAction(
	"$BUILD_DIR/${PROGNAME}.elf",
	env.VerboseAction(" ".join([
				"$OBJCOPY",
				"-O",
				"binary",
				"$TARGET",
				"$BUILD_DIR/${PROGNAME}.bin"
			]), "Building $TARGET"))
C:\Users\Maxi\Desktop\teensy_test>pio run
[...]
====================================================================== [SUCCESS] Took 3.96 seconds ======================================================================

C:\Users\Maxi\Desktop\teensy_test>file .pioenvs\teensy31\*
.pioenvs\teensy31\firmware.bin;          data
.pioenvs\teensy31\firmware.elf;          ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
.pioenvs\teensy31\firmware.hex;          ASCII text, with CRLF line terminators
.pioenvs\teensy31\FrameworkArduino;      directory
.pioenvs\teensy31\libFrameworkArduino.a; current ar archive
.pioenvs\teensy31\src;                   directory

EDIT: Changed $SOURCES to the ELF file, otherwise this only translates the main.cpp.o file binary…

4 Likes