Arduino IDE 2.3.4 on Windows 11 setting compile options

I want to set compile options for gcc to do a workaround for compile errors. Looked for documentation, but don't find any. I know the file/preferences to set verbose options, but nothing to change/add gcc options. Please help.

See if this helps
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Hi sonofcy, this is not what I'm looking for. I know the sources where I can find options. I don't know where in the IDE the wanted options have to be set.

I haven't used one in a while, but I believe you can put them in your source code as #pragma. You can also put them in your libraries as platform.local.txt but if you want them for an entire platform, then you modify the platfor.txt in each affected platdform.

1 Like

Hi @hwilly. Some Arduino boards platforms do provide menus that allow the user to control specific compiler options. For example, the "Compiler warnings" preference determines which warning flags are passed to the compiler. For some boards, you will also find custom menus under Arduino IDE's "Tools" menu that allows you to control other specific compiler options.

To set arbitrary compiler options, there are a couple of possible approaches:

Arduino CLI

Arduino provides a command line tool named Arduino CLI. This tool provides some capabilities that can be useful to advanced users.

One of those advanced capabilities is the ability to change the values of the configuration properties of the Arduino boards platform via the --build-property flag of the arduino-cli compile command:

https://arduino.github.io/arduino-cli/dev/commands/arduino-cli_compile/#options:~:text=of%20your%20OS.-,--build-property,-stringArray%20%20%20%20%20%20%20%20%20%20%20%20Override%20a

Please note that the --build-property flag is a very powerful tool that should only be used if you have a good understanding of the internal workings of the Arduino boards platforms you are using it with.

Platform Configuration Files

The compilation commands invoked by Arduino IDE are generated from templates defined in the configuration files of the platform of the board you are compiling for. As @sonofcy said, you can change the compilation commands by editing those configuration files.

You can learn about this subject from the Arduino Platform Specification:

https://arduino.github.io/arduino-cli/latest/platform-specification/

A feature you might find useful when modifying an existing platform is the platform.local.txt and boards.local.txt files:

Placing your modifications in these files instead of editing platform.txt and boards.txt directly allows you to keep your changes separate, which make it easy to revert or adjust them later, and also to reapply them after you use the Arduino IDE Boards Manager to update the platform (which will cause all modifications you made to the platform to be lost).


It sounds like this may be a "XY problem". If you provide a detailed explanation of the problem you are having and exactly what you are trying to accomplish, the forum helpers might be able to provide higher quality assistance.

2 Likes

Hi @sonofcy and @ptillisch , I think your answers show the information what I'm looked for. I'm going to study the documents. What I'm doing currently is, to upload a sketch for the LILYGO T-Panel S3. The examples are full of library problems, probably due to not adapted to Arduino IDE 2.3. I'm a hobbyist, so this problem is not urgent. I try to solve such problems by myself, but will ask the forum when I stuck and don't see how to proceed. Therefore I try get more information about the problem with the LILYGO with help of GCC options. I'm impressed by your quick and useful answers.

1 Like

Not likely, are you aware that the new Boards 3 has some issues, try backing off to 2.0.17. boards, NOT libraries, and Espressif not Arduino. See pic.

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