i compile blink program (main.cpp with make.exe ) without ardunio and load main.hex with teensyloader succesfully.
But teens3.1 don't work or blink . i copy all files to folder C:\blink (except *.c and *.cpp files)
and copy two *.ld files to C:\blinky\teensy folder , main.cpp is in C:\blink .
What can i do ? .
main cpp :
#include "WProgram.h"
extern "C" int main(void)
{
#if !defined(ARDUINO)
// To use Teensy 3.0 without Arduino, simply put your code here.
// For example:
pinMode(13, OUTPUT);
while (1) {
digitalWriteFast(13, HIGH);
delay(500);
digitalWriteFast(13, LOW);
delay(500);
}
#else
// Arduino's main() function just calls setup() and loop()....
setup();
while (1) {
loop();
yield();
}
#endif
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
my makefile :
# The name of your project (used to name the compiled .hex file)
TARGET = main
# configurable options
OPTIONS = -DF_CPU=72000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH
#************************************************************************
# 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.
#************************************************************************
# path location for Teensy Loader, teensy_post_compile and teensy_reboot
#TOOLSPATH = ../../../tools # on Linux
TOOLSPATH = C:\Program Files\Arduino\hardware\tools
# on Mac or Windows
# path location for Arduino libraries (currently not used)
LIBRARYPATH = C:\Program Files\Arduino\libraries
# path location for the arm-none-eabi compiler
COMPILERPATH = C:\Program Files\Arduino\hardware\tools\arm-none-eabi\bin
#************************************************************************
# Settings below this point usually do not need to be edited
#************************************************************************
# CPPFLAGS = compiler options for C and C++
CPPFLAGS = -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD $(OPTIONS) -I. -Iteensy/
# compiler options for C++ only
CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
# compiler options for C only
CFLAGS =
# linker options
LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -Tteensy/mk20dx256.ld
# additional libraries to link
LIBS = -lm
# names for the compiler programs
CC = $(COMPILERPATH)/arm-none-eabi-gcc
CXX = $(COMPILERPATH)/arm-none-eabi-g++
OBJCOPY = $(COMPILERPATH)/arm-none-eabi-objcopy
SIZE = $(COMPILERPATH)/arm-none-eabi-size
# automatically create lists of the sources and objects
# TODO: this does not handle Arduino libraries yet...
C_FILES := $(wildcard *.c) \
$(wildcard $(addprefix teensy/, *.c)) \
$(wildcard $(addprefix teensy/util, *.c)) \
$(wildcard $(addprefix teensy/avr, *.c))
CPP_FILES := $(wildcard *.cpp) \
$(wildcard $(addprefix teensy/, *.cpp)) \
$(wildcard $(addprefix teensy/util, *.cpp)) \
$(wildcard $(addprefix teensy/avr, *.cpp))
OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
# the actual makefile rules (all .o files built by GNU make's default implicit rules)
all: $(TARGET).hex
$(TARGET).elf: $(OBJS) teensy/mk20dx256.ld
$(CC) $(LDFLAGS) -o $@ $(OBJS)
%.hex: %.elf
$(SIZE) $<
$(OBJCOPY) -O ihex -R .eeprom $< $@
$(TOOLSPATH)/teensy_post_compile -file=$(basename $@) -path=$(shell echo %cd%) -tools=$(TOOLSPATH)
-$(TOOLSPATH)/teensy_reboot
# compiler generated dependency info
-include $(OBJS:.o=.d)
clean:
del *.o
del *.d
del $(TARGET).elf
del $(TARGET).hex
del $(CURRENT_PATH)\teensy\*.o
del $(CURRENT_PATH)\teensy\*.d
But teens3.1 don't work or blink . i copy all files to folder C:\blink (except *.c and *.cpp files)
and copy two *.ld files to C:\blinky\teensy folder , main.cpp is in C:\blink .
What can i do ? .
main cpp :
#include "WProgram.h"
extern "C" int main(void)
{
#if !defined(ARDUINO)
// To use Teensy 3.0 without Arduino, simply put your code here.
// For example:
pinMode(13, OUTPUT);
while (1) {
digitalWriteFast(13, HIGH);
delay(500);
digitalWriteFast(13, LOW);
delay(500);
}
#else
// Arduino's main() function just calls setup() and loop()....
setup();
while (1) {
loop();
yield();
}
#endif
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
my makefile :
# The name of your project (used to name the compiled .hex file)
TARGET = main
# configurable options
OPTIONS = -DF_CPU=72000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH
#************************************************************************
# 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.
#************************************************************************
# path location for Teensy Loader, teensy_post_compile and teensy_reboot
#TOOLSPATH = ../../../tools # on Linux
TOOLSPATH = C:\Program Files\Arduino\hardware\tools
# on Mac or Windows
# path location for Arduino libraries (currently not used)
LIBRARYPATH = C:\Program Files\Arduino\libraries
# path location for the arm-none-eabi compiler
COMPILERPATH = C:\Program Files\Arduino\hardware\tools\arm-none-eabi\bin
#************************************************************************
# Settings below this point usually do not need to be edited
#************************************************************************
# CPPFLAGS = compiler options for C and C++
CPPFLAGS = -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD $(OPTIONS) -I. -Iteensy/
# compiler options for C++ only
CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
# compiler options for C only
CFLAGS =
# linker options
LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -Tteensy/mk20dx256.ld
# additional libraries to link
LIBS = -lm
# names for the compiler programs
CC = $(COMPILERPATH)/arm-none-eabi-gcc
CXX = $(COMPILERPATH)/arm-none-eabi-g++
OBJCOPY = $(COMPILERPATH)/arm-none-eabi-objcopy
SIZE = $(COMPILERPATH)/arm-none-eabi-size
# automatically create lists of the sources and objects
# TODO: this does not handle Arduino libraries yet...
C_FILES := $(wildcard *.c) \
$(wildcard $(addprefix teensy/, *.c)) \
$(wildcard $(addprefix teensy/util, *.c)) \
$(wildcard $(addprefix teensy/avr, *.c))
CPP_FILES := $(wildcard *.cpp) \
$(wildcard $(addprefix teensy/, *.cpp)) \
$(wildcard $(addprefix teensy/util, *.cpp)) \
$(wildcard $(addprefix teensy/avr, *.cpp))
OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
# the actual makefile rules (all .o files built by GNU make's default implicit rules)
all: $(TARGET).hex
$(TARGET).elf: $(OBJS) teensy/mk20dx256.ld
$(CC) $(LDFLAGS) -o $@ $(OBJS)
%.hex: %.elf
$(SIZE) $<
$(OBJCOPY) -O ihex -R .eeprom $< $@
$(TOOLSPATH)/teensy_post_compile -file=$(basename $@) -path=$(shell echo %cd%) -tools=$(TOOLSPATH)
-$(TOOLSPATH)/teensy_reboot
# compiler generated dependency info
-include $(OBJS:.o=.d)
clean:
del *.o
del *.d
del $(TARGET).elf
del $(TARGET).hex
del $(CURRENT_PATH)\teensy\*.o
del $(CURRENT_PATH)\teensy\*.d