Skip to content

Commit 4d50612

Browse files
committed
Update README.md
Here is an alternative ordering of the instructions where the configuring of the tools comes before the examples. Just discard this change if you don't like it!
1 parent ed96f2b commit 4d50612

1 file changed

Lines changed: 57 additions & 61 deletions

File tree

README.md

Lines changed: 57 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -24,67 +24,6 @@ The required tools are similar either if __Windows__ or __Linux__ is being used:
2424

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
27-
28-
## Examples
29-
In this section you will find examples on how `CMakeLists.txt` files can be created to build __executable__ targets as well as __library__ targets.
30-
31-
The examples work with all the architectures supported in CMake.
32-
33-
__CMake 3__ has been described as the beginning of the "Modern CMake" age. Since then, it has been advised to avoid variables in favor of targets and properties. The commands __add_compile_options()__, __include_directories()__, __link_directories()__, __link_libraries()__, that were at the core of __CMake 2__, should now be replaced by target-specific commands.
34-
35-
The __CMakeLists.txt__ in the examples use expressions that look like this `$<...>`. Those are the so-called [_generator expressions_][url-cm-docs-genex] (or _genex_, for short) and they allow us to express our intentions in many powerful ways.
36-
37-
>:warning: In order to get the all the examples, you can clone this repository __or__, if you want to get only the files from a single example, click on its respective link in the examples' titles and get it bundled in a __zip__ archive.
38-
39-
40-
### Example 1 - [Mixing C and Assembly][url-repo-example1]
41-
The [mix-c-asm](examples/mix-c-asm) project demonstrates the basic concepts on how to build a single executable target (__mixLanguages__) using __C__ and __Assembly__ sources.
42-
43-
It also shows:
44-
* How to use __target_compile_definitions()__ to set preprocessor symbols that can be used in the target's sources.
45-
* __Windows-only__: How to execute the target using the [IAR C-SPY Debugger Simulator][url-iar-docs-cspybat] via CTest.
46-
47-
Each `<arch>` has its own __CMakeLists.txt__. The file is located in the respective `<arch>` folder and has further comments. Below you will find the direct links to each of them:
48-
49-
| [`430`][430-ex1] | [`8051`][8051-ex1] | [`arm`][arm-ex1] | [`avr`][avr-ex1] | [`riscv`][riscv-ex1] | [`rx`][rx-ex1] | [`rh850`][rh850-ex1] | [`rl78`][rl78-ex1] | [`stm8`][stm8-ex1] | [`v850`][v850-ex1] |
50-
| - | - | - | - | - | - | - | - | - | - |
51-
52-
Instructions for [building](#building-projects) and [testing](#testing-projects) these projects are provided below.
53-
54-
55-
### Example 2 - [Creating and using libraries][url-repo-example2]
56-
The [using-libs](examples/using-libs) project demonstrates some advanced features and how to build one executable target (__myProgram__) linked against a static library target (__myMath__) using __C__ sources.
57-
58-
It also shows:
59-
* How to use __set_target_properties()__ to propagate configuration details across the target options.
60-
* How to set __target_linker_options()__ to create a map file of the executable.
61-
* How to use __add_custom_target()__ for executing `ielftool` and generate an `.ihex`|`.srec`|`.bin` output.
62-
* __Windows-only__: How to execute the target using the [IAR C-SPY Debugger Simulator][url-iar-docs-cspybat] via CTest.
63-
64-
The __myMath__ library target is located in the __lib__ subdirectory. The library contains functions which take two integer parameters to perform basic arithmetic over them, returning another integer as result.
65-
66-
The __myProgram__ executable target is located in the __app__ subdirectory. The program performs arithmetic operations using the __myMath__'s library functions.
67-
68-
For each architecture, the project uses 3 __CMakeLists.txt__. These files have further comments.
69-
70-
* The __CMakeLists.txt__ in the __top-level__ directory:
71-
72-
| [`430`][430-ex2-t] | [`8051`][8051-ex2-t] | [`arm`][arm-ex2-t] | [`avr`][avr-ex2-t] | [`riscv`][riscv-ex2-t] | [`rx`][rx-ex2-t] | [`rh850`][rh850-ex2-t] | [`rl78`][rl78-ex2-t] | [`stm8`][stm8-ex2-t] | [`v850`][v850-ex2-t] |
73-
| - | - | - | - | - | - | - | - | - | - |
74-
75-
* The __lib/CMakeLists.txt__ for the __library__ target:
76-
77-
| [`430`][430-ex2-l] | [`8051`][8051-ex2-l] | [`arm`][arm-ex2-l] | [`avr`][avr-ex2-l] | [`riscv`][riscv-ex2-l] | [`rx`][rx-ex2-l] | [`rh850`][rh850-ex2-l] | [`rl78`][rl78-ex2-l] | [`stm8`][stm8-ex2-l] | [`v850`][v850-ex2-l] |
78-
| - | - | - | - | - | - | - | - | - | - |
79-
80-
* The __app/CMakeLists.txt__ for the __executable__ target:
81-
82-
| [`430`][430-ex2-a] | [`8051`][8051-ex2-a] | [`arm`][arm-ex2-a] | [`avr`][avr-ex2-a] | [`riscv`][riscv-ex2-a] | [`rx`][rx-ex2-a] | [`rh850`][rh850-ex2-a] | [`rl78`][rl78-ex2-a] | [`stm8`][stm8-ex2-a] | [`v850`][v850-ex2-a] |
83-
| - | - | - | - | - | - | - | - | - | - |
84-
85-
Instructions for [building](#building-projects) and [testing](#testing-projects) these projects are provided below.
86-
87-
8827
## Building Projects
8928

9029
### Configuring the toolchain file
@@ -263,6 +202,63 @@ __Example 2__ - expected output:
263202
>:warning: The __IAR C-SPY Debugger__ is only available on Windows.
264203
265204
205+
## Examples
206+
In this section you will find examples on how `CMakeLists.txt` files can be created to build __executable__ targets as well as __library__ targets.
207+
208+
The examples work with all the architectures supported in CMake.
209+
210+
__CMake 3__ has been described as the beginning of the "Modern CMake" age. Since then, it has been advised to avoid variables in favor of targets and properties. The commands __add_compile_options()__, __include_directories()__, __link_directories()__, __link_libraries()__, that were at the core of __CMake 2__, should now be replaced by target-specific commands.
211+
212+
The __CMakeLists.txt__ in the examples use expressions that look like this `$<...>`. Those are the so-called [_generator expressions_][url-cm-docs-genex] (or _genex_, for short) and they allow us to express our intentions in many powerful ways.
213+
214+
>:warning: In order to get the all the examples, you can clone this repository __or__, if you want to get only the files from a single example, click on its respective link in the examples' titles and get it bundled in a __zip__ archive.
215+
216+
217+
### Example 1 - [Mixing C and Assembly][url-repo-example1]
218+
The [mix-c-asm](examples/mix-c-asm) project demonstrates the basic concepts on how to build a single executable target (__mixLanguages__) using __C__ and __Assembly__ sources.
219+
220+
It also shows:
221+
* How to use __target_compile_definitions()__ to set preprocessor symbols that can be used in the target's sources.
222+
* __Windows-only__: How to execute the target using the [IAR C-SPY Debugger Simulator][url-iar-docs-cspybat] via CTest.
223+
224+
Each `<arch>` has its own __CMakeLists.txt__. The file is located in the respective `<arch>` folder and has further comments. Below you will find the direct links to each of them:
225+
226+
| [`430`][430-ex1] | [`8051`][8051-ex1] | [`arm`][arm-ex1] | [`avr`][avr-ex1] | [`riscv`][riscv-ex1] | [`rx`][rx-ex1] | [`rh850`][rh850-ex1] | [`rl78`][rl78-ex1] | [`stm8`][stm8-ex1] | [`v850`][v850-ex1] |
227+
| - | - | - | - | - | - | - | - | - | - |
228+
229+
Instructions for [building](#building-projects) and [testing](#testing-projects) these projects are provided below.
230+
231+
232+
### Example 2 - [Creating and using libraries][url-repo-example2]
233+
The [using-libs](examples/using-libs) project demonstrates some advanced features and how to build one executable target (__myProgram__) linked against a static library target (__myMath__) using __C__ sources.
234+
235+
It also shows:
236+
* How to use __set_target_properties()__ to propagate configuration details across the target options.
237+
* How to set __target_linker_options()__ to create a map file of the executable.
238+
* How to use __add_custom_target()__ for executing `ielftool` and generate an `.ihex`|`.srec`|`.bin` output.
239+
* __Windows-only__: How to execute the target using the [IAR C-SPY Debugger Simulator][url-iar-docs-cspybat] via CTest.
240+
241+
The __myMath__ library target is located in the __lib__ subdirectory. The library contains functions which take two integer parameters to perform basic arithmetic over them, returning another integer as result.
242+
243+
The __myProgram__ executable target is located in the __app__ subdirectory. The program performs arithmetic operations using the __myMath__'s library functions.
244+
245+
For each architecture, the project uses 3 __CMakeLists.txt__. These files have further comments.
246+
247+
* The __CMakeLists.txt__ in the __top-level__ directory:
248+
249+
| [`430`][430-ex2-t] | [`8051`][8051-ex2-t] | [`arm`][arm-ex2-t] | [`avr`][avr-ex2-t] | [`riscv`][riscv-ex2-t] | [`rx`][rx-ex2-t] | [`rh850`][rh850-ex2-t] | [`rl78`][rl78-ex2-t] | [`stm8`][stm8-ex2-t] | [`v850`][v850-ex2-t] |
250+
| - | - | - | - | - | - | - | - | - | - |
251+
252+
* The __lib/CMakeLists.txt__ for the __library__ target:
253+
254+
| [`430`][430-ex2-l] | [`8051`][8051-ex2-l] | [`arm`][arm-ex2-l] | [`avr`][avr-ex2-l] | [`riscv`][riscv-ex2-l] | [`rx`][rx-ex2-l] | [`rh850`][rh850-ex2-l] | [`rl78`][rl78-ex2-l] | [`stm8`][stm8-ex2-l] | [`v850`][v850-ex2-l] |
255+
| - | - | - | - | - | - | - | - | - | - |
256+
257+
* The __app/CMakeLists.txt__ for the __executable__ target:
258+
259+
| [`430`][430-ex2-a] | [`8051`][8051-ex2-a] | [`arm`][arm-ex2-a] | [`avr`][avr-ex2-a] | [`riscv`][riscv-ex2-a] | [`rx`][rx-ex2-a] | [`rh850`][rh850-ex2-a] | [`rl78`][rl78-ex2-a] | [`stm8`][stm8-ex2-a] | [`v850`][v850-ex2-a] |
260+
| - | - | - | - | - | - | - | - | - | - |
261+
266262
## Debugging
267263
When executable targets are built with __debug information__, they can be debugged with the __IAR C-SPY Debugger__, directly from the __IAR Embedded Workbench__ IDE.
268264

0 commit comments

Comments
 (0)