Teensy 3.1 without arduino IDE

Status
Not open for further replies.
I use NetBeans and make on Linux, and the AVR dragon, or other JTAG tools. This works just fine for me, thanks. Glad you like the avatar LOL!
 
I use NetBeans and make on Linux, and the AVR dragon, or other JTAG tools. This works just fine for me, thanks. Glad you like the avatar LOL!

I use what I can get to work without a big investment in time to be a tool-maker. Works for me.

I have to use Windows for my job so that's the desktop here. I'm not pro-MS or anti-Linux. I made a very good living for many years using System V unix, Sun OS, Ultrix, writing drivers, etc. But that was then, and now is now.
 
Visual Micro plug-in for Visual Studio/Atmel Studio 6.1 works well for Teensy3.x. I've been using it full time for several months. It's terrific. Easily installed. And $0.
Uses the normal Arduino+Teensyduino install. You can use Arduino .ino files and thus use either the Arduino IDE or VisualMicro/VS and flip back and forth. Uses same GCC command line as does Arduino's IDE.
that sounds very nice,
since I have already the studio 6.2 in use (for other projects),
I'll give it a try ... :)
 
I use NetBeans and make on Linux, and the AVR dragon, or other JTAG tools. This works just fine for me, thanks. Glad you like the avatar LOL!

Do you happen to have an example of the per-project makefile for NetBeans with Teensy 3.1?

In the example are a lot of relative paths, which don't match up with my NetBeans paths. This is just to compile a very basic test main.cpp.
gcc throws an error with some of the options picked up in boards.txt:
CLEAN SUCCESSFUL (total time: 205ms)

mkdir -p build
/Applications/Arduino_ARM.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/arm-none-eabi-gcc -c -std=gnu99 -Wstrict-prototypes -Wno-old-style-declaration -g -w -Wa,-adhlns=build/analog.lst -DARDUINO_ARCH_ARM-NONE-EABI -DUSING_MAKEFILE=1 -Wall -Wextra -Wformat=2 -Wuninitialized -Wshadow -Wconversion -mthumb -nostdlib -D__MK20DX256__ -DTEENSYDUINO=118 -DUSB_SERIAL -Os -freorder-blocks -fno-inline-small-functions -fno-exceptions -ffunction-sections -fdata-sections -MMD -DF_CPU= -DARDUINO=105 -mmcu=mk20dx256 -I./ -I/Applications/Arduino_ARM.app/Contents/Resources/Java/libraries/Task -I/Applications/Arduino_ARM.app/Contents/Resources/Java/libraries/VirtualWire -I/Applications/Arduino_ARM.app/Contents/Resources/Java/hardware/teensy/variants/ -I../common -I/Applications/Arduino_ARM.app/Contents/Resources/Java/hardware/teensy/cores/teensy3 -MMD /Applications/Arduino_ARM.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/analog.c -o build/analog.c.o
arm-none-eabi-gcc: error: unrecognized command line option '-mmcu=mk20dx256'
make: *** [build/analog.c.o] Error 1
BUILD FAILED (exit value 2, total time: 192ms)

example makefile:
BOARD = teensy31
PORT = /dev/tty.usbmodem448871
THIRD_PARTY_HARDWARE = /Applications/Arduino_ARM.app/Contents/Resources/Java/hardware/teensy
INC_DIRS = ../common
LIB_DIRS = /Applications/Arduino_ARM.app/Contents/Resources/Java/libraries/Task /Applications/Arduino_ARM.app/Contents/Resources/Java/libraries/VirtualWire
include ../Arduino_Makefile_master/Makefile.master
 
Hi PJRC!

I'm trying to use this nice Makefile from https://github.com/JonHylands/uCee/blob/master/Makefile that lets me write .ino files or .c/.cpp files and compile them all together as one would do in the Arduino IDE. For instance I can have this main.c file and compile it with make:

Code:
#include <Arduino.h>

void setup() {
    ;
}


void loop() {
    ;
}

But I get this error at link time:

Code:
~/projects/teensy/without_ardunio_ide $ make
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/analog.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/eeprom.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/keylayouts.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/math_helper.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/mk20dx128.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/nonstd.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/pins_teensy.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/ser_print.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/serial1.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/serial2.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/serial3.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/touch.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_desc.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_dev.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_joystick.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_keyboard.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_mem.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_midi.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_mouse.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_rawhid.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_seremu.c
[CC]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_serial.c
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/AudioStream.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/DMAChannel.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/HardwareSerial1.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/HardwareSerial2.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/HardwareSerial3.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/IPAddress.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/IntervalTimer.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Print.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Stream.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Tone.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/WMath.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/WString.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr_emulation.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/main.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/new.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_flightsim.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_inst.cpp
[CXX]	/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/yield.cpp
[LD]	without_ardunio_ide.elf
build/teensy3/main.o: In function `main':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/main.cpp:21: undefined reference to `setup'
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/main.cpp:23: undefined reference to `loop'
collect2: error: ld returned 1 exit status

I don't know why, since https://github.com/JonHylands/uCee/blob/master/src/main.cpp seems to look the same.

This is my (slightly modified) Makefile:

Code:
#
# This makefile started life as the Makefile from teensy-template, found here:
# https://github.com/apmorton/teensy-template
#

ifeq ($(v),)
export verbose = 0
else
export verbose = 1
endif

ifeq ($(verbose),)
export verbose = 0
endif

ifeq ($(verbose),0)
Q = @
MAKEFLAGS += -s
else
Q =
endif
export Q

# The name of your project (used to name the compiled .hex file)
TARGET = $(notdir $(CURDIR))

# configurable options
OPTIONS = -DF_CPU=96000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH

# options needed by many Arduino libraries to configure for Teensy 3.0
OPTIONS += -D__MK20DX256__ -DARDUINO=105

BUILDDIR = build

ifdef COMSPEC
cygpath-win    = $(shell cygpath -w "$1")
else
cygpath-win    = $1
endif

#************************************************************************
# Location of Teensyduino utilities, Toolchain, and Arduino Libraries.
# To use this makefile without Arduino, copy the resources from these
# locations and edit the pathnames.  The rest of Arduino is not needed.
#************************************************************************

ARDUINO ?= /Applications/Arduino.app/Contents/Java

# path location for Teensy Loader, teensy_post_compile and teensy_reboot
TOOLS_PATH = $(ARDUINO)/hardware/tools

# path location for Teensy 3 core
CORE_PARENT = $(ARDUINO)/hardware/teensy/avr/cores
CORE_PATH = $(CORE_PARENT)/teensy3

# path location for Arduino libraries
LIBRARY_PARENT = ..
LIBRARY_PATH = $(LIBRARY_PARENT)/libraries

# path location for the arm-none-eabi compiler
COMPILER_PATH = $(TOOLS_PATH)/arm/bin

#************************************************************************
# Settings below this point usually do not need to be edited
#************************************************************************

# CPPFLAGS = compiler options for C and C++
CPPFLAGS = -Wall -Wno-psabi -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD $(OPTIONS) -Isrc -I$(CORE_PATH)

# compiler options for C++ only
CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti

# compiler options for C only
CFLAGS =

LDSCRIPT = $(CORE_PATH)/mk20dx256.ld

# linker options
LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -T$(LDSCRIPT)

# additional libraries to link
LIBS = -lm

# names for the compiler programs
CC = $(COMPILER_PATH)/arm-none-eabi-gcc
CXX = $(COMPILER_PATH)/arm-none-eabi-g++
OBJCOPY = $(COMPILER_PATH)/arm-none-eabi-objcopy
SIZE = $(COMPILER_PATH)/arm-none-eabi-size

vpath %.c   $(LIBRARY_PARENT)
vpath %.cpp $(LIBRARY_PARENT)

vpath %.c   $(CORE_PARENT)
vpath %.cpp $(CORE_PARENT)

# automatically create lists of the sources and objects
LC_FILES := $(patsubst $(LIBRARY_PARENT)/%, %, $(wildcard $(LIBRARY_PATH)/*/*.c))
LCPP_FILES := $(patsubst $(LIBRARY_PARENT)/%, %, $(wildcard $(LIBRARY_PATH)/*/*.cpp))
TC_FILES := $(patsubst $(CORE_PARENT)/%, %, $(wildcard $(CORE_PATH)/*.c))
TCPP_FILES := $(patsubst $(CORE_PARENT)/%, %, $(wildcard $(CORE_PATH)/*.cpp))
C_FILES := $(wildcard src/*.c)
CPP_FILES := $(wildcard src/*.cpp)
INO_FILES := $(wildcard src/*.ino)

# include paths for libraries
L_INC := $(foreach lib,$(filter %/, $(wildcard $(LIBRARY_PATH)/*/)), -I$(lib))

OBJS_FILES := $(INO_FILES:.ino=.o) $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o) $(TC_FILES:.c=.o) $(TCPP_FILES:.cpp=.o) $(LC_FILES:.c=.o) $(LCPP_FILES:.cpp=.o)
OBJS := $(foreach obj,$(OBJS_FILES), $(BUILDDIR)/$(obj))

all: hex

build: $(TARGET).elf

hex: $(TARGET).hex

post_compile: $(TARGET).hex
	$(Q)$(TOOLS_PATH)/teensy_post_compile -file="$(basename $<)" -path="$(call cygpath-win,$(CURDIR))" -tools="$(TOOLS_PATH)"

reboot:
	$(Q)-$(TOOLS_PATH)/teensy_reboot

upload: post_compile reboot

$(BUILDDIR)/%.o: %.c
	@echo "[CC]\t$<"
	$(Q)mkdir -p "$(dir $@)"
	$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(L_INC) -o "$@" -c "$<"

$(BUILDDIR)/%.o: %.ino
	@echo "[CXX]\t$<"
	$(Q)mkdir -p "$(dir $@)"
	$(Q)$(CC) $(CPPFLAGS) $(CXXFLAGS) $(L_INC) -o "$@" -c -x c++ -include Arduino.h "$<"

$(BUILDDIR)/%.o: %.cpp
	@echo "[CXX]\t$<"
	@mkdir -p "$(dir $@)"
	$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(L_INC) -o "$@" -c "$<"

$(TARGET).elf: $(OBJS) $(LDSCRIPT)
	@echo "[LD]\t$@"
	$(Q)$(CC) $(LDFLAGS) -o "$@" -Wl,-Map,$(TARGET).map $(OBJS) $(LIBS)

%.hex: %.elf
	@echo "[HEX]\t$@"
	$(Q)$(SIZE) "$<"
	$(Q)$(OBJCOPY) -O ihex -R .eeprom "$<" "$@"

# compiler generated dependency info
-include $(OBJS:.o=.d)

clean:
	@echo Cleaning...
	$(Q)rm -rf "$(BUILDDIR)"
	$(Q)rm -f "$(TARGET).elf" "$(TARGET).hex" "$(TARGET).map"

Could anyone point me in the right direction?
 
You are probably the victim of name mangling.
I suspect the main.cpp is trying to find c++ functions. Under water it mangles the name.
Since your file is a c-file, which does not use mangled names, it cannot find it.
You might solve it by adding an 'extern "C"' to the prototypes in mian.cpp or wherever they are defined.
Another way is to change the extension of you simple main.c to cpp.
 
Thanks for the pointers people.

It seems I just forgot to put my source file (main.c) in src/ so it didn't get compiled at all! Now everything works fine and I have a .hex file ready to upload.
 
Bare metal ARM tools for Teensy 3.1

Karl Lunt set up the GNU ARM tool chain for "bare metal" (no Arduino, no IDE, just "make") Teensy 3.1 development on Windows.
I adapted his instructions and Makefile for Ubuntu, which has the pre-built ARM cross tools available, making it real easy to get everything installed. I put a short script on my web site that does everything automatically on a current Ubuntu system.

I re-arranged Karl's Makefile substantially for my taste and to take advantage of default rules and conventions in Unix make, but it would be possible to make one Makefile that would work on Windows and Unix.

Karl's page: http://www.seanet.com/~karllunt/bareteensy31.html
My page: http://blogs.omnicron.com/ford/2015/06/17/easy-teensy-development-on-ubuntu/

Mike
 
Last edited:
Some additional comments...

i have a preference for a OSX based solution and previously invested a significant amount of time into making Xcode and embeddedxcode work. For the most part, it worked on the first project after some back and forth, such as not being allowed to have spaces in file names, and other issues. Implementing libraries is still too convoluted IMO, Xcode seems simply too oriented towards hard-core iOS and OSX development. The recent transition to Xcode 7 went terribly. I spent several hours trying to follow the instructions in the iBooks manual to get my projects transitioned and I have given up for now.

I went back to Visual Studio 2015 (clean install), Arduino 1.6.6 (another clean install), VisualMicro, etc. and so far the whole package seems to install new boards (i.e. mighty 1284, for example), new libraries (i.e. Easy Transfer), etc. with ease. That is, you can use a GUI, select the files of interest or even download them directly from their githubs. More importantly, the documentation that VisualMicro provides to walk a user through the process of getting the IDE, boards, etc. going is leagues ahead of embeddedxcode. Perhaps some day I will go back and try again, for now I am terminally frustrated with the embedxcode experience.

I hope Rob can hire someone who will create a easy-to-follow installation guide that is not just aimed at people who know xCode like the back of their hand. VisualMicro provides a really nice online installation, setup, etc. manual that he should use as a pattern to follow. Is it perfect? Heck no! For instance, the download for the visualmicro code is not on the page one would expect it to be. However, the online visualmicro manual does a much better job of explaining the necessary steps, etc. than the iBook published by Rob.

Additionally, the experience INSIDE the visualmicro plugin is significantly more intuitive than what I am currently getting from embedxcode. It's simply a pleasure to be able to select from the many libraries, boards, etc. that Arduino 1.6.6 serves up or to import a ZIP and have the boards/libraries there, ready to be used. Thus, for anyone looking to transition to a IDE that is a step up from Arduino but who also expects a GUI experience, Visual Studio 2015 and VisualMicro on Windows is a great contender. As Steve points out, there are additional tools you can add like VisualGDB or the higher-end VisualMicro tool to enable debugging. Some day, I may have the skills, experience to use those things. For now, I am simply happy to have a IDE that doesn't get as much in the way of actually programming.
 
Some additional comments...

i have a preference for a OSX based solution and previously invested a significant amount of time into making Xcode and embeddedxcode work. For the most part, it worked on the first project after some back and forth, such as not being allowed to have spaces in file names, and other issues. Implementing libraries is still too convoluted IMO, Xcode seems simply too oriented towards hard-core iOS and OSX development. The recent transition to Xcode 7 went terribly. I spent several hours trying to follow the instructions in the iBooks manual to get my projects transitioned and I have given up for now.

I went back to Visual Studio 2015 (clean install), Arduino 1.6.6 (another clean install), VisualMicro, etc. and so far the whole package seems to install new boards (i.e. mighty 1284, for example), new libraries (i.e. Easy Transfer), etc. with ease. That is, you can use a GUI, select the files of interest or even download them directly from their githubs. More importantly, the documentation that VisualMicro provides to walk a user through the process of getting the IDE, boards, etc. going is leagues ahead of embeddedxcode. Perhaps some day I will go back and try again, for now I am terminally frustrated with the embedxcode experience.

I hope Rob can hire someone who will create a easy-to-follow installation guide that is not just aimed at people who know xCode like the back of their hand. VisualMicro provides a really nice online installation, setup, etc. manual that he should use as a pattern to follow. Is it perfect? Heck no! For instance, the download for the visualmicro code is not on the page one would expect it to be. However, the online visualmicro manual does a much better job of explaining the necessary steps, etc. than the iBook published by Rob.

Additionally, the experience INSIDE the visualmicro plugin is significantly more intuitive than what I am currently getting from embedxcode. It's simply a pleasure to be able to select from the many libraries, boards, etc. that Arduino 1.6.6 serves up or to import a ZIP and have the boards/libraries there, ready to be used. Thus, for anyone looking to transition to a IDE that is a step up from Arduino but who also expects a GUI experience, Visual Studio 2015 and VisualMicro on Windows is a great contender. As Steve points out, there are additional tools you can add like VisualGDB or the higher-end VisualMicro tool to enable debugging. Some day, I may have the skills, experience to use those things. For now, I am simply happy to have a IDE that doesn't get as much in the way of actually programming.

I echo the last sentence.
I'm a tool user, not a tool maker! So too said the carpenter.
 
For now, I am simply happy to have a IDE that doesn't get as much in the way of actually programming.

that is, why I stick with notepad++ / NppExec and Puttytel for a general Makefile based development, which works fine for me.
(I use Qtcreator for a Teens-acquisition GUI, but was unable, or not patient enough to adapt that to Teensy)
If we get a K66 with debugging interface, I may change.
 
Karl Lunt set up the GNU ARM tool chain for "bare metal" (no Arduino, no IDE, just "make") Teensy 3.1 development on Windows.
I adapted his instructions and Makefile for Ubuntu, which has the pre-built ARM cross tools available, making it real easy to get everything installed. I put a short script on my web site that does everything automatically on a current Ubuntu system.

My page: http://blogs.omnicron.com/ford/2015/06/17/easy-teensy-development-on-ubuntu/

Mike

Mike, your page currently returns an error "Unable to establish a database connection", rather than an actual web page.
 
FWIW, I got the same error.

I also want to re-iterate that I admire EmbedXCode and I wish the best of success to Rob.

Unlike a former user here, I will not stomp my feet and pout if I don't get my way re: how embedxcode works or how it is integrated. For all I know, I am the only person who had these usability and/or transition issues. That said, I would like to think that the extent to which a IDE experience can be simplified through the use of point-and-click GUI's, easy importation of libraries, transitions, etc. is something that the competition should take note of. This is an area where VisualMicro (through its toolbar and the online documentation) is significantly easier for me to follow.

I wish EmbedXcode could develop a toolbar that covers all the usual suspects in daily MCU coding, i.e. what is the target MCU (and what speed will the Teensy use), how to import a library into the library folder, how to rescan the contents of the library folder and add the newly found files to the allowed list of libraries (or conversely, remove deleted libraries), how to import a library into the INO file you're working on, initiate a build, upload, and so on. For all I know, I somehow bungled an existing toolbar and hence the clean install that I plan in the future will make all that re-appear.

I'll close by restating my support for Robs project. EmbedXcode is something you should look at if you plan on coding on a OSX machine. Take my suggestions / experience with a grain of salt... they reflect my abilities and my experience and may not be applicable to you, the reader. An experienced coder likely falls out of their chair laughing at my pathetic attempts to get something as simple as an IDE going.
 
Status
Not open for further replies.
Back
Top