Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cmsis_mcu_descr.py for custom targets #394

Merged
merged 4 commits into from
Nov 24, 2024

Conversation

JohnK1987
Copy link
Member

@JohnK1987 JohnK1987 commented Nov 22, 2024

Summary of changes

This PR will update cmsis_mcu_descr.py to be able to operate also for custom targets.

Impact of changes

The script was able to scan only targets.json5 file and potential existence of custom_targets.json5 was ignored.
Well, no more.

Migration actions required

N/A

Documentation

N/A


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[x] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR
Console output
[main] Configuring project: mbed-ce-custom-targets 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE:STRING=Develop -DMBED_TARGET:STRING=F103VGT6 -DUPLOAD_METHOD:STRING=NONE -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -SC:/MbedCE/mbed-ce-custom-targets -Bc:/MbedCE/mbed-ce-custom-targets/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Found Python3: C:/MbedCE/mbed-ce-custom-targets/mbed-os/venv/Scripts/python.exe (found version "3.12.4") found components: Interpreter 
[cmake] -- Mbed: First CMake run detected, generating configs...
[cmake] INFO: Custom_targets file detected - C:\MbedCE\mbed-ce-custom-targets\custom_targets\custom_targets.json5
[cmake] INFO: Scanning targets.json5 for used MCU names...
[cmake] INFO: Scanning custom_targets.json/json5. for used MCU names...
[cmake] INFO: Scanning cmsis_mcu_descriptions.json5 file for missing MCUs...
[cmake] INFO: CMSIS MCU description cache was last updated: 4 months ago
[cmake] INFO: In case of Custom target remove 'device_name' from your custom_targets.json5 file and add
[cmake] just the 'memories' section as 'memory_banks' section from content below.
[cmake] Otherwise add the whole following entries to C:\MbedCE\mbed-ce-custom-targets\mbed-os\targets\cmsis_mcu_descriptions.json5:
[cmake] {
[cmake]     "STM32F103VG": {
[cmake]         "algorithms": [
[cmake]             {
[cmake]                 "default": true,
[cmake]                 "file_name": "Flash/STM32F10x_1024.FLM",
[cmake]                 "ram_size": null,
[cmake]                 "ram_start": null,
[cmake]                 "size": 1048576,
[cmake]                 "start": 134217728,
[cmake]                 "style": "Keil"
[cmake]             },
[cmake]             {
[cmake]                 "default": false,
[cmake]                 "file_name": "Flash/STM32F10x_OPT.FLM",
[cmake]                 "ram_size": null,
[cmake]                 "ram_start": null,
[cmake]                 "size": 16,
[cmake]                 "start": 536868864,
[cmake]                 "style": "Keil"
[cmake]             }
[cmake]         ],
[cmake]         "family": "STM32F1 Series",
[cmake]         "from_pack": {
[cmake]             "pack": "STM32F1xx_DFP",
[cmake]             "url": "https://www.keil.com/pack/",
[cmake]             "vendor": "Keil",
[cmake]             "version": "2.4.1"
[cmake]         },
[cmake]         "memories": {
[cmake]             "IRAM1": {
[cmake]                 "access": {
[cmake]                     "execute": false,
[cmake]                     "non_secure": false,
[cmake]                     "non_secure_callable": false,
[cmake]                     "peripheral": false,
[cmake]                     "read": true,
[cmake]                     "secure": false,
[cmake]                     "write": true
[cmake]                 },
[cmake]                 "default": true,
[cmake]                 "p_name": null,
[cmake]                 "size": 98304,
[cmake]                 "start": 536870912,
[cmake]                 "startup": false
[cmake]             },
[cmake]             "IROM1": {
[cmake]                 "access": {
[cmake]                     "execute": true,
[cmake]                     "non_secure": false,
[cmake]                     "non_secure_callable": false,
[cmake]                     "peripheral": false,
[cmake]                     "read": true,
[cmake]                     "secure": false,
[cmake]                     "write": false
[cmake]                 },
[cmake]                 "default": true,
[cmake]                 "p_name": null,
[cmake]                 "size": 1048576,
[cmake]                 "start": 134217728,
[cmake]                 "startup": true
[cmake]             }
[cmake]         },
[cmake]         "name": "STM32F103VG",
[cmake]         "processors": [
[cmake]             {
[cmake]                 "address": null,
[cmake]                 "ap": 0,
[cmake]                 "apid": null,
[cmake]                 "core": "CortexM3",
[cmake]                 "default_reset_sequence": null,
[cmake]                 "dp": 0,
[cmake]                 "fpu": "None",
[cmake]                 "mpu": "Present",
[cmake]                 "name": null,
[cmake]                 "svd": "SVD/STM32F103xx.svd",
[cmake]                 "unit": 0
[cmake]             }
[cmake]         ],
[cmake]         "sub_family": "STM32F103",
[cmake]         "vendor": "STMicroelectronics:13"
[cmake]     }
[cmake] }
[cmake] ERROR: Target specifies device_name STM32F103VG but this device is not
[cmake] listed in C:\MbedCE\mbed-ce-custom-targets\mbed-os\tools\cmake\..\..\targets\cmsis_mcu_descriptions.json5. Please verified you device name in mbed-os	argets.json or your custom_targets.json5 file.
[cmake] Otherwise, see the instructions above this message.
[cmake] 
[cmake] More information may be available by using the command line option '-vv'.
[cmake] CMake Error at mbed-os/tools/cmake/mbed_generate_configuration.cmake:123 (message):
[cmake]   mbedtools configure failed! Cannot build this project.  Command was cd
[cmake]   C:/MbedCE/mbed-ce-custom-targets/mbed-os/tools/cmake/../python &&
[cmake]   C:/MbedCE/mbed-ce-custom-targets/mbed-os/venv/Scripts/python.exe -m
[cmake]   mbed_tools.cli.main -v configure -t GCC_ARM -m F103VGT6 --mbed-os-path
[cmake]   C:/MbedCE/mbed-ce-custom-targets/mbed-os/tools/cmake/../..  --output-dir
[cmake]   C:/MbedCE/mbed-ce-custom-targets/build --program-path
[cmake]   C:/MbedCE/mbed-ce-custom-targets --app-config
[cmake]   C:/MbedCE/mbed-ce-custom-targets/mbed_app.json5 --custom-targets-json
[cmake]   C:/MbedCE/mbed-ce-custom-targets/custom_targets/custom_targets.json5
[cmake] Call Stack (most recent call first):
[cmake]   mbed-os/tools/cmake/app.cmake:24 (include)
[cmake]   CMakeLists.txt:27 (include)
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE:STRING=Develop -DMBED_TARGET:STRING=F103VGT6 -DUPLOAD_METHOD:STRING=NONE -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -SC:/MbedCE/mbed-ce-custom-targets -Bc:/MbedCE/mbed-ce-custom-targets/build -G Ninja exited with code: 1

Reviewers


the fetch-missing is scanning also custom_target.json5 file if exist in project, for help not solve missing memory banks
Copy link
Collaborator

@multiplemonomials multiplemonomials left a comment

Choose a reason for hiding this comment

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

I like it, but we need to figure out a more robust way for the script to find custom_targets.json5

@JojoS62
Copy link

JojoS62 commented Nov 24, 2024

just a thought, shouldn't it be possible to use also .json for compatibility reasons?

@multiplemonomials multiplemonomials merged commit 0fb002c into master Nov 24, 2024
52 checks passed
@multiplemonomials multiplemonomials deleted the update-cmsis_mcu_descr.py branch November 24, 2024 23:17
@JohnK1987 JohnK1987 mentioned this pull request Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants