You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Better highlight on what needs to be changed in the toolchain file
- Using in-place references for source code in the minimal project and toolchain file
- Added ready-to-use hello-world in examples/arm
Copy file name to clipboardExpand all lines: README.md
+19-40Lines changed: 19 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,10 +33,14 @@ To build a project developed with the IAR Compiler using CMake we need at least
33
33
### Configuring the toolchain file
34
34
By default, CMake uses what it assumes to be the host platform's default compiler. When the application targets an embedded platform (known as cross-compiling), a toolchain file `<toolchain-file>.cmake` can be used to indicate the desired toolchain's location for its compiler and assembler. This section provides a simple generic template for the __IAR C/C++ Compilers__.
35
35
36
-
On the [examples/iar-toolchain.cmake](examples/iar-toolchain.cmake) file from the repository you have cloned, perform the following changes to match your system:
37
-
*Update [__CMAKE_SYSTEM_PROCESSOR__](examples/iar-toolchain.cmake#L5) replacing `<arch>` by the corresponding compiler's target architecture: `430`, `8051`, `arm`, `avr`, `riscv`, `rx`, `rh850`, `rl78`, `stm8` or `v850`.
36
+
On the example toolchain file from the repository you have cloned, set the following variables to match the product installed in your system:
37
+
*Set `CMAKE_SYSTEM_PROCESSOR`:
38
38
39
-
* Update [__IAR_INSTALL_DIR__](examples/iar-toolchain.cmake#L8) to match the corresponding location where the active product was __installed__ on __your__ system, adjusting as needed.
<details> <summary><b>Notes on IAR_INSTALL_DIR</b> (Click to unfold)</summary>
42
46
@@ -52,48 +56,23 @@ On the [examples/iar-toolchain.cmake](examples/iar-toolchain.cmake) file from th
52
56
53
57
</details>
54
58
55
-
### Configuring a minimal project
56
-
A project is defined by one or more CMakeLists.txt file(s). Let's understand how a project can be configured with a simple example for the Arm target architecture.
59
+
### A minimal project
60
+
A CMake project is defined by one or more CMakeLists.txt file(s). Let's understand how a simple `hello-world`project can be configured for the Arm target architecture.
57
61
58
-
*Inside the [examples/arm](examples/arm) directory, create a new subdirectory named __hello-world__:
62
+
*Change to the `hello-world` project:
59
63
```
60
-
> cd /path/to/cmake-tutorial/examples/arm
61
-
> mkdir hello-world
62
-
> cd hello-world
63
-
```
64
-
* Create the __CMakeLists.txt__ file:
65
-
```cmake
66
-
# CMake requires to set its minimum required version
67
-
cmake_minimum_required(VERSION 3.23)
68
-
69
-
# Set the project name, enabling its required languages (e.g. ASM, C and/or CXX)
Once we have our minimal project with a suitable toolchain file, we invoke CMake to configure our build environment for when cross-compiling, choosing which _build system generator_ and which _toolchain file_ should be used for the project.
0 commit comments