Skip to content

Commit c14bed8

Browse files
committed
mbed_cli_2: Add migration guide
Add a migration guide to help show how to do things that Mbed CLI 1 could do using Mbed CLI 2. Fixes ARMmbed/mbed-tools#227
1 parent 63c75f6 commit c14bed8

File tree

1 file changed

+212
-0
lines changed

1 file changed

+212
-0
lines changed
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# Migration guide
2+
3+
If you haven't already read the [introduction](./intro.md), then start from there.
4+
5+
The background color indicates:
6+
7+
* <span style="background-color:#ccffcc;">Green: New Functionality
8+
introduced in Mbed CLI 2 (mbed-tools)</span>
9+
* <span style="background-color:#ffe6cc;">Orange: Functionality
10+
modified in Mbed CLI 2 (mbed-tools) compared to Mbed CLI 1 (mbed-cli)</span>
11+
* <span style="background-color:#ffcccc;">Red: Functionality deprecated
12+
in Mbed CLI 2 (mbed-tools)</span>
13+
14+
## Installers
15+
<span style="background-color:#ffe6cc;">Windows, macOS and Linux
16+
installers may be made available at later point of time.</span><br>
17+
18+
## Commands
19+
20+
### Device management
21+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli
22+
device-management` (device management) is deprecated. Refer to your cloud
23+
provider's documentation on how to cloud-manage your devices.</span><br>
24+
25+
### Repository management
26+
<span style="background-color:#ffcccc;">Support for Mercurial and the
27+
subcommand `mbed-cli publish` (publish program or library) is deprecated.
28+
Hosted repositories on "mbed.org" are not supported from Mbed CLI 2. Version
29+
control with git can be used as an alternative. Hosting for git repositories is
30+
available on [GitHub](https://github.com/).</span><br>
31+
32+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli cache`
33+
(repository cache management) is deprecated. No replacement is
34+
supported.</span><br>
35+
36+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli releases`
37+
(show release tags) is deprecated. We recommend using standard `git` commands
38+
instead, for example `git tag -l` to list all tagged releases.</span><br>
39+
40+
<span style="background-color:#ffe6cc;">The subcommand `mbed-cli
41+
update` (update to branch, tag, revision or latest) is not implemented. Use
42+
standard `git` commands instead. From your application directory: to check out
43+
a branch of Mbed OS, `git -C mbed-os checkout branchname`; to checkout the Mbed
44+
OS 6.8.0 release, `git -C mbed-os checkout mbed-os-6.8.0`; to check out Mbed OS
45+
revision `3e24a7ea9602`, `git -C mbed-os checkout 3e24a7ea9602`; to checkout
46+
the latest released version of Mbed OS `git -C mbed-os checkout
47+
latest`.</span><br>
48+
49+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli export`
50+
(generate an IDE project) is deprecated. Use [CMake
51+
generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
52+
instead. While CMake supports many generators, including many not supported by
53+
Mbed CLI 1, not all of Mbed CLI 1's exporters have replacements available yet.
54+
The available project generators are listed below.</span><br>
55+
56+
- [CodeBlocks](https://cmake.org/cmake/help/latest/generator/CodeBlocks.html)
57+
- [Eclipse](https://cmake.org/cmake/help/latest/generator/Eclipse%20CDT4.html)
58+
- [Make](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#id10)
59+
- [Qt Creator](https://doc.qt.io/qtcreator/creator-project-cmake.html)
60+
- [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools)
61+
62+
<span style="background-color:#ffcccc;">If you'd like to help us prioritize
63+
which CMake project generators to work on first, please give your thumbs up to
64+
the following issues you care most about, or [raise a merge request to
65+
CMake](https://gitlab.kitware.com/cmake/cmake/-/merge_requests):</span><br>
66+
67+
- [CrossCore® Embedded Studio](https://github.com/ARMmbed/mbed-tools/issues/249)
68+
- [e<sup>2</sup> studio](https://github.com/ARMmbed/mbed-tools/issues/250)
69+
- [Embitz](https://github.com/ARMmbed/mbed-tools/issues/251)
70+
- [IAR Embedded Workbench for Arm](https://github.com/ARMmbed/mbed-tools/issues/252)
71+
- [MCUXpresso](https://github.com/ARMmbed/mbed-tools/issues/253)
72+
- [NetBeans](https://github.com/ARMmbed/mbed-tools/issues/254)
73+
- [STM32CubeIDE](https://github.com/ARMmbed/mbed-tools/issues/257)
74+
- [Keil uVision](https://github.com/ARMmbed/mbed-tools/issues/256)
75+
76+
### Library management
77+
78+
<span style="background-color:#ffcccc;">The subcommands `mbed-cli add` (add
79+
library from URL) and `mbed-cli remove` (remove library) are deprecated.
80+
Instead, use `git clone` or `mbed-tools import` to clone a library. Then,
81+
manually create a `reponame.lib` file that contains a single line in the form
82+
`https://github.com/ARMmbed/reponame#branch-or-tag` to fetch a specific branch
83+
or tag. If you want to fetch the default branch, you don't need to add
84+
`#branch-or-tag-name`.</span><br>
85+
86+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli new --library`
87+
(force creation of an Mbed library) is deprecated. Create a new Mbed library by
88+
creating a new folder and adding it to git version control. Then, create a
89+
`reponame.lib` in the application you wish to use the new library from, as
90+
described above (in the `mbed-cli add` paragraph).</span><br>
91+
92+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli ls` (view
93+
dependency tree) is deprecated. The subcommand `mbed-tools deploy` will now
94+
display all dependencies.</span><br>
95+
96+
### Tool configuration
97+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli config` (tool
98+
configuration) is deprecated. There is no need to configure an Mbed-specific
99+
compiler path in Mbed CLI 2; the compiler path is determined in a standard way
100+
by CMake instead. Other configuration options, like `target`, `toolchain`,
101+
`protocol`, `depth` and `cache`, are not supported in Mbed CLI 2.</span><br>
102+
103+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli toolchain`
104+
(set or get default toolchain) is deprecated. Pass the desired toolchain on the
105+
command line when compiling with `mbed-tools compile --toolchain GCC_ARM`, to,
106+
for example, select `GCC_ARM` as the toolchain.</span><br>
107+
108+
<span style="background-color:#ffcccc;">The subcommand `mbed-cli target` (set
109+
or get default target) is deprecated. Pass the desired target on the command
110+
line when compiling with `mbed-tools compile --mbed-target
111+
DISCO_L475VG_IOT01A`, to, for example, select `DISCO_L475VG_IOT01A` as the
112+
Mbed target.</span><br>
113+
114+
115+
### Creating an Mbed program
116+
<span style="background-color:#ffe6cc;">The subcommand `mbed-tools new` creates
117+
a new Mbed program by default and supports only one command-line-option
118+
`--create-only` (create a program without fetching mbed-os). The following
119+
command-line options, previously supported in Mbed CLI 1, are deprecated:
120+
121+
* `--scm`: We now always use git.
122+
* `--program`: There is no need to specify this. `mbed-tools new` always
123+
creates a program by creating a top-level application CMakeLists.txt that
124+
invokes `add_executable()`.
125+
* `--library`: There is no need to specify this. `mbed-tools new` always
126+
creates a program. If you wish to create a library, you can edit the
127+
autogenerated top-level application CMakeLists.txt to replace
128+
`add_executable()` with `add_library()` and removing the call to
129+
`mbed_set_post_build()` for the CMake library target.
130+
* `--mbedlib`: Importing Mbed 2 is no longer supported.
131+
* `--depth`: This is no longer needed, as Mbed CLI 2 automatically uses the
132+
shallowest clone or fetch possible.
133+
* `--protocol`: This is now determined from the URL instead.
134+
* `--offline`: This is not needed, as there is no longer any Mbed-specific git
135+
cache.
136+
* `--no-requirements`: Mbed CLI 2 never automatically installs requirements.
137+
</span><br>
138+
139+
### Importing an Mbed program
140+
<span style="background-color:#ffe6cc;">The subcommand `mbed-tools
141+
import` clones an Mbed project and library dependencies. The following
142+
command-line-options supported in Mbed CLI 1 are deprecated:
143+
144+
* `--depth`: The new CLI opportunistically imports the most shallow repository
145+
possible. Running `git clone --depth <depth> <repo_url> | cd <repo_name> &&
146+
mbed-tools deploy` will create an Mbed project with the required depth.
147+
* `--protocol`: To select the protocol, use a URL with the
148+
desired protocol. For instance, you may import projects or libraries over SSH
149+
(Secure Shell) as follows `mbed-tools import
150+
git@github.com:ARMmbed/<some_driver>`, or with https `mbed-tools import
151+
https://github.com/ARMmbed/<some_driver>`. Alternatively, if you would prefer
152+
to always use SSH, even when your library or its dependencies specify https
153+
in their `.lib` files, you can add the following into your .gitconfig to
154+
force git to use SSH instead of https when fetching from GitHub.
155+
156+
```sh
157+
[url "ssh://git@github.com/"]
158+
insteadOf = https://github.com/
159+
```
160+
161+
* `--offline`: The new tool doesn't maintain a git cache so we don't have the
162+
option to use locally cached repositories.
163+
* `--no-requirements`
164+
* `--insecure`
165+
166+
</span><br>
167+
168+
### Configuring an Mbed program
169+
170+
<span style="background-color:#ccffcc;">The subcommand `mbed-tools configure`
171+
generates an Mbed OS config CMake file named `mbed_config.cmake` in the path
172+
`cmake_build/<TARGET_NAME>/<PROFILE>/<TOOLCHAIN>/`.</span><br>
173+
174+
### Compiling an Mbed program
175+
176+
<span style="background-color:#ffcccc;">The subcommand `mbed-tools
177+
compile` can be used to compile the program. The command-line-option `mbed
178+
compile --source` is deprecated. To control which libraries and directories you
179+
want to build either modify your application's `CMakeLists.txt` to add/exclude
180+
or use `cmake --build cmake_build --target <library_name> --target
181+
<other_library_name>` to add any number of targets to your build.</span><br>
182+
183+
<span style="background-color:#ffcccc;">The command-line-option `mbed
184+
compile --library` is deprecated. Use standard CMake `add_library()`
185+
instead.</span><br>
186+
187+
<span style="background-color:#ffcccc;">The command-line-option `mbed compile
188+
-DMACRO_NAME` is deprecated. Use `mbed-tools configure -m <TARGET_NAME> -t
189+
<TOOLCHAIN>` followed by `cmake -S . -B
190+
cmake_build/<TARGET_NAME>/<PROFILE>/<TOOLCHAIN> -GNinja -DMACRO_NAME` and
191+
`cmake --build cmake_build` or use
192+
[`target_compile_definitions()`](https://cmake.org/cmake/help/latest/command/target_compile_definitions.html)
193+
in your application's `CMakeLists.txt` the add the define.</span><br>
194+
195+
<span style="background-color:#ffcccc;">The command-line-option `mbed compile
196+
-m detect` to automatically build for the single target connected to your
197+
computer is deprecated. Run `mbed-tools detect` to see which targets are
198+
connected to your computer and then run `mbed-tools compile -m <TARGET_NAME> -t
199+
<TOOLCHAIN>` to build for the target you which to build for.</span><br>
200+
201+
<span style="background-color:#ffe6cc;">The command-line-option `mbed
202+
compile --build` will be supported at later point of time. Although we don't
203+
currently have the option to explicitly state the application's build path, we
204+
have a ticket open to track the issue
205+
[#184](https://github.com/ARMmbed/mbed-tools/issues/184).</span><br>
206+
207+
### Testing an Mbed program
208+
209+
<span style="background-color:#ffe6cc;">The subcommand `mbed test` will be
210+
supported at later point of time. Keep apprised of progress by following [the
211+
issue to support mbed test on
212+
GitHub](https://github.com/ARMmbed/mbed-tools/issues/151)</span><br>

0 commit comments

Comments
 (0)