Skip to content

Commit c49b0b5

Browse files
authored
Update README.md
- Added CXARM
1 parent 43fe1a8 commit c49b0b5

1 file changed

Lines changed: 32 additions & 31 deletions

File tree

README.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
CMake is an open-source, cross-platform family of tools maintained and supported by Kitware. Among its many features, it essentially provides [Makefile Generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#id11) and [Ninja Generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#id12) which compose scripts for cross-compiling C/C++ embedded software projects based on one or more `CMakeLists.txt` configuration files.
44

5-
This tutorial offers a short introduction for those seeking information on how to start using the IAR C/C++ Compiler together with CMake from the command line. While this guide is based on the IAR Build Tools for Arm version 9.50.1 on Linux, it should work with other supported IAR products with no or minimal changes.
5+
This tutorial offers a short introduction for those seeking information on how to start using the IAR C/C++ Compiler together with CMake from the command line. While this guide is based on the IAR Build Tools for Arm (CXARM) 9.60.4 on Linux, it should work with other supported IAR products with no or minimal changes.
66

77
## Prerequisites
88
Before you begin, you will need to download and install the IAR product, CMake and then clone this repository.
99

1010
1) Download, install and activate[^1] your IAR product
1111

12-
| __Product__ | __Evaluation__ | __IAR Customers (login required)__ |
13-
| - | - | - |
14-
| IAR Build Tools | [Contact us](https://iar.com/about/contact) | [for Arm](https://updates.iar.com/?product=BXARM) (or for others[^2]) |
15-
| IAR Embedded Workbench | [Download](https://www.iar.com/products/free-trials/) | [for Arm](https://updates.iar.com/?product=EWARM) (or for others[^2]) |
12+
| Product | Evaluation | IAR Subscribers (login required)
13+
| - | - | -
14+
| IAR Build Tools (CX) ☁️ | [Contact us](https://iar.com/about/contact) | [for Arm](https://updates.iar.com/?product=CXARM) (or for others[^2])
15+
| IAR Build Tools (BX) | [Contact us](https://iar.com/about/contact) | [for Arm](https://updates.iar.com/?product=BXARM) (or for others[^2])
16+
| IAR Embedded Workbench | [Try now](https://www.iar.com/embedded-development-tools/free-trials) | [for Arm](https://updates.iar.com/?product=EWARM) (or for others[^2])
1617

1718
2) Download and install [CMake](https://github.com/Kitware/CMake/releases/latest).
1819

@@ -58,24 +59,24 @@ target_link_options(tutorial PRIVATE
5859
### Enabling the IAR Compiler
5960
CMake uses the host platform's default compiler. When cross-compiling embedded applications, the compiler must be set manually via [`CMAKE_<lang>_COMPILER`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) variables for each supported language. Additionally, it is possible to specify a build tool via [`CMAKE_MAKE_PROGRAM`]():
6061

61-
| Variable | Description | Examples |
62-
| - | - | - |
63-
| `CMAKE_C_COMPILER` | Must point to the C Compiler executable | `"C:/Program Files/..../arm/bin/iccarm.exe"`<br>`"/opt/iarsystems/bxarm/arm/bin/iccarm"` |
64-
| `CMAKE_CXX_COMPILER` | Must point to the C++ Compiler executable | `"C:/Program Files/..../arm/bin/iccarm.exe"`<br>`"/opt/iarsystems/bxarm/arm/bin/iccarm"` |
65-
| `CMAKE_ASM_COMPILER` | Must point to the Assembler executable | `"C:/Program Files/..../arm/bin/iasmarm.exe"`<br>`"/opt/iarsystems/bxarm/arm/bin/iasmarm"` |
66-
| `CMAKE_MAKE_PROGRAM` | Must point to the build tool executable | `"C:/Program Files/..../common/bin/ninja.exe"`<br>`"/opt/iarsystems/bxarm/common/bin/ninja"` |
62+
| Variable | Description | Examples (for Arm)
63+
| - | - | -
64+
| `CMAKE_C_COMPILER` | Must point to the C Compiler executable | `"/opt/iar/cxarm/arm/bin/iccarm"`<br>`"/opt/iarsystems/bxarm/arm/bin/iccarm"`<br>`"C:/iar/..../arm/bin/iccarm.exe"`
65+
| `CMAKE_CXX_COMPILER` | Must point to the C++ Compiler executable | `"/opt/iar/cxarm/arm/bin/iccarm"`<br>`"/opt/iarsystems/bxarm/arm/bin/iccarm"`<br>`"C:/iar/..../arm/bin/iccarm.exe"`<br>`"${CMAKE_C_COMPILER}"`
66+
| `CMAKE_ASM_COMPILER` | Must point to the Assembler executable | `"/opt/iar/cxarm/arm/bin/iasmarm"`<br>`"/opt/iarsystems/bxarm/arm/bin/iasmarm"`<br>`"C:/iar/..../arm/bin/iasmarm.exe"`
67+
| `CMAKE_MAKE_PROGRAM` | Must point to the build tool executable | `"/opt/iar/cxarm/common/bin/ninja"`<br>`"/opt/iarsystems/bxarm/common/bin/ninja"`<br>`"C:/iar/..../common/bin/ninja.exe"`
6768

6869
During the configuration phase, CMake reads these variables from:
69-
- a separate file called "toolchain file" that you invoke `cmake` with `--toolchain /path/to/<filename>.cmake` (see provided example files [bxarm.cmake](tutorial/bxarm.cmake) and [ewarm.cmake](tutorial/ewarm.cmake)) -or-
70-
- the [`CMAKE_TOOLCHAIN_FILE`](https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html) variable, when you invoke `cmake` with `-DCMAKE_TOOLCHAIN_FILE=/path/to/<filename>.cmake` (useful for earlier CMake versions) -or-
70+
- a separate file called "toolchain file" that you invoke `cmake` with `--toolchain /path/to/<filename>.cmake` (see provided example files [cxarm.cmake](tutorial/cxarm.cmake), [bxarm.cmake](tutorial/bxarm.cmake) and [ewarm.cmake](tutorial/ewarm.cmake)) -or-
71+
- the [`CMAKE_TOOLCHAIN_FILE`](https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html) variable, when you invoke `cmake` with `-DCMAKE_TOOLCHAIN_FILE=/path/to/<filename>.cmake` (useful CMake < 3.21) -or-
7172
- invoking `cmake` with `-DCMAKE_<lang>_COMPILER=/path/to/icc<target>` -or-
7273
- the user/system environment variables [`CC`](https://cmake.org/cmake/help/latest/envvar/CC.html), [`CXX`](https://cmake.org/cmake/help/latest/envvar/CXX.html) and [`ASM`](https://cmake.org/cmake/help/latest/envvar/ASM.html) which can be used to override the platform's default compiler -or-
7374
- the IAR Embedded Workbench IDE 9.3 or later, shipped with IAR products starting from the IAR Embedded Workbench for Arm 9.50, where the available IAR toolchain environment is automatically set for CMake projects (See [this article](https://github.com/IARSystems/cmake-tutorial/wiki/Building-and-Debugging-from-the-Embedded-Workbench) for details).
7475

7576
### Configure and Build
7677
We are ready to build our first project! Run CMake to configure the project and then build it with your chosen build tool.
7778

78-
- Before starting to use CMake, make sure your compiler is working and does not run into any [license issues](#issues). Example (for Arm):
79+
- Before starting to use CMake, make sure your compiler is working properly. Example (for Arm):
7980
```
8081
/path/to/iccarm --version
8182
```
@@ -85,10 +86,10 @@ We are ready to build our first project! Run CMake to configure the project and
8586
mkdir build
8687
```
8788

88-
- Next, navigate to that build directory and run CMake to configure the project and generate a native build system using the compiler specified in the `bxarm.cmake` toolchain file (if needed, edit the supplied toolchain file to match your tool):
89+
- Next, navigate to that build directory and run CMake to configure the project and generate a native build system using the compiler specified in the `cxarm.cmake` toolchain file (if needed, edit the supplied toolchain file to match your tool):
8990
```
9091
cd build
91-
cmake .. -G Ninja --toolchain ../bxarm.cmake
92+
cmake .. -G Ninja --toolchain ../cxarm.cmake
9293
```
9394

9495
- Then call CMake for building the executable using the build system:
@@ -100,19 +101,19 @@ cmake --build .
100101
Let's test the application. To run the executable you will need the non-interactive[^3] command line interface for the IAR C-SPY Debugger (`cspybat`) with the proper drivers for the desired target. Amongst the many ways of accomplishing this, let's take advantage of the `add_test()` for testing the application in a Arm Cortex-M4 simulated target.
101102

102103
This section is interactive. In this example we will use Arm. So, you will need to update your Tutorial's `CMakeLists.txt`:
103-
- Firstly add [`enable_testing()`](https://cmake.org/cmake/help/latest/command/enable_testing.html#command:enable_testing) to enable testing:
104+
- Firstly add [`enable_testing()`](https://cmake.org/cmake/help/latest/command/enable_testing.html) to enable testing:
104105
```cmake
105106
enable_testing()
106107
```
107108

108-
- Then use [`add_test()`](https://cmake.org/cmake/help/latest/command/add_test.html#add-test) to encapsulate the command line `cspybat` needs. In the example below, the parameters are adjusted for simulating a generic Arm Cortex-M4 target environment:
109+
- Then use [`add_test()`](https://cmake.org/cmake/help/latest/command/add_test.html) to encapsulate the command line `cspybat` needs. In the example below, the parameters are adjusted for simulating a generic Arm Cortex-M4 target environment:
109110
```cmake
110111
add_test(NAME tutorialTest
111-
COMMAND /opt/iarsystems/bxarm/common/bin/CSpyBat
112+
COMMAND /opt/iar/cxarm/common/bin/CSpyBat
112113
# C-SPY drivers for the Arm simulator via command line interface
113-
/opt/iarsystems/bxarm/arm/bin/libarmPROC.so
114-
/opt/iarsystems/bxarm/arm/bin/libarmSIM2.so
115-
--plugin=/opt/iarsystems/bxarm/arm/bin/libarmLibsupportUniversal.so
114+
/opt/iar/cxarm/arm/bin/libarmPROC.so
115+
/opt/iar/cxarm/arm/bin/libarmSIM2.so
116+
--plugin=/opt/iar/cxarm/arm/bin/libarmLibsupportUniversal.so
116117
# The target executable (built with debug information)
117118
--debug_file=$<TARGET_FILE:tutorial>
118119
# C-SPY driver options
@@ -123,7 +124,7 @@ add_test(NAME tutorialTest
123124
>[!TIP]
124125
>- Read this [article](https://github.com/iarsystems/cmake-tutorial/wiki/CTest-with-IAR-Embedded-Workbench-for-Arm) for the specifics when driving tests from IAR Embedded Workbench for Arm.
125126
126-
- Now use the [`PASS_REGULAR_EXPRESSION`](https://cmake.org/cmake/help/latest/prop_test/PASS_REGULAR_EXPRESSION.html#prop_test:PASS_REGULAR_EXPRESSION) test property to validate if the program emits the expected string to the standard output (`stdout`). In this case, verifying that `printf()` prints the expected message.
127+
- Now use the [`PASS_REGULAR_EXPRESSION`](https://cmake.org/cmake/help/latest/prop_test/PASS_REGULAR_EXPRESSION.html) test property to validate if the program emits the expected string to the standard output (`stdout`). In this case, verifying that `printf()` prints the expected message.
127128
```cmake
128129
set_tests_properties(tutorialTest PROPERTIES PASS_REGULAR_EXPRESSION "Hello world!")
129130
```
@@ -133,7 +134,7 @@ set_tests_properties(tutorialTest PROPERTIES PASS_REGULAR_EXPRESSION "Hello worl
133134
cmake --build .
134135
```
135136

136-
- And finally we call CMake's [`ctest`](https://cmake.org/cmake/help/latest/manual/ctest.1.html#manual:ctest(1)) which subsequently will execute `Tutorial.elf` using the IAR C-SPY Debugger for Arm:
137+
- And finally we call CMake's [`ctest`](https://cmake.org/cmake/help/latest/manual/ctest.1.html) which subsequently will execute `Tutorial.elf` using the IAR C-SPY Debugger for Arm:
137138
```
138139
ctest
139140
```
@@ -151,7 +152,7 @@ For technical support contact [IAR Customer Support][url-iar-customer-support].
151152

152153
For questions related to this tutorial: try the [wiki][url-repo-wiki] or check [earlier issues][url-repo-issue-old]. If those don't help, create a [new issue][url-repo-issue-new] with detailed information.
153154

154-
[^1]: For more information, see the "Installation and Licensing" guide for your product. If you do not have a license, [contact us](https://iar.com/about/contact).
155+
[^1]: For more information, see the "Installation and Licensing" guide for your product. If you are not a subscriber yet, [contact us](https://iar.com/about/contact).
155156
[^2]: CMake has built-in IAR C/C++ Compiler support for the following non-Arm architectures: 8051, AVR, MSP430, RH850, RISC-V, RL78, RX, STM8 and V850.
156157
[^3]: For interactively debugging of executable files (`*.elf`) using the C-SPY Debugger from the IAR Embedded Workbench IDE, read [this wiki article][url-wiki-ide-build-debug].
157158

@@ -162,11 +163,11 @@ For questions related to this tutorial: try the [wiki][url-repo-wiki] or check [
162163
[url-repo-issue-new]: https://github.com/IARSystems/cmake-tutorial/issues/new
163164
[url-repo-issue-old]: https://github.com/IARSystems/cmake-tutorial/issues?q=is%3Aissue+is%3Aopen%7Cclosed
164165

165-
[url-help-cmake_minimum_required]: https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html#command:cmake_minimum_required
166-
[url-help-project]: https://cmake.org/cmake/help/latest/command/project.html#command:project
167-
[url-help-add_executable]: https://cmake.org/cmake/help/latest/command/add_executable.html#command:add_executable
168-
[url-help-target_sources]: https://cmake.org/cmake/help/latest/command/target_sources.html#target-sources
169-
[url-help-target_compile_options]: https://cmake.org/cmake/help/latest/command/target_compile_options.html#target-compile-options
170-
[url-help-target_link_options]: https://cmake.org/cmake/help/latest/command/target_link_options.html#target-link-options
166+
[url-help-cmake_minimum_required]: https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html
167+
[url-help-project]: https://cmake.org/cmake/help/latest/command/project.html
168+
[url-help-add_executable]: https://cmake.org/cmake/help/latest/command/add_executable.html
169+
[url-help-target_sources]: https://cmake.org/cmake/help/latest/command/target_sources.html
170+
[url-help-target_compile_options]: https://cmake.org/cmake/help/latest/command/target_compile_options.html
171+
[url-help-target_link_options]: https://cmake.org/cmake/help/latest/command/target_link_options.html
171172

172173
[url-wiki-ide-build-debug]: https://github.com/IARSystems/cmake-tutorial/wiki/Building-and-Debugging-from-the-Embedded-Workbench

0 commit comments

Comments
 (0)