This will avoid to load edbg logic and especially adds it to the list of FLASHDEPS: it won't be unnecessarily built when flashing a samr21-xpro/arduino-zero board on IoT-LAB
Do not remove the '-D' and '-U' values from CFLAGS.
This prevents issues where a '-D' could contain a space.
Some values way be duplicated from the 'riotbuild.h' header and the
command line but with the same value so without conflict.
To not put too many things in the command line, the -DMODULE_NAME are
only put in CFLAGS_WITH_MACROS.
Also, as now, the deferred value of CFLAGS is used for 'riotbuild.h',
macros set after the inclusion of `Makefile.include` will be taken into
account.
Old versions of GNU Make (especially on OSX) are a pain to deal
with. This commit introduces a warning when such an old version
is found. The goal is the future the warning will be turned into
an error.
2020.01 is set as the date we remove support.
Complying with version 4.x is easy on OSX by using homebrew, and
on Linux, even Debian stable has the required version.
This adds a new target "archive-check".
Thin archives should be created with relative paths so that archives created
in a build container are useful in the host. This check ensures there are no
absolute paths inside thin archives.
Add make only function to convert strings to lowercase and uppercase.
This can replace the `$(shell echo $(var) | tr 'a-z-' 'A-Z_')` pattern.
Using the 'make' implementation results in being around 100 times faster.
Update the documentation to say it can also be 'ELFFILE'
The first version was setting it to EFLFILE by default but the default
behavior was removed to prevent hiding errors.
It can also be overwritten for application specific needs, like when
using 'riotboot'.
Add a 'buildtest-indocker' that forces executing 'buildtest' for loop
completely inside the container.
It prevents starting one container per compilation wich is slower but
it could hide errors where the host toolchain would be used
It is currently equivalent to `buildtest` but will change when the
`buidtest` handling will be move outside of `BUILD_IN_DOCKER`.
Display an error when executed without BUILD_IN_DOCKER=1.
This changes CFLAGS_WITH_MACROS to be:
* a deferred variable
* not exported so only evaluated when actually used
The value is only used by `Makefile.include` and `makefiles/eclipse.inc.mk`
so not required to export it.
Previously, this was hard-coded to allow one file, hard-coded to be
called "flash file".
This commit allows multiple files to be specified via adding them to the
TEST_EXTRA_FILES variable. All files will be stored in the worker's
application bin directory.
Also, the existence check has been removed, as dwqc bails out on missing
file anyways.
Currently, some targets are serialized before "clean" by conditionally
adding a dependency.
Make does allow ordering using "|" syntax in prerequisites, but for
"clean" that would always trigger the clean target.
By only conditionally setting $(CLEAN) to clean, that can be
circumvented.
The new CLEAN allows any recipe to be run after "clean" by specifying "|
$(CLEAN)" as prerequisite.
Prepare for when boards define `CPU` in `BOARD/Makefile.features`.
Include '$(RIOTCPU)/$(CPU)/Makefile.features' directly when it is
defined. This will allow removing the file inclusion from the
`BOARD/Makefile.features`. The board must then not include it directly.
Transitional change to allow migrating part by parts.
Part of moving CPU/CPU_MODEL definition to Makefile.features to have it
available before Makefile.include.
Update the FEATURES_OPTIONAL meaning to be more in line since
FEATURES_USED is defined. Handle FEATURES_OPTIONAL as a configuration from
the BSP/build that should not be changed anymore after.
`FEATURES_OPTIONAL` are by definition optional so are not supposed to
cause a build to fail.
Only the 'REQUIRED' ones that are not 'PROVIDED' are 'MISSING'.
* Do not change FEATURES_OPTIONAL to remove REQUIRED features
* Prepare for having a different variable for the previous value
* Update dependency resolution/info-build as FEATURES_OPTIONAL cannot be missing
This will allow sharing it between Makefile.include and
makefiles/info-global.inc.mk.
Also some common variables definition can also be moved to here.
Part of moving CPU/CPU_MODEL definition to Makefile.features to have it
available before Makefile.include.
My system (Ubuntu 16.04) creates a backup when opening a file with
`vim`. This backup is called `filename~`. Due to it being a copy of the
file before opening, it also is executable, which is why it is selected
for execution with the `make test` target.
This change makes the `TESTS` macro exclude files ending in `~`. This
way files ending in `~` are not executed with `make test`.
Since e.g. projects like NextCloud are excluding such files also from
their sync [[1]], I think this is fine.
[1]: d7b881feb6/sync-exclude.lst (L3)
This allows querying the build system if there are test available.
Before, one should rely on 'info-debug-variable-TESTS' to print the list
of test files. But was not reliable as sometime the build system printed
messages anyway.
BOARD=esp32-wroom-32 make --silent --no-print-directory \
-C examples/hello-world/ info-debug-variable-TESTS
ESP32_SDK_DIR should be defined as /path/to/esp-idf directory
ESP32_SDK_DIR is set by default to /opt/esp/esp-idf
# empty line here
Now the return code can be trusted.
Include the 'riotboot.mk' file before using FLASHFILE/ELFFILE/HEXFILE
variables. This will allow setting variables to values from riotboot.mk
like `FLASHFILE = $(RIOTBOOT_COMBINED_BIN)` before it is evaluated in
Makefile.include.
It should be included after defining 'BINFILE' for 'riotboot.bin'
handling.
Introduce FLASHFILE variable to start migrating boards to use it.
This is the file that will be used for flashing.
Boards do not currently use it but will migrated in upcoming PRs.
This allows setting other GLOBAL_GOALS by setting it before.
This could be the case for the application `Makefile` or files parsed
from `RIOT_MAKEFILES_GLOBAL_PRE`.
This introduces a new environment variable for a common directory
that holds all output of the build process, such as application or
package binaries. This would also allow to easily redirect output
to any other location, e.g. for out-of-source builds.
riotboot is introduced here and makes use of riotboot_hdr,
which indentifies the images encapsulated as slots.
The slot size and offset is configurable, which makes
slots extendable if needed, e.g. 2 or more slots can be
transparently added.
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
Co-authored-by: Gaëtan Harter <gaetan.harter@fu-berlin.de>
When flash-only was introduced (in #8373), the `flash` rule was
made conditionally dependent on `all` by looking for `flash-only`
in MAKECMDGOALS. This was done to avoid code duplication.
There's a cleaner way, by using canned recipes. When we upgrade the
requirements to gnu make 4, the flash recipe can be defined as ?=.
This rule is not being used, it complicates the makefile and causes
make clean to permform unnecessary actions.
All packages have a Makefile.include, so the rule is not needed anyways.
Also, it is defined with a double colon for no reason.
This allows specifying a list of files that should be parsed by make at
the beginning and at the end of Makefile.include.
It is a generic mechanism to allow specifying system wide configuration:
* Globally overwrite the 'TERMPROG'
* Specify a hard written port / debug_adapter_id for some BOARD values
* Define you own specific targets
* Override default targets
It can include file before and after Makefile.include to allow handling
different configurations.
When building in parallel, clean is done at the same time as the
container starts building.
So the parallel `clean all` handling should also be done for the
`..in-docker-container` target.
Makefile.include contained logic to clone a different RIOT version and
build the application against it. This can be easily achieved by making
a git worktree and overriding RIOTBASE, without adding any complexity
to our makefiles. Therefore, the feature is being removed.
When an application only includes Makefile.include without specifying
RIOTBASE and uses a `Makefile.local` file, RIOTBASE would use a wrong
default value and get the value of the directory where `Makefile.local` is.
The hostname does not provide any additional or necessary information to
the RIOT_VERSION string. On the contrary, some might consider the hostname
as personal information, which should not be exposed unsolicitedly.
Process `Makefile.include` for external modules. It is included after the others
so it could overwrite some of the configuration if wanted.
Process `Makefile.dep` for external modules. It is included before the others so
it could be parsed before setting 'default' values to dependencies.
It fixes issues with the current rule that it is wrong that each
`$(BINDIR)/pkgname.a` is built by going in the package directory:
* `nordic_softdevice_ble.a` is built using `DIRS` and so the
`$(APPLICATION_MODULE).a` target.
* It prevents having packages that are pseudomodules, which may be
required to only use one "library" part of a package.
It also simplifies handling changes in 'ld -r' PR that could produce
objects instead of archives for packages.
Limitation of the current implementation
----------------------------------------
It removes rules being 'file' target and makes them depend on `.PHONY`
targets so always forces re-build.
But having a file target whose file is silently generated by another
target does not trigger a rebuild in Make.
They may have been declared as `order-only` prerequisites but as there are
some edge-cases that may not always work and does not currently add anything,
it was decided to keep them as normal prerequisites until it can be
globally solved.
Now also print warnings if there are missing features or a blacklisted
board when doing 'make flash'
Before, only when doing 'make' or 'make all' the FEATURES_REQUIRED,
BOARD_BLACKLIST/WHITELIST and TOOLCHAINS were checked and a warning was printed.
However as 'flash' triggers 'all' it is a common case to do 'make flash'
directly instead of 'make all flash'. So better also print warnings in
this case.
Assuming `TOOLCHAIN_SUPPORTED` is provided by the board and
`TOOLCHAIN_BLACKLIST` by a module or `pkg`, this outputs the fact that
a toolchain is not supported or blacklisted in a similar manner as
(un-)supported features and boards are.
When downloading the release archive and building an example, the RIOT_VERSION string is not set to "Version 2018.04" but to
Version: UNKNOWN (builddir: /home/me/Downloads/RIOT-2018.04)
This allows sourcing a global VERSION file to manually set it before releases.
Introduce dist/pythonlibs directory to store RIOT python packages.
This directory is exported via PYTHONPATH by the build system to
make it commonly available.
When selecting a directory to build using `-C` with make
`BUILD_IN_DOCKER` will fail, because the `BUILDRELPATH` chooses the path
`make` is executed in, not the path selected by `-C`. This fixes this
bug by replacing `PWD` in the macro's definition with `CURDIR`.
Fixes a regression introduces #9479 which breaks building on macOS.
The introduces `uniq` function is never called, hence the includes
ie. USEMODULE_INCLUDES are not used.
Currently, `USEMODULE_INCLUDES` is deduplicated using a combination of
`tr` and `awk`. The proposed method achieves a deduplication (no
sorting) without the need to shell out by using make internals only.
BUILDDEPS are files / make targets that should be build before compiling.
It can include packages source download, generating headers, modules.
It is the equivalent of `APPDEPS` but not limited to the application.
It cannot be done right now with `APPDEPS` as it is used in `BASELIBS` and
fixing it requires changing mips using it for source files.
They can define PSEUDOMODULES which is used to populate BASELIBS.
It means they must be processed before using BASELIBS immediate value.
This moved the processing of all `Makefile.include` before using `BASELIBS`.
It is also moved before setting `BASELIBS` in `modules.inc.mk to keep the
order logical (it would work anyway thanks to deferred variables evaluation).
This fixes the problems for `make -C tests/unittests`
Build targets were using the immediate value of '$(BASELIBS)' before it was
actually set. bindist.inc.mk should also be processed before as it is adding
`BIN_USEMODULE` to `USEMODULE`.
This fixes use before define problems for:
* `make -C examples/hello-world`
* `make -C examples/bindist`
Include order for board and cpu was
1. cpu include
2. board include
3. board common includes
4. cpu common includes
Its now changed to:
1. board include
2. board common includes
3. cpu include
4. cpu common includes
Verifications:
There are no common headers names between boards and cpus.
Except native that has a 'periph_conf.h' in cpu instead of being in board.
Add support to do flash/reset/term on an IoT-LAB node.
It also allow running test using 'testrunner'.
Configuration variables are:
* `IOTLAB_NODE` which should be set to your node url
* The full url including site to use from your computer `m3-1.grenoble.iot-lab.info`
* The short url when used on the IoT-LAB frontend `m3-1`
* `IOTLAB_EXP_ID` for your experiment id for flash and reset.
By default it tries to use your currently running experiment if you have only one
* `IOTLAB_USER`: is read from `${HOME}/.iotlabrc` as saved by `iotlab-auth`
* It is expected to have run `iotlab-auth` beforehand.
Unittests add libraries in 'BASELIBS' which do not have any rules to be built as
they are built by 'application.inc.mk', packages and the DIRS variable.
So make complains about missing target for the unittests archives.
The fix tells these files are generated when building '$(APPLICATION_MODULE).a'.
The bug was introduced by #8844Fixes#8910
* Add ELFFILE, HEXFILE, print-size targets
$(BINDIR)/$(APPLICATION_MODULE).a target builds libraries in RIOT and in DIRS.
Uses a FORCE phony target dependency to force rebuilding but still let
`make` use the file modification timestamps
This variable can be used to specify the linker which should be used to
link C++ object files. This is needed in order to use g++ for linking
with TOOLCHAIN=llvm.
Set the application module name with APPLICATION_MODULE.
The default module name is "application_$(APPLICATION)".
This should fix name conflicts where an application/test has the same name as
an existing module and so both write to the same archive.
All macros are filtered out of the `CFLAGS` variable and during this
process, the `CFLAGS` string is destroyed. This is due to the fact that
the `RIOT_VERSION` string contains spaces, but the filtering process does
not take the whole string into account (following the first space). This
leads to some parts of the `RIOT_VERSION` string be sill existent in the
`CFLAGS` string.
Instead of exporting the `RIOT_VERSION` string to the `CFLAGS` macro to
just remove it again from there, I exported it to `CFLAGS_WITH_MACROS`.
Fixes#5859
Can be overridden from the environment by setting WERROR=0
also remove reversed logic for Werror in Makefile.buildtest
(a typo caused Werror to be always enabled for all builds)
- Better support for passing environment variables to the Docker container.
- Move Docker-related definitions into Makefile.docker.
- Only environment variables that originates from the command line or
the environment will be passed to the Docker container.
export BUILD_IN_DOCKER=1 to use Docker for building inside a Docker
container.
GDB debug file paths will be wrong after building inside the container,
use the script provided in `dist/gdbinit-docker` to set the correct GDB
substitution paths (copy and paste the contents into your `~/.gdbinit`)
The environment variable DOCKER_FLAGS can be used to pass extra
parameters to the Docker process.
llvm-ar does not understand `-rc`, but works for creating empty
archives when called with `rc` (without the leading dash). BSD `ar`
which ships with OSX, which the test is written for, understands the
argument with or without the leading dash (but does not support creating
empty archives.)
The '""' pattern is used so that the variable can be processed as a string
after the preprocessors evaluation. Change to \"\" instead, so that single
quotes can be used externally. The extra quotation marks are unneeded.
Related to #2213
This change allows drivers (or any module for that matter) to provide
features. This is e.g. useful if a board does not have a transceiver,
but your application uses `USEMODULE += some_driver`, which implements
the transceiver interface.
The line `FEATURES_PROVIDED += some_feature` should go to the guarded
block in `{sys,drivers}/Makefile.include`.
Fixes#1876
This PR introduces `FEATURES_OPTIONAL` which can be used to tell the
Make system, that the application would like to use some feature, but
the build should proceed even if the selected board cannot provide the
optional feature.
`make buildtest` and `make info-supported-boards` heed this variable
when examining the list of supported boards.
If a word is present in `FEATURES_REQUIRED` and `FEATURES_OPTIONAL`,
then `FEATURES_OPTIONAL` takes precedence.
distclean
removes all build products, also depends on docclean
clean
removes all build products for the current board
also, silence clean target from Makefile.include and let it ignore errors
Please see #1715.
Closes#1715.
This PR implements the new Makefile variables "FEATURES_PROVIDED" and
"FEATURES_REQUIRED". A board *can* have a new file `Makefile.features`
which looks like:
```make
FEATURES_PROVIDED = transceiver
```
An application can have a corresponding line
```make
FEATURES_REQUIRED = transceiver
```
If the selected BOARD does not fulfil the requirements of the
application, then a *warning* is issued at compile time.
This change only includes the feature "transceiver", further features
are expected to be listed in further PRs. The requirement "transceiver"
is automatically added if the application uses the module
"defaulttransceiver".
`make buildtest` understands the new feature listing, so the user won't
need to add boards to `BOARD_BLACKLIST` manually.
Part of the change are the added Make targets
* `info-features-missing`, which prints the required features
`\setminus` the provided features. The output is empty if there are no
features missing.
* `info-boards-features-missing`, the same as `info-features-missing`
but as a table for all boards, but heeded `BOARD_WHITELIST` and
`BOARD_BLACKLIST`.
Applications don't have to use this new feature. This change does not
break existing Makefile.
Sometimes boards/*/Makefile.include (e. g. in case of the msba2) gets included
twice somehow, leading the TERMFLAG to be set twice and faulty. This
fixes that.
With many open PRs that could benefit from loading SDKs when needed,
instead adding vast amounts of code to RIOTs master, this PR provides
the "functions" `$(DOWNLOAD_TO_STDOUT)`, `$(DOWNLOAD_TO_FILE)`, and
`$(UNZIP_HERE)`.
The first "function" takes one argument, the URL from where to download
the content. It is then piped to stdout. To be used e.g. with `tar xz`.
The second "function" taken two arguments, the destination file name,
and the source URL. If the previous invocation was interrupted, then the
download gets continued, if possible.
The last "function" takes one argument, the source ZIP file. The file
gets extracted into the cwd, so best use this "function" with
`cd $(SOME_WHERE) &&`.
The clumsy name `$(UNZIP_HERE)` is taken because the program "unzip"
takes the environment variable `UNZIP` as the source file, even if
another file name was given on the command line. The rationale for that
is that the hackers of "unzip" hate their users. Also they sacrifice
hamsters to Satan.