platform-atmelavr icon indicating copy to clipboard operation
platform-atmelavr copied to clipboard

toolchain-atmelavr source code and build scripts?

Open mid-kid opened this issue 2 years ago • 12 comments

Hi, I'm trying to figure out a few details about the toolchain-atmelavr package:

  • Which specific version of the code is used? Is it patched?
  • How is it built? With what kind of options?
  • Where are the current binaries obtained from, if anywhere?

mid-kid avatar Nov 30 '23 11:11 mid-kid

Hi @mid-kid,

Where are the current binaries obtained from, if anywhere?

We use binaries provided by the Arduino IDE, for example: https://github.com/arduino/Arduino/blob/master/hardware/package_index_bundled.json#L74-L116

How is it built? With what kind of options?

You can find the used option if you run avr-gcc -v, for example:

Target: avr
Configured with: ../gcc/configure --enable-fixed-point --enable-languages=c,c++ --prefix=/home/jenkins-mingw32/workspace/avr-gcc-staging/label/Ubuntu14.04x64-mingw32/objdir --disable-nls --disable-libssp --disable-libada --disable-shared --with-avrlibc=yes --with-dwarf2 --disable-doc --target=avr --host=i686-w64-mingw32

Which specific version of the code is used? Is it patched?

It's GCC 7.3.0 with some additional patches, you can find sources here https://github.com/arduino/toolchain-avr

valeros avatar Dec 01 '23 18:12 valeros

Thanks! That answers most of my Qs.

Is that the json file being used as a definition, or are the package definitions for platformio hosted elsewhere?

mid-kid avatar Dec 04 '23 08:12 mid-kid

Package definitions are specified in this file https://github.com/platformio/platform-atmelavr/blob/develop/platform.json, the packages are hosted on the PlatformIO Package Registry and delivered through our CDN network.

valeros avatar Dec 04 '23 10:12 valeros

I see the toolchain-atmelavr entry in there but nothing that'd tell it where to download it from or checksum information so I'm a bit confused.

mid-kid avatar Dec 05 '23 09:12 mid-kid

PlatformIO Core handles all these things automatically. When you build a project for the first time, PlatformIO Core pulls dependencies from the PlatformIO Registry and validates checksum for each downloaded package. See https://github.com/platformio/platformio-core/blob/develop/platformio/package/download.py#L122

ivankravets avatar Dec 05 '23 10:12 ivankravets

Yeah, I'm just trying to understand the "repository" structure and how it decides to download what from where. Mostly out of personal interest, but also because I'm wary of package managers downloading random binaries from the internet. Thanks for all the answers thus far.

mid-kid avatar Dec 09 '23 11:12 mid-kid

PlatformIO Core is an OSS project. You learn more about PlatformIO Package Manager from its sources https://github.com/platformio/platformio-core/tree/develop/platformio/package/manager

The core logic is based on get_systype(). Having information about host architecture, PlatormIO Core goes to the PlatformIO Registry and looks for the best package corresponding to the https://semver.org/

ivankravets avatar Dec 09 '23 12:12 ivankravets

I see, it's querying https://api.registry.platformio.org/v3/packages/platformio/tool/toolchain-atmelavr for all the information, including download URL (from dl.registry.platformio.org) and checksum.

Is the data obtained from api.registry.platformio.org hosted in a git somewhere, or is it entered into a live database? Is the backend published anywhere?

mid-kid avatar Dec 10 '23 21:12 mid-kid

Hi, I'm also having trouble understanding how this works. Where is the source for the toolchain-atmelavr package? I haven't been able to find it anywhere, even though the license is listed as GPL-2.0-or-later

thirstyice avatar May 14 '24 00:05 thirstyice

@thirstyice

Where is the source for the toolchain-atmelavr package? I haven't been able to find it anywhere, even though the license is listed as GPL-2.0-or-later

It's generic GCC 7.3.0 with some additional patches, you can find sources here https://github.com/arduino/toolchain-avr

valeros avatar May 14 '24 10:05 valeros

How are they packaged for platformio?

thirstyice avatar May 15 '24 05:05 thirstyice

How are they packaged for platformio?

We use compiled packages provided by Arduino IDE from their manifest.

valeros avatar May 15 '24 10:05 valeros