Compiling for Teensy LC and Linux

Status
Not open for further replies.

Stardust

New member
Hello,

I am a fresh member for the Teensy universe. After receiving my new Teensy-LC I tried compiling and making a hex file... But It failed.
(My apologies if this was answered elsewhere, but after searching did not find any answer to it...)

As I found in the documentation, I should replace the MCU= option with MCU=mkl26z64

However, this gave me the following error output:

Code:
-------- begin --------
avr-gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: example.c
avr-gcc -c -mmcu=mk20dx256 -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./example.lst  -std=gnu99 -MMD -MP -MF .dep/example.o.d example.c -o example.o 
avr-gcc: error: unrecognized argument in option ‘-mmcu=mk20dx256’
avr-gcc: note: valid arguments to ‘-mmcu=’ are: at43usb320 at43usb355 at76c711 at86rf401 at90c8534 at90can128 at90can32 at90can64 at90pwm1 at90pwm161 at90pwm2 at90pwm216 at90pwm2b at90pwm3 at90pwm316 at90pwm3b at90pwm81 at90s1200 at90s2313 at90s2323 at90s2333 at90s2343 at90s4414 at90s4433 at90s4434 at90s8515 at90s8535 at90scr100 at90usb1286 at90usb1287 at90usb162 at90usb646 at90usb647 at90usb82 at94k ata5272 ata5505 ata5790 ata5790n ata5795 ata6285 ata6286 ata6289 atmega103 atmega128 atmega1280 atmega1281 atmega1284 atmega1284p atmega128a atmega128rfa1 atmega16 atmega161 atmega162 atmega163 atmega164a atmega164p atmega164pa atmega165 atmega165a atmega165p atmega165pa atmega168 atmega168a atmega168p atmega168pa atmega169 atmega169a atmega169p atmega169pa atmega16a atmega16hva atmega16hva2 atmega16hvb atmega16hvbrevb atmega16m1 atmega16u2 atmega16u4 atmega2560 atmega2561 atmega26hvg atmega32 atmega323 atmega324a atmega324p atmega324pa atmega325 atmega3250 atmega3250a atmega3250p atmega3250pa atmega325a atmega325p atmega328 atmega328p atmega329 atmega3290 atmega3290a atmega3290p atmega3290pa atmega329a atmega329p atmega329pa atmega32a atmega32c1 atmega32hvb atmega32hvbrevb atmega32m1 atmega32u2 atmega32u4 atmega32u6 atmega406 atmega48 atmega48a atmega48hvf atmega48p atmega48pa atmega64 atmega640 atmega644 atmega644a atmega644p atmega644pa atmega645 atmega6450 atmega6450a atmega6450p atmega645a atmega645p atmega649 atmega6490 atmega6490a atmega6490p atmega649a atmega649p atmega64a atmega64c1 atmega64hve atmega64m1 atmega64rfa2 atmega64rfr2 atmega8 atmega8515 atmega8535 atmega88 atmega88a atmega88p atmega88pa atmega8a atmega8hva atmega8u2 atmxt112sl atmxt224 atmxt224e atmxt336s atmxt540s atmxt540sreva attiny11 attiny12 attiny13 attiny13a attiny15 attiny1634 attiny167 attiny22 attiny2313 attiny2313a attiny24 attiny24a attiny25 attiny26 attiny261 attiny261a attiny28 attiny4313 attiny43u attiny44 attiny44a attiny45 attiny461 attiny461a attiny48 attiny84 attiny84a attiny85 attiny861 attiny861a attiny87 attiny88 atxmega128a1 atxmega128a1u atxmega128a3 atxmega128a3u atxmega128a4u atxmega128b1 atxmega128b3 atxmega128c3 atxmega128d3 atxmega128d4 atxmega16a4 atxmega16a4u atxmega16c4 atxmega16d4 atxmega16x1 atxmega192a3 atxmega192a3u atxmega192c3 atxmega192d3 atxmega256a3 atxmega256a3b atxmega256a3bu atxmega256a3u atxmega256c3 atxmega256d3 atxmega32a4 atxmega32a4u atxmega32c4 atxmega32d4 atxmega32e5 atxmega32x1 atxmega384c3 atxmega384d3 atxmega64a1 atxmega64a1u atxmega64a3 atxmega64a3u atxmega64a4u atxmega64b1 atxmega64b3 atxmega64c3 atxmega64d3 atxmega64d4 avr1 avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 m3000
make: *** [example.o] Error 1

I have the following system: (lsb_release -a)

Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
Kernel: 3.13.0-24-generic

Installed following packages (apt-get):
- gcc-avr 1:4.8-2.1 0
- binutils-avr 2.23.1-2.1
- avr-libc 1:1.8.0-4.1 0
- libusb-dev 2:0.1.12-23.3ubuntu1

lsusb shows me that the device is connected and recognized.
I can also load the sample hex programs (slow blink and fast blink)

I hope someone can give me some directions to proceed...
 
Sounds like you need to start by installing Arduino and then Teensyduino and then try with those - just search using your favorite method for 'installing teensyduino' and you should find heaps.

Any good?
 
Yup, you need to use Teensyduino with the newer 32 bit boards.

If you *really* want to run a makefile from command line, after installing Teensyduino, look in Arduino's hardware/teensy/avr/cores/teensy3 folder for a sample makefile.
 
Hi,

Thanks for the quick response. Oke... seems that a long adventure lies in front of me .... haven't got any experience with arduino :-/
(As reference, I am a Java Programmer... so C and so on are a bit scary for me ...)

What I found, based on your search advice was : https://www.pjrc.com/teensy/tutorial.html
So I installed this teensyduino and arduino IDE...

Got the example with the blinking led working (from the examples menu) :-D

I am afraid that I probably have to learn a lot...
 
Don't let C (actually C++) scare you! Arduino is mostly a big collection of libraries that will help you get fun stuff working fast. The main() function is written for you. You just write setup() and loop(). After that it's all C++. Yes, C++ can get very scary indeed and so can direct hardware access, but you don't need to get into the scary parts until you want to.
 
+1 to pictographer, except I would have used the word 'daunting' instead of scary and I will go on to say that if you already understand basic programming principles, (ie/eg; you can write code to solve problems of varying complexity in some or other language already) then a new language is mostly a matter of syntax and perhaps froms of pedantry.

There is only one real way to advance and conquer new skills and such like; try :)
 
I am afraid that I probably have to learn a lot...

It's perfectly fine to ask for help here, if you run into a problem.

Just be sure to follow the "forum rule". When you post the actual complete code (so it can be copied into Arduino and compiled to reproduce the problem), usually it's pretty quick to figure out why it's not compiling.
 
I am working with the blinky example from https://www.pjrc.com/teensy/gcc.html and have it compiling properly for AVR controllers such as the Teensy 2. I have a Teensy LC which uses an ARM controller.

When I try to upload to my board with TeensyDuino I get messages that "blinky.hex" is not compiled for this board
Compiled for: "Teensy 2.0 (ATMEGA32U4)"
This board is: "Teensy LC (MKL26Z64)"

My next step will be to modify Makefile so that it calls for ARM compiler tools instead of AVR tools. The boards.txt file from my Arduino folder helps show which changes I need to make.

It may work if I go into the Makefile and change avr-gcc to arm-none-eabi-gcc, avr-objcopy can be replaced with arm-none-eabi-objcopy, avr-objdump with arm-none-eabi-objdump and avr-nm can be replaced with arm-none-eabi-nm.

CompatibilityError.PNG
 
Status
Not open for further replies.
Back
Top