gcc, libc for atmega4809 ?

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

I'm on linux, and prefer to use classic unix tools to cross compile for AVR.

My linux distro comes with avr-gcc 5.4.0, avr-libc-2.0.0, etc.

 

Has anyone found a way to cross-compile to the 4809?   I have tried stuffing the associated spec file from microchip "pack" into the installed gcc/libc but it's not working.

 

$ make
avr-gcc -DF_CPU=16000000 -mmcu=atmega4809 -Os  -o main.elf main.c
main.c:1:0: error: unknown core architecture 'avrxmega3' specified with '-mmcu='
 #include <util/delay.h>
 ^
main.c:1:0: note: supported core architectures: avr2 avr25 avr3 avr31 avr35 avr4
avr5 avr51 avr6 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny avr1

 

I can build gcc-8 and avr-libc from the sources, but I don't want to go down the trial-and-error path if someone else has the recipe already.

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

I don't see the -B in that you need when working with "packs"? Let me just build something in AS7 for 4809 and I'll show the build command to give you and idea.

 

EDIT: so...

		Invoking: AVR8/GNU C Compiler : 5.4.0
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG -DFOO=3  
                -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.3.300\include"  -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums 
                -g2 -Wall -pedantic -mmcu=atmega4809 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.3.300\gcc\dev\atmega4809" 
                -c -std=gnu99 -H -save-temps -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c" 

You need a similar kind of -B to say where your 4809 pack in unpacked.

Last Edited: Wed. May 15, 2019 - 02:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

... but if your version of gcc does not have the xmega3 architecture, then ... you need a version of gcc that knows about it :) 

:: 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

He said 5.4.0 - are there some 5.4.0 that do know xmega3 and some that don't? How confusing!

 

Assuming it does need an "Atmel special" then I guess he needs "AVR Toolchain for Linux" from this page...  https://www.microchip.com/mplab/avr-support/avr-and-arm-toolchains-c-compilers

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

... I don't know when xmega3 came into life...

:: 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 long long time ago in a place far far away.

 

EDIT And more specifically:  http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=history;f=ld/emulparams/avrxmega3.sh;hb=9ddc1af18c31e775ae7b107779addfcde92c723f

 

So it looks like it's been around since 2011

Last Edited: Wed. May 15, 2019 - 03:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use GCC v8+, Binutils v2.29+ and avr-libc from SVN trunk.

avrfreaks does not support Opera. Profile inactive.

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

You should be able to copy the libraries from the Atmel "Packs", using a procedure similar to the one described here:  https://www.avrfreaks.net/comment/2526416#comment-2526416

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

Thanks all.  I'm taking a shot at building from source, using svn-repo for avr-libc.  I'll let you know how it goes.

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

I have gcc-8.3.0 build running pretty far but still some issues.   Looking to build from source and add reference to files from the pack (1.3.300).  I will post when/if I get to completion.