PATH = %PATH%;C:\\CAMINHO_PARA_O_ARDUINO\\arduino-1.0.3\\hardware\\tools\\arm-none-eabi\\bin<\/p><\/blockquote>\n
[If you don’t want to know the modifications that I did, just jump to the end where you can find a resume]<\/strong><\/p>\nTo guarantee that I will not screw everything, I did a copy of “arduino-1.0.3\\hardware\/teensy\/cores\/teensy3” and did my modifications on it. I executed:<\/p>\n
cs-make.exe<\/p><\/blockquote>\n
Receveid this error message:<\/p>\n
C:\\CAMINHO_PARA_O_ARDUINO\\arduino-1.0.3\\Projects\\Example_not_working>cs-make.exe
\nC:\/Users\/X-warrior\/Desktop\/tools\/arm-none-eabi\/bin\/arm-none-eabi-gcc -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I. -c -o analog.o analog.c
\nprocess_begin: CreateProcess(NULL, C:\/Users\/X-warrior\/Desktop\/tools\/arm-none-eabi\/bin\/arm-none-eabi-gcc -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I. -c -o analog.o analog.c, …) failed.
\nmake (e=2): The system cannot find the file specified.
\ncs-make.exe: *** [analog.o] Error 2<\/p><\/blockquote>\n
Checking the Makefile I decided to change some configs and used FULL PATH for it.
\nTOOLSPATH = C:\\CAMINHO_PARA_O_ARDUINO\\arduino-1.0.3\\hardware\\tools
\nCOMPILERPATH = C:\\CAMINHO_PARA_O_ARDUINO\\arduino-1.0.3\\hardware\\tools\\arm-none-eabi\\bin<\/p>\n
The error received was the same, so checking the code again I saw the “abspath” and thought that maybe the problem was this, since I changed my folder location. So I removed all “$(abspath” remember that it has a parenthesis that closes the command. So for example:<\/p>\n
$(abspath $(COMPILERPATH)) will be<\/strong> $(COMPILERPATH)<\/p><\/blockquote>\nTrying to get it working again with cs-make, it started compiling it, but on the end I received this error:<\/p>\n
\nC:\\Users\\X-warrior\\Desktop\\arduino-1.0.3\\hardware\\tools\\arm-none-eabi\\bin\/arm-none-eabi-objcopy -O ihex -R .eeprom main.elf main.hex
\nC:\\Users\\X-warrior\\Desktop\\arduino-1.0.3\\hardware\\tools\/teensy_post_compile -file=main -path= -tools=C:\\Users\\X-warrior\\Desktop\\arduino-1.0.3\\hardware\\tools
\nOpening Teensy Loader…
\nTeensy Loader could not find the file main
\ncs-make.exe: *** [main.hex] Error 1<\/p><\/blockquote>\n
Triple checking the Makefile I found “path=$(shell pwd)” and I didn’t remember this pwm command on windows so I tried to execute it and it didn’t work. So I changed it to “path=$(shell echo %cd%)”. Before I start compiling again I decide to clean directory using cs-make clean<\/p>\n
I received the following errors:<\/p>\n
C:\\Users\\X-warrior\\Desktop\\arduino-1.0.3\\Projects\\Example_not_working>cs-make.exe clean
\nrm -f *.o *.d main.elf main.hex
\nprocess_begin: CreateProcess(NULL, rm -f *.o *.d main.elf main.hex, …) failed.
\nmake (e=2): The system cannot find the file specified.
\ncs-make.exe: *** [clean] Error 2<\/p><\/blockquote>\n
And then I noticed that it was calling rm -f which isn’t a windows command too. I changed the rm command to:<\/p>\n
\tdel *.o
\n\tdel *.d
\n\tdel $(TARGET).elf
\n\tdel $(TARGET).hex<\/p><\/blockquote>\n
With this I managed to clean the files and tried to compile again, and… IT WORKS! I did a few tests using main.cpp that was being compiled and uploaded to my Teensy 3. Anyways to work with all that files wasn’t attractive so I decided to go a little further and do some cleaning. So inside my “Project” folder I copied all files excluding Makefile and main.cpp to my new folder inside my project “teensy\/”. This way I can compile it without all that files on my working folder. I needed to do a few more changes on Makefile as follow:<\/p>\n
C_FILES := $(wildcard *.c) \\
\n\t $(wildcard $(addprefix teensy\/, *.c)) \\
\n\t\t $(wildcard $(addprefix teensy\/util, *.c)) \\
\n\t\t $(wildcard $(addprefix teensy\/avr, *.c))
\nCPP_FILES := $(wildcard *.cpp) \\
\n\t\t $(wildcard $(addprefix teensy\/, *.cpp)) \\
\n\t\t $(wildcard $(addprefix teensy\/util, *.cpp)) \\
\n\t\t $(wildcard $(addprefix teensy\/avr, *.cpp))
\nOBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)<\/p><\/blockquote>\n
Linker configuration to:<\/p>\n
LDFLAGS = -Os -Wl,–gc-sections -mcpu=cortex-m4 -mthumb -Tteensy\/mk20dx128.ld<\/p><\/blockquote>\n
And to keep it consistent:<\/p>\n
$(TARGET).elf: $(OBJS) teensy\/mk20dx128.ld
\n\t$(CC) $(LDFLAGS) -o $@ $(OBJS)<\/p><\/blockquote>\n
And then I found this error:<\/p>\n
\nteensy\/keylayouts.c:1: fatal error: avr\/pgmspace.h: No such file or directory
\ncompilation terminated.
\ncs-make: *** [teensy\/keylayouts.o] Error 1\n<\/p><\/blockquote>\n
So I updated the CPPFLAGS to:<\/p>\n
CPPFLAGS = -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD $(OPTIONS) -I. -Iteensy\/<\/p><\/blockquote>\n
And also remembered that the clean should be updated too.<\/p>\n
clean:
\n\tdel *.o
\n\tdel *.d
\n\tdel $(TARGET).elf
\n\tdel $(TARGET).hex
\n\tdel $(CURRENT_PATH)\\teensy\\*.o
\n\tdel $(CURRENT_PATH)\\teensy\\*.d<\/p><\/blockquote>\n
And add this on the begin of “Configurations that shouldn’t be updated”<\/p>\n
CURRENT_PATH=$(shell echo %cd%)<\/p><\/blockquote>\n
With all this I managed to get the Makefile working on Windows compiling and uploading for Teensy 3.0<\/p>\n
Summary:<\/strong>
\nYou must update TOOLSPATH , COMPILERPATH and use your FULL PATH
\nThen create a folder “My_Project”
\nCreate another folder inside your project called “teensy” (My_Project\/teensy\/)
\nCopy “arduino-1.0.3\\hardware\/teensy\/cores\/teensy3\/” to “My_Project\/teensy\/” (subdir too, but not the Makefile)
\nAdd the Makefile that you can download on the end of this post inside “My_Project”
\nCopy “Meu_Projeto\/teensy\/main.cpp” too “Meu_Projeto\/main.cpp”
\nProgramm inside main.cpp
\nCompile and upload with cs-make.exe<\/p>\nMakefile to Teensy on Windows<\/a><\/p>\nMatheus<\/p>\n
<\/p>","protected":false},"excerpt":{"rendered":"
Good Night, If you don’t want to use Arduino IDE (Or Teensy IDE? \ud83d\ude09 to programming and uploading your code to Teensy 3.0 you can…<\/p>\n
Continue readingCompile to Teensy 3.0 on Windows using Makefile<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[15,163,296,38],"tags":[298,301,300,299,297],"class_list":["post-1489","post","type-post","status-publish","format-standard","hentry","category-c","category-cpp","category-teensy","category-windows","tag-3-0","tag-cs-make","tag-make","tag-makefile","tag-teensy-2","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/psjGE-o1","_links":{"self":[{"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/posts\/1489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/comments?post=1489"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/posts\/1489\/revisions"}],"predecessor-version":[{"id":1491,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/posts\/1489\/revisions\/1491"}],"wp:attachment":[{"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/media?parent=1489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/categories?post=1489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/tags?post=1489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}