mbed-ce / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
79 stars 15 forks source link

Add feature for auto search of upload method config for custom targets #250

Closed JohnK1987 closed 7 months ago

JohnK1987 commented 7 months ago

Summary of changes

This PR is in context of many discussions and I hope everyone will find its option.

In current state Mbed CE build system auto searches only for upload method config for regular targets. In case of custom targets is expected the config will be defined via top level cmakelist.

// this is example how look current structure of a project with a custom target
./Project_Name/
│
├── mbed-os/
├── Build/
├── Custom_targets/
│   ├── YOUR_TARGET/
│   │   └──  somefiles.xxx
│   ├── ANOTHER_TARGET/
│   │   └──  somefiles.xxx
│   └── CMakeLists.txt
│
├── CMakeLists.txt
├── mabed_app.json
├── custom_targets.json
└── main.cpp

This PR brings the build system will also search for an upload method config in custom_targets/upload_method_cfg/ folder (it mirrors same logic from mbed-os/targets/upload_method_cfg/ folder) and also brings an option to change default expected path via top lvl cmakelist.

// this is example how will look new expected structure of a project with a custom target
./Project_Name/
│
├── mbed-os/
├── Build/
├── Custom_targets/
│   ├── YOUR_TARGET/
│   │   └──  somefiles.xxx
│   ├── ANOTHER_TARGET/
│   │   └──  somefiles.xxx
│   │
│   ├── upload_method_cfg/
│   │   ├──  YOUR_TARGET.cmake
│   │   └──  ANOTHER_TARGET.cmake
│   └── CMakeLists.txt
│
├── CMakeLists.txt
├── custom_targets.json
├── mabed_app.json
└── main.cpp

We will have an official automated solution how to deal with upload method config file for custom targets. But also a solution for anyone who want to go its own way.

Impact of changes

Migration actions required

N/A

Documentation

How will this merged I can update custom target example as soon as possible.


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

Reviewers

@multiplemonomials