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

Implementing an alternative build framework with CMake#1776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fpistm merged 30 commits intostm32duino:mainfrommassonal:cmake_dev
Dec 21, 2022

Conversation

massonal
Copy link
Contributor

Implementing an alternative build framework with CMake

This PR implements an alternative build engine to Arduino IDE or arduino-cli.
Although widely compatible with these tools, a CMake implementation is much faster (especially on Windows, especially behind a proxy/firewall): in the order of 10sec, instead of up to a minute with the IDE on my machine. Other benefits include more flexibility in describing the build, and enhanced support of incremental compilation, including when making changes to the core.

Most features of Arduino IDE are reimplemented here; the most obvious missing feature is the lack of automatic dependency management (libraries). Indeed, the way Arduino implements can not be mirrored cleanly with CMake.

How to use:

Examples can be found athttps://github.com/massonal/STM32CMake_workspace.
Briefly, there needs to be a CMakeLists.txt present in the sketch, along the sources. The recommended template makes heavy use of wrapper functions designed to mirror the Arduino automation; these are implemented in the/cmake folder here.
Please readthe wiki I started writing on my fork for more details.

How to maintain

  • Arduino doesn't "see" CMake files, so this PR overall should have no effect on the Arduino tools.
  • Most CMake files are autogenerated from a template;this script updates them all. I advise running it automatically as a git hook after this PR gets merged.

fpistm reacted with thumbs up emojifpistm reacted with hooray emojifpistm reacted with heart emojifpistm reacted with rocket emojifpistm reacted with eyes emoji
@fpistmfpistm self-requested a reviewJuly 29, 2022 12:16
@massonalmassonalforce-pushed thecmake_dev branch 4 times, most recently from2f8ea81 to290b330CompareAugust 3, 2022 07:15
Copy link
Member

@fpistmfpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please use passive form as far as possible

@massonalmassonalforce-pushed thecmake_dev branch 3 times, most recently fromc0babcf tof5960abCompareAugust 4, 2022 12:53
@massonalmassonal marked this pull request as draftAugust 9, 2022 07:28
@massonalmassonalforce-pushed thecmake_dev branch 4 times, most recently fromed57b42 tofe5794cCompareAugust 12, 2022 09:31
@massonalmassonalforce-pushed thecmake_dev branch 5 times, most recently from2da70fa toc4b84c4CompareSeptember 8, 2022 06:44
massonaland others added14 commitsDecember 20, 2022 14:52
The script uses its location and arduino-cli to write a templateof the sketch's CMakeLists.txt.* Defines:  - CORE_PATH  - USER_LIBS -> for use with `external_library()`* Includes all user libraries* Usable on a given sketch or generically (use placeholders)* Optionally: run CMake (config+build)
I.e. changed some variables from "CACHE" to "regular in the parent scope"CACHE variables can exhibit some counterintuitive behavior;switching back to regular variables is thus saferand does not significantly impact build time.
Using:- platform.txt to get the version of the core- the dev version of the JSON describing all the tools+versions+deps- stand-alone: Python, wrt. version and modules.Changes:- The download folder is no longer inside Arduino_Core_STM32, but alongside.- The options to control the download (clearance + folder) are removed.- CMake: harmonize the `cmake_minimum_required()`sCMSIS and xpack are no longer downloaded _in_ the root folder, but alongside.All this parsing is costly (e.g., on rebuild), so shortcuts have been implemented ifit looks like the dependencies are satisfied already.
- Added a new kind of insight: logic structure- Added the CORE_CALLBACK overall setting
Important: the changed implemented here _require_ the userto call `project()` in "step 1", before calling any custom function,but after defining the toolchain file.The whole of Arduino_Core_STM32 (variant + core) is now addedautomatically when the user calls build_sketch() ; they don't have todo it themselves anymore.Also the standard libraries have moved from stm32_runtime to base_config.Indeed, even the files from the core depend on them.Also, _all_ the Arduino libraries depend on base_config only (even SrcWrapper).Additional dependencies were actually not needed.***Moved the CMake-related files to /cmake***-- for clarity with the remainder of the project (when using Arduino IDE)-- Also, this prevents IDEs from building the core "standalone" when seeing a CMakeLists.txt at the root,--   since that would be meaningless anyway.Also improve portability by replacing backslashes with forward slashes in paths on Windows.=======================Change: moved the download folder awayHaving the download folder along the core seemed tocause malfunctions with some external tools (Arduino plugin on VScode).Moving it in the user's home folder fixes this issue.Each core installation nonetheless has its own download subfolder,to allow different versions with different requirements to coexist.
Using a fuzzy find after parsing boards.txt.This has required refactoring the board parser code in a dedicated modules,with minor impacts in the files that depended on it.=============Doc changes:expand on the syntax in easy_setup:Added a comment block to explain the use of the DEPENDS clause.Added "usual" values for board settings.Add a link to the wiki in easy_setup.Also update link in the README_CMAKE- update link to point to the new location for the examples;- unify the displayed text for the links;- add a link to the wiki.
This adds a new keyword, BOOTLOADER, in set_board().Cmake-wise, the bootloader targets replace the board targets, they are not feature targets to plug in.
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>Signed-off-by: Alexis Masson <alexis.masson@st.com>
Mostly to benefit from the built-in "--help",as the script takes no actual argument.
ASM not being enabled when `external_library()` is calledtriggered an error where CMAKE_ASM_COMPILE_OBJECT was undefined.This commit fixes that by adding the calls to enable_language()earlier in the config process.
massonaland others added4 commitsDecember 20, 2022 16:31
Now detects and warns when arduino-cli is misconfigured,and falls back to a sensible default value for userlibs.
To mirror as closely as possible the behavior of Arduino tools.
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistmfpistm marked this pull request as ready for reviewDecember 20, 2022 16:11
@fpistmfpistm self-requested a reviewDecember 20, 2022 16:13
@fpistmfpistmforce-pushed thecmake_dev branch 2 times, most recently fromf17548f to74d524eCompareDecember 20, 2022 16:16
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Copy link
Member

@fpistmfpistm left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks@massonal for this PR.
As a first implementation it is a good job.
Ready to merge and deploy.

@fpistmfpistm merged commit280efe1 intostm32duino:mainDec 21, 2022
@fpistmfpistm added enhancementNew feature or request and removed New feature labelsJul 16, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fpistmfpistmfpistm approved these changes

Assignees

@massonalmassonal

Labels
enhancementNew feature or request
Projects
None yet
Milestone
2.4.0
Development

Successfully merging this pull request may close these issues.

2 participants
@massonal@fpistm

[8]ページ先頭

©2009-2025 Movatter.jp