FLASHER and FFLAGS are evaluated by the main Makefile.include or by file
included by it. Their value does not need to be exported.
This will also prevent evaluating 'PORT' for FFLAGS when not needed.
Testing
-------
`git diff --word-diff` only reports `export` being removed.
`git show --stat` reports `84 insertions(+), 84 deletions(-)`
Which is the same amount as lines that where matching
`export[[:blank::]]\+VARIABLE`.
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.
This enables "BUILD_IN_DOCKER=1 BOARDS='foo bar' make buildtest".
Without this line, when executed with BUILD_IN_DOCKER, "make buildtest"
would always build all boards.
Add a trivial shell program that scans for all slaves on an I2C bus by iterating
all of the possible 127 I2C addresses and checking for the ACK of the device.
The build system contains several instances of
INCLUDES += -I$(RIOTBASE)/sys/posix/include
This is bypassing the module management system, by directly accesing
headers without depending on a module. The module is the posix module.
That line is also added when one of the posix_* modules is requested.
According to the docs, the posix module provides headers only, but in
reality there is also inet.c.
This patch:
- Moves `inet.c` into `posix_inet`, leaving `posix` as a headers-only
module.
- Rename `posix` as `posix_headers` to make it clear the module only
includes headers.
- Makes `posix_*` modules depend on `posix_headers`, thus removing the
explicit `INCLUDES+=...` in `sys/Makefile.include`.
- Ocurrences of `INCLUDES+=...` are replaced by an explicit dependency
on `posix_headers`.
In UniFlash 4.4.0 the directory where 'xds110reset' is changed.
Try to use the newest one available. If none is found in UNIFLASH_PATH,
try to use one from the PATH to be sure to have a value.
./uniflash_4.1/simplelink/gen2/bin/xds110reset
./uniflash_4.3.0/simplelink/gen2/bin/xds110reset
./uniflash_4.4.0/simplelink/imagecreator/bin/xds110reset
./uniflash_4.5.0/simplelink/imagecreator/bin/xds110reset
Linkerscript for `nrf52dk` has been updated to use `cortexm.ld` so does
not need the configuration anymore for the removed
`cpu/nrf52/ldscripts/nrf52832xxaa.ld`.
JLink flasher used by the only supported board `nrf52dk` has been updated.
FLASHFILE must now be defined by the board to use this in case a new one
wants to be supported.
Refactor to define REALMODULES incrementally without overwriting
'NO_PSEUDOMODULES'.
This also allows an external makefile to maybe add something there if it really
needs to.
Factorize the reused value in a private variable.
I define it private as somehow 'USEPKG' is supposed to be removed so the
variables can be removed later.
BASELIBS is used only in the main Makefile.include or included files.
As it is not used in sub make executions or scripts it does not need to
be exported.
The canned recipe is preferred to using $(FLASHER) $(FFLAGS) as it
allows to specify additional action actions (like what preflash is
currently doing.)
A canned recipe had previously been defined to perform the flashing
procedure. The canned recipe is preferred to calling $(FLASHER) $(FFLAGS)
as there might be additional steps involved in flashing (this is handled by
preflash currently but with the canned recipe we will be able to fix it.)
Modern versions of GDB support multiple targets with the same gdb binary.
At least Ubuntu and Debian have dropped the gdb-arm-none-eabi package in favour
of gdb-multiarch.
Here, no $(PREFIX)-gdb binary is availiable, instead gdb-multiarch should be used.
This patch tries to automatically detect the presense of gdb-multiarch and uses it
instead of arm-none-eabi-gdb.
Using 'link' was working too but will introduce a circular dependency
when FLASHFILE is one of the slot files.
This trims down to the minimal required dependency to work. It is now
the same as `ELFFILE` dependencies.
If FLASHFILE is set keep the original value.
It changes the variable from an immediate to a deferred variable but if
murdocks keeps working there is no issue.
The CPU variable in the boards Makefile.include file already contains the target
CPU, so there is no reason to provide it in each board again as avrdude flag.
This commit automatically sets the avrdude target from the CPU variable and
removes the unneeded flags.
Currently the flag "-P ${PORT}" is added to avrdude regardless of the programmer
used. But this flag should only be set for programmers that operate over a
serial port - e.g. like the various Arduino bootloaders. This commit changes
the behaviour so that the "-P flag" is only set for only of the default
programmers of the various AVR boards supported by RIOT. This allows to use
ICSP programmers (e.g. like the usbtiny) like this:
make BOARD=arduino-uno PROGRAMMER=usbtiny
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.
They are remapped to `$(DOCKER_BUILD_ROOT)/external` if they are not
inside RIOT (usually the case but not for `tests/external_modul_dirs`).
If they are inside 'riotproject' they are currently also remapped to
'external'.
The value of `EXTERNAL_MODULE_DIRS` is then enforced by configuring it on
the command line as the application should not try to set it anymore.
The remapping is done in `external/directory_name` so cannot handle
multiple external directories with the same name.
Use RIOTPROJECT from within the riot repository if it is inside.
This means when it is the case to use:
* Not mounting the directory to `riotproject`
* Use `APPDIR` relative to inside RIOT
If it is not inside, do the same as before:
* Mount the RIOTPROJECT to `riotproject`
* Use `APPDIR` relative to RIOTPROJECT
Add functions to get volume and env arguments for a given directory environment
variable.
It handles:
* variables with multiple directories like EXTERNAL_MODULE_DIRS
* relative path
* if the 'directories' variable is empty, it will not be exported to docker
Due to a recent fix in shell.c, remote echo is now working as originally
intended. Local echo must be disabled or otherwise it will add up to the
remote one, causing a character-by-character double echoing.
TERMPROG and TERMFLAGS variables do not need to be exported as they are
used directly by a make receipe.
Exporting them prevents overwriting 'RIOT_TERMINAL' in the test.
TERMPROG and TERMFLAGS variables do not need to be exported as they are
used directly by a make receipe.
Exporting them prevents overwriting 'RIOT_TERMINAL' in the test.
Allows to use avrdude as a flashing tool in any context
(e.g. not dependent on arduino or atmega) though it only
works (AFAIK) on atmega, but I thought it's better to
have it here as we have other flashing tools.
`command -v first second third` only works in `bash` and not in `sh`.
So replace with multiple calls to `command`.
This fixes using `objcopy` when the toolchain `objcopy` is not available.
It is only used by `Makefile.include` and should not be used by sub-make
instances.
This is required to prevent evaluating `LINKFLAGS` when not needed and a
required step to not evaluate it on the host with for example `avr-ld`
when building in docker.
I checked usage with:
git grep -e '(LINKFLAGS)' -e '{LINKFLAGS}'
Packages may be using it but `LINKFLAGS` is a RIOT way of naming
things and even if `generate-xcompile-toolchain` uses `LINK` it does not
use `LINKFLAGS`.
arm-gcc version from ubuntu bionic repository is not supported in RIOT.
Both when building with `gnu` and `llvm`.
arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
So detect this version and print an error if found.
The check is done on the building machine and not on the host when building in
docker.
The error can be disabled when building with WERROR=0.
The 'build' directory should be created before starting docker.
If not it will be created as root.
Also add mapping for the directory in docker.
Currently create the directory in the target until there is a directory
creation target.
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.
By erasing slot 1 header the slot gets invalidated.
This is very useful while debugging, since we can
force the bootloader to ignore anything on that
slot.
riotboot looks for valid, available slots and compares its
version. The slot with the highest version is booted, otherwise
if no valid slot is found it loops on `while(1);`
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>
A call to `$(ensure_value x,y)` will fail with message y if x is empty, and
otherwise return x. This can be useto write more compact makefiles, while still
producing friendly error messages.
When doing `make -j clean all' the directories can be cleaned after
files are made. To ensure files are created after clean, those targets
are made conditionally dependent on the clean target.
This copies the handling done in Makefile.include.
Get FLASH_FILE and ELFFILE from command line instead of environment variable.
The documentation was claiming ELFFILE was given as a command line argument
already, but is was not.
riotboot_hdr enables to partition the internal flash memory
into "slots", each one with a header providing information
about the partition. The concept for now is limited to
firmware partitions, which are recognised by the riotboot
bootloader. In the future the concept might be extended to
represent other content.
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
Get BINFILE and ELFFILE from command line instead of environment variable.
Rename 'HEXFILE' to 'BINFILE' in the script as the binary file is used.
The documentation was already talking about 'BINFILE' but 'BINFILE'
was never exported by the build system and it was using 'HEXFILE' in the
implementation.
This makes doing 'scan-build-analyze' produce an error at execution if
WERROR=1.
When used from `scan-build` it will not procude an error to display the result
webpage.
This correctly defines a `scan-build-analyze` target that does not display the
result webpage.
`scan-build-view` has now been moved to a private target as should not
be used directly.
The handling of displaying the page on the host system and implementing
'scan-build-analyze' are now explicitely done with separate targets and
not double implemented target when in docker or on the host that were executed
twice with different implementations.
When building from a worktree, the common git directory was not mounted
in docker.
This lead to the version not being set and issues with git-cache in
ubuntu bionic that could not execute the 'git hash-object' command.
This completely removes the hardcoded/os specific path setting for includes.
It directly queries gcc include directories.
It takes what was already done by `makefiles/libc/llvm.inc.mk`.
I replaced the `GCC_MULTI_DIR` handling by givining `CFLAGS_CPU` when
searching for include directories.
`CFLAGS` cannot be used as it will crash when `-target $(CPU_ARCH)` is
added.
It currently requires using deferred variables as `CFLAGS_CPU` can be
overwritten later in the build process.
Handle that `IMAGE_OFFSET` can be set to something that contain spaces.
With 'IMAGE_OFFSET=$$((0x1000 + 0x1000))' we had in the command line when doing
'flash'
--offset $((0x1000 --offset + --offset 0x1000))
With the change we correctly have
--offset $((0x1000 + 0x1000))
There are two major reasons for this:
1. clang picks up different errors sometimes than GCC.
2. OSX support is hardened as it is usually the toolchain used there.
Allow flashing with an offset in ROM from the rom base address.
It reuses `IMAGE_OFFSET` configuration variable name from `openocd.sh`.
This will allow flashing multiple images with different flash operations.
Introduce dist/pythonlibs directory to store RIOT python packages.
This directory is exported via PYTHONPATH by the build system to
make it commonly available.
While info-build already provides lots of useful information
it does not print the application source dir. However this
might be useful for debugging and logging, hence its added
to the output.
When running tests, I often needed to modify `buildtests.inc.mk` to see the
actual errors/standard output.
This allows overwriting the default redirection of both to `/dev/null`.
It is low level and directly given to the command execution.
As it is interpreted by make, it can even be overwritten using build system
variables:
'BUILDTEST_MAKE_REDIRECT=>/tmp/buildtest.$${board}.out 2>&1'
It replaces
make BOARD=iotlab-m3 info-debug-variable-NEWLIB_INCLUDE_DIR
/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/
with
make BOARD=iotlab-m3 info-debug-variable-NEWLIB_INCLUDE_DIR
/usr/arm-none-eabi/include
Without trailing slash and without relative '..' everywhere.
It also uses `realpath` instead of `abspath` to support Mingw32.
Some versions of Mingw32 abspath implementation has trouble working with
windows formatted path.
$(abspath "C:/A/B") returns "/C/CUR/DIR/C:/A/B" instead of "/C/A/B"
relpath does not have this problem, it does additional symlink resolution but is
not a problem.
Note: on windows it does not remove the trailing `/`.
https://github.com/zephyrproject-rtos/zephyr/issues/2061#issuecomment-331635063
Patched in
941059c69f
Only keep lines that are indeed include path.
It also keeps newlines as they do not matter.
It fixes Mingw32 support where `grep '^\s'` is not working the same way.
It also handles some mac `sed` that do not support `\s`.
Ouput tested with:
make -C examples/hello-world BOARD=samr21-xpro info-debug-variable-COMPILER_INCLUDE_PATHS
# by also putting newlines for readability
Now:
/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include
/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include
Before:
/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1 -E -quiet -v -iprefix /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/ -isysroot /usr/bin/../arm-none-eabi -D__USES_INITFINI__ /dev/null
/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include
/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include
When NEWLIB_INCLUDE_DIR is set from other parts than 'COMPILER_INCLUDE_PATHS' it
does not have a trailing slash.
Also, it makes it more problematic when supplying it from the command line.
And anyway having two '/' does not break anything.
Not all users register their user in the docker group and should not run the
whole make process as root to use docker.
They can now overwrite DOCKER with `DOCKER="sudo docker"`.
Creating files as a user is correctly handled as `id -u` is still run as the
original user.
In the previous state, with llvm and arm for example, newlib-nano include dir
NEWLIB_NANO_INCLUDE_DIR is placed after NEWLIB_INCLUDES and so the default
'newlib.h' is used instead of the nano version.
The excluded patterns can always be defined as they only set `CFLAGS` that
should not be passed to `CXX`.
This prepares for replacing the cflags support detection by a function.
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.
The sensor family SHT10, SHT11 and SHT15 only differ in their accuracy (as in
calibration, not as in resolution). Thus, the same driver can be used for all.
The new driver name better reflects this fact.
I'm using something like this command for a while now for debugging
GNRC. Usually, I just patch it into the application I'm using it with,
but I think there is a benefit to also provide it to RIOT upstream
properly.
Add a target to print an internal variable value.
Usage: make info-debug-variable-VARIABLENAME
Example:
make info-debug-variable-ELFFILE
/path/to/riot/examples/hello-world/bin/native/hello-world.elf
Skald is a very small and simple, TX-only BLE stack that supports
sending advertisements only. It is useful for building all kinds
of BLE beacons with very minimal memory footprints.
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.
`#ifdef FEATURE_PERIPH_NAME` usage should now be replaced by
`#ifdef MODULE_PERIPH_NAME`.
This deprecation was started by pull requests #8226 and #8227.
Attempt to decouple board configuration from debugger interface
configuration by specifying the DEBUG_IFACE variable for the debug
hardware interface to use.
- Merge flash and flash-elf commands since they were identical except
for the file name of the image
- Split GDB command from DBG environment variable to allow more easily
configure front-ends for GDB via environment variables.
- Remove verbose tests of empty variables and replace by `: ${VAR:=default}`
- Remove passed command line arguments to sub-functions, they were
unused in the functions anyway.
- Remove TUI variable, use `export DBG_EXTRA_FLAGS=-tui` to get the same
result.
The CAN stack support only raw CAN at this time.
It contains a device interface (drivers/include/can/candev.h) and the data link
layer, build around can/device.c can/pkt.c and can/router.c. can/dll.c contains
the upper level and lower level interface to send and receive CAN frames.
Upper layer interface is located in include/can/raw.h
The packet buffer was originally designed to have a replaceable
back-end. This is why the actual module is called `gnrc_pktbuf_static`.
However, since than some auxiliary functions snuck into the static
back-end, which should go into the common module (which is a
pseudo-module at the moment).
This fix makes the `gnrc_pktbuf` pseudo-module an actual module and
moves the auxiliary functions to that module.
- Copied the relevant parts of mipshal.mk from the toolchain
- Cleaned up CFLAGS and more in Makefile.include
- Added empty syscalls implementation which can be used to interface
with the UHI system
- Added a note on why -std=gnu99 is necessary for this CPU presently