How to know if my device is supported (?)

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is one thing that has confused me in the past (and i have seen in this forum has sometimes confused other people): Even though my device is listed as supported in the documentation on the AVR-LIBC website (http://www.nongnu.org/avr-libc/u...), the device may not be supported by the rest of the tool-chain that I have installed.

Since many people are running different versions of each tool in their tool-chain, and some have patched versions and some do not -
What is de definitive way of finding out if my tool-chain setup will support my given device?

Unfortunately it is not as simple as checking the websites of the various components of the avr-toolchain, because most are not as well documented as the AVR-LIBC, especially when it comes to device support. So how does one do it?

Scenario: A new version of the AVR-LIBC comes out, I'm very excited to see what fancy new devices I can program... only to find that it is not yet supported in the AVR-GCC. :( Often the answer is a matter of installing a patch, but how does one know what needs to be patched and which patch to get? (I'm asking this question in the public forum because I'm sure it will solve problems in the future for myself and others.)

Cheers,
Ryan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try some simple tests from the command line to see what parts are supported by your version of the binary utilities (binutils) and the compiler (GCC).

To test binutils:

$avr-as --help

The final block of text that is returned will be a listing of all MCU types recognized by the assembler, and thus, by all of binutils.

To test avr-gcc:

$avr-gcc --target-help

The final block of text that is returned will be a listing of all MCU types that are recognized by the compiler.

You know which version of avr-libc you're using, and so you can look at the help files to determine which MCU types the library supports.

If you want to use an MCU that is listed in all three places, then you will be able to use your current toolchain.

Otherwise, you'll need to look for a new binary distribution, or else download the latest official source codes for all the relevant tools and apply the latest patches before rebuilding the tools. Jörg (dl8dtl on this Forum) maintains a set of new device patches for binutils and gcc in the FreeBSD ports system, which should translate into most flavours of *nix.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks! This is great information. It's still not the whole picture though.
I've run the two lines of code you gave and indeed they produced the lists of supported devices.

However there are a number of devices that are listed as being supported by the Assembler, the GCC and the LIBC, that I still cannot target. What am I missing?

For example: see the output from the terminal below and it will show that it did not accept the target for the Tiny13. (sorry for the long paste but it shows the different lists)

Hard-Drive:~/desktop/blinky_tiny user$ make      
avr-gcc -c -g -Os -Wall -Wstrict-prototypes -I/avrlib -Wa,-ahlms=blinky.lst -mmcu=attiny13 -I. blinky.c -o blinky.o
unknown MCU `attiny13' specified
Known MCU names:
   avr2
   at90s2313
   at90s2323
   at90s2333
   at90s2343
   attiny22
   attiny26
   at90s4414
   at90s4433
   at90s4434
   at90s8515
   at90c8534
   at90s8535
   at86rf401
   avr3
   atmega103
   atmega603
   at43usb320
   at43usb355
   at76c711
   avr4
   atmega8
   atmega8515
   atmega8535
   avr5
   atmega16
   atmega161
   atmega162
   atmega163
   atmega169
   atmega32
   atmega323
   atmega64
   atmega128
   at94k
   avr1
   at90s1200
   attiny11
   attiny12
   attiny15
   attiny28
blinky.c:0: error: MCU `attiny13' supported for assembler only
In file included from blinky.c:2:
/sw/share/avr/lib/gcc/avr/3.4.5/../../../../avr/include/avr/io.h:300:6: warning: #warning "device type not defined"
blinky.c: In function `main':
blinky.c:17: error: `DDRB' undeclared (first use in this function)
blinky.c:17: error: (Each undeclared identifier is reported only once
blinky.c:17: error: for each function it appears in.)
blinky.c:18: error: `PORTB' undeclared (first use in this function)
make: *** [blinky.o] Error 1
Hard-Drive:~/desktop/blinky_tiny user$ avr-as --help
Usage: avr-as [option...] [asmfile...]
Options:
  -a[sub-option...]       turn on listings
                          Sub-options [default hls]:
                          c      omit false conditionals
                          d      omit debugging directives
                          h      include high-level source
                          l      include assembly
                          m      include macro expansions
                          n      omit forms processing
                          s      include symbols
                          =FILE  list to FILE (must be last sub-option)
  --alternate             initially turn on alternate macro syntax
  -D                      produce assembler debugging messages
  --defsym SYM=VAL        define symbol SYM to given value
  --execstack             require executable stack for this object
  --noexecstack           don't require executable stack for this object
  -f                      skip whitespace and comment preprocessing
  -g --gen-debug          generate debugging information
  --gstabs                generate STABS debugging information
  --gstabs+               generate STABS debug info with GNU extensions
  --gdwarf-2              generate DWARF2 debugging information
  --help                  show this message and exit
  --target-help           show target specific options
  -I DIR                  add DIR to search list for .include directives
  -J                      don't warn about signed overflow
  -K                      warn when differences altered for long displacements
  -L,--keep-locals        keep local symbols (e.g. starting with `L')
  -M,--mri                assemble in MRI compatibility mode
  --MD FILE               write dependency information in FILE (default none)
  -nocpp                  ignored
  -o OBJFILE              name the object-file output OBJFILE (default a.out)
  -R                      fold data section into text section
  --statistics            print various measured statistics from execution
  --strip-local-absolute  strip local absolute symbols
  --traditional-format    Use same format as native assembler when possible
  --version               print assembler version number and exit
  -W  --no-warn           suppress warnings
  --warn                  don't suppress warnings
  --fatal-warnings        treat warnings as errors
  --itbl INSTTBL          extend instruction set to include instructions
                          matching the specifications defined in file INSTTBL
  -w                      ignored
  -X                      ignored
  -Z                      generate object file even after errors
  --listing-lhs-width     set the width in words of the output data column of
                          the listing
  --listing-lhs-width2    set the width in words of the continuation lines
                          of the output data column; ignored if smaller than
                          the width of the first line
  --listing-rhs-width     set the max width in characters of the lines from
                          the source file
  --listing-cont-lines    set the maximum number of continuation lines used
                          for the output data column of the listing
AVR options:
  -mmcu=[avr-name] select microcontroller variant
                   [avr-name] can be:
                   avr1 - AT90S1200, ATtiny1x, ATtiny28
                   avr2 - AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22
                   avr3 - ATmega103, ATmega603
                   avr4 - ATmega83, ATmega85
                   avr5 - ATmega161, ATmega163, ATmega32, AT94K
                   or immediate microcontroller name.
  -mall-opcodes    accept all AVR opcodes, even if not supported by MCU
  -mno-skip-bug    disable warnings for skipping two-word instructions
                   (default for avr4, avr5)
  -mno-wrap        reject rjmp/rcall instructions with 8K wrap-around
                   (default for avr3, avr5)
Known MCU names:
  avr1 avr2 avr3 avr4 avr5 at90s1200 attiny10 attiny11 attiny12 attiny15
  attiny28 at90s2313 at90s2323 at90s2333 at90s2343 attiny22 attiny26
  at90s4433 at90s4414 at90s4434 at90s8515 at90s8535 at90c8534 at86rf401
  attiny13 attiny2313 atmega603 atmega103 at43usb320 at43usb355 at76c711
  atmega48 atmega8 atmega83 atmega85 atmega88 atmega8515 atmega8535
  atmega16 atmega161 atmega162 atmega163 atmega165 atmega168 atmega169
  atmega32 atmega323 atmega325 atmega3250 atmega64 atmega128 atmega645
  atmega6450 at90can128 at94k

Report bugs to 
Hard-Drive:~/desktop/blinky_tiny user$ avr-gcc --target-help

Target specific options:
  -msize                    Output instruction sizes to the asm file
  -mshort-calls             Use rjmp/rcall (limited range) on >8K devices
  -mno-tablejump            Do not generate tablejump insns
  -mtiny-stack              Change only the low 8 bits of the stack pointer
  -mcall-prologues          Use subroutines for function prologue/epilogue
  -mno-interrupts           Change the stack pointer without disabling interrupts
  -mint8                    Assume int to be 8 bit integer
  -mmcu=                    Specify the MCU name
  -minit-stack=             Specify the initial stack address

There are undocumented target specific options as well.
AVR options:
  -mmcu=[avr-name] select microcontroller variant
                   [avr-name] can be:
                   avr1 - AT90S1200, ATtiny1x, ATtiny28
                   avr2 - AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22
                   avr3 - ATmega103, ATmega603
                   avr4 - ATmega83, ATmega85
                   avr5 - ATmega161, ATmega163, ATmega32, AT94K
                   or immediate microcontroller name.
  -mall-opcodes    accept all AVR opcodes, even if not supported by MCU
  -mno-skip-bug    disable warnings for skipping two-word instructions
                   (default for avr4, avr5)
  -mno-wrap        reject rjmp/rcall instructions with 8K wrap-around
                   (default for avr3, avr5)
Known MCU names:
  avr1 avr2 avr3 avr4 avr5 at90s1200 attiny10 attiny11 attiny12 attiny15
  attiny28 at90s2313 at90s2323 at90s2333 at90s2343 attiny22 attiny26
  at90s4433 at90s4414 at90s4434 at90s8515 at90s8535 at90c8534 at86rf401
  attiny13 attiny2313 atmega603 atmega103 at43usb320 at43usb355 at76c711
  atmega48 atmega8 atmega83 atmega85 atmega88 atmega8515 atmega8535
  atmega16 atmega161 atmega162 atmega163 atmega165 atmega168 atmega169
  atmega32 atmega323 atmega325 atmega3250 atmega64 atmega128 atmega645
  atmega6450 at90can128 at94k
  no emulation specific options.
Hard-Drive:~/desktop/blinky_tiny user$ 

I've cross checked the 'Known MCU names' list against all the devices that are supported by the Assembler, GCC, and LIBC and found the following discrepancies (targets that are not known):

    attiny13 attiny2313
    atmega48
    atmega88
    atmega165
    atmega168
    atmega325
    atmega3250
    atmega645
    atmega6450
    at90can128

So what am I missing? What else is there in the tool-chain that is not supporting these devices?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Interesting. Out of your list of discrepancies, I have successfully used avr-gcc (both WinAVR and a homebrewed version of the avr-gcc 4.1 toolchain running under Cygwin) to compile programs that target the ATtiny2313, ATmega48, and ATmega168.

Can you give some more information about your set-up? (Operating system, versions of all tools, which patches have been applied, etc.)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To test I tried compiling for a few other targets. I tried compiling for the three devices you mentioned and each give the exact same results as the Tiny13: 'unknown MCU'.
(However, I also compiled for the Tiny22, Tiny26, Mega16, and Mega128 and they were all successful)

My tool versions are:

    avr-binutils 2.16.1 avr-gcc 3.4.5
    avr-libc1.4 1.4.3
    avrdude 5.1
    gcc3.3 3.3-1819
    gcc4.0 4.0.1-5363
Patches: None

The operating system is Mac OS 10.4.8

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It appears that you used Fink to gather together all of the AVR tools.

Could you try removing all those avr-related tools, and installing the OSX-AVR distribution instead?
These packages should be properly patched for full device support.

http://sourceforge.net/project/s...

Alternatively, you may consider building the toolchain from scratch yourself, following the instructions in the avr-libc online documentation
http://www.nongnu.org/avr-libc/u...
...and applying the relevant patches from Jörg's contribution to the FreeBSD ports? (There will be patches for avr-binutils and avr-gcc.)
(binutils 2.17) http://www.freebsd.org/cgi/cvswe...

AND

(gcc 3.4.6) http://www.freebsd.org/cgi/cvswe...
OR
(gcc 4.1.1) http://www.freebsd.org/cgi/cvswe...