cmake .. -DMCU=MK66FX1M0
Again, I just want a simple make command line, that I can add switches to for conditional builds. The context is that I am deploying the project on a few different flavors of board.
Sorry, I thought you know how to read and use makefiles.@WMXZ Sounds great. Where is it in the tree? And, how do I use it?
Do I just copy it into the directory with the .ino file, or do I need to edit the makefile?
And how do I pass the switch for the conditional build? Is it just the usual CFLAGS=-Dsomething ?
And does it produce a hex file, or does it flash the teensy?
Thank you
Sorry, I thought you know how to read and use makefiles.
I don't know your system, I'm not using linux, but it is in the directory where the Teensy cores files are. (either Teensy3 or Teensy4)
I do indeed know how to read make files.
I still don't know where this one is to be found.
And sometimes makefiles are so complicated that it takes a long time to decipher what a particular makefile is doing and how to use it. And, I see from what is displayed on the ide that this a pretty complicated build
A little specific guidance and would be a big help and likely save a lot of time,
....\hardware\teensy\avr\cores\teensy4
What needs to be done to process .ino files?
# arduino --pref compiler.cpp.extra_flags=-Dsomething [ --verify | --upload ] myfile.ino
teensy41.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=153 -Dmyflag
#******************************************************************************
# Generated by VisualTeensy (https:\\github.com\luni64\VisualTeensy)
#
# Board Teensy 3.2 \ 3.1
# USB Type Serial
# CPU Speed 96 MHz (overclock)
# Optimize Faster
# Keyboard Layout US English
#
# 15.11.2020 15:19
#******************************************************************************
SHELL := cmd.exe
export SHELL
SKETCH_NAME := ttt_motor.ino
BOARD_ID := TEENSY32
MCU := mk20dx256
BUILDER_BASE := "C:\Program Files\Arduino\arduino-1.8.12"
FLAGS := -verbose=1 -warnings=all
FQBN := teensy:avr:teensy31:usb=serial,speed=96,opt=o2std,keys=en-us
BUILD_PATH := "C:\Users\lutz\source\Teensy\TeensySupport\ttt_motor\.vsteensy\build"
BUILD_CACHE := "C:\Users\lutz\source\Teensy\TeensySupport\ttt_motor\.vsteensy\cache"
HARDWARE := -hardware="C:\Program Files\Arduino\arduino-1.8.12/hardware"
TOOLS := -tools="C:\Program Files\Arduino\arduino-1.8.12\tools-builder"
LIBRARIES := -built-in-libraries="C:\Program Files\Arduino\arduino-1.8.12/libraries"
LIBRARIES := -libraries="C:\Users\lutz\Documents\Arduino\libraries"
UPL_PJRC_B := C:\PROGRA~1\Arduino\ARDUIN~1.12\hardware\tools
UPL_TYCMD_B := C:\toolchain\TyTools
UPL_CLICMD_B :=
TARGET_HEX := $(BUILD_PATH)/$(SKETCH_NAME).hex
#******************************************************************************
# BINARIES
#******************************************************************************
BUILDER := $(BUILDER_BASE)/arduino-builder
UPL_PJRC := "$(UPL_PJRC_B)/teensy_post_compile" -test -file=$(SKETCH_NAME) -path=$(BUILD_PATH) -tools="$(UPL_PJRC_B)" -board=$(BOARD_ID) -reboot
UPL_TYCMD := $(UPL_TYCMD_B)/tyCommanderC upload $(TARGET_HEX) --autostart --wait --multi
UPL_CLICMD := $(UPL_CLICMD_B)/teensy_loader_cli -mmcu=$(MCU) -v $(TARGET_HEX)
.PHONY: all upload uploadTy uploadCLI clean
all:
$(BUILDER) $(FLAGS) -build-path=$(BUILD_PATH) -build-cache=$(BUILD_CACHE) -fqbn=$(FQBN) $(HARDWARE) $(TOOLS) $(LIBRARIES) $(SKETCH_NAME)
upload: all
$(UPL_PJRC)
uploadTy: all
@$(UPL_TYCMD)
uploadCLI: all
@$(UPL_CLICMD)
clean:
@echo Cleaning user binaries...
@if exist .vsteensy\build rd /s/q .vsteensy\build
@md .vsteensy\build
@if exist .vsteensy\cache rd /s/q .vsteensy\cache"
@md .vsteensy\cache
@echo done
Can anyone clarify this, or suggest the exact command line for the Teensy 3.2?
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{build.toolchain}{build.command.g++}" -c {build.extra_flags} {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}"
#******************************************************************************
# BINARIES
#******************************************************************************
BUILDER := $(BUILDER_BASE)/arduino-builder
UPL_PJRC := "$(UPL_PJRC_B)/teensy_post_compile" -test -file=$(SKETCH_NAME) -path=$(BUILD_PATH) -tools="$(UPL_PJRC_B)" -board=$(BOARD_ID) -reboot
UPL_TYCMD := $(UPL_TYCMD_B)/tyCommanderC upload $(TARGET_HEX) --autostart --wait --multi
UPL_CLICMD := $(UPL_CLICMD_B)/teensy_loader_cli -mmcu=$(MCU) -v $(TARGET_HEX)
.PHONY: all upload uploadTy uploadCLI clean
all:
$(BUILDER) $(FLAGS) [B][COLOR="#B22222"]-prefs=build.extra_flags=-DMY_DEFINE=42[/COLOR][/B] -build-path=$(BUILD_PATH) -build-cache=$(BUILD_CACHE) -fqbn=$(FQBN) $(HARDWARE) $(TOOLS) $(LIBRARIES) $(SKETCH_NAME)
sy\\TeensySupport\\ttt_motor\\.vsteensy\\build\\sketch\\ttt_motor.ino.cpp" -o "C:\\Users\\lutz\\source\\Teensy\\TeensySupport\\ttt_motor\\.vsteensy\\build\\sketch\\ttt_motor.ino.cpp.o"
"C:\\Program Files\\Arduino\\arduino-1.8.12\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -c [B][COLOR="#B22222"]-DMY_DEFINE=42[/COLOR][/B] -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -D__MK20DX256__ -DTEENSYDUINO=154 -DARDUINO=10600 -DARDUINO_TEENSY32 -DF_CPU=96000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Users\\lutz\\source\\Teensy\\TeensySupport\\ttt_motor\\.vsteensy\\build/pch" "-IC:\\Program Files\\Arduino\\arduino-1.8.12\\hardware\\teensy\\avr\\cores\\teensy3"
Are build_path and build_cache specific to your project? I just have one ino file, with includes for adc and eeprom. Is there not a simple one liner for that using the arduino command?
$(BUILDER) $(FLAGS) -prefs=build.extra_flags=-DMY_DEFINE=42 -build-path=$(BUILD_PATH) -build-cache=$(BUILD_CACHE) -fqbn=$(FQBN) $(HARDWARE) $(TOOLS) $(LIBRARIES) $(SKETCH_NAME)
BUILD_PATH := "C:\Users\lutz\source\Teensy\TeensySupport\ttt_motor\.vsteensy\build"
BUILD_CACHE := "C:\Users\lutz\source\Teensy\TeensySupport\ttt_motor\.vsteensy\cache"
These define where the builder stores the binaries and the cache file. You can choose any path you like for them. Did you read the documentation I linked in the last post?
--pref build.flags.cpp=
--pref teensy41.build.flags.cpp=
arduino_debug --verbose --board teensy:avr:teensy40 --pref "build.flags.cpp=-D USB_MIDI_AUDIO_SERIAL -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing" --verify sketch_oct10a.ino
arduino --verbose --board teensy:avr:teensy40 --pref 'build.flags.cpp=-D USB_MIDI_AUDIO_SERIAL -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing' --verify sketch_oct10a.ino
if you look at hardware\teensy\avr\boards.txt in arduino install folder
you can see the build flags there
arduino_debug --verbose --board teensy:avr:teensy40:usb=serialmidiaudio --verify sketch_oct10a.ino
arduino_debug --verbose --board teensy:avr:teensy40:usb=serialmidiaudio --verify sketch_oct10a.ino
'/Applications/Teensyduino.app/Contents/MacOS/Arduino' --verbose --board teensy:avr:teensy40:usb=serialmidiaudio --buildpath ~/Documents/Arduino/buildTemp --verify ~/Documents/Arduino/sketch_oct18b/sketch_oct18b.ino
mode description (as in the menu)
---------------------------
serial
serial2 Dual Serial
serial3 Triple Serial
keyboard
touch Keyboard + Touch Screen
hidtouch Keyboard + Mouse + Touch Screen
hid Keyboard + Mouse + Joystick
serialhid Serial + Keyboard + Mouse + Joystick
midi
midi4
midi16
serialmidi
serialmidi4
serialmidi16
audio
serialmidiaudio
serialmidi16audio
mtp MTP Disk (Experimental)
rawhid
flightsim
flightsimjoystick
disable