Commit Graph

68 Commits

Author SHA1 Message Date
Yasser Grimes
7938a8a80f McuSupport: Store macros as part of McuSdkRepository
To support extending the macros and calling the
McuTargetFactory::expandVariables function statically, the macros are
added as part of the SdkRepository.

This commit also adds helper functions to extend macros other than the
ones created from the packages.

Change-Id: Ie7d2a9ad626782eec18738bdd3472ffd202e7a36
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-28 11:57:37 +00:00
Rainer Keller
9257a15a68 McuSupport: The armgcc version string does not contain 'v'
Change-Id: Ic259bed17a97bccb64f427ce2054efc9d05b55f2
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-26 09:26:58 +00:00
Daniele Bortolotti
16261ad472 McuSupport: Improve version detector logic
McuPackageDirectoryVersionDetector class name was misleading,
McuPackageDirectoryEntriesVersionDetector better describes its
purpose as it can be used to search for a regex match among the
entries in packagePath filtered by filePattern. Also, remove
isFile boolean member variable since is not needed for current
use cases, ie Renesas Graphics library (RGL), and filePattern
can be used instead.

Also, improve version detector creation logic. If no filePattern
is present in the Json kit file, the regex match is based on
packagePath only, which is the correct way to detect the version
for RGL.

Task-number: UL-6642
Change-Id: I3ee2fdb623bdd77aea60f9eae3672b9b5aa40433
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-24 11:40:11 +00:00
Rainer Keller
34d0f2e678 McuSupport: Fix invalid version detector being instantiatied
In case the JSON entry was missing completely, a directory version detector
was instantiated.
Instantiate version dectectors only if there is enough and valid
information available.

Change-Id: Iaf9cd40165e4d75124f3e0ddda66db2f4dab5ff7
Reviewed-by: Daniele Bortolotti <daniele.bortolotti@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-24 10:59:49 +00:00
Sivert Krøvel
b1a3e136b6 McuSupport: Add handling of os-specific validation paths
Before the refactoring, the various third party packages had detection
paths set to facilitate picking the correct subdirectory in QtCreator.
Adding these paths to the JSONs prompts hints in the Devices>MCU UI to
which path to enter, and prevents the user from picking the wrong path

Since the paths might vary based on the host-os, it is necessary to
enable parsing this from JSONs, similar to how the "defaultValue" is
handled. The "detectionPath" entry can either be an object with
separate values in fields named "windows" and "linux", or a string.

Change-Id: I813affe856fe73f6cf34ea75850500b49a1b2b6a
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
Reviewed-by: Kwangsub Kim <kwangsub.kim@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
2022-10-24 07:09:39 +00:00
Rainer Keller
6326ccfe30 McuSupport: Store the source location of the JSON file
This allows to mention the file name the configuration was created from in
error messages.

Change-Id: Id8e3d4a754cf5c1f0a12c6b21af1158713c68690
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-24 06:27:57 +00:00
Kwangsub Kim
d7f9f45daf McuSupport: Identify MinGW toolchain
QtMCUs will support MinGW toolchain for Windows desktop platform,
so MinGW toolchain needs to be identified.

If the default toolchain or a user configured one is a correct
MinGW toolchain, it would be selected. If not, a proper toolchain
would be picked up from the registered toolchains in Qt Creator.

Task-number: UL-6607
Change-Id: I82580d721d9ed916a6b32d35c124a638d7a3e68e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-20 17:55:00 +00:00
Piotr Mućko
9b47b1575a McuSupport: 3rd party packages creation tests
Change-Id: I0f9ed6c49b28007c617627525fc081ae9152e3f1
Reviewed-by: hjk <hjk@qt.io>
2022-10-12 14:50:41 +00:00
Sivert Krøvel
531e1a572e McuSupport: Add flag in JSON for adding a package path to system path
An entry called "addToSystemPath" was added to JSON files to signal
whether the corresponding path should also be added to the system path.

Task-number: UL-6409
Change-Id: I2d7ba38b3905d67475a3c482692e4f8e21d4141e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit fb643db088)
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-07 15:01:37 +00:00
Yasser Grimes
e38efabea9 McuSupport: support reading packages defaultValues depending on OS
default values can vary between windows and linux so when it is the
case a json object can be specified to describe the default values for
both.

Change-Id: Ifd3e4225ba0e1b1760f93ecea9cfafa4545c3404
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-09-27 09:05:11 +00:00
Alessandro Portale
76fc1bddfa McuSupport: Fix some warnings
Change-Id: I301e3194248423323f15f0e1404535f6eff692da
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-26 09:15:35 +00:00
Piotr Mućko
df92e79da4 McuSupport: Sync JSON files with QtMCUs repo and related fixes
This synchronizes JSON files used by unit tests with files
in QtMCUs repo. To do that some changes in code were needed.

QtMCUs package is no longer created for each JSON file. Because of
its nature it's created once and passed to each target.

Unit tests now have verifyPackage function to avoid duplication
of checks.

In test creating target QtMCUs package is checked beside toolchain
ones.

Change-Id: I5dea470daf184b45facfaaa793c359310ac22fc1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-23 07:48:14 +00:00
Christian Stenger
28349c1b08 McuSupport: Fix tests
Change-Id: If8d8f00bef3ebf163f59036661e6b99be9b3e2ec
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-12 10:30:38 +00:00
Sivert Krøvel
0a17b29cfb McuSupport: Check FreeRTOS path for required files
It is easy to pick the wrong directory for FreeRTOS sources when
configuring an MCU device. This commit adds a check that the
supplied path contains tasks.c, which probably means the given
directory is correct.

Task-number: QTCREATORBUG-27180
Change-Id: Iff1242e8970e59bf334d50829dd1d5bdd8164d47
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-09-07 15:11:41 +00:00
Piotr Mućko
fe5fdce2d6 McuSupport: Compare OS specific paths in unit test
Change-Id: I95cae23dc1aebfa5f9d7ff7c6cb36f984b2d53a5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
2022-09-06 07:42:03 +00:00
Piotr Mućko
9552658b2b McuSupport: Use qtc Utils::Environment helpers instead of qt globals
Change-Id: I7e50c7a2417dd6cf2abf6f46a67bbc7eed6f664d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-01 11:58:21 +00:00
Piotr Mućko
c060e2e5c8 McuSupport: Add missing PackageDescription members initialization in tests
Change-Id: Iee9dce4833c5f9ccf8521952c82b215e17d1a72a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-01 10:13:18 +00:00
Eike Ziller
c79d4bd606 MCU: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*
And instead of qgetenv.
Takes Qt Creator's setting at "Environment > System > Environment" into
account, which makes it easier on some platforms to set them (e.g.
macOS), can be configured differently in different settings paths, and
potentially can be changed at runtime (depending on usage).

Change-Id: Ib644dd6178bf9e0a1a75a2c6cf49fd5f3d121cf4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-08-31 06:19:45 +00:00
Piotr Mućko
d76ba33381 McuSupport: unittests for legacy 3rd party package creation
Change-Id: I83e3daf1f718066b20798aae2cf19836529b1f56
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-08-29 11:50:50 +00:00
Piotr Mućko
d66b791df1 McuSupport: Use MacroExpander for variables evaluation
Change format of variables to qtcreator's internal:
From $Qul_DIR to %{Env:Qul_DIR}.

Change-Id: I3838593b979a0a9b7d85e77114b1b129e1a128da
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-08-29 10:46:59 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Piotr Mućko
3ec085b4f4 McuSupport: Use constants for qt MCUs package variables
Change-Id: I7ca83a6ed3981005bf562d4937d6b27bbcfd53eb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-08-25 07:52:00 +00:00
Piotr Mućko
6a8a6d937c McuSupport: Create freeRTOS package from JSON
Adjust test JSONs.
Write unit tests.
Adjust existing package creation to support freeRTOS package.

Example JSON:
"freeRTOS": {
    "cmakeVar": "FREERTOS_DIR",
    "defaultValue": "$QUL_BOARD_SDK_DIR/rtos/freertos/freertos_kernel",
    "envVar": "IMXRT1064_FREERTOS_DIR",
    "id": "NXP_FREERTOS_DIR",
    "label": "FreeRTOS SDK for MIMXRT1064-EVK",
    "optional": false,
    "setting": "FreeRTOSSourcePackage_IMXRT1064",
    "type": "path"
}

Change-Id: I25ca9f732cd3a54eebb23b73b7950e11976c0f68
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-08-25 07:51:52 +00:00
Piotr Mućko
fe9de4e205 McuSupport: Evaluate cmake variables in paths
Change-Id: I04dd77bd5420e57903afe281e6e2601782795909
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-08-22 17:36:18 +00:00
Piotr Mućko
cb24da01b3 McuSupport: Evaluate environment variables in paths
Packages are created as defined in JSON. Some paths
contain variables. This creates dependencies between
packages. After all packages are created and collected
environment variables are evaluated in one pass. McuTarget
packages get updated.

This is needed because we shouldn't show the user paths
with variables in them. Also file picker wouldn't work.

There will be cmake variables support in separate commit.

Change-Id: Id210ea394f3f5bb5a14d87f3cf6a0a9a99e690bf
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-08-17 12:17:38 +00:00
Piotr Mućko
662281e837 McuSupport: Parse and create qt for MCUs package
Change-Id: I295f8c275d67992ba633f194ace119c2784d8525
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-08-17 12:16:27 +00:00
Piotr Mućko
038b839f9e McuSupport: Remove unavailable JSON param
freeRTOS' boardSdkSubDir param in JSON was removed long time ago.
It's time to remove corresponding code.

Change-Id: I6805aaa51cce599f5505fbc74692ed562f448ad4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-08-17 10:27:42 +00:00
Yasser Grimes
a8e1ab9c56 McuSupport: Fix tests and non legacy code for desktop kits
Post merge updates for the "Add toolchain information for desktop kits"
task.

Task-number: QTCREATORBUG-26750
Change-Id: Idd230589650f88d921f5f97c2bbecabac4784584
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-08-10 14:26:11 +00:00
Piotr Mućko
e8b25f1e75 McuSupport: Tests fixup
Change-Id: Ida4fab44f9e3736efb0253d4c270981ecc544e2c
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-08-04 09:58:30 +00:00
Piotr Mućko
2e70915ab0 McuSupport: Use FilePath::fromUserInput instead of fromString
to normalize path separators for all OS-es

Change-Id: Iad6ea4abf21ba57705e07007bb238ebd7748ecfe
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
2022-08-01 14:01:47 +00:00
Piotr Mućko
5be5f7a331 McuSupport: Version detection handling for kit requirements
Create appropriate instance of version detector depending on
parsed data from JSON and pass it to McuPackage's ctor. Also tests.

Change-Id: I4f7e5cd6d998745dfe951284c34904526abc216b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-07-11 07:23:38 +00:00
Eike Ziller
c7b724c4ca Merge remote-tracking branch 'origin/8.0'
Change-Id: Ia1c97d5949de607177a5a0632c7e8a37cbfd3475
2022-06-27 10:33:44 +02:00
hjk
2496ffe3ce Code cosmetics
Mostly unused #include's, also sort them or reduce scope.

A few namespaces, ...

Change-Id: I9ee71e07de7157c9942125672addf87dd41e78f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-06-24 14:44:13 +00:00
Piotr Mućko
cf147aa4b6 McuSupport: Organize namespaces, separate legacy constants
qtc9 will use new implementation for qtForMCUs 2.3 and newer.
Legacy implementation will be used for older versions.

Change-Id: Ibb2919f25d03d6445b8328e20316d4f88203a463
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-06-24 08:32:14 +00:00
Piotr Mućko
c1a223549b McuSupport: Show toolchain packages in UI
For new implementation toolchain  packages must be added
to rest of traget's packages to be visible in UI.

