Skip to content

Commit d2fdf65

Browse files
committed
adr: Recommend CMSIS component source structure
Added an ADR to recommend component source structure.
1 parent 890f056 commit d2fdf65

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# CMSIS component source structure recommendations
2+
Date: 2020-08-19
3+
4+
## Status
5+
Proposed
6+
7+
## Context
8+
9+
[`ARM-software/CMSIS_5`](https://github.com/ARM-software/CMSIS_5) has been ported to Mbed OS. However, it is split across multiple directories and it is not immediately obvious that it comes from that directory. It also makes it difficult to create an independent CMake target can be built as a library that can be optionally be added by end users.
10+
11+
The current proposal is to create a new directory `rtos/CMSIS_5/` that will mirror closely the structure used by `ARM-software/CMSIS_5/`. It will result in the removal of `rtos/source/TARGET_CORTEX/` and `cmsis/`.
12+
13+
Additionally it will provide the following advantages:
14+
* Better maintenance of component
15+
* Easy creation of an independent CMake target
16+
* Easy source navigation that mirrors closely the upstream repository
17+
18+
19+
## Decision
20+
The following directory restructure is recommended:
21+
22+
```
23+
+-- rtos/CMSIS_5/
24+
| +-- README.md
25+
| +-- docs/
26+
| +-- CMSIS/
27+
| +-- include/
28+
| +-- mbed_cmsis_conf.h # Currently in cmsis/
29+
| +-- RTE/
30+
| +-- include/
31+
| +-- RTE_Components.h # Currently in cmsis/
32+
| +-- RTOS2/ # This is currently rtos/source/TARGET_CORTEX/rtx5/
33+
| +-- Include/ # Content of rtos/source/TARGET_CORTEX/rtx5/Include/
34+
| +-- X # Header files currently in rtos/source/TARGET_CORTEX/
35+
| +-- RTX/
36+
| +-- Config/ # Content of rtos/source/TARGET_CORTEX/rtx5/RTX/Config/
37+
| +-- Include/ # Content of rtos/source/TARGET_CORTEX/rtx5/RTX/Include/
38+
| +-- Include1/
39+
| +-- cmsis_os.h # Currently in rtos/source/TARGET_CORTEX/rtx4/
40+
| +-- Library/
41+
| +-- cmsis_os1.c # Currently in rtos/source/TARGET_CORTEX/rtx4/
42+
| +-- Source/ # Content of rtos/source/TARGET_CORTEX/rtx5/RTX/Source/
43+
| +-- Source/
44+
| +-- Y # Content of rtos/source/TARGET_CORTEX/rtx5/Source
45+
| +-- Z # Source files currently in rtos/source/TARGET_CORTEX/
46+
| +-- TOOLCHAIN_ARM_MICRO/ # Currently in rtos/source/TARGET_CORTEX/
47+
| +-- TOOLCHAIN_ARM_STD/ # Currently in rtos/source/TARGET_CORTEX/
48+
| +-- TOOLCHAIN_GCC_ARM/ # Currently in rtos/source/TARGET_CORTEX/
49+
| +-- TOOLCHAIN_IAR/ # Currently in rtos/source/TARGET_CORTEX/
50+
| +-- mbed_lib.json # Currently in rtos/source/TARGET_CORTEX/
51+
| +-- Core_A/ # This is currently cmsis/TARGET_CORTEX_A/
52+
| +-- Include/ # Header files currently in cmsis/TARGET_CORTEX_A/
53+
| +-- Source/ # Source files currently in cmsis/TARGET_CORTEX_A/
54+
| +-- Core/ # This is currently cmsis/TARGET_CORTEX_M/
55+
| +-- Include/ # Header files currently in cmsis/TARGET_CORTEX_M/
56+
```
57+
58+
However, to cope with Mbed-CLI requirement to find directories to process with the target labels mechanism, some directories will be prefixed with `TARGET_` and capitalized. It will therefore look as follows:
59+
60+
```
61+
+-- rtos/CMSIS_5/
62+
| +-- README.md
63+
| +-- docs/
64+
| +-- CMSIS/
65+
| +-- include/
66+
| +-- mbed_cmsis_conf.h # Currently in cmsis/
67+
| +-- RTE/
68+
| +-- include/
69+
| +-- RTE_Components.h # Currently in cmsis/
70+
| +-- RTOS2/ # This is currently rtos/source/TARGET_CORTEX/rtx5/
71+
| +-- Include/ # Content of rtos/source/TARGET_CORTEX/rtx5/Include/
72+
| +-- X # Header files currently in rtos/source/TARGET_CORTEX/
73+
| +-- RTX/
74+
| +-- Config/ # Content of rtos/source/TARGET_CORTEX/rtx5/RTX/Config/
75+
| +-- Include/ # Content of rtos/source/TARGET_CORTEX/rtx5/RTX/Include/
76+
| +-- Include1/
77+
| +-- cmsis_os.h # Currently in rtos/source/TARGET_CORTEX/rtx4/
78+
| +-- Library/
79+
| +-- cmsis_os1.c # Currently in rtos/source/TARGET_CORTEX/rtx4/
80+
| +-- Source/ # Content of rtos/source/TARGET_CORTEX/rtx5/RTX/Source/
81+
| +-- Source/
82+
| +-- Y # Content of rtos/source/TARGET_CORTEX/rtx5/Source
83+
| +-- Z # Source files currently in rtos/source/TARGET_CORTEX/
84+
| +-- TOOLCHAIN_ARM_MICRO/ # Currently in rtos/source/TARGET_CORTEX/
85+
| +-- TOOLCHAIN_ARM_STD/ # Currently in rtos/source/TARGET_CORTEX/
86+
| +-- TOOLCHAIN_GCC_ARM/ # Currently in rtos/source/TARGET_CORTEX/
87+
| +-- TOOLCHAIN_IAR/ # Currently in rtos/source/TARGET_CORTEX/
88+
| +-- mbed_lib.json # Currently in rtos/source/TARGET_CORTEX/
89+
| +-- TARGET_CORTEX_A/ # This is currently cmsis/TARGET_CORTEX_A/
90+
| +-- Include/ # Header files currently in cmsis/TARGET_CORTEX_A/
91+
| +-- Source/ # Source files currently in cmsis/TARGET_CORTEX_A/
92+
| +-- TARGET_CORTEX_M/ # This is currently cmsis/TARGET_CORTEX_M/
93+
| +-- Include/ # Header files currently in cmsis/TARGET_CORTEX_M/
94+
```
95+
96+
## Documentation
97+
The README.md may contain a brief introduction to the component. Detailed documentation may be added under `docs` directory.

0 commit comments

Comments
 (0)