How is the Arduino IDE, CLI and Core developed?

I'd like to set up a development environment in which I can make changes to the Arduino Core and maybe also the Arduino IDE.
I managed to set up the Arduino IDE from source (the beta version). But it is unclear to me where it gets the Arduino Core code from. I can see that it downloads an arduino-cli binary which is probably based on this project, but I don't understand where the source code for the bootloaders etc. is and how I can modify it. It sounds like the arduino-cli can be used to download the bootloaders (cores) for specific devices, but I'd assume those cores would come precompiled and even if not, I don't see how I could safely work in a directory that might get wiped any time the arduino-cli wants to install a core update.
Ideally I'd simply have a separate directory for each git project. E.g.

  • arduino-cli
  • arduino-ide
  • ArduinoCore-avr

and have them all linked together.

It is not to be rude, but if you cannot figure out an answer to those questions by your self, you should probably not make any modifications to it! :expressionless:

felic:
I managed to set up the Arduino IDE from source (the beta version).

Way cool! I've only nibbled around the edges of the source code, but I have built it from source quite a bit and found that to be refreshingly straightforward.

felic:
But it is unclear to me where it gets the Arduino Core code from.

When you install Arduino AVR Boards via the Arduino IDE's Boards Manager, it downloads it from the archive files URLs defined in the official package index here:
https://downloads.arduino.cc/packages/package_index.json

felic:
I can see that it downloads an arduino-cli binary which is probably based on this project,

That's correct.

felic:
I don't understand where the source code for the bootloaders etc. is

Both the bootloader source code and compiled binaries are available here:

felic:
how I can modify it

Here you are getting into the more old school C and makefile paradigm where things tend to be more of a pain. If you want to play around with bootloaders, I would recommend this project:

It's the same bootloader as used on the Arduino Uno and Nano, but our hero Bill Westfield has carried on with conscientious development and mainainership since the version Arduino has locked in for the official boards. So I think you'll find that building it from source is easier (even some nice documentation) and that more targets are supported (including ATmega2560!).

felic:
how I could safely work in a directory that might get wiped any time the arduino-cli wants to install a core update.

The common practice among Arduino boards platform developers, including Arduino's own is to put the working copy of the boards platform in the hardware subfolder of the sketchbook folder (File > Preferences > Sketchbook Location in the IDE or directories.user configuration key in Arduino CLI). Boards Manager installations won't affect that folder. A neat trick is to use Boards Manager to install the release version of the platform to get the toolchain, then install the development version in your sketchbook with a modified vendor folder name, but the same architecture folder name (e.g., hardware/arduino-development/avr). This causes the platform to be recognized as different from the release version, but to still be able to use the tools provided by the release version.

Unfortunately, Arduino IDE 2.x doesn't currently support the skechbook boards platforms:

But Arduino CLI and the classic Arduino IDE support it perfectly well, so it's still a viable strategy.

One thing I want to caution you against is getting all this too much mixed up together. You are covering a huge amount of ground from Arduino IDE to Arduino CLI to boards platforms to core libraries to bootloaders. Even though they are all part of the Arduino experience, these are very much distinct components. You might be better off to focus your attention on only one at a time. The developer at Arduino who writes the Arduino IDE 2.x code likely has never looked at a single line of the bootloader source code. Being proficient in TypeScript is plenty enough of an accomplishment on its own.

Danois90:
It is not to be rude, but if you cannot figure out an answer to those questions by your self, you should probably not make any modifications to it! :expressionless:

Meh, I say feel free to experiment and play in the Arduino spirit. But also understand that it will likely take a lot of perseverence to get anything more than cryptic error messages in return for your efforts.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.