Change-Id: I6804a114e05caac1d864ceffb378f3f61481c433
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-06-22 12:34:27 +00:00
Piotr Mućko
bc2aee1af5 McuSupport: Test Qt MCUs package legacy creation
Change-Id: I8e724e11f8342ef02a8ee7246fbf35e65e0166a1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-06-22 10:57:49 +00:00
Piotr Mućko
73a0929bba McuSupport: Create board sdk packages
Adapt legacy implementation and pass appropriate data
to new implementation in McuTargetFactory::createPackage.

Change-Id: I13e0896e219cea2629e15de2a6885df457249790
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-06-22 09:59:47 +00:00
Piotr Mućko
2bdb75ac7a McuSupport: Pass versioning from json to McuPackage ctor
Use versions parameter from JSON kits.
Instead of setting version in separate step pass it directly
to ctor.

Change-Id: I7ac9017d56dafa316f95ba4c504dcb0af641dbdc
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-06-17 06:54:24 +00:00
Piotr Mućko
6f2a7d50bc McuSupport: Access ToolChainFactory static member using scope resolution
Change-Id: Iec1863c8f52dc8c7a30535b3c52ac2c661398dbb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-06-14 13:29:54 +00:00
Piotr Mućko
1c4abbf069 McuSupport: Auto manage memory of McuPackage's version detector
Use smart pointer for member of McuPackage.

Change-Id: I2474fc791b91c489be77aee3aab86401aaef76e8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-06-10 11:19:49 +00:00
Piotr Mućko
3b02d7b32a McuSupport: Use legacy implementation for QtMCUs 2.2
New implementation of mcu support plugin is not yet finished
so we should use legacy implementation for QtMCUs 2.2 JSON kits.

Change-Id: I8e6a8b7af2c3b4683bb19a5f05edd6ff5df46e5b
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-06-02 12:38:47 +00:00
Eike Ziller
b3dfcfd3b7 McuSupport: Fix compiler warnings
- override missing for mock methods
- remove unused variable

Change-Id: If703b60dece417fc7dc004d67966f2b6b8281990
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 18:20:14 +00:00
Christian Stenger
8479cb1514 McuSupport: Fix tests
Note, this also changes how the CMAKE_TOOLCHAIN_FILE is stored
inside the settings.

Change-Id: I018cc44be37deef36d685eb856bb706f47274017
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-05-11 10:23:01 +00:00
Piotr Mućko
d4c582d227 McuSupport: Test package fallback/default path
Change-Id: I26107fc28fd4d82a550953a38649a19e43563b47
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-09 08:16:05 +00:00
Piotr Mućko
4fde5f11ce McuSupport: Tests overhaul, mocks verification
Change-Id: I710a58b987c501dfff1102a6e3361981df4fdaee
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-09 08:15:28 +00:00
Piotr Mućko
3c3ea74ca2 McuSupport: Separate toolchain file and compiler packages
Toolchain package represents information about compiler and toolchain
file (.cmake). This information is parsed from JSON and used for Kit
creation. This includes cmake variables, path to compiler. This patch
extracts information about toolchain file into separate McuPackage.

Change-Id: Id165bdc5afa5d7cf5b5c96620e11cb878254c181
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-05-06 08:52:16 +00:00
Piotr Mućko
7cef593ec0 McuSupport: Extract settings handling to a class
Change-Id: I671098f14d7bc13255dc130a4de1ab97d5bdab94
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-04-28 10:29:20 +00:00
Christian Stenger
70dde948ed McuSupport: Fix tests
Change-Id: Ia40a8aa6af12c93087a20ce2b2000cccd8fd6e0c
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-04-13 11:27:44 +00:00
Erik Verbruggen
1d63eaee23 Change two paths from QString to FilePath
Fixes: QTCREATORBUG-27144
Change-Id: I41ecc2e96b61a5a8383ef710b558f65e93c5b591
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-04-07 12:26:57 +00:00
Piotr Mućko
566cea1b60 McuSupport: Update test json files to new format
2.1 is released hence uses legacy creation of packages.
McuSupport refactoring is part of QtMCU 2.2.
Will be finished before qtc 8.
It will be documented before 2.2 and qtcreator 8.

Change-Id: Iab0e85f27186149cb73456983d15b30401d99233
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-04-04 13:03:52 +00:00