11# Application Example with Subfolders
22
33This example demonstrates the usage of subfolders in a RIOT application
4- (or in a RIOT module in general) show-casing two possible approaches: RIOT
5- modules and simple subfolders.
4+ (or in a RIOT module in general) show-casing two possible approaches:
5+ External RIOT modules and simple subfolders.
66
77## Details
88
@@ -12,16 +12,18 @@ while the source files in `folder` are considered part of the application itself
1212
1313```
1414.
15+ ├── external_modules
16+ │ └── module
17+ │ ├── a.c
18+ │ ├── b.c
19+ │ └── Makefile
1520├── folder
1621│ ├── a.c
1722│ └── subfolder
18- │ └── b.c
23+ │ ├── b.c
24+ │ └── c.c
1925├── main.c
2026├── Makefile
21- ├── module
22- │ ├── a.c
23- │ ├── b.c
24- │ └── Makefile
2527└── README.md
2628```
2729
@@ -30,14 +32,11 @@ while the source files in `folder` are considered part of the application itself
3032At a minimum, each module in RIOT requires a ` Makefile ` with the following content:
3133
3234``` Makefile
33- MODULE := my_module
34-
3535include $(RIOTBASE ) /Makefile.base
3636```
3737
38- If `MODULE` is not specified, the name of the module's directory is automatically used,
39- leaving only the last line as minimal content.
40- It is important to note that module names have to be unique both among _all_ RIOT modules,
38+ The name of the module's directory is automatically used as the module name.
39+ It is important to note that module names have to be unique among _all_ RIOT modules,
4140i.e., including the modules that are part of RIOT itself.
4241
4342If not manually specified via `SRC`, all source files which reside
@@ -47,12 +46,13 @@ RIOT modules are also described in greater detail [in the documentation](https:/
4746Two lines need to be added to the application's Makefile in order to compile and use the module :
4847
4948```Makefile
50- DIRS += module
51- USEMODULE += my_module
49+ EXTERNAL_MODULE_DIRS += $( CURDIR ) /external_modules/
50+ USEMODULE += module
5251```
5352
54- The string added to ` DIRS ` has to match the directory name,
55- while the string added to ` USEMODULE ` has to match the module's name as defined above.
53+ The path added to ` EXTERNAL_MODULE_DIRS ` is the parent directory of the external module,
54+ while the string added to ` USEMODULE ` has to match the module's directory name.
55+ External modules are described in greater detail [ in the documentation] ( https://doc.riot-os.org/creating-an-application.html#autotoc_md2308 ) .
5656
5757
5858### Subfolders
0 commit comments