Skip to content

Commit ed96f2b

Browse files
Felipe TorrezanFelipe Torrezan
authored andcommitted
Move toolchain file section
1 parent 537cb52 commit ed96f2b

1 file changed

Lines changed: 34 additions & 33 deletions

File tree

README.md

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,6 @@ The required tools are similar either if __Windows__ or __Linux__ is being used:
2525
>:warning: In order to conveniently execute __cmake__ and __ninja__ from anywhere in your system, without specifying their respective full paths, make sure their locations are in the `PATH` variable of your operating system.
2626
2727

28-
## Configuring the toolchain file
29-
When cross-compiling applications with CMake, an appropriate `<toolchain-file>.cmake` must be specified.
30-
This file contains the toolchain's location for its compiler and assembler.
31-
32-
This section provides a simple example of a generic __toolchain file__ for CMake that can be used along with the __IAR C/C++ Compiler__.
33-
34-
On the [examples/iar-toolchain.cmake](examples/iar-toolchain.cmake) file, perform the following changes to match your system:
35-
* Update [__CMAKE_SYSTEM_PROCESSOR__](examples/iar-toolchain.cmake#L11) with one of the valid compiler's target `<arch>`:
36-
>`430`, `8051`, `arm`, `avr`, `riscv`, `rx`, `rh850`, `rl78`, `stm8` or `v850`.
37-
38-
* Update [__IAR_INSTALL_DIR__](examples/iar-toolchain.cmake#L14) to point to the location where the corresponding IAR tools are __installed__ on __your__ system:
39-
>__Windows__ examples:
40-
>```
41-
>"C:/Program\ Files/IAR\ Systems/Embedded\ Workbench\ 9.0"
42-
>```
43-
>```
44-
>"C:/IAR_Systems/EWARM/9.10.2"
45-
>```
46-
>__Linux__ examples:
47-
>```
48-
>"/opt/iarsystems/bxarm-9.10.2"
49-
>```
50-
>```
51-
>"/opt/iarsystems/bxarm"
52-
>```
53-
> __Notes__
54-
> * If the __IAR_INSTALL_DIR__ contains blank spaces, it might be necessary to escape them using backslashes `\ ` or, instead, use `\\`.
55-
> * __Do not__ include `<arch>/bin` on the __IAR_INSTALL_DIR__ variable. The `<arch>` will be automatically added in the [__TOOLKIT_DIR__](https://github.com/IARSystems/cmake-tutorial/blob/1.0.0/examples/iar-toolchain.cmake#L17) variable using __CMAKE_SYSTEM_PROCESSOR__. The `/bin` sub-directory will be hardcoded to the ephemeral `PATH` environment variable used internally while CMake is running.
56-
57-
* When using the __IAR Assembler__ for `430`, `8051`, `avr` or `v850` architecture, update [__CMAKE_ASM_COMPILER__](examples/iar-toolchain.cmake#L29) to:
58-
>`"a${CMAKE_SYSTEM_PROCESSOR}"`
59-
60-
6128
## Examples
6229
In this section you will find examples on how `CMakeLists.txt` files can be created to build __executable__ targets as well as __library__ targets.
6330

@@ -119,6 +86,40 @@ Instructions for [building](#building-projects) and [testing](#testing-projects)
11986

12087

12188
## Building Projects
89+
90+
### Configuring the toolchain file
91+
When cross-compiling applications with CMake, an appropriate `<toolchain-file>.cmake` must be specified.
92+
This file contains the toolchain's location for its compiler and assembler.
93+
94+
This section provides a simple example of a generic __toolchain file__ for CMake that can be used along with the __IAR C/C++ Compiler__.
95+
96+
On the [examples/iar-toolchain.cmake](examples/iar-toolchain.cmake) file, perform the following changes to match your system:
97+
* Update [__CMAKE_SYSTEM_PROCESSOR__](examples/iar-toolchain.cmake#L11) with one of the valid compiler's target `<arch>`:
98+
>`430`, `8051`, `arm`, `avr`, `riscv`, `rx`, `rh850`, `rl78`, `stm8` or `v850`.
99+
100+
* Update [__IAR_INSTALL_DIR__](examples/iar-toolchain.cmake#L14) to point to the location where the corresponding IAR tools are __installed__ on __your__ system:
101+
>__Windows__ examples:
102+
>```
103+
>"C:/Program\ Files/IAR\ Systems/Embedded\ Workbench\ 9.0"
104+
>```
105+
>```
106+
>"C:/IAR_Systems/EWARM/9.10.2"
107+
>```
108+
>__Linux__ examples:
109+
>```
110+
>"/opt/iarsystems/bxarm-9.10.2"
111+
>```
112+
>```
113+
>"/opt/iarsystems/bxarm"
114+
>```
115+
> __Notes__
116+
> * If the __IAR_INSTALL_DIR__ contains blank spaces, it might be necessary to escape them using backslashes `\ ` or, instead, use `\\`.
117+
> * __Do not__ include `<arch>/bin` on the __IAR_INSTALL_DIR__ variable. The `<arch>` will be automatically added in the [__TOOLKIT_DIR__](https://github.com/IARSystems/cmake-tutorial/blob/1.0.0/examples/iar-toolchain.cmake#L17) variable using __CMAKE_SYSTEM_PROCESSOR__. The `/bin` sub-directory will be hardcoded to the ephemeral `PATH` environment variable used internally while CMake is running.
118+
119+
* When using the __IAR Assembler__ for `430`, `8051`, `avr` or `v850` architecture, update [__CMAKE_ASM_COMPILER__](examples/iar-toolchain.cmake#L29) to:
120+
>`"a${CMAKE_SYSTEM_PROCESSOR}"`
121+
122+
122123
### Generate a <i>Project Buildsystem</i>
123124
The general syntax to generate the input files for a native build system is:
124125
```

0 commit comments

Comments
 (0)