Hi,

as far as I know, the development of gcc port for AVR stalled for some time and there were some licensing issues. The result is that both Ubuntu and Debian got stuck with some ancient versions (Ubuntu has version 7.3, Debian has 5.4.) According to Ubuntu website, none of them support these newer devices.

I remember working around it by downloading some kind of pack file from Microchip website. Don't have the original file anymore but I found something on my PC that is probably its unpacked contents. Among others, it has these directories:

include/avr
gcc/dev/

There is also an xc8 directory in there.

If this is what you have, then you're all set. According to my notes, for simple testing you can use -B and -I switches to point gcc to the location where you unpacked the file. If you don't want to bother with that, the files that need to be moved to /usr are:

/usr/lib/avr/include/avr/ioavr128da28.h
/usr/lib/avr/lib/avrxmega4/crtavr128da28.o
/usr/lib/avr/lib/avrxmega4/libavr128da28.a
/usr/lib/gcc/avr/5.4.0/device-specs/specs-avr128da28

In Ubuntu case, 5.4.0 version in the path will need to be replaced with actual version number as found in Ubuntu.

To avoid manual changes, I made a Debian package instead - nothing complicated, you just create a directory (say atpack) and place the files as if the directory was your filesystem root. Aside from that, you also need to create "atpack/DEBIAN" directory containing a file called "control"

Package: avr-libc-avr128-atpack
Version: 20250428
Architecture: all
Section: otherosfs
Maintainer: Name <email>
Priority: optional
Depends: gcc-avr (>= 5.4.0+Atmel3.6.2-1), binutils-avr (>= 2.26.20160125+Atmel3.6.2-1)
Description: Standard C library for Atmel AVR development - AVR128
 Standard library used to the development of C programs for the
 Atmel AVR micro controllers. This package contains static
 libraries as well as the header files needed.
 .
 These libraries are downloaded from microchip website
 as a non-free software

Run "fakeroot-sysv dpkg -b atpack ." and you are golden (first parameter is the directory where you put the files, the second parameter - the dot - decides where the resulting .deb file ends up being.) You may need dpkg-dev package installed for the -b switch to work and the fakeroot-sysv command comes from fakeroot package.

Install with "dpkg -i avr-libc-avr128-atpack_20220201_all.deb" (as root)

Another option could be upgrading your Ubuntu to the new one - 25.04. Apparently, it has gcc-avr 14.2 which already contains the files from the pack file. Note that if you decide to create the package manually first and then attempt the upgrade, you will probably end up with conflict (same files in two packages.) Uninstalling the manually created package before running the upgrade should prevent that from happening.

Dne 2025-04-28 18:39, Alan C. Assis napsal:
Hi KR,

What avr-gcc version are you using?

I'm getting this error: "avr-gcc: error: device-specs/specs-avr128da28: No
such file or directory"

I found a reference to it here:
https://www.avrfreaks.net/s/topic/a5C3l000000UlWyEAK/t193338

I downloaded the Microchip.AVR-Dx_DFP.2.7.321.atpack file renamed it to
Microchip.AVR-Dx_DFP.2.7.321.zip and extract it, but I think it is
something ot xc8 from Microchip...

Are you using Linux as well? I'm using Ubuntu and just ran: "sudo apt
install avr-gcc". Could you please

BR,

Alan

On Sun, Apr 27, 2025 at 7:49 AM <kr....@kerogit.eu> wrote:

Hi,

thanks for the response and for the PR on GitHub.

> Ok. If possible, could you explain the issue with github?

Well, it's a personal thing. Aside from the usual gripe about big
corporation there is also a clause in their Terms of Service that
requires the user to "agree to submit to the exclusive jurisdiction and
venue of the courts located in the City and County of San Francisco,
California." And that's certainly something I don't agree with.

> I think in this case we could add _bm and _bp as exceptions as well.

The _bm case is the most prevalent in the current source so that's a
great help. There are currently two cases of _gp and around 10 cases of
_gc so that should be manageable to redefine in the architecture code.
It also seems like I missed a 5th suffix - _gm - but that also has
around 10 uses currently.

Even with the bm exception though, the nxstyle tools reports mixed case
errors. Apparently, it cannot apply the exception for the line of code
which looks like this:

ret = (VPORTA.IN & (PIN2_bm | PIN3_bm)) >> 2;

Splitting it into two lines works though and it should yield the same
result in the machine code.

ret = (VPORTA.IN & (PIN2_bm | PIN3_bm));
ret >>= 2;

I'll incorporate these changes to the next revision of the patch series
and also submit a patch for the nxstyle.c

>
>> 2. These patches depend on "nuttx/clock: make NSEC_PER_USEC and others
>> long" (ac42add946) being applied. It is only present in NuttX master
>> branch and needs to be cherry-picked for testing on the branch based
>> on
>> release 12.9
>>
>>
> Could you please give more details here?

Since the fixes were applied to the master branch, I expect the
remaining patches in the series to go there as well - in which case
everything is sorted and nothing else needs to be done, the patch
ac42add946 is present there. The issue why that patch is needed is
explained in
https://lists.apache.org/thread/xzor3tjy9jozlmox82frd27v969b37l4 . In
short - without this patch, avr-gcc will produce malfunctioning code
when converting between ticks and time.

Hope I didn't miss any questions, please point it out if I did. Other
than that, I will try to submit second version of the patch series
during the next week.

Thanks for the review.

Reply via email to