Skip to content

Commit

Permalink
Add usage of SRC in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
plmorange committed Nov 4, 2024
1 parent ae2c562 commit 873378f
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions doc/doxygen/src/creating-an-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,74 @@ inside a modules os boards directory. The RIOT build system has both
`EXTERNAL_MODULE_DIRS` and `EXTERNAL_BOARD_DIRS` variables to specify
directories that contain extra modules and extra boards.

## Using subfodlers in application

Applications can contain subfolders.

```
├── apps
│   └── my_app
│   ├── app_dependant
│   │   └── file.c
│   ├── Makefile
│   └── main.c
└── RIOT
```

To add subfolders, `SRC` can be used.

Check failure on line 214 in doc/doxygen/src/creating-an-application.md

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.

The `Makefile` in my_app will be :

```
APPLICATION = my_app
PROJECT_BASE ?= $(CURDIR)/../..
RIOTBASE ?= $(PROJECT_BASE)/RIOT
# Declare the main.c and all .c file in subfolders
# that doesn't need to be done with module

Check failure on line 224 in doc/doxygen/src/creating-an-application.md

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.
SRC += main.c
SRC += app_dependant/file.c
include $(RIOTBASE)/Makefile.include
```

`SRC` allows creating subfolders without needing to create a module with a `Makefile` but can be combined with modules:

```
├── apps
│   └── my_app
| ├── my_app_module
| | ├── Makefile
│   │   └── module.c
│   ├── app_dependant
│   │   └── file.c
│   ├── Makefile
│   └── main.c
└── RIOT
```

my_app got one subfolder and one module called my_app_module.

Check failure on line 246 in doc/doxygen/src/creating-an-application.md

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.

When we want to add modules, we have nothing to add in `SRC`; we only add `DIRS` and `USEMODULE`:

```
APPLICATION = my_app
PROJECT_BASE ?= $(CURDIR)/../..
RIOTBASE ?= $(PROJECT_BASE)/RIOT
# Declare directory where the module is and

Check failure on line 255 in doc/doxygen/src/creating-an-application.md

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.
# usage of it.

Check failure on line 256 in doc/doxygen/src/creating-an-application.md

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.
DIRS += my_app_module
USEMODULE += my_app_module
# Declare the main.c and all .c file in subfolders,
# which doesn't need to be done with modules.
SRC += main.c
SRC += app_dependant/file.c
include $(RIOTBASE)/Makefile.include
```

## External Boards

External boards can be ported in an identical way as porting a regular board to
Expand Down

0 comments on commit 873378f

Please sign in to comment.