ATTiny1614 linux support

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

Hi all,

Two disclaimers - I am quite new to the AVR world and this is the first time I have booted into Windows in almost half a year (and that was to install AtmelStudio :) so apologies in advance for any n00b q's. I have however dabbled with PICs in the past, but the biggest problem I had with these was the lack of a decent (free) C compiler.

Reading about avr-gcc I thought this would be perfect for my Linux development, so designed a board around an ATTiny1614 with UDPI as the programming pin, it turns out I should have done more research.

 

Having purchased the Ateml ICE (one of the few programmers claiming to support UDPI) it seems that avr-gcc doesn't support this device. In Atmel Studio things are slightly better; the part is detected but examples are very scarce. Port definitions appear to be completely different from the 100's of other LED blinking examples out there. Instead of using

DDRB = (1 << PB0);

one sets it Port B, pin 0 using

VPORTB_DIR = PIN0_bm

 

I have now managed (by trolling this forum) to get a LED to flash under Atmel Studio, but was hoping to ultimately develop under Linux.

Onto concrete questions:

- Does anyone have any tips to getting this Atmel part working with Linux?

- Any links to good example code for this device - how/why is it different from the other Atmel devices?

 

That will do for a start; many thanks in advance!
 

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

m.prebble wrote:
- Does anyone have any tips to getting this Atmel part working with Linux?
Build Microchip AVR GCC 3.6.1, though 3.6.0 is in some Linux distributions, or build FSF AVR GCC 8.0

UPDI is in the forthcoming AVRDUDE 6.4

 

http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/3.6.1/SOURCES.README

https://gcc.gnu.org/gcc-8/changes.html

http://svn.savannah.gnu.org/viewvc/avrdude/trunk/avrdude/NEWS?revision=1425&view=markup

via http://savannah.nongnu.org/projects/avrdude

 

"Dare to be naïve." - Buckminster Fuller

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

Also, look at the text at http://distribute.atmel.no/tools... for how to download device support and add it to any avr-gcc

 

As for the headers, you should probably read AVR1000 describing the XMEGA header style.

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

A sincere thanks to both @gchapman and @meolsen for the invaluable advice and links.

Building the toolchain for Linux was not as straightforward as expected - for some reason the compiler was getting specs from Ubuntu's version  avr-gcc which didn't support the xmega3 architecture and thus crucial libs such as libm weren't built. By removing Ubuntu distro version of avr-gcc helped and now I can build my Atmel start project after a few tweaks in the Makefile.

Unfortunately avr-gdb has failed to build due to some error in ncurses:

 

In file included from /home/marcus/dev/atmel/gcc_build/src/ncurses-5.9/ncurses/curses.priv.h:283:0,
                 from ../ncurses/lib_gen.c:19:
_11439.c:835:15: error: expected ‘)’ before ‘int’
../include/curses.h:1594:56: note: in definition of macro ‘mouse_trafo’
 #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
                                                        ^
Makefile:785: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
make[1]: Leaving directory '/home/marcus/dev/atmel/gcc_build/build/ncurses/ncurses'
Makefile:109: recipe for target 'all' failed
make: *** [all] Error 2

There is probably a patch for this, but will come back to avr-gdb when I need it.

@gchapman, checking out the SVN version of avrdude and building from source was sufficient enough to get it to to program successfully ...woo!

 

One thing which still doesn't work so well is avr-size: In Atmel Studio it will print out the % used etc. In my version, the -C doesn't recognize the device even though the path to avr-size seems correct. (actually running avr-size --mlist doesn't list my elusive ATTiny1614).

Is there an environment variable/option to point it to my device/ why does avr-gcc support it?

 

As always, thanks in advance for any tips.

 

Last Edited: Sun. Apr 15, 2018 - 04:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

Well done!

m.prebble wrote:
Unfortunately avr-gdb has failed to build due to some error in ncurses:
Is ncurses compatible?

gdb-avr builds successfully on Debian with ncurses 6.1

https://packages.debian.org/buster/gdb-avr

 

"Dare to be naïve." - Buckminster Fuller

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

@meolsen Morten, thank you. avr-objdump using the ELF file works a treat.

@gchapman - yeah, ncurses 6.1 built without issue so that did the trick. I think the http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/3.6.1/SOURCES.README

needs updating, as it specifically says ncurses-5.9 is required.

Eventually Linux distros will end up shipping a newer avr-gcc package and building from source will become a non-issue. But as an aside, I want to say how nice it is to find such a knowledgeable and helpful community. I would probably not have been able to get this working without this forum.

 

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

Well done!

m.prebble wrote:
Eventually Linux distros will end up shipping a newer avr-gcc package ...
Some distributions move faster than others; Arch Linux seems relatively up to date.

Others?

m.prebble wrote:
... and building from source will become a non-issue.
fyi, FSF AVR GCC 8 has tinyAVR 1-series.

https://gcc.gnu.org/gcc-8/changes.html

 


https://www.archlinux.org/packages/?q=avr-gcc

 

"Dare to be naïve." - Buckminster Fuller

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

m.prebble wrote:
... ncurses 6.1 built without issue so that did the trick.
AVaRICE from repository has EDBG but doesn't have tiny1614; might not take much effort to add tinyAVR 1-series to AVaRICE.

Otherwise, it's Windows and Atmel Studio 7 atbackend.exe

 

https://sourceforge.net/p/avarice/code/commit_browser

Making GDB attach to gdbserver instead of launching

by janj

https://www.avrfreaks.net/forum/making-gdb-attach-gdbserver-instead-launching

...

https://www.avrfreaks.net/forum/making-gdb-attach-gdbserver-instead-launching#comment-2420641

 

"Dare to be naïve." - Buckminster Fuller