Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Arduino (in)compatibility

Frederic Pillon edited this pageMar 6, 2023 ·1 revision

Deviations to the behavior of Arduino IDE

While the CMake toolsuite aims at replicating the behavior of Arduino IDE, there may be some deviations, by design or accident.This page lists all such known deviations.

Source files

Arduino IDE dynamically discovers all the source files of the sketch when rebuilding.On the other hand, with the CMake tools, there is a hard-coded list of files to update manually (cf.build_sketch().).

This comes from the different levels at which the tools operate: Arduino IDE behaves as a build system, while CMake is ameta build system.This means that, while CMake can discover all the source files when it is manually invoked,it may not be reinvoked (as should be) after a source file is added, since it was not "monitoring" that file in the first place.Please reat thewarning note in the CMake documentation for details.

Also, as mentioned inthe Arduino documentation, all the.ino files of the sketch are concatenated during the pre-processing step.This is not implemented with CMake, as most sketches have a single.ino file, but if you fill the need for this feature, please submit a PR!

On the other hand, Arduinorequires each sketch to have a.ino file with the same name as the sketch folder.In CMake, there is no such restriction; you may name your.ino files differently, or even not have any.ino file at all.

Final tweak: as part of the conversion.ino ->.cpp, Arduino IDE generates the prototypes of all the functions defined in .ino files.This is meant mostly for beginners, so that they may write their functions in any order without the added complexity of prototypes.This process is replicated with CMake, with the slight nuance that Arduino runs the GCC preprocessorbefore doing this,in order to resolve all the macros and get "sane" C++ code. As opposed to this, CMake does not model the preprocessing stage, so it has to workon the "raw".ino file. Usually this has no consequence whatsoever, but it may cause trouble if you use complex macros that alter the structureof the code.

Library management

Arduino IDE comes with a full library management suite, to download and update third-pary libraries as needed.This is out of the scope of the CMake tool; users have to download and manage their libraries externally.It is, however, possible to reuse the libraries installed byarduino-cli, e.g., by using thequickstart script.

Second item, Arduino IDE discovers at compile-time what libraries the sketch needs.This is done by catching GCC errors during the preprocessing stage, and fuzzy matching the missing#include with all the available libraries,as described intheir documentation.

CMake does not have access to all these dataat configure-time; also, it does not model the preprocessing at all.This means the dependency resolution process, if implemented, would have been awkward and fragile.This is why another solution has been preferred: to have the user fill in all the dependencies manually (cf. theDEPENDS keyword in several functions inFunctions reference.)

Upload, serial monitor, debugger

These items are out of the scope of a CMake-based tool. Your IDE may handle (part of) those features; please refer to its documentation.As a fallback,arduino-cli may also be used to these ends.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp