1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 06:53:52 +01:00

Merge branch 'master' into gnrc_gomach/adapt_duty_recode_para_name

This commit is contained in:
benpicco 2021-10-13 17:36:21 +02:00 committed by GitHub
commit f8c8abf75d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12988 changed files with 1773062 additions and 723914 deletions

3
.bandit Normal file
View File

@ -0,0 +1,3 @@
# codacy:
# Solve flagged valid Python "assert" statements
skips: ['B101']

25
.circleci/config.yml Normal file
View File

@ -0,0 +1,25 @@
# CircleCI configuration file used to build and get a preview of the generated
# Doxygen documentation.
# Note that the job on CircleCI takes around 30 minutes to complete because
# copying +19k individual files to their cloud storage is very slow.
version: 2
jobs:
doc-build:
docker:
- image: riot/static-test-tools
steps:
- checkout
- run: make doc
- run:
command: |
cp -R doc/doxygen/html /doc
- store_artifacts:
path: /doc
workflows:
version: 2
doc-build:
jobs:
- doc-build

View File

@ -13,15 +13,4 @@ pipeline:
matrix:
BUILDTEST_MCU_GROUP:
- static-tests
- cortex_m4_3
- cortex_m4_2
- cortex_m4_1
- cortex_m0_2
- cortex_m0_1
- x86
- cortex_m3_2
- cortex_m3_1
- avr8
- msp430
- arm7
- host

View File

@ -1,37 +0,0 @@
<!--
If your issue is a usage question, please submit it to the user mailing-list
users@riot-os.org or to the developer mailing-list devel@riot-os.org.
If your issue is related to security, please submit it to the security
mailing-list security@riot-os.org.
-->
#### Description
<!--
Example: Cannot build gnrc_networking application for samr21-xpro board.
-->
#### Steps to reproduce the issue
<!--
Try to describe as precisely as possible here the steps required to reproduce
the issue. Here you can also describe your hardware configuration, the network
setup, etc.
-->
#### Expected results
<!--
Example: The gnrc_networking application builds on samr21-xpro.
-->
#### Actual results
<!--
Please paste or specifically describe the actual output.
-->
#### Versions
<!--
Operating system: Mac OSX, Linux, Vagrant VM
Build environment: GCC, CLang versions (you can run the following command from
the RIOT base directory: ./dist/tools/ci/print_toolchain_versions.sh).
-->
<!-- Thanks for contributing! -->

46
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us improve
---
<!--
====================================
IF YOUR ISSUE IS RELATED TO SECURITY
====================================
please submit it to the security mailing-list security@riot-os.org.
If your issue is a question related to the usage of RIOT, please submit it to
our forum at https://forum.riot-os.org.
-->
#### Description
<!--
Example: Cannot build gnrc_networking application for samr21-xpro board.
-->
#### Steps to reproduce the issue
<!--
Try to describe as precisely as possible here the steps required to reproduce
the issue. Here you can also describe your hardware configuration, the network
setup, etc.
-->
#### Expected results
<!--
Example: The gnrc_networking application builds on samr21-xpro.
-->
#### Actual results
<!--
Please paste or specifically describe the actual output.
-->
#### Versions
<!--
Operating system: Mac OSX, Linux, Vagrant VM
Build environment: GCC, CLang versions (you can run the following command from
the RIOT base directory: make print-versions).
-->
<!-- Thanks for contributing! -->

View File

@ -0,0 +1,14 @@
---
name: Feature Request
about: Ask for missing features or improvements
---
#### Description
<!-- Please describe your use case, why you need this feature and why this
feature is important for RIOT. -->
### Useful links
<!-- Please include links to any documentation that you think is useful. -->
<!-- Thanks for contributing! -->

12
.github/ISSUE_TEMPLATE/security_bug.md vendored Normal file
View File

@ -0,0 +1,12 @@
---
name: 'Security Bug report'
about: |
Don't use the issue tracker for this! Please write an e-mail to
security@riot-os.org. The button was just added to advertise this message.
---
# DON'T USE THE ISSUE TRACKER FOR THIS!
<!--
Please write an e-mail to security@riot-os.org. The button was just added to
advertise this message!
-->

View File

@ -15,6 +15,16 @@ Put here the description of your contribution:
-->
### Testing procedure
<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->
### Issues/PRs references
<!--
@ -23,4 +33,4 @@ Examples: Fixes #1234. See also #5678. Depends on PR #9876.
Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->
-->

155
.github/labeler.yml vendored Normal file
View File

@ -0,0 +1,155 @@
"Area: arduino API":
- "sys/arduino/**/*"
"Area: BLE":
- "pkg/nimble/**/*"
- "sys/net/ble/**/*"
- "sys/include/net/bluetil/**/*"
- "sys/include/net/skald/**/*"
- "sys/include/net/skald.h"
"Area: boards":
- "boards/**/*"
"Area: build system":
- "Makefile.*"
- "makefiles/**/*"
- "**/*.mk"
"Area: CI":
- ".circleci/**/*"
- ".github/**/*.yml"
- ".murdock"
"Area: CoAP":
- "sys/net/application_layer/*coap/**/*"
- "sys/include/net/*coap*/**/*"
"Area: core":
- "core/**/*"
"Area: cpu":
- "cpu/**/*"
"Area: doc":
- "doc/**/*"
- "**/*.md"
- "**/*.txt"
"Area: drivers":
- "drivers/**/*"
"Area: examples":
- "examples/**/*"
"Area: Kconfig":
- "dist/tools/kconfiglib/**/*"
- "makefiles/kconfig.mk"
- "kconfigs/*"
- "**/Kconfig"
"Area: LoRa":
- "drivers/llcc68/**/*"
- "drivers/sx126x/**/*"
- "drivers/sx127x/**/*"
- "drivers/include/llcc68.h"
- "drivers/include/sx126x.h"
- "drivers/include/sx127x.h"
- "pkg/semtech-loramac/**/*"
- "sys/net/lora/**/*"
- "sys/net/gnrc/link_layer/lorawan/**/*"
- "sys/include/net/lorawan/**/*"
- "sys/include/net/gnrc/lorawan/**/*"
- "sys/include/net/gnrc/lorawan.h"
- "sys/include/net/lora.h"
- "sys/include/net/loramac.h"
"Area: network":
- "sys/net/**/*"
- "sys/include/net/**/*"
- "pkg/lwip/**/*"
- "pkg/openthread/**/*"
- "pkg/openwsn/**/*"
- "pkg/paho-mqtt/**/*"
"Area: OTA":
- "sys/suit/**/*"
- "sys/include/suit/**/*"
- "sys/include/suit.h"
"Area: pkg":
- "pkg/**/*"
"Area: SAUL":
- "drivers/saul/**/*"
- "drivers/include/saul/**/*"
- "drivers/include/saul.h"
- "sys/saul_reg/**/*"
- "sys/include/saul_reg.h"
"Area: sys":
- "sys/**/*"
"Area: tests":
- "tests/**/*"
- "fuzzing/**/*"
- "dist/pythonlibs/**/*"
- "makefiles/tests/**/*"
"Area: timers":
- "sys/*timer/**/*"
- "sys/include/*timer/**/*"
- "sys/include/*timer.h"
"Area: toolchain":
- "makefiles/toolchain/**/*"
"Area: tools":
- "dist/tools/**/*"
- "dist/testbed-support/**/*"
- "makefiles/tools/**/*"
"Area: USB":
- "sys/usb/**/*"
- "sys/include/usb/**/*"
- "sys/include/usb.h"
"Platform: native":
- "boards/native/**/*"
- "cpu/native/**/*"
"Platform: ARM":
- "cpu/arm7_common/**/*"
- "cpu/cortexm_common/**/*"
- "cpu/cc2*/**/*"
- "cpu/efm32/**/*"
- "cpu/kinetis/**/*"
- "cpu/lm4f120/**/*"
- "cpu/lpc*/**/*"
- "cpu/nrf5*/**/*"
- "cpu/qn908x/**/*"
- "cpu/sam*/**/*"
- "cpu/stellaris_common/**/*"
- "cpu/stm32/**/*"
- "makefiles/arch/cortexm.inc.mk"
"Platform: AVR":
- "cpu/atmega*/**/*"
- "cpu/avr8_common/**/*"
- "makefiles/arch/avr8.inc.mk"
"Platform: ESP":
- "cpu/esp*/**/*"
"Platform: MIPS":
- "cpu/mips*/**/*"
- "makefiles/arch/mips.inc.mk"
"Platform: MSP":
- "cpu/msp*/**/*"
- "makefiles/arch/msp430.inc.mk"
"Platform: RISC-V":
- "cpu/riscv_common/**/*"
- "cpu/fe310/**/*"
- "makefiles/arch/riscv.inc.mk"

21
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,21 @@
# Number of days of inactivity before an issue becomes stale (185 days > 1/2 year)
daysUntilStale: 185
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 31
# Issues with these labels will never be considered stale
exemptLabels:
- "Area: security"
- "State: demonstrator"
- "State: don't stale"
- "Type: bug"
- "Type: tracking"
# Label to use when marking an issue as stale
staleLabel: "State: stale"
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.
If you want me to ignore this issue, please mark it with the
"State: don't stale" label. Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

36
.github/workflows/check-pr.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: check-pr
on:
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]
pull_request_review:
types: [submitted, dismissed]
jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- uses: RIOT-OS/check-labels-action@v1.0.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
unset_labels: 'CI: needs squashing,State: waiting for other PR,Process: blocked by feature freeze'
cond_labels: '(Process: needs >1 ACK,review.approvals>1),(Area: RDM,review.approvals>2)'
check-commits:
runs-on: ubuntu-latest
if: ${{ github.base_ref }}
strategy:
fail-fast: false
matrix:
check: [commit-msg, pr_check]
steps:
- uses: actions/checkout@master
with:
# Use the SHA of the PR branch as-is, not the PR branch merged
# in master (default behavior in GH actions)
# See https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Fetch base branch
run:
git fetch origin '${{ github.base_ref }}:${{ github.base_ref }}'
- name: Run checks
run: |
./dist/tools/${{ matrix.check }}/check.sh "${{ github.base_ref }}"

13
.github/workflows/circleci.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: doc-build-artifact
on: [status]
jobs:
circleci_artifacts_redirector_job:
runs-on: ubuntu-latest
name: Run CircleCI artifacts redirector
steps:
- name: GitHub Action step
uses: larsoner/circleci-artifacts-redirector-action@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifact-path: 0/doc/index.html
circleci-jobs: doc-build

14
.github/workflows/labeler.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: pr-labeler
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true

175
.github/workflows/release-test.yml vendored Normal file
View File

@ -0,0 +1,175 @@
name: release-tests
# Run automated part of the tests specified by the release specs (see
# https://github.com/RIOT-OS/Release-Specs/) on `native` and IoT-LAB boards.
#
# It is split into `native` tests and IoT-LAB tests, as the tests are
# resource-wise disjunct and thus can be run parallel. For each IoT-LAB board
# test an IoT-LAB experiment is started using the `rici` account.
#
# This workflow is run periodically on master with a cron job, on new pushed
# release candidates tags and release tags, and can be triggered via workflow
# dispatch.
on:
schedule:
- cron: '0 3 * * 6'
push:
# Run on all new release candidates and release tags
tags:
- '[0-9][0-9][0-9][0-9].[0-9][0-9]-RC[0-9]*'
- '[0-9][0-9][0-9][0-9].[0-9][0-9]'
- '[0-9][0-9][0-9][0-9].[0-9][0-9].*'
workflow_dispatch:
inputs:
riot_version:
description: 'RIOT version to checkout'
required: true
default: 'master'
release_specs_version:
description: 'Release-Specs version to checkout'
required: true
default: 'master'
docker_version:
description: 'riot/riotbuild docker image version'
required: true
default: 'latest'
filter:
description: 'Pytest filter. Leave empty for all.'
required: false
env:
DOCKER_MAKE_ARGS: -j
# split up native and IoT-LAB tasks to parallelize somewhat and prevent
# to hit Github Limit of 6h per job.
jobs:
tasks:
runs-on: ubuntu-latest
timeout-minutes: 360
strategy:
fail-fast: false
matrix:
pytest_mark:
- "iotlab_creds"
include:
- pytest_mark: "not iotlab_creds"
sudo: "sudo"
steps:
- name: Generate .riotgithubtoken
run: |
if [ -z "${{ matrix.sudo }}" ]; then
echo '${{ secrets.RIOT_CI_ACCESS_TOKEN }}' > ~/.riotgithubtoken
else
sudo sh -c "echo '${{ secrets.RIOT_CI_ACCESS_TOKEN }}' > ~/.riotgithubtoken"
fi
- name: Setup IoT-LAB credentials
if: ${{ matrix.pytest_mark == 'iotlab_creds' }}
run: |
echo '${{ secrets.IOTLABRC }}' > ~/.iotlabrc
- name: Setup SSH agent
if: ${{ matrix.pytest_mark == 'iotlab_creds' }}
uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.IOTLAB_PRIVATE_KEY }}
- name: Fetch host key from IoT-LAB saclay site
if: ${{ matrix.pytest_mark == 'iotlab_creds' }}
run: |
IOTLAB_USER=$(cat ~/.iotlabrc | cut -f1 -d:)
ssh -oStrictHostKeyChecking=accept-new \
${IOTLAB_USER}@saclay.iot-lab.info exit
- name: Fetch host key from IoT-LAB lille site
if: ${{ matrix.pytest_mark == 'iotlab_creds' }}
run: |
IOTLAB_USER=$(cat ~/.iotlabrc | cut -f1 -d:)
ssh -oStrictHostKeyChecking=accept-new \
${IOTLAB_USER}@lille.iot-lab.info exit
- name: Checkout Release-Specs
uses: actions/checkout@v2
with:
repository: RIOT-OS/Release-Specs
path: Release-Specs
fetch-depth: 1
ref: ${{ github.event.inputs.release_specs_version }}
- name: Checkout RIOT
uses: actions/checkout@v2
with:
repository: RIOT-OS/RIOT
path: RIOT
fetch-depth: 1
ref: ${{ github.event.inputs.riot_version }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox junit2html
- name: Pull riotbuild docker image
run: |
DOCKER_VERSION="${{ github.event.inputs.docker_version }}"
if [ -z "$DOCKER_VERSION" ]; then
DOCKER_VERSION="latest"
fi
docker pull riot/riotbuild:$DOCKER_VERSION
- name: Create TAP interfaces
if: ${{ matrix.pytest_mark == 'not iotlab_creds' }}
run: |
sudo RIOT/dist/tools/tapsetup/tapsetup -c 11
- name: Run release tests
timeout-minutes: 350
run: |
RIOTBASE="$GITHUB_WORKSPACE/RIOT"
TOX_ARGS=""
if ! echo ${{ github.event.inputs.riot_version }} | \
grep -q "[0-9]\{4\}.[0-9]\{2\}-RC[0-9]\+"; then
TOX_ARGS+="--non-RC "
fi
if [ -n "${{ github.event.inputs.filter }}" ]; then
K="-k"
fi
cd Release-Specs
# definition in env does not work since $GITHUB_WORKSPACE seems not to
# be accessible
${{ matrix.sudo }} \
BUILD_IN_DOCKER=1 \
DOCKER_MAKE_ARGS=${DOCKER_MAKE_ARGS} \
DOCKER_ENV_VARS="USEMODULE QUIETER" \
GITHUB_REPOSITORY=${GITHUB_REPOSITORY} \
GITHUB_RUN_ID=${GITHUB_RUN_ID} \
GITHUB_SERVER_URL=${GITHUB_SERVER_URL} \
APPKEY="${{ secrets.CI_TTN_APPKEY }}" \
NWKSKEY="${{ secrets.CI_TTN_NWKSKEY_ABP }}" \
APPSKEY="${{ secrets.CI_TTN_APPSKEY_ABP }}" \
LORAWAN_DL_KEY="${{ secrets.CI_TTN_APPID_KEY }}" \
DEVEUI="009E40529364FBE6" \
APPEUI="70B3D57ED003B26A" \
DEVADDR="26011EB0" \
TTN_APP_ID="11-lorawan" \
TTN_DEV_ID="riot_lorawan_1" \
TTN_DEV_ID_ABP="riot_lorawan_1_abp" \
RIOTBASE=${RIOTBASE} \
$(which tox) -e test -- ${TOX_ARGS} \
${K} "${{ github.event.inputs.filter }}" -m "${{ matrix.pytest_mark }}"
- name: junit2html and XML deploy
if: always()
run: |
DATE=$(date +"%Y-%m-%d-%H-%M-%S")
if echo ${{ github.event.inputs.riot_version }} | \
grep -q "[0-9]\{4\}.[0-9]\{2\}"; then
VER=${{ github.event.inputs.riot_version }}
else
VER=$(git -C $GITHUB_WORKSPACE/RIOT rev-parse --short HEAD)
fi
MARK=$(echo "${{ matrix.pytest_mark }}" | tr '[ _]' '-')
REPORT_XML=$GITHUB_WORKSPACE/Release-Specs/test-report.xml
REPORT_NAME=test-reports/test-report-$MARK-$VER-$DATE
mkdir test-reports/
junit2html ${REPORT_XML} ${REPORT_NAME}.html
cp ${REPORT_XML} ${REPORT_NAME}.xml
- uses: actions/upload-artifact@v2
if: always()
with:
name: Test Reports
path: test-reports/*

41
.github/workflows/static-test.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: static-tests
on:
push:
branches:
- master
tags:
- '[0-9][0-9][0-9][0-9].[0-9][0-9]-RC[0-9]*'
- '[0-9][0-9][0-9][0-9].[0-9][0-9]'
- '[0-9][0-9][0-9][0-9].[0-9][0-9].*'
pull_request:
branches:
- '*'
jobs:
static-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup git
run: |
# Note: ${{ github.base_ref }} is empty when not in a PR
if [ -n "${{ github.base_ref }}" ]; then
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} --no-tags
else
git config diff.renameLimit 16384
fi
git config apply.whitespace nowarn
- name: Fetch riot/static-test-tools Docker image
run: docker pull riot/static-test-tools:latest
- name: Run static-tests
run: |
# Note: ${{ github.base_ref }} is empty when not in a PR
docker run --rm \
-e CI_BASE_BRANCH=${{ github.base_ref }} \
-e GITHUB_RUN_ID=${GITHUB_RUN_ID} \
-v $(pwd):/data/riotbuild \
riot/static-test-tools:latest \
make static-test

137
.github/workflows/test-on-iotlab.yml vendored Normal file
View File

@ -0,0 +1,137 @@
name: test-on-iotlab
# Run 'compile_and_test_for_board.py' on IoT-LAB boards.
#
# This workflow will launch all tests on a list of IoT-LAB boards.
#
# This workflow is only run periodically on master with a cron and on new
# pushed release candidates tags.
on:
# Schedule weekly runs on Monday at 00:00 on master
schedule:
- cron: '00 0 * * 1'
push:
# Run on all new releases and release candidates tags
tags:
- '[0-9][0-9][0-9][0-9].[0-9][0-9]-RC[0-9]*'
- '[0-9][0-9][0-9][0-9].[0-9][0-9]'
- '[0-9][0-9][0-9][0-9].[0-9][0-9].*'
# Allow manual trigger
workflow_dispatch:
inputs:
riot_version:
description: 'RIOT version to checkout'
required: true
default: 'master'
jobs:
# Runs all tests on IoT-LAB boards
compile_and_test_for_board:
strategy:
max-parallel: 8
fail-fast: false
matrix:
boards:
- riot: iotlab-m3
iotlab:
archi: m3:at86rf231
site: saclay
- riot: nrf51dk
iotlab:
archi: nrf51dk:ble
site: saclay
- riot: nrf52dk
iotlab:
archi: nrf52dk:ble
site: saclay
- riot: nrf52840dk
iotlab:
archi: nrf52840dk:multi
site: saclay
- riot: nrf52832-mdk
iotlab:
archi: nrf52832mdk:ble
site: saclay
- riot: samr21-xpro
iotlab:
archi: samr21:at86rf233
site: saclay
- riot: b-l072z-lrwan1
iotlab:
archi: st-lrwan1:sx1276
site: saclay
- riot: b-l475e-iot01a
iotlab:
archi: st-iotnode:multi
site: saclay
runs-on: ubuntu-latest
name: ${{ matrix.boards.riot }}
env:
IOTLAB_NODE: auto
BUILD_IN_DOCKER: 1
# Force .bin files generation because these files are used to flash on IoT-LAB and
# because compile_and_test_for_board forces RIOT_CI_BUILD which skip .bin
# files generation
DOCKER_ENVIRONMENT_CMDLINE: -e BUILD_FILES=\$$\(BINFILE\)
COMPILE_AND_TEST_FOR_BOARD: ./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py
COMPILE_AND_TEST_ARGS: --with-test-only --jobs=2 --report-xml
# Exclude applications that are expected to fail or cannot run on iotlab
# - tests/periph_timer_short_relative_set is expected to fail
# - tests/riotboot requires the riotboot feature and provides a test
# but flashing at a specific offset is not (yet) supported on IoT-LAB
# so it will always fail because of that limitation
APPLICATIONS_EXCLUDE: tests/periph_timer_short_relative_set tests/riotboot
# Increase tolerance error with `tests/periph_timer_periodic` because
# of timing issues with the test script when running in the github
# actions environment
TEST_PERIPH_TIMER_PERIODIC_PRECISION: 0.30
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install iotlabcli pexpect riotctrl[rapidjson] junit-xml
- name: Configure credentials
run: echo '${{ secrets.IOTLABRC }}' > ~/.iotlabrc
- name: Setup SSH agent
uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.IOTLAB_PRIVATE_KEY }}
- name: Fetch host key from IoT-LAB ${{ matrix.boards.iotlab.site }} site
run: |
IOTLAB_USER=$(cat ~/.iotlabrc | cut -f1 -d:)
ssh -oStrictHostKeyChecking=accept-new \
${IOTLAB_USER}@${{ matrix.boards.iotlab.site }}.iot-lab.info exit
- name: Pull riotbuild docker image
run: |
docker pull riot/riotbuild:latest
- name: Checkout RIOT
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.riot_version }}
- name: Launch IoT-LAB experiment
run: |
IOTLAB_EXP_ID=$(iotlab-experiment --jmespath="id" submit \
-n "riot-ci-${{ matrix.boards.riot }}" -d 360 \
-l 1,site=${{ matrix.boards.iotlab.site }}+archi=${{ matrix.boards.iotlab.archi }})
iotlab-experiment wait -i ${IOTLAB_EXP_ID}
echo "IOTLAB_EXP_ID=${IOTLAB_EXP_ID}" >> $GITHUB_ENV
- name: Run compile_and_test_for_board.py on ${{ matrix.boards.riot }}
run: |
${COMPILE_AND_TEST_FOR_BOARD} . ${{ matrix.boards.riot }} \
results-${{ matrix.boards.riot }} ${COMPILE_AND_TEST_ARGS} \
--applications-exclude="${APPLICATIONS_EXCLUDE}"
- name: Stop IoT-LAB experiment
if: always()
run: iotlab-experiment stop -i ${IOTLAB_EXP_ID}
- name: Archive results
if: always()
# Store generated results-<riot board name> artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.boards.riot }}
path: results-${{ matrix.boards.riot }}

105
.github/workflows/test-on-ryot.yml vendored Normal file
View File

@ -0,0 +1,105 @@
---
# Run 'compile_and_test_for_board.py' on connected boards.
#
# This workflow will run on a RYOT (Run Your Own Test) machine and launch
# all tests on all boards currently connected to that machine. This
# workflow relies on self-hosted runners, this means building and
# flashing happens on the self-hosted runner (all in docker). An alternative
# approach was used in https://github.com/RIOT-OS/RIOT/pull/14600, where
# the RYOT machine was only used for remote flashing, this is a better
# alternative if ssh access is possible.
#
# Documentation:
#
# * Setup a RYOT machine:
# https://github.com/fjmolinas/riot-ryot/blob/master/setup.md
#
# * Requirements (already filled by a RYOT machine):
# * Add one or more self-hosted runners:
# https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners
# * All required flashing tools installed
# * udev rules that map all BOARD to /dev/riot/tty-$(BOARD), see
# http://riot-os.org/api/advanced-build-system-tricks.html#multiple-boards-udev
# * RIOT_MAKEFILES_GLOBAL_PRE that sets PORT and DEBUG_ADAPTER_ID for each
# BOARD
# * A list of connected BOARDs in JSON format so that fromJSON can be used
# to dynamically setup the matrix, e.g. make target providing this:
# https://github.com/fjmolinas/riot-ryot/blob/72fc9ad710a2219e942c5965a014e934822e9da5/template/conf/makefiles.pre#L19-L24
# * RYOT: https://github.com/fjmolinas/riot-ryot
name: test-on-ryot
on:
# Schedule weekly runs Saturday at 00:00 on master
schedule:
- cron: '0 0 * * 6'
push:
# Run on all new release candidates
tags:
- '[0-9][0-9][0-9][0-9].[0-9][0-9]-RC[0-9]*'
- '[0-9][0-9][0-9][0-9].[0-9][0-9]'
- '[0-9][0-9][0-9][0-9].[0-9][0-9].*'
env:
# self-hosted runners are started by a systemd which is not a "login" shell
# this means that no local environment variables are loaded (e.g. /etc/environment)
# when the runner is started. So explicitly set RIOT_MAKEFILES_GLOBAL_PRE
# to set PORT and DEBUG_ADAPTER_ID per BOARD
RIOT_MAKEFILES_GLOBAL_PRE: '/builds/conf/makefiles.pre'
jobs:
connected_boards:
name: Get Connected Boards
runs-on: self-hosted
outputs:
boards: ${{ steps.ci-connected-boards.outputs.boards }}
steps:
# Get all currently connected boards if not passed through an input
- id: ci-connected-boards
run: echo "::set-output name=boards::$(make -C /builds/boards/ list-boards-json --no-print-directory)"
# Runs all tests on connected boards
compile_and_test_for_board:
name: ${{ matrix.board }}
runs-on: self-hosted
needs: connected_boards
# ci-riot-tribe has 8 cores, parallelism will depend on actually configured
# runners
strategy:
max-parallel: 7
fail-fast: false
matrix:
board: ${{ fromJson(needs.connected_boards.outputs.boards) }}
env:
BUILD_IN_DOCKER: 1
COMPILE_AND_TEST_FOR_BOARD: /builds/boards/RIOT/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py
# args for compile_and_test_for_board script
COMPILE_AND_TEST_ARGS: --with-test-only --report-xml --incremental
# environment vars for compile_and_test_for_board script to pass
# USEMODULE and CFLAGS use:
# DOCKER_ENVIRONMENT_CMDLINE=\'-e USEMODULE=<name>\'
# DOCKER_ENVIRONMENT_CMDLINE=\'-e CFLAGS=-D<flag>\'
COMPILE_AND_TEST_VARS: ''
APPLICATIONS: ''
# Exclude 'tests/periph_timer_short_relative_set' since its expected
# to fail on most BOARDs
APPLICATIONS_EXCLUDE: 'tests/periph_timer_short_relative_set'
steps:
- name: Checkout RIOT
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.riot_version }}
# Make sure it runs git clean -xdff before fetching
clean: true
- name: Run compile_and_test_for_board.py
run: |
${COMPILE_AND_TEST_VARS} ${COMPILE_AND_TEST_FOR_BOARD} . \
${{ matrix.board }} results-${{ matrix.board }} \
${COMPILE_AND_TEST_ARGS} \
--applications="${APPLICATIONS}" \
--applications-exclude="${APPLICATIONS_EXCLUDE}"
- name: Archive results
if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.board }}
path: results-${{ matrix.board }}

77
.github/workflows/tools-buildtest.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: tools-buildtest
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- '*'
jobs:
tools-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build flatc standalone
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/flatc
- name: Build mosquitto_rsmb standalone
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/mosquitto_rsmb
- name: Build bossa-1.8 standalone
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/bossa-1.8
- name: Build bossa-1.9 standalone
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/bossa-1.9
- name: Build bossa-nrf52 standalone
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/bossa-nrf52
- name: Build edbg standalone
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/edbg
- name: Build pic32prog standalone
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/pic32prog
- name: Build setsid standalone
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/setsid
- name: Build ethos
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/ethos
- name: Build uhcpd
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/uhcpd
- name: Build stm32 clk_conf
uses: aabadie/riot-action@v1
with:
cmd: make -C cpu/stm32/dist/clk_conf
- name: Build kinetis calc_spi_scalers
uses: aabadie/riot-action@v1
with:
cmd: make -C cpu/kinetis/dist/calc_spi_scalers
- name: Build fixdep tool
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/fixdep
- name: Build lpc2k_pgm tool
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/lpc2k_pgm
- name: Build riotboot_serial tool
uses: aabadie/riot-action@v1
with:
cmd: make -C dist/tools/riotboot_serial

37
.github/workflows/tools-test.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: tools-test
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- '*'
jobs:
python-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install kconfiglib
sudo apt-get install gcc-multilib
- name: Test backport_pr
run: cd dist/tools/backport_pr && tox
- name: Test compile_and_test_for_board
run: cd dist/tools/compile_and_test_for_board && tox
- name: Test riotctrl_ctrl
run: cd dist/pythonlibs/riotctrl_ctrl && tox
- name: Test riotctrl_shell
run: cd dist/pythonlibs/riotctrl_shell && tox
- name: Test kconfig script
run: cd dist/tools/kconfiglib/tests && ./test.sh

36
.gitignore vendored
View File

@ -1,5 +1,7 @@
# Object files
*.o
# Target files
*.elf
# Documentation artifacts
doc/doxygen/html
doc/doxygen/latex
@ -9,10 +11,19 @@ doc/doxygen/*.db
doc/doxygen/*.tmp
# Built binaries
*bin
# Build directory
/build
# AFL findings
fuzzing/**/findings/
# Backup files
*~
*.orig
.*.swn
.*.swo
.*.swp
*.save
*.rej
\#*\#
cachegrind.out*
# Eclipse workspace files
.project
@ -56,3 +67,28 @@ Makefile.local
# scan-build artifacts
scan-build/
# compile_and_test_for_boards default "results" directory
results/
# mypy artifacts
.mypy_cache/
# Clangd compile flags (language server)
compile_commands.json
compile_flags.txt
# cache files of clangd (and probably other tools)
.cache/
# generated by clang-check for C++ code
*.plist
# suit manifest keys
keys/
# clangd language server
.clangd/
# custom clang-tidy flags, also used when using clangd language server
.clang-tidy

View File

@ -1,3 +1,8 @@
Benjamin Valentin <benjamin.valentin@ml-pa.com> <benjamin.valentin@ml-pa.com>
Benjamin Valentin <benjamin.valentin@ml-pa.com> <benpicco@googlemail.com>
Benjamin Valentin <benjamin.valentin@ml-pa.com> <benpicco@beuth-hochschule.de>
Benjamin Valentin <benjamin.valentin@ml-pa.com> <benpicco@zedat.fu-berlin.de>
Benjamin Valentin <benjamin.valentin@ml-pa.com> <benpicco@flauschlabor.de>
Cenk Gündoğan <mail-github@cgundogan.de> <cnkgndgn@gmail.com>
Cenk Gündoğan <mail-github@cgundogan.de> <mail@cgundogan.de>
Hauke Petersen <devel@haukepetersen.de> <hauke.petersen@fu-berlin.de>

336
.murdock
View File

@ -1,15 +1,99 @@
#!/bin/sh
export TEST_BOARDS_AVAILABLE=${TEST_BOARDS_AVAILABLE:-"samr21-xpro"}
: ${TEST_BOARDS_AVAILABLE:="esp32-wroom-32 samr21-xpro"}
# temporarily disabling llvm builds until https://github.com/RIOT-OS/RIOT/pull/15595
# is in
#: ${TEST_BOARDS_LLVM_COMPILE:="iotlab-m3 native nrf52dk mulle nucleo-f401re samr21-xpro slstk3402a"}
: ${TEST_BOARDS_LLVM_COMPILE:=""}
: ${TEST_KCONFIG_BOARDS_AVAILABLE:="
dwm1001
hifive1
native
nrf52840dk
nucleo-f103rb
remote-revb
samr21-xpro
seeedstudio-gd32
"}
: ${TEST_KCONFIG_ENFORCE_APP_GROUPS:="
tests/cb_mux*
tests/congure_*
tests/driver_b*
tests/driver_f*
tests/driver_g*
tests/driver_h*
tests/driver_i*
tests/driver_j*
tests/driver_l*
tests/driver_o*
tests/driver_p*
tests/driver_q*
tests/driver_r*
tests/driver_s*
tests/driver_t*
tests/driver_u*
tests/driver_v*
tests/periph_*
tests/prng_*
tests/xtimer_*
tests/ztimer_*
examples/hello-world
tests/ieee802154_hal
"}
: ${TEST_WITH_CONFIG_SUPPORTED:="examples/suit_update tests/driver_at86rf2xx_aes"}
export RIOT_CI_BUILD=1
export STATIC_TESTS=${STATIC_TESTS:-1}
export CC_NOCOLOR=1
export STATIC_TESTS=0
export CFLAGS_DBG=""
export DLCACHE_DIR=${DLCACHE_DIR:-~/.dlcache}
export ENABLE_TEST_CACHE=${ENABLE_TEST_CACHE:-1}
# This is a work around for a bug in CCACHE which interacts very badly with
# some features of RIOT and of murdock. The result is that ccache is
# ineffective (i.e. objects are never reused, resulting in extreme cache miss
# rate) and murdock becomes slow.
#
# - CCACHE thinks that -gz by itself enables debugging, which is not true.
# see https://github.com/ccache/ccache/issues/464
# - When debug info is included, CCACHE hashes the file paths, as these
# influence the debug information (the name of compile units and/or their
# "comp_dir" attribute)
# - Riot does not set -fdebug-prefix-map. This is not that easy as it may not
# be supported in every toolchain (some are quite old).
# - Murdock builds PRs in different directories each time.
#
# It is only the combination of these three factors which causes this bug.
export OPTIONAL_CFLAGS_BLACKLIST="-gz"
NIGHTLY=${NIGHTLY:-0}
RUN_TESTS=${RUN_TESTS:-${NIGHTLY}}
DWQ_ENV="-E BOARDS -E APPS -E NIGHTLY -E RUN_TESTS"
DWQ_ENV="-E BOARDS -E APPS -E NIGHTLY -E RUN_TESTS -E ENABLE_TEST_CACHE
-E TEST_HASH -E CI_PULL_LABELS -EPKG_USE_MIRROR"
if [ ${NIGHTLY} -eq 1 ]; then
export PKG_USE_MIRROR=0
fi
get_supported_kconfig_board_app() {
local board=$1
local appdir=$2
if is_in_list "${board}" "${TEST_KCONFIG_BOARDS_AVAILABLE}"; then
if is_in_list "${appdir}" "${TEST_KCONFIG_ENFORCE_APP_GROUPS}"; then
return 0
fi
if [ -f "${appdir}/app.config.test" ]; then
return 0
fi
fi
return 1
}
check_label() {
local label="${1}"
@ -22,11 +106,39 @@ check_label() {
check_label "CI: run tests" && RUN_TESTS=1
}
[ "$ENABLE_TEST_CACHE" = "1" ] && {
check_label "CI: disable test cache" && export ENABLE_TEST_CACHE=0
}
error() {
echo "$@"
exit 1
}
# true if "$2" starts with "$1", false otherwise
startswith() {
case "${2}" in
${1}*) true ;;
*) false ;;
esac
}
# if MURDOCK_HOOK is set, this function will execute it and pass on all it's
# parameters. should the hook script exit with negative exit code, hook() makes
# this script exit with error, too.
# hook() will be called from different locations of this script.
# currently, the only caller is "run_test", which calls "hook run_test_pre".
# More hooks will be added as needed.
hook() {
if [ -n "${MURDOCK_HOOK}" ]; then
echo "- executing hook $1"
"${MURDOCK_HOOK}" "$@" || {
error "$0: hook \"${MURDOCK_HOOK} $@\" failed!"
}
echo "- hook $1 finished"
fi
}
# true if word "$1" is in list of words "$2", false otherwise
# uses grep -w, thus only alphanum and "_" count as word bounderies
# (word "def" matches "abc-def")
@ -39,11 +151,17 @@ is_in_list() {
echo "$haystack" | grep -q -w "$needle"
}
# grep that doesn't return error on empty input
_grep() {
grep "$@"
true
}
_greplist() {
if [ $# -eq 0 ]; then
echo cat
else
echo -n "grep -E ($1"
echo -n "_grep -E ($1"
shift
for i in $*; do
echo -n "|$i"
@ -54,9 +172,8 @@ _greplist() {
# get list of all app directories
get_apps() {
find tests/ examples/ \
-mindepth 2 -maxdepth 2 -name Makefile -type f \
| xargs dirname | $(_greplist $APPS) | sort
make -f makefiles/app_dirs.inc.mk info-applications \
| $(_greplist $APPS) | sort
}
# take app dir as parameter, print all boards that are supported
@ -76,22 +193,50 @@ get_supported_boards() {
done | $(_greplist $BOARDS)
}
# given an app dir as parameter, print "$appdir board" for each supported
# board. Only print for boards in $BOARDS.
get_app_board_pairs() {
get_supported_toolchains() {
local appdir=$1
for board in $(get_supported_boards $appdir)
local board=$2
local toolchains="gnu"
if is_in_list "${board}" "${TEST_BOARDS_LLVM_COMPILE}"; then
toolchains="$(make -s --no-print-directory -C${appdir} BOARD=${board} \
info-toolchains-supported 2> /dev/null | grep -o -e "llvm" -e "gnu")"
fi
echo "${toolchains}"
}
# given an app dir as parameter, print "$appdir $board:$toolchain" for each
# supported board and toolchain. Only print for boards in $BOARDS.
# if extra args are given, they will be prepended to each output line.
get_app_board_toolchain_pairs() {
local appdir=$1
local boards="$(get_supported_boards $appdir)"
# collect extra arguments into prefix variable
shift
local prefix="$*"
if [ "$boards" = makefile_broken ]; then
echo "$appdir makefile_broken"
return
fi
for board in ${boards}
do
echo $appdir $board
for toolchain in $(get_supported_toolchains $appdir $board)
do
echo $prefix $appdir $board:$toolchain
done
done | $(_greplist $BOARDS)
}
# use dwqc to create full "appdir board" compile job list
# use dwqc to create full "appdir board toolchain" compile job list
get_compile_jobs() {
check_label "CI: skip compile test" && return
get_apps | \
dwqc ${DWQ_ENV} -s \
"$0 get_app_board_pairs \${1}" \
| xargs '-d\n' -n 1 echo $0 compile
${DWQ_JOBID:+--subjob} \
"$0 get_app_board_toolchain_pairs \${1} $0 compile"
}
print_worker() {
@ -99,12 +244,42 @@ print_worker() {
echo "-- running on worker ${DWQ_WORKER} thread ${DWQ_WORKER_THREAD}, build number $DWQ_WORKER_BUILDNUM."
}
# compile one app for one board. delete intermediates.
test_hash_calc() {
local bindir=$1
# Why two times cut?
# "test-input-hash.sha1" contains a list of lines containing
# "<hash> <filename>" on each line.
# We need to filter out the filename, as it contains the full path name,
# which differs depending on the build machine.
#
# After piping through sha1sum, we get "<hash> -". " -" has to go so we save the
# hassle of escaping the resulting hash.
cat ${bindir}/test-input-hash.sha1 | cut -f1 -d' ' | sha1sum | cut -f1 -d' '
}
test_cache_get() {
test "${ENABLE_TEST_CACHE}" = "1" || return 1
test -n "$(redis-cli get $1)" > /dev/null
}
test_cache_put() {
redis-cli set "$1" ok
}
# compile one app for one board with one toolchain. delete intermediates.
compile() {
local appdir=$1
local board=$2
local board=$(echo $2 | cut -f 1 -d':')
local toolchain=$(echo $2 | cut -f 2 -d':')
[ "$board" = "makefile_broken" ] && error "$0: Makefile in \"$appdir\" seems to be broken!"
[ "$board" = "makefile_broken" ] && {
echo "$0: There seems to be a problem in \"$appdir\" while getting supported boards!"
echo "$0: testing \"make -C$appdir info-boards-supported\"..."
make -C$appdir info-boards-supported && echo "$0: success. no idea what's wrong." || echo "$0: failed!"
exit 1
}
# set build directory. CI ensures only one build at a time in $(pwd).
export BINDIR="$(pwd)/build"
@ -116,15 +291,45 @@ compile() {
print_worker
# sanity checks
[ $# -ne 2 ] && error "$0: compile: invalid parameters (expected \$appdir \$board)"
[ $# -ne 2 ] && error "$0: compile: invalid parameters (expected \$appdir \$board:\$toolchain)"
[ ! -d "$appdir" ] && error "$0: compile: error: application directory \"$appdir\" doesn't exist"
[ ! -d "boards/$board" ] && error "$0: compile: error: board directory \"boards/$board\" doesn't exist"
# compile
CCACHE_BASEDIR="$(pwd)" BOARD=$board RIOT_CI_BUILD=1 \
make -C${appdir} clean all -j${JOBS:-4}
# We compile a first time with Kconfig based dependency
# resolution for regression purposes. $TEST_KCONFIG contains a
# list of board-application tuples that are currently modeled to
# run with Kconfig
should_check_kconfig_hash=0
if get_supported_kconfig_board_app "${board}" "${appdir}"; then
should_check_kconfig_hash=1
BOARD=${board} make -C${appdir} clean
CCACHE_BASEDIR="$(pwd)" BOARD=${board} TOOLCHAIN=${toolchain} RIOT_CI_BUILD=1 TEST_KCONFIG=1 \
make -C${appdir} all test-input-hash -j${JOBS:-4}
RES=$?
if [ $RES -eq 0 ]; then
kconfig_test_hash=$(test_hash_calc "${BINDIR}")
else
kconfig_test_hash=0
echo "An error occurred while compiling using Kconfig";
fi
fi
# compile without Kconfig
CCACHE_BASEDIR="$(pwd)" BOARD=$board TOOLCHAIN=$toolchain RIOT_CI_BUILD=1 \
make -C${appdir} clean all test-input-hash -j${JOBS:-4}
RES=$?
test_hash=$(test_hash_calc "$BINDIR")
if [ ${should_check_kconfig_hash} != 0 ]; then
if [ ${kconfig_test_hash} != ${test_hash} ]; then
echo "Hashes of binaries with and without Kconfig mismatch for ${appdir}";
echo "Please check that all used modules are modelled in Kconfig and enabled";
RES=1
fi
fi
# run tests
if [ $RES -eq 0 ]; then
if [ $RUN_TESTS -eq 1 -o "$board" = "native" ]; then
@ -133,8 +338,14 @@ compile() {
BOARD=$board make -C${appdir} test
RES=$?
elif is_in_list "$board" "$TEST_BOARDS_AVAILABLE"; then
BOARD=$board make -C${appdir} test-murdock
RES=$?
echo "-- test_hash=$test_hash"
if test_cache_get $test_hash; then
echo "-- skipping test due to positive cache hit"
else
BOARD=$board TOOLCHAIN=$toolchain TEST_HASH=$test_hash \
make -C${appdir} test-murdock
RES=$?
fi
fi
fi
fi
@ -153,51 +364,78 @@ compile() {
test_job() {
local appdir=$1
local board=$2
local flashfile="$3"
local board=$(echo $2 | cut -f 1 -d':')
local toolchain=$(echo $2 | cut -f 2 -d':')
[ ! -f "$flashfile" ] && {
echo "$0: _test(): flashfile \"$flashfile\" doesn't exist!"
return 1
}
# interpret any extra arguments as file names.
# They will be sent along with the job to the test worker
# and stored in the application's binary folder.
shift 2
local files=""
for filename in "$@"; do
# check if the file is within $(BINDIR)
if startswith "${BINDIR}" "${filename}"; then
# get relative (to $(BINDIR) path
local relpath="$(realpath --relative-to ${BINDIR} ${filename})"
else
error "$0: error: extra test files not within \${BINDIR}!"
fi
# set remote file path.
# currently, the test workers build in the default build path.
local remote_bindir="${appdir}/bin/${board}"
files="${files} --file ${filename}:${remote_bindir}/${relpath}"
done
dwqc \
${DWQ_ENV} \
${DWQ_JOBID:+--subjob} \
--file $flashfile:$appdir/bin/${board}/$(basename $flashfile) \
--queue ${TEST_QUEUE:-$board} \
--maxfail 1 \
"./.murdock run_test $appdir $board"
$files \
"./.murdock run_test $appdir $board:$toolchain"
}
run_test() {
local appdir=$1
local board=$2
local board=$(echo $2 | cut -f 1 -d':')
local toolchain=$(echo $2 | cut -f 2 -d':')
print_worker
echo "-- executing tests for $appdir on $board:"
BOARD=$board make -C$appdir flash-only test
echo "-- executing tests for $appdir on $board (compiled with $toolchain toolchain):"
hook run_test_pre
# do flashing and building of termdeps simultaneously
BOARD=$board TOOLCHAIN=${toolchain} make -C$appdir flash-only termdeps -j2
# now run the actual test
if is_in_list "${appdir}" "${TEST_WITH_CONFIG_SUPPORTED}"; then
BOARD=${board} TOOLCHAIN=${toolchain} make -C${appdir} test-with-config
else
BOARD=$board TOOLCHAIN=${toolchain} make -C$appdir test
fi
RES=$?
if [ $RES -eq 0 -a -n "$TEST_HASH" ]; then
echo -n "-- saving test result to cache: "
test_cache_put $TEST_HASH
fi
return $RES
}
# execute static tests
static_tests() {
local repo=${CI_BASE_REPO:-https://github.com/RIOT-OS/RIOT}
local branch=${CI_BASE_BRANCH:-master}
print_worker
./dist/tools/ci/static_tests.sh
}
OUT="$(git remote add upstream $repo 2>&1 && git fetch upstream ${branch}:${branch} 2>&1)"
RES=$?
if [ $RES -ne 0 ]; then
echo "$OUT"
exit 1
fi
BUILDTEST_MCU_GROUP=static-tests ./dist/tools/ci/build_and_test.sh
get_non_compile_jobs() {
[ "$STATIC_TESTS" = "1" ] && \
echo "$0 static_tests"
}
get_jobs() {
[ "$STATIC_TESTS" = "1" ] && \
echo "$0 static_tests###{ \"jobdir\" : \"exclusive\" }"
get_non_compile_jobs
get_compile_jobs
}

View File

@ -1,8 +0,0 @@
dist: trusty
before_install:
- sudo apt-get install coreutils realpath doxygen graphviz python-lesscpy cppcheck coccinelle pcregrep python3-pip
- sudo pip3 install flake8
script:
- make static-test

153
CODEOWNERS Normal file
View File

@ -0,0 +1,153 @@
## CODEOWNERS for autoreview assigning in github
# https://help.github.com/en/articles/about-code-owners#codeowners-syntax
# Order is important; for each modified file, the last matching
# pattern takes the most precedence.
*.md @jia200x
/.murdock @kaspar030
/boards/common/atxmega/ @nandojve
/boards/common/esp*/ @gschorcht
/boards/common/nrf*/ @aabadie @haukepetersen
/boards/common/nucleo*/ @aabadie
/boards/common/silabs/ @basilfx
/boards/common/slwstk6000b/ @basilfx
/boards/common/stm32/ @aabadie @fjmolinas
/boards/e180-zg120b-tb/ @basilfx
/boards/esp*/ @gschorcht @yegorich
/boards/hamilton/ @Hyungsin
/boards/ikea-tradfri/ @basilfx
/boards/lobaro-lorabox/ @leandrolanzieri
/boards/nrf*/ @aabadie @haukepetersen
/boards/nucleo*/ @aabadie @fjmolinas
/boards/phynode-kw41z/ @jia200x
/boards/sam*-xpro/ @dylad
/boards/same54-xpro/ @benpicco
/boards/sensebox_samd21/ @leandrolanzieri @jia200x
/boards/slstk340*/ @basilfx
/boards/sltb001a/ @basilfx
/boards/slwstk6000b/ @basilfx
/boards/slwstk6220a/ @basilfx
/boards/sodaq-sara-aff/ @leandrolanzieri
/boards/stk3*00/ @basilfx
/boards/openmote*/ @MrKevinWeiss
/boards/cc1352p-launchpad @luisan00
/boards/atxmega*/ @nandojve
/core/ @kaspar030
/cpu/arm7_common/ @kaspar030 @maribu
/cpu/avr8_common/ @kYc0o @maribu @nandojve
/cpu/atmega*/ @kYc0o @maribu
/cpu/atxmega/ @nandojve
/cpu/cc2538/ @hexluthor @smlng @fjmolinas
/cpu/cc26x0/ @hexluthor @smlng
/cpu/cc26x2_cc13x2/ @hexluthor @smlng
/cpu/cc26xx_cc13xx/ @hexluthor @smlng
/cpu/cortexm_common/ @kaspar030 @bergzand
/cpu/efm32/ @basilfx
/cpu/esp*/ @gschorcht
/cpu/fe310/ @aabadie @kaspar030 @bergzand
/cpu/kinetis/ @fjmolinas
/cpu/lpc2387/ @benpicco @maribu
/cpu/mips*/ @kaspar030 @francois-berder
/cpu/msp430*/ @kaspar030 @gschorcht
/cpu/nrf*/ @aabadie @haukepetersen
/cpu/nrf52/radio/nrf802154/ @bergzand @SemjonKerner @jia200x
/cpu/sam0_common/ @benpicco @dylad @keestux
/cpu/samd21/ @dylad @biboc
/cpu/samd5x/ @benpicco @dylad
/cpu/saml1x/ @dylad
/cpu/saml21/ @dylad
/cpu/stm32*/ @aabadie @fjmolinas @DipSwitch @vincent-d
/cpu/stm32/periph/eth* @maribu
/cpu/stm32/periph/ptp.c @maribu
/doc/ @aabadie @jia200x
/dist/tools/sliptty/ @miri64
/dist/tools/dhcpv6-pd_ia/ @miri64
/drivers/ad7746/ @leandrolanzieri
/drivers/at24mac/ @benpicco
/drivers/at86rf215/ @benpicco
/drivers/at86rf2xx/ @daniel-k @Hyungsin @jia200x @smlng @miri64
/drivers/bh1900nux/ @wosym
/drivers/bq2429x/ @jeandudey
/drivers/cc110x/ @maribu
/drivers/cc1xxx_common/ @maribu
/drivers/ccs811/ @gschorcht
/drivers/enc28j60/ @haukepetersen
/drivers/dcf77/ @daexel
/drivers/dose/ @jue89
/drivers/ds18/ @leandrolanzieri
/drivers/itg320x/ @gschorcht
/drivers/mcp2515/ @wosym
/drivers/mrf24j40/ @bergzand
/drivers/pca9685/ @gschorcht
/drivers/sht3x/ @gschorcht
/drivers/si70xx/ @basilfx
/drivers/slipdev/ @miri64
/drivers/sx127x/ @aabadie @jia200x
/drivers/ws281x/ @maribu
/drivers/xbee/ @haukepetersen @miri64
/drivers/include/periph/ @MrKevinWeiss
/drivers/periph_common/ @MrKevinWeiss
/drivers/include/periph/ptp.h @maribu
/pkg/cryptoauthlib/ @Einhornhool @PeterKietzmann
/pkg/lua/ @jcarrano
/pkg/lwip/ @miri64
/pkg/gecko_sdk/ @basilfx
/pkg/lora-serialization/ @leandrolanzieri
/pkg/micropython/ @bergzand @kaspar030
/pkg/openthread/ @Hyungsin @jia200x
/pkg/semtech-loramac/ @aabadie @jia200x
/pkg/tinydtls/ @rfuentess @leandrolanzieri
/pkg/u8g2/ @basilfx
/pkg/ucglib/ @basilfx
/pkg/wakaama/ @leandrolanzieri
/sys/clif/ @leandrolanzieri
/sys/event/ @kaspar030
/sys/evtimer/ @kaspar030
/sys/fmt/ @kaspar030
/sys/net/application_layer/gcoap/ @haukepetersen @kb2ma @chrysn
/sys/net/application_layer/nanocoap/ @kaspar030 @haukepetersen @kb2ma @chrysn
/sys/include/net/sock* @maribu
/sys/net/netif/ @miri64 @jia200x
/sys/net/gnrc/network_layer/ @miri64
/sys/net/gnrc/transport_layer/tcp/ @brummer-simon @miri64
/sys/net/gnrc/transport_layer/udp/ @miri64
/sys/net/gnrc/link_layer/lorawan/ @jia200x
/sys/net/gnrc/netif/ @miri64 @jia200x
/sys/net/gnrc/routing/rpl/ @cgundogan @emmanuelsearch
/sys/net/ @miri64 @haukepetersen @PeterKietzmann @cgundogan
/sys/pm_layered/ @kaspar030
/sys/random/fortuna/ @basilfx
/sys/riotboot/ @kaspar030 @fjmolinas
/sys/suit @kaspar030 @fjmolinas @bergzand
/sys/tsrb/ @kaspar030
/sys/usb/ @bergzand @dylad @aabadie
/sys/xtimer/ @kaspar030 @MichelRottleuthner
/sys/include/ztimer.h @kaspar030 @bergzand
/sys/include/ztimer/ @kaspar030 @bergzand
/sys/ztimer/ @kaspar030 @bergzand
/tests/ @smlng @leandrolanzieri @aabadie @MichelRottleuthner @fjmolinas
/tests/candev/ @wosym
/tests/driver_bq2429x/ @jeandudey
/tests/gnrc* @miri64
/tests/lwip* @miri64
/tests/slip/ @miri64
/tests/unittests @miri64
/tests/*/tests/*.py @miri64
/tests/cpu_efm32_features/ @basilfx
# KConfig maintainers will be notified about all KConfig changes
Kconfig @leandrolanzieri @jia200x @cgundogan
pm.c @kaspar030

403
CODING_CONVENTIONS.md Normal file
View File

@ -0,0 +1,403 @@
# Coding Conventions
## General
* Code shall be [C11](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf)
compliant.
* Avoid dynamic memory allocation (malloc/free, new, etc.)! It will break
real-time guarantees, increase code complexity, and make it more likely to use
more memory than available.
* Avoid the use of floating point arithmetic. Not every MCU has a FPU and software
floating point libraries cause unnecessary overhead.
Instead use fixed-point integers and transform equations so that they stay within
the range of integer math.
An easy way to ensure this is by multiplying by a constant factor, ideally a power
of two - this is a simple shift operation.
Take care that intermediate values do not exceed the range of the data type you are using.
When writing drivers, do not convert the measurement data into float, but instead
choose an appropriate integer format / SI prefix.
* Please obey the Linux coding style as described in
https://www.kernel.org/doc/Documentation/process/coding-style.rst with the
following modifications and additions:
* Line length: aim for no more than 80 characters per line, the absolute
maximum should be 100 characters per line.
* All line endings shall be set to LF (`\n`). (How to handle line endings in
Git: https://help.github.com/articles/dealing-with-line-endings)
* There must be no trailing whitespace in any line.
The script `/dist/tools/whitespacecheck/check.sh master || exit` can be
used to detect whitespaces at the end of line(s) that would lead to
*Murdock* build error(s).
* Use empty braces for empty while loops waiting for a hardware register
instead of semicolon.
`while (HW_STATUS != STATUS_OK) {}` is correct,
`while (HW_STATUS != STATUS_OK);` is wrong.
* Our policy regarding `typedef`s is
[completely different](https://www.kernel.org/doc/html/latest/process/coding-style.html#typedefs)
(see below) (BTW: Do we have any reason to do so?)
* Comments should be C-style comments (see below)
* In order to follow Linux's recommendation on
[conditional compilation](https://www.kernel.org/doc/html/latest/process/coding-style.html#conditional-compilation)
make use of `IS_ACTIVE` and `IS_USED` macros from `kernel_defines.h` with C
conditionals. If a symbol is not going to be defined under a certain
condition, the usage of preprocessor `#if defined()` is fine.
* You can use [uncrustify](http://uncrustify.sourceforge.net/) with the provided
option files: https://github.com/RIOT-OS/RIOT/blob/master/uncrustify-riot.cfg
## Types
* Be careful with platform dependent type sizes like `int` or `long`. Use data
types that include the bit length in the name like `uint16_t` when you need to
make sure that a certain variable is exactly of this length.
* The use of typedefs for structs and pointers is allowed.
* Type definitions (using `typedef`) always end on "_t".
* If a typedef is used for a struct, it has to be specified at the struct
definition (i.e., not as a separate line). E.g.:
```
typedef struct {
uint8_t a;
uint8_t b;
} foobar_t;
```
* Use of a separate line typedef for structs is allowed for forward
declarations, e.g.,
```
typedef struct mystruct mystruct_t;
[...]
struct mystruct {
[...]
};
```
* Guidelines for pointer types (as long as it is reasonable):
- use `char *` for strings and only for strings
- use `uint8_t[]` as type for arbitrary byte buffers, but use `void *` to
pass them around. `uint8_t[]` because we're dealing with bytes and not
characters, `void *` to avoid unnecessary casting shall the need arise to
have their content to have a certain type
- use `uint8_t *` to pass "typed" byte buffers, e.g., link-layer addresses,
where it avoids unnecessary temporary variable
- use `void *` for generic typing
## Variables
* Do NOT use global variables unless it is unavoidable.
* If you declare a variable within a header file, you MUST use the keyword
`extern`.
## Functions
* Every function needs a prototype in addition to its definition. If a prototype
is specified within a .c file it has to be declared BEFORE any function
definitions.
* If the scope of a function is limited to one file, it MUST be declared static.
* Functions without parameters must be specified with `(void)`.
* Keep functions short! As a rule of thumb, the function's body should not
exceed one screen.
* Do NOT use global macros defining more than one line of code. Use inline
functions instead.
## Return values
* Every function must return one of the following values or none (void):
* logical value (zero or not zero)
* an error code (given as a negative number or zero) or a positive status
value
* the count of read or written bytes/values for I/O functions
* the position or address (for search functions)
* a pointer
* `NULL` indicates an error case, too.
* Do NOT return structs or other larger types! These would get copied to the
stack, resulting in expensive operations. Moreover, some compilers have
trouble with larger return types. Use pointers to structs instead and take
care of the structs lifetime.
* If possible, prefer signed types over unsigned ones in order to be able to add
error codes later on.
## Naming
* Names of all public functions and variables must start with the name of the
corresponding library, e.g.:
```
thread_getpid(void);
hwtimer_init_comp(uint32_t fcpu);
int transceiver_pid;
```
* Private functions and variables do NOT have this library prefix.
* Do NOT use CamelCase. Function, variable and file names as well as enums,
structs or typedefs are written in lowercase with underscores.
```
/* instead of: */
void CamelCaseNamedFunction(int camelCaseNamedVar);
/* write: */
void camel_case_named_function(int camel_case_named_var);
```
* When implementing constants or variables that are defined in third party
documents such as RFCs, add a prefix to those names based on the RIOT coding
conventions. If you use a name in the RIOT code that is different from the one
in the third party document, you must add a reference to the original name of
the constant or variable in the Doxygen documentation.
## Indentation and braces
* Indentations are four spaces (i.e., NO tab characters).
* As an exception to the Linux coding style, the closing brace is empty on a
line of its own when followed by an else, too. When followed by a `while` in a
`do`-statement, it goes into the same line.
* Use curly braces even for one-line blocks. This improves debugging and later
additions.
```
/* instead of: */
if (debug) println("DEBUG");
else println("DEBUG ELSE");
/* write: */
if (debug) {
println("DEBUG");
}
else {
println("DEBUG ELSE");
}
```
* Commas are always followed by a space.
* For complex statements it is always good to use more parentheses - or split up
the statement and simplify it.
## Includes
* The include of system headers (in <>-brackets) always precedes RIOT specific
includes (in quotes).
* Optional headers must only be included if their corresponding module is
selected/being build. In other words: always put an `#ifdef MODULE_...`
statement around includes of optional headers:
```c
#ifdef MODULE_ABC
#include "abc.h"
#endif
```
## Header Guards
All files are required to have header guards of the form
```c
#ifndef PATH_TO_FILE_FILENAME_H
#define PATH_TO_FILE_FILENAME_H
...
#endif /* PATH_TO_FILE_FILENAME_H */
```
Rules for generating the guard name:
1. take the file name
2. if there's ```include/``` in the file's pathname, include the path from there
on.
3. replace "/" and "." with "_"
4. convert to uppercase letters
5. if the produced guard starts with "_", prefix "PRIV"
Examples:
- "core/include/msg.h" -> "MSG_H"
- "sys/include/net/gnrc/pkt.h" -> NET_GNRC_PKT_H
- "drivers/abcd0815/abcd0815_params.h" -> ABCD0815_PARAMS_H
- "sys/module/_internal.h" -> PRIV_INTERNAL_H
Note: these rules will be enforced by the CI.
## C++ compatibility
* C Header files should be always wrapped for C++ compatibility to prevent
issues with name mangling, i.e. mark all the containing functions and
definitions as `extern "C"`
``` C
#ifdef __cplusplus
extern "C" {
#endif
... all your function declarations, global variables and defines belong here
#ifdef __cplusplus
}
#endif
```
* use `__restrict` instead of `restrict` in headers (compare
https://github.com/RIOT-OS/RIOT/pull/2042)
## Absolute values
* Absolute values must be specified as macros or enums, not as literals, i.e.
instead of
```
int timeout = 7 * 1000000;
```
write
```
int timeout = TIMEOUT_INTERVAL * USEC_PER_SEC;
```
## Comments
* All comments should be written as C-style comments.
E.g:
```
/* This is a C-style comment */
```
Wrong:
```
// C++ comment here
```
## Documentation
* All documentation must be in English.
* All files contain the copyright note and the author.
* Doxygen documentation is mandatory for all header files.
* Every header file includes a general description about the provided
functionality.
* Every function must be documented - including parameters and return value.
An examplary doxygen documentation in a header file can look like this.
```
/*
* Copyright (C) 2014 Peter Schmerzl <peter@schmerzl-os.org>
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup foobar
* @{
*
* @file
* @brief Definitions for foo and bar functions.
*
* More detailed information about the file and the functionality implemented.
*
* @author Peter Schmerzl <peter@schmerzl-os.org>
*
*/
/**
* @brief Set the state of foobar.
*
* @param[in] state The new state of foobar.
* @param[out] old_state The old state of foobar is written to this variable.
*
* @return 1 if setting the state was successful, 0 otherwise.
*/
int set_foobar(int state, int *old_state);
```
## Common compilation warnings
Some solutions to correctly handle compilation warnings.
### -Wformat
Solution for string formatting errors:
* When printing a `size_t`
* use `%u` and cast the variable to `(unsigned)` because `newlib-nano` does
not support `%zu`
[example](https://github.com/RIOT-OS/RIOT/blob/e19f6463c09fc22c76c5b855799054cf27a697f1/tests/sizeof_tcb/main.c#L34)
* When printing an `unsigned char/uint8_t`
* Use `%u` because `newlib-nano` does not support `%hu/PRIu8`
[example](https://github.com/RIOT-OS/RIOT/pull/4851)
* When printing an `uint32_t`
* Use `PRIu32` print format
[example](https://github.com/RIOT-OS/RIOT/blob/4c74db4e7a6cf1e3be1edb3c10cdba14ba032513/drivers/sx127x/sx127x_getset.c#L126)
* When printing `64bit` variables
* It is not correctly supported by `newlib-nano` as
[said here](https://github.com/RIOT-OS/RIOT/issues/1891). It is
recommended to use `fmt` module for these.
[Example](https://github.com/RIOT-OS/RIOT/blob/e19f6463c09fc22c76c5b855799054cf27a697f1/tests/posix_semaphore/main.c#L277)
### -Wformat-nonliteral
For a `printf` style function with the following error: `error: format string is
not a string literal`.
* Function using a variable number of arguments:
* Use `__attribute__((__format__ (__printf__, 3, 4)))`, where here `3` is
the number of the argument with the format and `4` the format arguments,
starting from 1. See
[example](https://github.com/miri64/RIOT/blob/d6cdf4d06f2aeed05dcf86a5437254e2403e147b/pkg/openthread/contrib/platform_logging.c#L31-L32)
* Function using `va_list`:
* Use `__attribute__((__format__ (__printf__, 1, 0)))`, where here `1` is
the number of the argument with the format and `0` as there is no variable
numbers of arguments. See
[example](https://github.com/miri64/RIOT/blob/ad133da2096c44e001ee65071cb36db60a54e215/cpu/native/syscalls.c#L268-L271)
## Git
* Make one commit per change.
* The first line of the commit message describes the main feature of the commit.
## Continuous Integration
* If the CI tests fail due to errors these errors need to be addressed.
* If the CI tests fail due to warnings/errors emitted by cppcheck you should try
to fix the error. If the error is definitely a false positive there is the
possibility to suppress this warning/error. You MUST do so by adding a
comment, including a rationale why it is a false positive and why the code
can't be fixed otherwise, in the following format:
```
/* cppcheck-suppress <category of error/warning>
* (reason: cppcheck is being really silly. this is certainly not a
* null-pointer dereference */
```
## Python coding convention
* Code shall be compliant with Python 3.5 minimum because this is the default
Python 3 version in Ubuntu 16.04 (used as the reference system for CI)
* Code shall report no error when running the
[Flake8](http://flake8.pycqa.org/en/latest/) tool, e.g:
* for style checks described in
[PEP8](https://www.python.org/dev/peps/pep-0008/),
* for lint checks provided by
[Pyflakes](https://pypi.python.org/pypi/pyflakes),
* for complexity checks provided by the
[McCabe project](https://pypi.python.org/pypi/mccabe)
* A line length of maximum of 120 is allowed instead of the pep8 79: this
increases tests readability as they can expects long line of output.
* Only runnable scripts shall start with `#!/usr/bin/env python3`
* Runnable scripts shall use the following scheme:
```python
#!/usr/bin/env python3
# Copyright (C) <your copyright>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
# put the module imports first
# see https://www.python.org/dev/peps/pep-0008/#imports
# for more details
import module1
import module2
# Optional global variables
GLOBAL_VARIABLE = "I'm global"
# local functions, if required
def local_func():
# Put your local function code here
# The main function
def main_func():
# Put your main code here
if __name__ == "__main__":
# Call the main function from here:
main_func()
```

370
CODING_CONVENTIONS_C++.md Normal file
View File

@ -0,0 +1,370 @@
You should check out the [C Conventions](CODING_CONVENTIONS.md) as some section
still apply (Documentation, Git, Travis).
When contributing source code, please adhere to the following coding style,
which is loosely based on the [Google C++ Style Guide] and the coding
conventions used by the C++ Standard Library. Based on the [CAF coding style].
[Google C++ Style Guide]: (https://google.github.io/styleguide/cppguide.html)
[CAF coding style]: (https://github.com/actor-framework/actor-framework/blob/master/CONTRIBUTING.md)
## Example for the Impatient
```cpp
// module/riot/example/my_class.hpp
#ifndef RIOT_EXAMPLE_MY_CLASS_HPP
#define RIOT_EXAMPLE_MY_CLASS_HPP
#include <string>
// use "//" for regular comments and "///" for doxygen
namespace riot {
namespace example {
/// This class is only being used as style guide example.
class my_class {
public:
/// Brief description. More description. Note that RIOT uses the
/// "JavaDoc-style" autobrief option, i.e., everything up until the
/// first dot is the brief description.
my_class();
/// Destructs `my_class`. Please use Markdown in comments.
~my_class();
// suppress redundant @return if you start the brief description with "Returns"
/// Returns the name of this instance.
inline const std::string& name() const {
return name_;
}
/// Sets the name of this instance.
inline void name(const std::string& new_name) {
name_ = new_name;
}
/// Prints the name to `STDIN`.
void print_name() const;
/// Does something (maybe).
void do_something();
/// Does something else.
void do_something_else();
private:
std::string name_;
};
} // namespace example
} // namespace riot
#endif // RIOT_EXAMPLE_MY_CLASS_HPP
```
```cpp
// my_module/my_class.cpp
#include "riot/example/my_class.hpp"
#include <iostream>
namespace riot {
namespace example {
namespace {
constexpr const char default_name[] = "my object";
} // namespace <anonymous>
my_class::my_class() : name_(default_name) {
// nop
}
my_class::~my_class() {
// nop
}
void my_class::print_name() const {
std::cout << name() << std::endl;
}
void my_class::do_something() {
if (name() == default_name) {
std::cout << "You didn't gave me a proper name, so I "
<< "refuse to do something."
<< std::endl;
} else {
std::cout << "You gave me the name " << name()
<< "... Do you really think I'm willing to do something "
"for you after insulting me like that?"
<< std::endl;
}
}
void my_class::do_something_else() {
switch (default_name[0]) {
case 'a':
// handle a
break;
case 'b':
// handle b
break;
default:
handle_default();
}
}
} // namespace example
} // namespace riot
```
## General
- Use 4 spaces per indentation level.
- The maximum number of characters per line is 80.
- No tabs, ever.
- Never use C-style casts.
- Vertical whitespaces separate functions and are not used inside functions:
use comments to document logical blocks.
- Header filenames end in `.hpp`, implementation files end in `.cpp`.
- Never declare more than one variable per line.
- `*` and `&` bind to the *type*, e.g., `const std::string& arg`.
- Namespaces and access modifiers (e.g., `public`) do not increase the
indentation level.
- In a class, use the order `public`, `protected`, and then `private`.
- Always use `auto` to declare a variable unless you cannot initialize it
immediately or if you actually want a type conversion. In the latter case,
provide a comment why this conversion is necessary.
- Never use unwrapped, manual resource management such as `new` and `delete`.
- Never use `typedef`; always write `using T = X` in favor of `typedef X T`.
- Keywords are always followed by a whitespace: `if (...)`, `template <...>`,
`while (...)`, etc.
- Leave a whitespace after `!` to make negations easily recognizable:
```cpp
if (! sunny())
stay_home();
else
go_outside();
```
- Opening braces belong to the same line:
```cpp
void foo() {
// ...
}
```
- Use standard order for readability: C standard libraries, C++ standard
libraries, other libraries, (your) RIOT headers:
```cpp
// some .hpp file
#include <sys/types.h>
#include <vector>
#include "3rd/party.h"
#include "riot/fwd.hpp"
```
RIOT includes should always be in doublequotes, whereas system-wide
includes in angle brackets. In a `.cpp` file, the implemented header always
comes first and the header `riot/config.hpp` can be included second if you
need platform-dependent headers.
- When declaring a function, the order of parameters is: outputs, then inputs.
This follows the parameter order from the STL.
- Protect single-argument constructors with `explicit` to avoid implicit
conversions.
## Naming
- All names except macros and template parameters should be
lower case and delimited by underscores.
- Template parameter names should be written in CamelCase.
- Types and variables should be nouns, while functions performing an action
should be "command" verbs. Classes used to implement metaprogramming
functions also should use verbs, e.g., `remove_const`.
- Private and protected member variables use the suffix `_` while getter *and*
setter functions use the name without suffix:
```cpp
class person {
public:
const std::string& name() const {
return name_
}
void name(const std::string& new_name) {
name_ = new_name;
}
private:
std::string name_;
};
```
- Use `T` for generic, unconstrained template parameters and `x`
for generic function arguments. Suffix both with `s` for
template parameter packs:
```cpp
template <class... Ts>
void print(const Ts&... xs) {
// ...
}
```
## Headers
- Each `.cpp` file has an associated `.hpp` file.
Exceptions to this rule are unit tests and `main.cpp` files.
- Each class has its own pair of header and implementation
files and the relative path for the header file is derived from its full name.
For example, the header file for `riot::example::my_class` of module
`my_module` is located at `path/to/my_module/riot/example/my_class.hpp`
and the source file at `path/to/my_module/my_class.cpp`.
- All header files should use `#define` guards to prevent multiple inclusion.
The symbol name is `<RELATIVE>_<PATH>_<TO>_<FILE>_HPP`.
- Do not `#include` when a forward declaration suffices.
- Each library component must provide a `fwd.hpp` header providing forward
declarations for all types used in the user API.
- Each library component must provide an `all.hpp` header that contains the
main page for the documentation and includes all headers for the user API.
- Use `inline` for small functions (rule of thumb: 10 lines or less).
## Breaking Statements
- Break constructor initializers after the comma, use four spaces for
indentation, and place each initializer on its own line (unless you don't
need to break at all):
```cpp
my_class::my_class()
: my_base_class(some_function()),
greeting_("Hello there! This is my_class!"),
some_bool_flag_(false) {
// ok
}
other_class::other_class() : name_("tommy"), buddy_("michael") {
// ok
}
```
- Break function arguments after the comma for both declaration and invocation:
```cpp
intptr_t channel::compare(const abstract_channel* lhs,
const abstract_channel* rhs) {
// ...
}
```
- Break before tenary operators and before binary operators:
```cpp
if (today_is_a_sunny_day()
&& it_is_not_too_hot_to_go_swimming()) {
// ...
}
```
## Template Metaprogramming
Despite its power, template metaprogramming came to the language pretty
much by accident. Templates were never meant to be used for compile-time
algorithms and type transformations. This is why C++ punishes metaprogramming
with an insane amount of syntax noise. In RIOT, we make excessive use of
templates. To keep the code readable despite all the syntax noise, we have some
extra rules for formatting metaprogramming code.
- Brake `using name = ...` statements always directly after `=` if it
does not fit in one line.
- Consider the *semantics* of a metaprogramming function. For example,
`std::conditional` is an if-then-else construct. Hence, place the if-clause
on its own line and do the same for the two cases.
- Use one level of indentation per "open" template and place the closing `>`,
`>::type` or `>::value` on its own line. For example:
```cpp
using optional_result_type =
typename std::conditional<
std::is_same<result_type, void>::value,
bool,
optional<result_type>
>::type;
// think of it as the following (not valid C++):
auto optional_result_type =
conditional {
if result_type == void
then bool
else optional<result_type>
};
```
- Note that this is not necessary when simply defining a type alias.
When dealing with "ordinary" templates, indenting based on the position of
the opening `<` is ok, e.g.:
```cpp
using response_handle_type = response_handle<Subtype, message,
ResponseHandleTag>;
```
## Preprocessor Macros
- Use macros if and only if you can't get the same result by using inline
functions or proper constants.
- Macro names use the form `RIOT_<COMPONENT>_<NAME>`.
## Comments
- Doxygen comments start with `///`.
- Use Markdown instead of Doxygen formatters.
- Use `@cmd` rather than `\cmd`.
- Use `//` to define basic comments that should not be
swallowed by Doxygen.

View File

@ -1,16 +1,362 @@
# CONTRIBUTE
This is a short version of the [Development Procedures](https://github.com/RIOT-OS/RIOT/wiki/Development-procedures).
# Contributing to RIOT
1. Check if your code follows the [coding conventions](https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions). If the code does not comply these style rules, your code will not be merged.
Thank you for your interest in contributing to RIOT! There are many ways to
contribute, and we appreciate all of them. You can jump to the major sections
of this document using the following links:
2. The master branch should always be in a working state. The RIOT maintainers will create release tags based on this branch, whenever a milestone is completed.
* [Getting Started][getting-started]
* [Bug Reports and Feature Requests][issues]
* [Contributing code][contributing-code]
* [Writing Documentation][writing-documentation]
* [Working with Git][working with git]
3. Comments on a pull request should be added to the request itself, and *not* to the commit.
If you have questions, please write a post over at our [forum] or chat on
`#riot-os:matrix.org` on [Matrix].
4. Keep commits to the point, e.g., don't add whitespace/typo fixes to other code changes. If changes are layered, layer the patches.
As a reminder, all contributors are expected to follow our
[Code of Conduct](CODE_OF_CONDUCT.md).
5. Describe the technical detail of the change(s) as specific as possible.
[forum]: https://forum.riot-os.org
[Matrix]: https://matrix.to/#/#riot-os:matrix.org
6. Use [Labels](https://github.com/RIOT-OS/RIOT/wiki/Labels) to help classify pull requests and issues.
## Getting Started
[getting-started]: #getting-started
If you are just beginning to work with RIOT you might first want to read our
[documentation]. Especially the following sections might be of interest to you
7. Please adhere to our [code of conduct](https://github.com/RIOT-OS/RIOT/blob/master/CODE_OF_CONDUCT.md)
- [Getting Started](https://doc.riot-os.org/getting-started.html)
- [Creating modules](https://doc.riot-os.org/creating-modules.html)
- [Creating an application](https://doc.riot-os.org/creating-an-application.html)
[documentation]: https://doc.riot-os.org
## Bug reports and feature requests
[issues]: #bug-reports-and-feature-requests
Both bug reports and feature request, big or small, are welcome.
Before submitting a feature request, please check if an [open issue][existing-feature-request]
already exists. If this is not the case, [submit a feature request][feature-request].
Describe your use case, why you need this feature and why this feature is important for RIOT.
Before filing a bug report, please check if an [open issue][existing-bug]
already exists. If this is not the case, [submit a new bug report][bug-report].
If you're not sure if something is a bug or not, feel free to file a bug report anyway.
**If you believe reporting your bug publicly represents a security risk to
RIOT users, please send an email describing the bug to <security@riot-os.org>**.
We would appreciate waiting for a 6 months grace period before reporting it on
public channels, to allow us adequate time to release the fix.
[bug reports]: https://github.com/RIOT-OS/RIOT/issues/new?template=bug_report.md
[feature requests]: https://github.com/RIOT-OS/RIOT/issues/new?template=feature_request.md
[existing-feature-request]: https://github.com/RIOT-OS/RIOT/issues?q=state:open+type:issue+label:"Type:+new+feature"
[feature-request]: https://github.com/RIOT-OS/RIOT/issues/new?template=feature_request.md&title=Feature+Request:
[existing-bug]: https://github.com/RIOT-OS/RIOT/issues?q=state:open+type:issue+label:"Type:+bug"
[bug-report]: https://github.com/RIOT-OS/RIOT/issues/new?template=bug_report.md&title=Bug:
## Contributing code
[contributing-code]: #contributing-code
If you think your work should be integrated in the main RIOT repository, take
the following steps:
1. Fork the RIOT git repository (if you haven't done this already).
1. Create a branch for your contribution.
1. Make sure your code is in compliance with RIOTs [coding conventions].
1. Make commits. Make sure to follow RIOTs [commit conventions].
1. Push this branch to your fork on GitHub.
1. Open a [pull request][open-a-pull-request]. See [pull requests].
1. RIOT maintainers will set [labels] and provide feedback.
1. Address this feedback. See [working with git].
1. Your code is merged in RIOT master branch when it passes review.
Be sure to read the [general tips] below.
[open-an-issue]: https://github.com/RIOT-OS/RIOT/issues?q=state:open+type:issue+label:"Type:+bug"
[labels]: https://github.com/RIOT-OS/RIOT/wiki/RIOT%27s-labeling-system
[open-a-pull-request]: https://help.github.com/articles/using-pull-requests
### General Tips
[general tips]: #general-tips
From experience, the following recommendations help to get a software
contribution into RIOT master faster:
- **Ask around for help!** Either offline or through one of our communication
channels (see above). The earlier you check your feature design with other
people, the less likely it is that it is denied during the review process.
- **Verify your concept early!** If you work on your own until the code
*looks* good enough to show publicly, you might miss some design flaws others
might have spotted earlier.
- **Keep it simple!** Try to use what is already there and don't change existing
APIs if not absolutely necessary.
- **Keep it small!** A PR with >1000 lines of changes will very likely make
even the most active reviewer put your review on their long to-do list.
- **Keep it modular!** Make extensions to a feature or new features for a
platform optionally to use.
- **Provide tests!** They should be comprehensible and easy to be executed.
Alternatively comprehensive testing procedures should be provided with your
pull request.
### Coding conventions
[coding conventions]: #coding-conventions
RIOT has extensive [coding conventions][coding-conventions].
It is possible to check if your code follows these conventions:
* You can [uncrustify] `.c` and `.h` files:
```console
$ uncrustify -c $RIOTBASE/uncrustify-riot.cfg --no-backup <your file>
```
**Note**: The `--no-backup` flag makes uncrustify *replace* the current file
with a formatted version.
* RIOT provides static test tools to verify the quality of changes (cppcheck,
trailing whitespaces, documentation, etc). These tools are wrapped in a
single `make` target: `static-test`.
*Watch out:* the command below will rebase your branch on your master branch,
so make sure they can be rebased (e.g. there's no potential conflict).
```console
$ make static-test
```
Use it before opening a PR to perform last time checks.
[coding-conventions]: CODING_CONVENTIONS.md
### Commit conventions
[commit conventions]: #commit-conventions
* Each commit should target changes of specific parts/modules of RIOT. The
commits use the following pattern:
```
area of code: description of changes
```
You can use multi-line commit messages if you want to detail more the
changes.
For example:
```
periph/timer: Document that set_absolute is expected to wrap
Most timers are implemented this way already, and keeping (documenting)
it that way allows the generic timer_set implementation to stay as
simple as it is.
```
### Pull Requests
[pull requests]: #pull-requests
GitHub's Pull Request (PR) feature is the primary mechanism used to make
contributions to the RIOT codebase. GitHub itself has some great documentation
on [using the Pull Request feature][about-pull-requests].
We use the [fork and pull model][development-models], where contributors push
changes to their personal fork and create pull requests to bring those changes
into the source repository.
* Before opening a new Pull Request, have a look at
[existing ones][existing-pull-requests]. Maybe someone has already opened one
about the same thing. If it's the case, you might be able to help with the
contribution. Just comment on the PR and ask. Include closed PR's in your
search, as previous work might have been closed for lack of interest.
Old and stalled [PRs are sometimes archived][archived-pull-requests] with the
"State: archived" label, maybe one of them is also about the same topic.
* The Pull Request title should reflect what it is about and be in the same form
as the [commit conventions].
* Each Pull Request form uses a template that is there to help
maintainers understand your contribution and help them in testing it.
Please fill each section with as much information as possible.
* We recommend that you leave the *'Allow edits from maintainers'* check box ticked.
This will allow maintainer finalizing your PR by pushing in your branch.
In general, this speeds up the PR merge in the main repository.
Note that this is not an obligation.
* Remember that smaller PRs tend to be merged faster, so keep your changes as
concise as possible. They should be confined to a single explainable
change, and be runnable on their own. So don't hesitate to split your PRs
into smaller ones when possible.
* Maintainers try their best to review every PR as fast as possible, but they
are also only human and it can happen that they miss a few PRs or might be
preoccupied with other PRs. If it happens that your PR receives no review for
a long time, don't hesitate to gently solicit a review by commenting or
by explicitly mentioning a maintainer that you know is knowledgeable in the
area of the PR. You can also advertise the PR on the [forum] and ask for a
review there.
* Try to answer reviews as quickly as possible to speed up the review process
and avoid stalled PRs.
You can find more information about RIOT development procedure on this
[wiki page][development-procedures].
[about-pull-requests]: https://help.github.com/articles/about-pull-requests/
[development-models]: https://help.github.com/articles/creating-a-pull-request-from-a-fork
[existing-pull-requests]: https://github.com/RIOT-OS/RIOT/pulls
[archived-pull-requests]: https://github.com/RIOT-OS/RIOT/pulls?q=is:pr+label:"State:+archived"
[uncrustify]: http://uncrustify.sourceforge.net
[development-procedures]: https://github.com/RIOT-OS/RIOT/wiki/Development-procedures
## Writing Documentation
[writing-documentation]: #writing-documentation
Documentation improvements are always welcome and a good starting point for
new contributors. This kind of contribution is merged quite quickly in general.
RIOT documentation is built with [doxygen][doxygen]. Doxygen is configured to
parse header (.h) and `doc.txt` files in the RIOT source code to generate
the modules, cpus, boards and packages documentation.
General documentation pages are written in Markdown and located in
`doc/doxygen/src`.
To generate the documentation, simply run the following
from the base directory of the RIOT source code.
```console
$ make doc
```
The generated documentation is located in `doc/doxygen/html`
[doxygen]: http://www.doxygen.nl/
## Working with Git
[working with git]: #working-with-git
Using git is a bit difficult for newcomers. If you are completely new to git,
we recommend that you [start by learning it][try-github-io] a bit. You can also
read the official [getting started documentation][git-scm-getting-started].
In this section, we give the bare minimum for a better experience with our
development workflow on GitHub.
[try-github-io]: https://try.github.io/
[git-scm-getting-started]: https://git-scm.com/book/en/v2/Getting-Started-Git-Basics
### Setup your local RIOT repository
Before you start modifying code, you need to fork the RIOT upstream repository
from the [RIOT main GitHub page][riot-github].
If it's your first time with git, configure your name and emails:
```console
$ git config --global user.name = "<your name here>"
$ git config --global user.email = "<your email address here>"
```
Then clone locally your fork of RIOT (replace `account name` with your actual
login on GitHub):
```console
$ git clone git@github.com:<account name>/RIOT.git
```
You can keep any branch of your local repository up-to-date with the upstream
master branch with the following commands:
```console
$ git checkout <branch name>
$ git pull --rebase https://github.com/RIOT-OS/RIOT.git
```
Use it before opening a PR. This will at least ensure the PR is mergeable but
also that it is up-to-date with the upstream repository.
[riot-github]: https://github.com/RIOT-OS/RIOT
### Work on branches
Avoid opening PR from the `master` branch of your fork to the master branch of
the RIOT upstream repository: update your master branch and start a new branch
from it.
```console
$ git checkout master
$ git pull --rebase https://github.com/RIOT-OS/RIOT.git
$ git checkout -b <new branch>
```
Do your changes, commit, update with latest upstream master
```console
$ git push
```
### Add fixup commits during review
To keep the history of changes easier to track for reviewers, it is recommended
to push your review request updates in fixup commits.
Let's say your PR contains 3 commits with comments: `prefix1: change 1`,
`prefix2: change 2` and `prefix3: change 3`.
Instead of committing changes in `prefix2` in a 4th commit `prefix2: change 4`,
you can use the `--fixup` option:
```console
$ git add /path/of/prefix2
$ git commit --fixup <prefix2 commit hash>
```
### Squash commits after review
Squashing a commit is done using the rebase subcommand of git in interactive
mode:
```console
$ git rebase master -i
```
You can find information on rebasing in
[GitHub rebase documentation][about-git-rebase].
[about-git-rebase]: https://help.github.com/articles/about-git-rebase/
If you used [fixup commits](#add-fixup-commits-during-review) during the review
phase, squashing commits can be performed in a single command:
```console
$ git rebase -i --autosquash
```
**Watch out: Don't squash your commit until a maintainer asks you to do it.**
Otherwise the history of review changes is lost and for large PRs, it
makes it difficult for the reviewer to follow them. It might also happen that
you introduce regression and won't be able to recover them from previous
commits.
If you encounter a merge conflict you could either resolve it by hand with an
editor and use
```console
$ git add -p
```
To add your changes or use a merge tool like [meld](https://meldmerge.org/) to
resolve your merge conflict.
```console
$ git mergetool
```
After the merge conflict is resolved you can continue to rebase by using
```console
$ git rebase --continue
```
Once squashing is done, you will have to force push your branch to update the
PR:
```console
$ git push --force-with-lease
```

59
Kconfig Normal file
View File

@ -0,0 +1,59 @@
# Copyright (c) 2019 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
mainmenu "RIOT Configuration"
# Load macro definitions
rsource "kconfigs/Kconfig.consts"
# Load feature declarations
rsource "kconfigs/Kconfig.features"
# Load error symbols
rsource "kconfigs/Kconfig.errors"
# For now, get used modules as macros from this file (see kconfig.mk)
osource "$(KCONFIG_GENERATED_DEPENDENCIES)"
# Load first board configurations, which might override CPU's
orsource "$(BOARDDIR)/Kconfig"
orsource "$(RIOTCPU)/$(CPU)/Kconfig"
rsource "$(RIOTBOARD)/Kconfig"
rsource "$(RIOTCPU)/Kconfig"
# The application may declare new symbols as well
osource "$(APPDIR)/Kconfig"
rsource "core/Kconfig"
rsource "drivers/Kconfig"
rsource "sys/Kconfig"
rsource "pkg/Kconfig"
menu "External Modules"
osource "$(KCONFIG_EXTERNAL_CONFIGS)"
endmenu # External Modules
comment "RIOT is in a migration phase."
comment "Some configuration options may not be here. Use CFLAGS instead."
comment "!! ERROR: There are conflicting modules active !!"
depends on ERROR_MODULES_CONFLICT != ""
config TEST_KCONFIG
bool
default y if '$(TEST_KCONFIG)' = '1'
help
This is used during the Kconfig migration to test the module dependency
modelling. Don't change the default value unless you know what you are
doing.
config DEVELHELP
bool "Development Help"
help
Set to enable code in RIOT that does safety checking which might not be
needed in a production environment but helps in the development
process.

View File

@ -31,6 +31,8 @@ Reason for removal:
- feature was never used and there is no reason for keeping it
~~~~~~~~~~~~~~~~~~~
Additionally, a link reference for the commit on GitHub is added to the bottom of this document.
By putting the name of the removed feature and the commit hash in the same line,
one can very quickly find the commit using `git grep`.
@ -40,6 +42,88 @@ This way, their names are never removed from the RIOT repository.
# Removed Features
### sys/net/gnrc/nettest [cdc252ab7bd4161cc046bf93a3e55995704b24d4]
Author:
- Martine Lenders <mlenders@inf.fu-berlin.de>
Reasons for removal:
- Not maintained anymore
- Not used in GNRC
### boards/chronos [ed3887ac5c1e95308c2827bce3cdca8b0f146c22]
Author(s):
- Oliver Hahm <oliver.hahm@inria.fr>
- Kaspar Schleiser <kaspar@schleiser.de>
Reason for removal:
- board is quite outdated
- board cannot be automatically tested for lack of UART
- board has many special cases, which hurt upgrade to msp430-elf-gcc 9.x
- the onboard radio has been unsupported for a while
- no one seems to use the board, no one seems to maintain it
### sys/net/gnrc/application_layer/tftp [0e2a62078850e1ecc74db2db4d639cf2d8fb96d3]
Author:
- DipSwitch <dipswitch@ownage4u.nl>
Reasons for removal:
- Not maintained anymore.
- Existing quality and security defects.
### pkg/oonf_api [c829f820ee870bffc60c7df688d2da8373553212]
Author:
- Benjamin Valentin <benpicco@googlemail.com>
Reasons for removal:
- Package has not been update since 2013.
- Tests were never integrated to the CI.
- NHDP, which was the only upstream user, has been removed.
### sys/net/routing/nhdp [9026823bb906f64168d7d38e52be92f390353dc8]
Author:
- Fabian Nack <nack@inf.fu-berlin.de>
Reasons for removal:
- Not maintained anymore.
- Does not comply with the current RIOT programming practices.
### sys/ubjson [bea30c3f8949ebd9fdf4a9bf0a987652889930f5]
Author(s):
- René Kijewski <rene.kijewski@fu-berlin.de>
Reasons for removal:
- Unsafe code.
- Did not comply with RIOT standards.
- More standard alternatives available (such as CBOR).
### boards/jiminy-mega256rfr2 [232aed3e18118624b862d36bfec7cd1c21ca2d26]
Author:
- Josua Arndt <jarndt@ias.rwth-aachen.de>
- Steffen Robertz <steffen.robertz@rwth-aachen.de>
Reasons for removal:
- The board is a custom design at the RWTH Aachen, so only two persons have
access to the hardware
- It was unmaintained for several month now
- Various refactoring PRs affected the ATmega CPU family have not been tested,
it is unclear if the board is actually usable with RIOT
### cpu/mips32r2_generic [a2bcd7539ce1931b7aec0077ea71dadd62c96edd]
Author:
- Neil Jones <neil.jones@imgtec.com>
- No boards use this CPU (the only one was mips-malta).
- (Same reasons as mips-malta)
### boards/mips-malta [ee6b6b9c388b78fcec7ba6e239a6c76041b9bbb7]
Author:
- Neil Jones <neil.jones@imgtec.com>
Reasons for removal:
- UART input not supported.
- Hardware not available for testing and not available for purchase either.
- Not actively maintained / broken for some time.
### boards/pca10000 [9447cb303426d7c6348bb84999f88bf929cd6263]
Author(s):
- Christian Kühling <kuehling@zedat.fu-berlin.de>
@ -100,3 +184,109 @@ Author(s):
Reason for removal:
- code broken and excluded from all tests for a long time
- no maintainer available
### gnrc_pktbuf_duplicate_upto() [b83430aa625a1d42f11f9badf5e5cfbb8efacd99]
Author(s):
- Takuo Yonezawa <yonezawa.t2@gmail.com>
- Martine S. Lenders <m.lenders@fu-berlin.de>
Reason for removal:
- broke the abstraction of `gnrc_pktbuf`
- its only user within the RIOT code base `gnrc_ipv6_ext` was reworked in
[f671a87fe2c539c3aecd595ae03fa4f6f209d042] so it is not needed anymore.
- the function was deprecated in [f2760c033c5f332be076b25aa212aca4007c3d65]
### boards/wsn430-v1_3b, boards/wsn430-v1_4 [e63cd54f3b1e002a7895bb7c46af889b341c1a15]
Author(s):
- Hauke Petersen <hauke.petersen@fu-berlin.de>
- Martine Lenders <m.lenders@fu-berlin.de>
- Milan Babel <babel@inf.fu-berlin.de>
- Oliver Hahm <oliver.hahm@inria.fr>
Reason for removal:
- no longer accessible on the IoT-LAB testbed
### pkg/emb6 [4f243c52eabefe709d78560ce7f1d502d737a999]
Author(s):
- Martine S. Lenders <m.lenders@fu-berlin.de>
Reason for removal:
- Stale upstream (last update to date in Mar 2018)
- Ported version even older (last update Feb 2016)
- Updating to more recent version would be more effort than its worth
### GNRC_NETTYPE_IOVEC [4f243c52eabefe709d78560ce7f1d502d737a999]
Author(s):
- Martine S. Lenders <m.lenders@fu-berlin.de>
- Hauke Petersen <devel@haukepetersen.de>
Reason for removal:
- Unused since [9fb2f541baca469e34fa01b004d6f19385700ce9]
### pkg/nordic_softdevice_ble [35b6ccedf31f10a5f8e4f97609ad5b10c28bdc34]
Author(s):
- Hauke Petersen <hauke.petersen@fu-berlin.de>
- Kaspar Schleiser <kaspar@schleiser.de>
- Martine Lenders <m.lenders@fu-berlin.de>
- Wojciech Bober <wojciech.bober@nordicsemi.no>
Reason for removal:
- Outdated, unmaintained and no longer working
### gnrc_pktbuf_replace_snip() [72821a502f073006643cb4ef7815fc8c42563ce6]
Author(s):
- Joakim Nohlgård <joakim.nohlgard@eistec.se>
- Martine S. Lenders <m.lenders@fu-berlin.de>
Reason for removal:
- Unused, untested and no longer needed
### sys/irq_handler [a2dd6f90e51ca9edef643ba72bd1fd18113cf0d2]
Author(s):
- Gunar Schorcht <gunar@schorcht.net>
Reason for removal:
- Provides some feature as `sys/event_thread`
- Has been deprecated directly in the first release it was provided
### boards/slwstk6220a [cab1ea66b49e3c72e2827c8686c09d84ae3ef9a9]
Author(s):
- Hauke Petersen <hauke.petersen@fu-berlin.de>
- Bas Stottelaar <basstottelaar@gmail.com>
Reason for removal:
- The old implementation of the SLWSTK6220A based on `cpu/ezr32wg` did not use
the Gecko SDK, that other EFM32-based boards do use
- The old implementation had limited peripherals supported
- New implementation (with the same name) that is based on `cpu/efm32` was
added in commit [fe941ac9fe3f81c0f08ff3b8564cf439639abcda]
[cdc252ab7bd4161cc046bf93a3e55995704b24d4]: https://github.com/RIOT-OS/RIOT/commit/cdc252ab7bd4161cc046bf93a3e55995704b24d4
[ed3887ac5c1e95308c2827bce3cdca8b0f146c22]: https://github.com/RIOT-OS/RIOT/commit/ed3887ac5c1e95308c2827bce3cdca8b0f146c22
[0e2a62078850e1ecc74db2db4d639cf2d8fb96d3]: https://github.com/RIOT-OS/RIOT/commit/0e2a62078850e1ecc74db2db4d639cf2d8fb96d3
[c829f820ee870bffc60c7df688d2da8373553212]: https://github.com/RIOT-OS/RIOT/commit/c829f820ee870bffc60c7df688d2da8373553212
[9026823bb906f64168d7d38e52be92f390353dc8]: https://github.com/RIOT-OS/RIOT/commit/9026823bb906f64168d7d38e52be92f390353dc8
[bea30c3f8949ebd9fdf4a9bf0a987652889930f5]: https://github.com/RIOT-OS/RIOT/commit/bea30c3f8949ebd9fdf4a9bf0a987652889930f5
[232aed3e18118624b862d36bfec7cd1c21ca2d26]: https://github.com/RIOT-OS/RIOT/commit/232aed3e18118624b862d36bfec7cd1c21ca2d26
[a2bcd7539ce1931b7aec0077ea71dadd62c96edd]: https://github.com/RIOT-OS/RIOT/commit/a2bcd7539ce1931b7aec0077ea71dadd62c96edd
[ee6b6b9c388b78fcec7ba6e239a6c76041b9bbb7]: https://github.com/RIOT-OS/RIOT/commit/ee6b6b9c388b78fcec7ba6e239a6c76041b9bbb7
[9447cb303426d7c6348bb84999f88bf929cd6263]: https://github.com/RIOT-OS/RIOT/commit/9447cb303426d7c6348bb84999f88bf929cd6263
[ea73cc49eacd45640b9660134c4c92b887cb2716]: https://github.com/RIOT-OS/RIOT/commit/ea73cc49eacd45640b9660134c4c92b887cb2716
[99009af25e201bbc182d376e99df34133417be6c]: https://github.com/RIOT-OS/RIOT/commit/99009af25e201bbc182d376e99df34133417be6c
[cfa9580f319508f858c8fe30ecce8b2b59b6caa3]: https://github.com/RIOT-OS/RIOT/commit/cfa9580f319508f858c8fe30ecce8b2b59b6caa3
[b3eb9b8cf23f0702fa725d536df6ad6528f84189]: https://github.com/RIOT-OS/RIOT/commit/b3eb9b8cf23f0702fa725d536df6ad6528f84189
[7bc271807cecbffbb01a37c56a367b98fb823573]: https://github.com/RIOT-OS/RIOT/commit/7bc271807cecbffbb01a37c56a367b98fb823573
[fc45d7c5ac3d46bfdfb21c243cd3d4881bc5c836]: https://github.com/RIOT-OS/RIOT/commit/fc45d7c5ac3d46bfdfb21c243cd3d4881bc5c836
[b83430aa625a1d42f11f9badf5e5cfbb8efacd99]: https://github.com/RIOT-OS/RIOT/commit/b83430aa625a1d42f11f9badf5e5cfbb8efacd99
[f671a87fe2c539c3aecd595ae03fa4f6f209d042]: https://github.com/RIOT-OS/RIOT/commit/f671a87fe2c539c3aecd595ae03fa4f6f209d042
[f2760c033c5f332be076b25aa212aca4007c3d65]: https://github.com/RIOT-OS/RIOT/commit/f2760c033c5f332be076b25aa212aca4007c3d65
[e63cd54f3b1e002a7895bb7c46af889b341c1a15]: https://github.com/RIOT-OS/RIOT/commit/e63cd54f3b1e002a7895bb7c46af889b341c1a15
[4f243c52eabefe709d78560ce7f1d502d737a999]: https://github.com/RIOT-OS/RIOT/commit/4f243c52eabefe709d78560ce7f1d502d737a999
[3cac6e0979468ba56659291fd1cd11096611589d]: https://github.com/RIOT-OS/RIOT/commit/3cac6e0979468ba56659291fd1cd11096611589d
[9fb2f541baca469e34fa01b004d6f19385700ce9]: https://github.com/RIOT-OS/RIOT/commit/9fb2f541baca469e34fa01b004d6f19385700ce9
[35b6ccedf31f10a5f8e4f97609ad5b10c28bdc34]: https://github.com/RIOT-OS/RIOT/commit/35b6ccedf31f10a5f8e4f97609ad5b10c28bdc34
[72821a502f073006643cb4ef7815fc8c42563ce6]: https://github.com/RIOT-OS/RIOT/commit/72821a502f073006643cb4ef7815fc8c42563ce6
[a2dd6f90e51ca9edef643ba72bd1fd18113cf0d2]: https://github.com/RIOT-OS/RIOT/commit/a2dd6f90e51ca9edef643ba72bd1fd18113cf0d2
[cab1ea66b49e3c72e2827c8686c09d84ae3ef9a9]: https://github.com/RIOT-OS/RIOT/commit/cab1ea66b49e3c72e2827c8686c09d84ae3ef9a9
[fe941ac9fe3f81c0f08ff3b8564cf439639abcda]: https://github.com/RIOT-OS/RIOT/commit/fe941ac9fe3f81c0f08ff3b8564cf439639abcda

189
MAINTAINING.md Normal file
View File

@ -0,0 +1,189 @@
# RIOT Maintainer Guidelines
This list presents a series of guidelines for maintainers, including technical
and non-technical. The list is not exhaustive, and represents a baseline on
things that should be ensured for contributions.
Notes:
- Any of the items in this list might be skipped, if clearly and logically
articulated reasons are presented.
- The order of the steps is meant to maximize efficiency and minimize
overhead, with the philosophy that failing in step n makes steps n+x
obsolete. However, this efficiency can depend on the quality of the
submission itself. If the PR (Pull Request) is clearly not in a reviewable
state (for example, due to poor code cleanliness or overall design), it
might be more efficient to give the contributor some broader comments for
improvement before further review.
- This is a working document and any changes, additions, or other discussions
are encouraged, via PRs raised against the document. Changes to this
document should however have at least two ACKs, to ensure these guidelines
are well thought out, and that they reflect community consensus.
The [list of maintainers] gives information on the current maintainers and the
areas of RIOT they each maintain.
## Technical guidelines
### 1. - Review the fundamentals
Before spending the time on an in-depth code review, it's important to assess
the overall validity of the PR.
1. Does the reasoning for this PR make sense? \
Are the requirements and design goals clearly thought out and clearly
expressed? \
Is the problem that the PR intends to solve clearly stated?
2. Is the solution presented in the PR as simple as possible to satisfy the
requirements, but no simpler?
3. Is the PR a manageable size? It should be confined to a single explainable
change, and be runnable on its own.
4. Is the solution well designed on a high level?
5. Do the concepts used by the PR make sense?
6. Does the PR break with existing concepts?
7. Is there a clean commit history in the pulled branch? The commit history
should group the code differences cleanly.
8. Are there clear and adequate instructions on how to test the PR? \
This may or may not include implemented tests as part of the PR.
9. Does the code compile and run?
10. Does this PR respect the rights of previous authors, either through
retaining their commits or by retaining their copyrights in the boilerplate
headers?
11. Is the PR a duplicate of another PR?
### 2. - Review the design of the code
The following list is not exhaustive and addresses the coding issues we have
regularly seen in the past. In particular, check that the [Best Practices]
are followed. These checks can be aided (but not replaced) by a tool such as
Coccinelle, using the script found in dist/tools/coccinelle.
1. Check for code duplication
2. [Check memory usage][Comparing build sizes]
3. Check all code paths
4. Check for API compliance
5. Check for consistent error handling
6. Check scope of variables and functions
7. Check for syntactical, semantical or logical errors
8. Check for any runtime efficiency improvements that can be made in specific
lines of code - i.e., without changing the overall design of the code
9. Check that the code design is as simple as possible to solve the problem,
but no simpler
### 3. - Test the PR
Run tests to verify the correct behavior (see 1.6), both on `native` and on a
few selected boards, or present clearly and logically articulated reasons for
skipping some/all tests.
### 4. - Review the code against the coding conventions
Check that the code follows the [Coding Conventions]. This can be aided (but not
replaced) by Uncrustify, using the uncrustify-riot.cfg file found in the base
directory. Note the difference between personal coding style, which is allowed
subject to the other guidelines, and the coding conventions, which are absolute
and must always be followed.
### 5. - Review the documentation
The aim of the documentation is to ensure that the code can be picked up as
easily as possible in the future. Ideally, the documentation is sufficiently
complete that no input from the original developer or maintainer is required.
1. Check for sufficient high-level (module-level) documentation
2. Verify function level documentation
3. Are critical/hard to understand parts in the code documented?
4. Check grammar and spelling of documentation
## Non-technical guidelines
### Interaction with contributors
- Be responsive. Even if you are too busy to review the contribution, try to
add a note fairly soon after the PR is submitted, thanking them for their
valuable contribution and saying that you will review it in due course. Once
the contributor has made their changes, ensure you reply to them in a
reasonable timeframe. Acknowledge their replies to concerns if you're happy
with their argument.
- Be helpful. Give precise and correct advice when possible and when it will
help the contributor. This can include code snippets, links to
code/issues/wiki entries/web pages, or anything else. Educating contributors
means we are investing in our community.
- Be friendly. Respect the original author, bearing in mind that their coding
style or their design may be just as valid as the way you would have done
it. And of course, always follow the [Code of Conduct].
- If a contributor has opened a PR, the reviewer should attempt to
help the author of the contribution to get it to its best shape and
according to the RIOT Standard™. If there is disagreement, its important
to understand the reasons behind and always give technical arguments,
pros and cons or snippets.
### Organisation of reviewing between maintainers
#### Partial review
You can review a PR partially. This would involve reviewing all points in one or
more sections outlined in the [technical guidelines](#technical-guidelines).
In that case, please do not "approve" the PR to prevent accidental merges.
Rather, give your verbal ACK and describe what you reviewed. In addition, if you
processed or reasonably stepped over a whole section, mark the PR with the
according label from the "Reviewed:" category. If you set a label by stepping
over a section, please articulate your reasoning for this clearly, as noted in
the [introduction](#introduction). This will help other maintainers help to
better understand your line of thought. If you disagree with the assessment of
a previous review, you may remove a certain "Reviewed:" label. Please state your
reasoning in this case as well.
When all "Reviewed:" labels are set you may give your approval for the PR.
As everything in this document this is a "CAN", not a "MUST": It might help
other maintainers to track your work, but if the overhead isn't justified, a
simple approving ACK might suffice.
#### Github etiquette
It is good etiquette to describe what you reviewed, even if you gave the PR a
full review and gave your approval. This way the contributor and other
maintainers are able to follow your thought process.
Maintainers should only assign themselves to PRs and shouldn't assign other
maintainers. You can however request reviews from other maintainers or
contributors, either by mentioning them in a comment or selecting them in
GitHub's review sidebar.
If there are multiple maintainers reviewing a PR, always give the other
maintainers reasonable time to ACK before dismissing their review.
### Release, Feature Freeze, and Backports
Before the official release of a new RIOT version, two feature freeze periods
are announced on the
[RIOT development email list](https://lists.riot-os.org/mailman/listinfo/devel):
The soft feature freeze and the hard feature freeze. During the soft feature
freeze only PRs with minor impact should be merged into master. The hard feature
freeze begins when the release manager creates a new release branch. Therefore,
the restriction on merging PRs into the master branch are lifted at that point.
Once the release branch is created, no backports of new features will be
accepted. Instead, backports should consist only of bug fixes or of reverting
features that were added during the last development period (and not part of any
release), but didn't reach the required maturity or API stability yet. For
bigger changes (which explicitly includes any revert), the PR has to be
announced to the maintainer mailing list and should be merged no sooner than
48h after the announcement and needs at least two ACKs.
In case of security relevant backports (both bug fixes and reverts), the
announcement can be skipped and the fix merged once at least two ACKs are
there.
[list of maintainers]: https://github.com/RIOT-OS/RIOT/wiki/Maintainers
[Best Practices]: https://github.com/RIOT-OS/RIOT/wiki/Best-Practice-for-RIOT-Programming
[Comparing build sizes]: https://github.com/RIOT-OS/RIOT/wiki/Comparing-build-sizes
[Coding Conventions]: CODING_CONVENTIONS.md
[Code of Conduct]: https://github.com/RIOT-OS/RIOT/blob/master/CODE_OF_CONDUCT.md

View File

@ -1,6 +1,6 @@
.all:
.PHONY: all doc doc-man doc-latex docclean welcome
.PHONY: all doc doc-man doc-latex docclean print-versions welcome
all: welcome
@echo ""
@ -20,11 +20,15 @@ docclean:
clean:
@echo "Cleaning all build products for the current board"
@find ./examples/ ./tests/ -maxdepth 2 -mindepth 2 -type f -name Makefile -execdir "$(MAKE)" clean ';'
@for dir in $(APPLICATION_DIRS); do "$(MAKE)" -C$$dir clean; done
distclean: docclean
pkg-clean:
@echo "Cleaning all package sources"
rm -rf build/pkg
distclean: docclean pkg-clean
@echo "Cleaning all build products"
@find ./examples/ ./tests/ -maxdepth 2 -mindepth 2 -type f -name Makefile -execdir "$(MAKE)" distclean ';'
@for dir in $(APPLICATION_DIRS); do "$(MAKE)" -C$$dir distclean; done
welcome:
@echo "Welcome to RIOT - The friendly OS for IoT!"
@ -34,7 +38,14 @@ welcome:
@echo ""
@echo "Please see our Quick Start Guide at:"
@echo " https://doc.riot-os.org/getting-started.html"
@echo "Or ask questions on our mailing list:"
@echo " users@riot-os.org (http://lists.riot-os.org/mailman/listinfo/users)"
@echo "You can ask questions or discuss with other users on our forum:"
@echo " https://forum.riot-os.org"
print-versions:
@./dist/tools/ci/print_toolchain_versions.sh
include makefiles/boards.inc.mk
include makefiles/app_dirs.inc.mk
include makefiles/tools/riotgen.inc.mk
-include makefiles/tests.inc.mk

View File

@ -2,14 +2,25 @@ ifeq (, $(__RIOTBUILD_FLAG))
$(error You cannot build a module on its own. Use "make" in your application's directory instead.)
endif
#
# enable second expansion of prerequisites.
#
# Doing that here enables it globally for all modules
#
# See https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html
# for what it can be used for.
.SECONDEXPANSION:
unexport DIRS
DIRS := $(sort $(abspath $(DIRS)))
MODULE ?= $(shell basename $(CURDIR))
_MOD := $(shell basename $(CURDIR))
MODULE ?= $(_MOD)
.PHONY: all $(DIRS:%=ALL--%) $(DIRS:%=CLEAN--%)
.PHONY: all clean $(DIRS:%=ALL--%) $(DIRS:%=CLEAN--%) $(MODULE).module \
compile-commands $(DIRS:%=COMPILE-COMMANDS--%) $(MODULE).cleanup
all: $(BINDIR)/$(MODULE).a ..nothing
all: $(MODULE).module ..nothing
..nothing:
@:
@ -22,6 +33,9 @@ $(DIRS:%=ALL--%):
$(DIRS:%=CLEAN--%):
$(QQ)"$(MAKE)" -C $(@:CLEAN--%=%) clean
$(DIRS:%=COMPILE-COMMANDS--%):
$(QQ)"$(MAKE)" -C $(@:COMPILE-COMMANDS--%=%) compile-commands
## submodules
ifeq (1, $(SUBMODULES))
# don't use *.c as SRC if SRC is empty (e.g., no module selected)
@ -31,19 +45,20 @@ ifeq (1, $(SUBMODULES))
BASE_MODULE ?= $(MODULE)
# for each $(BASE_MODULE)_<name> in USEMODULE, add <name>.c to SRC
SRC += $(patsubst $(BASE_MODULE)_%,%.c,$(filter $(BASE_MODULE)_%,$(USEMODULE)))
SRC += $(wildcard $(patsubst $(BASE_MODULE)_%,%.c,$(filter $(BASE_MODULE)_%,$(USEMODULE))))
# don't fail if a selected *.c file does not exist
ifeq (1, $(SUBMODULES_NOFORCE))
SRC := $(filter $(SRC), $(wildcard *.c))
endif
# remove duplicates
SRC := $(sort $(SRC))
endif
# By default consider C++ files has a .cpp extension
SRCXXEXT ?= cpp
ifeq ($(strip $(SRC))$(NO_AUTO_SRC),)
SRC := $(filter-out $(SRC_NOLTO), $(wildcard *.c))
endif
ifeq ($(strip $(SRCXX))$(NO_AUTO_SRC),)
SRCXX := $(wildcard *.cpp)
SRCXX := $(filter-out $(SRCXXEXCLUDE),$(wildcard *.$(SRCXXEXT)))
endif
ifeq ($(strip $(ASMSRC))$(NO_AUTO_SRC),)
ASMSRC := $(wildcard *.s)
@ -52,25 +67,62 @@ ifeq ($(strip $(ASSMSRC))$(NO_AUTO_SRC),)
ASSMSRC := $(wildcard *.S)
endif
ifneq (,$(SRCXX))
ifeq (,$(filter cpp,$(USEMODULE)))
ifneq (1,$(TEST_KCONFIG))
$(error Found C++ source, but feature "cpp" is not used. Add "FEATURES_REQUIRED += cpp")
else
$(error Found C++ source, but "cpp" module is not used. Enable the MODULE_CPP in Kconfig)
endif
endif
endif
compile-commands: | $(DIRS:%=COMPILE-COMMANDS--%)
$(file >$(BINDIR)/$(MODULE)/compile_cmds.txt,SRC: $(sort $(SRC) $(SRC_NO_LTO)))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,SRC_NO_LTO: $(sort $(SRC_NO_LTO)))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,SRCXX: $(sort $(SRCXX)))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,CURDIR: $(CURDIR))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,CFLAGS: $(CFLAGS))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,LTOFLAGS: $(LTOFLAGS))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,INCLUDES: $(INCLUDES))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,CXXFLAGS: $(CXXFLAGS))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,CXXINCLUDES: $(CXXINCLUDES))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,CC: $(CC))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,CXX: $(CXX))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,TARGET_ARCH: $(TARGET_ARCH))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,TARGET_ARCH_LLVM: $(TARGET_ARCH_LLVM))
# include makefile snippets for packages in $(USEPKG) that modify GENSRC:
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.gensrc)
GENOBJC := $(GENSRC:%.c=%.o)
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)
OBJC_NOLTO := $(SRC_NOLTO:%.c=$(BINDIR)/$(MODULE)/%.o)
OBJC := $(OBJC_NOLTO) $(OBJC_LTO)
OBJCXX := $(SRCXX:%.cpp=$(BINDIR)/$(MODULE)/%.o)
OBJCXX := $(SRCXX:%.$(SRCXXEXT)=$(BINDIR)/$(MODULE)/%.o)
ASMOBJ := $(ASMSRC:%.s=$(BINDIR)/$(MODULE)/%.o)
ASSMOBJ := $(ASSMSRC:%.S=$(BINDIR)/$(MODULE)/%.o)
OBJ := $(OBJC) $(OBJCXX) $(ASMOBJ) $(ASSMOBJ)
OBJ := $(OBJC) $(OBJCXX) $(ASMOBJ) $(ASSMOBJ) $(GENOBJC)
DEP := $(OBJC:.o=.d) $(OBJCXX:.o=.d) $(ASSMOBJ:.o=.d)
include $(RIOTMAKE)/blob.inc.mk
include $(RIOTMAKE)/tools/fixdep.inc.mk
$(BINDIR)/$(MODULE)/:
$(Q)mkdir -p $@
$(BINDIR)/$(MODULE).a $(OBJ): | $(BINDIR)/$(MODULE)/
OLD_OBJECTS = $(wildcard $(BINDIR)/$(MODULE)/*.o)
OBJECTS_TO_REMOVE = $(filter-out $(OBJ),$(OLD_OBJECTS))
$(BINDIR)/$(MODULE).a: $(OBJ) | $(DIRS:%=ALL--%)
@# Recreate archive to cleanup deleted/non selected source files objects
$(Q)$(RM) $@
$(Q)$(AR) $(ARFLAGS) $@ $^
$(MODULE).module compile-commands $(OBJ): | $(BINDIR)/$(MODULE)/
$(MODULE).module: $(OBJ) $(if $(OBJECTS_TO_REMOVE),$(MODULE).cleanup) | $(DIRS:%=ALL--%)
$(MODULE).cleanup:
$(Q)# cleanup non selected source files objects
$(Q)$(RM) $(OBJECTS_TO_REMOVE)
CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS)
CCASFLAGS = $(filter-out $(CCASUWFLAGS), $(CFLAGS)) $(CCASEXFLAGS)
@ -79,23 +131,48 @@ CCASFLAGS = $(filter-out $(CCASUWFLAGS), $(CFLAGS)) $(CCASEXFLAGS)
$(OBJC_LTO): CFLAGS+=$(LTOFLAGS)
$(OBJC): $(BINDIR)/$(MODULE)/%.o: %.c $(RIOTBUILD_CONFIG_HEADER_C)
# Define dependencies for object files
OBJ_DEPS += $(RIOTBUILD_CONFIG_HEADER_C)
$(OBJC): $(BINDIR)/$(MODULE)/%.o: %.c $(OBJ_DEPS) | $(if $(SHOULD_RUN_KCONFIG),$(KCONFIG_GENERATED_AUTOCONF_HEADER_C))
$(Q)$(CCACHE) $(CC) \
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \
-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
$(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
$(CFLAGS) $(INCLUDES) -MQ '$@' -MD -MP -c -o $@ $(abspath $<)
ifneq (,$(SHOULD_RUN_KCONFIG))
$(Q)$(FIXDEP) $(@:.o=.d) $@ $(KCONFIG_SYNC_DIR) > $(@:.o=.tmp)
$(Q)mv $(@:.o=.tmp) $(@:.o=.d)
endif
$(OBJCXX): $(BINDIR)/$(MODULE)/%.o: %.cpp $(RIOTBUILD_CONFIG_HEADER_C)
$(GENOBJC): %.o: %.c $(OBJ_DEPS) | $(if $(SHOULD_RUN_KCONFIG),$(KCONFIG_GENERATED_AUTOCONF_HEADER_C))
$(Q) $(CCACHE) $(CC) \
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$<)\" \
-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
$(CFLAGS) $(INCLUDES) -MQ '$@' -MD -MP -c -o $@ $<
ifneq (,$(SHOULD_RUN_KCONFIG))
$(Q)$(FIXDEP) $(@:.o=.d) $@ $(KCONFIG_SYNC_DIR) > $(@:.o=.tmp)
$(Q)mv $(@:.o=.tmp) $(@:.o=.d)
endif
$(OBJCXX): $(BINDIR)/$(MODULE)/%.o: %.$(SRCXXEXT) $(OBJ_DEPS) | $(if $(SHOULD_RUN_KCONFIG),$(KCONFIG_GENERATED_AUTOCONF_HEADER_C))
$(Q)$(CCACHE) $(CXX) \
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \
-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
$(CXXFLAGS) $(CXXINCLUDES) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
$(CXXFLAGS) $(CXXINCLUDES) $(INCLUDES) -MQ '$@' -MD -MP -c -o $@ $(abspath $<)
ifneq (,$(SHOULD_RUN_KCONFIG))
$(Q)$(FIXDEP) $(@:.o=.d) $@ $(KCONFIG_SYNC_DIR) > $(@:.o=.tmp)
$(Q)mv $(@:.o=.tmp) $(@:.o=.d)
endif
$(ASMOBJ): $(BINDIR)/$(MODULE)/%.o: %.s
$(Q)$(AS) $(ASFLAGS) -o $@ $(abspath $<)
$(ASSMOBJ): $(BINDIR)/$(MODULE)/%.o: %.S $(RIOTBUILD_CONFIG_HEADER_C)
$(Q)$(CCAS) $(CCASFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
$(ASSMOBJ): $(BINDIR)/$(MODULE)/%.o: %.S $(OBJ_DEPS) | $(if $(SHOULD_RUN_KCONFIG),$(KCONFIG_GENERATED_AUTOCONF_HEADER_C))
$(Q)$(CCAS) $(CCASFLAGS) $(INCLUDES) -MQ '$@' -MD -MP -c -o $@ $(abspath $<)
ifneq (,$(SHOULD_RUN_KCONFIG))
$(Q)$(FIXDEP) $(@:.o=.d) $@ $(KCONFIG_SYNC_DIR) > $(@:.o=.tmp)
$(Q)mv $(@:.o=.tmp) $(@:.o=.d)
endif
# pull in dependency info for *existing* .o files
# deleted header files will be silently ignored

View File

@ -1,658 +1,49 @@
#
OLD_USEMODULE := $(sort $(USEMODULE))
OLD_USEPKG := $(sort $(USEPKG))
# include board specific application dependencies
-include $(APPDIR)/Makefile.board.dep
-include $(APPDIR)/Makefile.$(TOOLCHAIN).dep
# include board dependencies
-include $(RIOTBOARD)/$(BOARD)/Makefile.dep
-include $(BOARDDIR)/Makefile.dep
# pull dependencies from drivers
# include cpu dependencies
-include $(RIOTCPU)/$(CPU)/Makefile.dep
# include external modules dependencies
# processed before RIOT ones to be evaluated before the 'default' rules.
-include $(EXTERNAL_MODULE_PATHS:%=%/Makefile.dep)
# pull dependencies from sys and drivers
include $(RIOTBASE)/sys/Makefile.dep
include $(RIOTBASE)/drivers/Makefile.dep
ifneq (,$(filter cbor_ctime,$(USEMODULE)))
ifneq (,$(filter newlib,$(USEMODULE)))
USEMODULE += newlib_gnu_source
endif
endif
ifneq (,$(filter csma_sender,$(USEMODULE)))
USEMODULE += random
USEMODULE += xtimer
endif
ifneq (,$(filter gnrc_mac,$(USEMODULE)))
USEMODULE += gnrc_priority_pktqueue
USEMODULE += csma_sender
endif
ifneq (,$(filter gnrc_gomach,$(USEMODULE)))
USEMODULE += gnrc_netif
USEMODULE += random
USEMODULE += xtimer
USEMODULE += gnrc_mac
FEATURES_REQUIRED += periph_rtt
endif
ifneq (,$(filter nhdp,$(USEMODULE)))
USEMODULE += sock_udp
USEMODULE += xtimer
USEMODULE += oonf_rfc5444
endif
ifneq (,$(filter sntp,$(USEMODULE)))
USEMODULE += gnrc_sock_udp
USEMODULE += xtimer
endif
ifneq (,$(filter gnrc_netdev_default,$(USEMODULE)))
USEMODULE += netdev_default
USEMODULE += gnrc_netif
endif
ifneq (,$(filter netdev_ieee802154,$(USEMODULE)))
USEMODULE += ieee802154
endif
ifneq (,$(filter gnrc_uhcpc,$(USEMODULE)))
USEMODULE += uhcpc
USEMODULE += gnrc_sock_udp
USEMODULE += fmt
endif
ifneq (,$(filter uhcpc,$(USEMODULE)))
USEMODULE += posix
endif
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
USEMODULE += softdevice_handler
USEMODULE += ble_common
USEMODULE += ble_6lowpan
USEMODULE += gnrc_sixlowpan
USEMODULE += gnrc_sixlowpan_iphc
USEMODULE += gnrc_ipv6_nib_6ln
USEMODULE += gnrc_ipv6_default
# prevent application from being a router
# TODO: maybe find a nicer solution in future build system update
_ROUTER_MODULES = gnrc_ipv6_router% gnrc_rpl netstats_rpl auto_init_gnrc_rpl
ifneq (,$(filter $(_ROUTER_MODULES),$(USEMODULE)))
$(warning nordic_softdevice_ble: Disabling router modules:\
$(filter $(_ROUTER_MODULES),$(USEMODULE)))
endif
USEMODULE := $(filter-out $(_ROUTER_MODULES),$(USEMODULE))
endif
ifneq (,$(filter gnrc_%,$(filter-out gnrc_netapi gnrc_netreg gnrc_netif% gnrc_pkt%,$(USEMODULE))))
USEMODULE += gnrc
endif
ifneq (,$(filter gnrc_sock_%,$(USEMODULE)))
USEMODULE += gnrc_sock
endif
ifneq (,$(filter gnrc_sock_ip,$(USEMODULE)))
USEMODULE += sock_ip
endif
ifneq (,$(filter gnrc_sock_udp,$(USEMODULE)))
USEMODULE += gnrc_udp
USEMODULE += random # to generate random ports
USEMODULE += sock_udp
endif
ifneq (,$(filter gnrc_sock,$(USEMODULE)))
USEMODULE += gnrc_netapi_mbox
USEMODULE += sock
endif
ifneq (,$(filter gnrc_netapi_mbox,$(USEMODULE)))
USEMODULE += core_mbox
endif
ifneq (,$(filter netdev_tap,$(USEMODULE)))
USEMODULE += netif
USEMODULE += netdev_eth
USEMODULE += iolist
endif
ifneq (,$(filter gnrc_tftp,$(USEMODULE)))
USEMODULE += gnrc_udp
USEMODULE += xtimer
endif
ifneq (,$(filter gnrc_rpl_p2p,$(USEMODULE)))
USEMODULE += gnrc_rpl
endif
ifneq (,$(filter gnrc_rpl,$(USEMODULE)))
USEMODULE += gnrc_icmpv6
USEMODULE += gnrc_ipv6_nib
USEMODULE += trickle
USEMODULE += xtimer
endif
ifneq (,$(filter trickle,$(USEMODULE)))
USEMODULE += random
USEMODULE += xtimer
endif
ifneq (,$(filter ieee802154 nrfmin,$(USEMODULE)))
ifneq (,$(filter gnrc_ipv6, $(USEMODULE)))
USEMODULE += gnrc_sixlowpan
endif
ifneq (,$(filter gnrc_ipv6_router, $(USEMODULE)))
USEMODULE += gnrc_sixlowpan_router
endif
ifneq (,$(filter gnrc_ipv6_default, $(USEMODULE)))
USEMODULE += gnrc_sixlowpan_default
endif
ifneq (,$(filter gnrc_ipv6_router_default, $(USEMODULE)))
USEMODULE += gnrc_sixlowpan_router_default
endif
ifneq (,$(filter lwip%, $(USEMODULE)))
USEMODULE += lwip_sixlowpan
endif
endif
ifneq (,$(filter gnrc_sixlowpan_default,$(USEMODULE)))
USEMODULE += gnrc_ipv6_default
USEMODULE += gnrc_ipv6_nib_6ln
USEMODULE += gnrc_sixlowpan
USEMODULE += gnrc_sixlowpan_frag
USEMODULE += gnrc_sixlowpan_iphc
endif
ifneq (,$(filter gnrc_sixlowpan_router_default,$(USEMODULE)))
USEMODULE += gnrc_ipv6_router_default
USEMODULE += gnrc_ipv6_nib_6lr
USEMODULE += gnrc_sixlowpan_router
USEMODULE += gnrc_sixlowpan_frag
USEMODULE += gnrc_sixlowpan_iphc
endif
ifneq (,$(filter gnrc_sixlowpan_border_router_default,$(USEMODULE)))
USEMODULE += gnrc_ipv6_nib_6lbr
USEMODULE += gnrc_ipv6_router_default
USEMODULE += gnrc_sixlowpan_router
USEMODULE += gnrc_sixlowpan_frag
USEMODULE += gnrc_sixlowpan_iphc
endif
ifneq (,$(filter gnrc_sixlowpan_router,$(USEMODULE)))
USEMODULE += gnrc_ipv6_router
endif
ifneq (,$(filter gnrc_sixlowpan_frag,$(USEMODULE)))
USEMODULE += gnrc_sixlowpan
USEMODULE += xtimer
endif
ifneq (,$(filter gnrc_sixlowpan_iphc,$(USEMODULE)))
USEMODULE += gnrc_sixlowpan
USEMODULE += gnrc_sixlowpan_ctx
USEMODULE += gnrc_sixlowpan_iphc_nhc
endif
ifneq (,$(filter gnrc_sixlowpan,$(USEMODULE)))
USEMODULE += gnrc_ipv6
USEMODULE += sixlowpan
endif
ifneq (,$(filter gnrc_sixlowpan_ctx,$(USEMODULE)))
USEMODULE += ipv6_addr
USEMODULE += xtimer
endif
ifneq (,$(filter gnrc_ipv6_default,$(USEMODULE)))
USEMODULE += gnrc_ipv6
USEMODULE += gnrc_icmpv6
endif
ifneq (,$(filter gnrc_ipv6_router_default,$(USEMODULE)))
USEMODULE += gnrc_ipv6_router
USEMODULE += gnrc_icmpv6
endif
ifneq (,$(filter gnrc_ndp,$(USEMODULE)))
USEMODULE += gnrc_icmpv6
USEMODULE += gnrc_netif
endif
ifneq (,$(filter gnrc_icmpv6_echo,$(USEMODULE)))
USEMODULE += gnrc_icmpv6
endif
ifneq (,$(filter gnrc_icmpv6_error,$(USEMODULE)))
USEMODULE += gnrc_icmpv6
endif
ifneq (,$(filter gnrc_icmpv6,$(USEMODULE)))
USEMODULE += inet_csum
USEMODULE += gnrc_ipv6
USEMODULE += icmpv6
endif
# pull Makefile.dep of each driver modules if they exist
-include $(sort $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep))
ifneq (,$(filter gnrc_rpl_srh,$(USEMODULE)))
USEMODULE += ipv6_ext_rh
endif
ifneq (,$(filter ipv6_ext_rh,$(USEMODULE)))
USEMODULE += ipv6_ext
endif
ifneq (,$(filter gnrc_ipv6_ext,$(USEMODULE)))
USEMODULE += gnrc_ipv6
endif
ifneq (,$(filter gnrc_ipv6_whitelist,$(USEMODULE)))
USEMODULE += ipv6_addr
endif
ifneq (,$(filter gnrc_ipv6_blacklist,$(USEMODULE)))
USEMODULE += ipv6_addr
endif
ifneq (,$(filter gnrc_ipv6_router,$(USEMODULE)))
USEMODULE += gnrc_ipv6
USEMODULE += gnrc_ipv6_nib_router
endif
ifneq (,$(filter gnrc_ipv6,$(USEMODULE)))
USEMODULE += inet_csum
USEMODULE += ipv6_addr
USEMODULE += gnrc_ipv6_hdr
USEMODULE += gnrc_ipv6_nib
USEMODULE += gnrc_netif
endif
ifneq (,$(filter gnrc_ipv6_hdr,$(USEMODULE)))
USEMODULE += ipv6_hdr
USEMODULE += gnrc_pktbuf
endif
ifneq (,$(filter sixlowpan,$(USEMODULE)))
USEMODULE += ipv6_hdr
endif
ifneq (,$(filter ipv6_hdr,$(USEMODULE)))
USEMODULE += inet_csum
USEMODULE += ipv6_addr
endif
ifneq (,$(filter gnrc_ipv6_nib_6lbr,$(USEMODULE)))
USEMODULE += gnrc_ipv6_nib_6lr
endif
ifneq (,$(filter gnrc_ipv6_nib_6lr,$(USEMODULE)))
USEMODULE += gnrc_ipv6_nib_6ln
USEMODULE += gnrc_ipv6_nib_router
endif
ifneq (,$(filter gnrc_ipv6_nib_6ln,$(USEMODULE)))
USEMODULE += gnrc_ipv6_nib
USEMODULE += gnrc_sixlowpan_nd
endif
ifneq (,$(filter gnrc_ipv6_nib_router,$(USEMODULE)))
USEMODULE += gnrc_ipv6_nib
endif
ifneq (,$(filter gnrc_ipv6_nib,$(USEMODULE)))
USEMODULE += evtimer
USEMODULE += gnrc_ndp
USEMODULE += gnrc_netif
USEMODULE += ipv6_addr
USEMODULE += random
endif
ifneq (,$(filter gnrc_udp,$(USEMODULE)))
USEMODULE += inet_csum
USEMODULE += udp
endif
ifneq (,$(filter gnrc_tcp,$(USEMODULE)))
USEMODULE += inet_csum
USEMODULE += random
USEMODULE += tcp
USEMODULE += xtimer
USEMODULE += core_mbox
endif
ifneq (,$(filter gnrc_nettest,$(USEMODULE)))
USEMODULE += gnrc_netapi
USEMODULE += gnrc_netreg
USEMODULE += gnrc_netif
USEMODULE += gnrc_pktbuf
USEMODULE += xtimer
endif
ifneq (,$(filter gnrc_pktdump,$(USEMODULE)))
USEMODULE += gnrc_pktbuf
USEMODULE += od
endif
ifneq (,$(filter od,$(USEMODULE)))
USEMODULE += fmt
endif
ifneq (,$(filter od_string,$(USEMODULE)))
USEMODULE += od
endif
ifneq (,$(filter newlib_gnu_source,$(USEMODULE)))
USEMODULE += newlib
endif
ifneq (,$(filter newlib_nano,$(USEMODULE)))
USEMODULE += newlib
endif
ifneq (,$(filter newlib,$(USEMODULE)))
# allow custom newlib syscalls implementations by adding
# newlib_syscalls_XXX to USEMODULE
ifeq (,$(filter newlib_syscalls_%,$(USEMODULE)))
USEMODULE += newlib_syscalls_default
endif
ifeq (,$(filter rtt_stdio,$(USEMODULE)))
USEMODULE += uart_stdio
endif
endif
ifneq (,$(filter posix_sockets,$(USEMODULE)))
USEMODULE += bitfield
USEMODULE += random
USEMODULE += vfs
USEMODULE += posix
USEMODULE += xtimer
endif
ifneq (,$(filter rtt_stdio,$(USEMODULE)))
USEMODULE += xtimer
endif
ifneq (,$(filter uart_stdio,$(USEMODULE)))
USEMODULE += isrpipe
FEATURES_REQUIRED += periph_uart
endif
ifneq (,$(filter isrpipe,$(USEMODULE)))
USEMODULE += tsrb
endif
ifneq (,$(filter shell_commands,$(USEMODULE)))
ifneq (,$(filter fib,$(USEMODULE)))
USEMODULE += posix
endif
endif
ifneq (,$(filter posix_semaphore,$(USEMODULE)))
USEMODULE += sema
USEMODULE += xtimer
endif
ifneq (,$(filter posix_time,$(USEMODULE)))
USEMODULE += xtimer
endif
ifneq (,$(filter lwip_sixlowpan,$(USEMODULE)))
USEMODULE += lwip_ipv6_autoconfig
endif
ifneq (,$(filter lwip_ipv6_autoconfig lwip_ipv6_mld,$(USEMODULE)))
USEMODULE += lwip_ipv6
endif
ifneq (,$(filter lwip_ipv6,$(USEMODULE)))
USEMODULE += random
endif
ifneq (,$(filter lwip_udplite,$(USEMODULE)))
USEMODULE += lwip_udp
endif
ifneq (,$(filter lwip_sock_%,$(USEMODULE)))
USEMODULE += lwip_sock
endif
ifneq (,$(filter lwip_sock_ip,$(USEMODULE)))
USEMODULE += lwip_raw
USEMODULE += sock_ip
endif
# pull dependencies from packages
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)
ifneq (,$(filter lwip_sock_tcp,$(USEMODULE)))
USEMODULE += lwip_tcp
USEMODULE += sock_tcp
ifneq (,$(filter mpu_stack_guard,$(USEMODULE)))
FEATURES_REQUIRED += cortexm_mpu
endif
ifneq (,$(filter lwip_sock_udp,$(USEMODULE)))
USEMODULE += lwip_udp
USEMODULE += sock_udp
ifneq (,$(filter mpu_noexec_ram,$(USEMODULE)))
FEATURES_REQUIRED += cortexm_mpu
endif
ifneq (,$(filter lwip_%,$(USEMODULE)))
USEMODULE += lwip
endif
ifneq (,$(filter lwip,$(USEMODULE)))
USEPKG += lwip
USEMODULE += core_mbox
USEMODULE += lwip_api
USEMODULE += lwip_contrib
USEMODULE += lwip_core
USEMODULE += lwip_netif
ifeq (,$(filter lwip_ipv4 lwip_ipv6,$(USEMODULE)))
USEMODULE += lwip_ipv4
endif
ifeq (,$(filter lwip_tcp lwip_udp lwip_udplite,$(USEMODULE)))
USEMODULE += lwip_raw
endif
endif
ifneq (,$(filter lwip_ppp,$(USEMODULE)))
USEMODULE += lwip_polarssl
endif
ifneq (,$(filter lwip_contrib,$(USEMODULE)))
USEMODULE += sema
USEMODULE += xtimer
endif
ifneq (,$(filter sema,$(USEMODULE)))
USEMODULE += xtimer
endif
ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
USEPKG += libfixmath
USEMODULE += libfixmath
endif
ifneq (,$(filter luid,$(USEMODULE)))
FEATURES_OPTIONAL += periph_cpuid
endif
ifneq (,$(filter fib,$(USEMODULE)))
USEMODULE += universal_address
USEMODULE += xtimer
endif
ifneq (,$(filter oonf_rfc5444,$(USEMODULE)))
USEMODULE += oonf_common
endif
ifneq (,$(filter oonf_common,$(USEMODULE)))
USEPKG += oonf_api
USEMODULE += posix_sockets
endif
# if any log_* is used, also use LOG pseudomodule
ifneq (,$(filter log_%,$(USEMODULE)))
USEMODULE += log
endif
ifneq (,$(filter cpp11-compat,$(USEMODULE)))
USEMODULE += xtimer
USEMODULE += timex
FEATURES_REQUIRED += cpp
endif
ifneq (,$(filter gnrc,$(USEMODULE)))
USEMODULE += gnrc_netapi
USEMODULE += gnrc_netreg
USEMODULE += gnrc_netif
USEMODULE += gnrc_netif_hdr
USEMODULE += gnrc_pktbuf
endif
ifneq (,$(filter gnrc_pktbuf, $(USEMODULE)))
ifeq (,$(filter gnrc_pktbuf_%, $(USEMODULE)))
USEMODULE += gnrc_pktbuf_static
endif
USEMODULE += gnrc_pkt
endif
ifneq (,$(filter gnrc_pktbuf_%, $(USEMODULE)))
USEMODULE += gnrc_pktbuf # make MODULE_GNRC_PKTBUF macro available for all implementations
endif
ifneq (,$(filter netstats_%, $(USEMODULE)))
USEMODULE += netstats
endif
ifneq (,$(filter gnrc_lwmac,$(USEMODULE)))
USEMODULE += gnrc_netif
USEMODULE += gnrc_mac
FEATURES_REQUIRED += periph_rtt
endif
ifneq (,$(filter pthread,$(USEMODULE)))
USEMODULE += xtimer
USEMODULE += timex
endif
ifneq (,$(filter schedstatistics,$(USEMODULE)))
USEMODULE += xtimer
endif
ifneq (,$(filter arduino,$(USEMODULE)))
FEATURES_REQUIRED += arduino
FEATURES_REQUIRED += cpp
USEMODULE += xtimer
endif
ifneq (,$(filter xtimer,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer
USEMODULE += div
endif
ifneq (,$(filter saul,$(USEMODULE)))
USEMODULE += phydat
endif
ifneq (,$(filter saul_reg,$(USEMODULE)))
USEMODULE += saul
endif
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul
USEMODULE += saul_reg
USEMODULE += auto_init_saul
endif
ifneq (,$(filter saul_adc,$(USEMODULE)))
FEATURES_REQUIRED += periph_adc
endif
ifneq (,$(filter saul_gpio,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio
endif
ifneq (,$(filter saul,$(USEMODULE)))
USEMODULE += phydat
endif
ifneq (,$(filter phydat,$(USEMODULE)))
USEMODULE += fmt
endif
ifneq (,$(filter evtimer,$(USEMODULE)))
USEMODULE += xtimer
endif
ifneq (,$(filter can_linux,$(USEMODULE)))
LINKFLAGS += -lsocketcan
endif
ifneq (,$(filter can,$(USEMODULE)))
USEMODULE += can_raw
USEMODULE += auto_init_can
ifneq (,$(filter can_mbox,$(USEMODULE)))
USEMODULE += core_mbox
endif
USEMODULE += gnrc_pktbuf_static
endif
ifneq (,$(filter can_isotp,$(USEMODULE)))
USEMODULE += xtimer
endif
ifneq (,$(filter conn_can,$(USEMODULE)))
USEMODULE += can
USEMODULE += can_mbox
USEMODULE += xtimer
endif
ifneq (,$(filter random,$(USEMODULE)))
USEMODULE += prng
# select default prng
# select default prng if no prng is selected
ifeq (,$(filter prng_%,$(USEMODULE)))
USEMODULE += prng_tinymt32
endif
ifneq (,$(filter prng_tinymt32,$(USEMODULE)))
USEMODULE += tinymt32
endif
USEMODULE += luid
endif
ifneq (,$(filter openthread_contrib,$(USEMODULE)))
USEMODULE += openthread_contrib_netdev
FEATURES_REQUIRED += cpp
endif
ifneq (,$(filter emcute,$(USEMODULE)))
USEMODULE += core_thread_flags
USEMODULE += sock_udp
USEMODULE += xtimer
endif
ifneq (,$(filter constfs,$(USEMODULE)))
USEMODULE += vfs
endif
ifneq (,$(filter devfs,$(USEMODULE)))
USEMODULE += vfs
endif
ifneq (,$(filter vfs,$(USEMODULE)))
ifeq (native, $(BOARD))
USEMODULE += native_vfs
endif
endif
ifneq (,$(filter sock_dns,$(USEMODULE)))
USEMODULE += sock_util
endif
ifneq (,$(filter event_%,$(USEMODULE)))
USEMODULE += event
endif
ifneq (,$(filter event_timeout,$(USEMODULE)))
USEMODULE += xtimer
endif
ifneq (,$(filter event,$(USEMODULE)))
USEMODULE += core_thread_flags
endif
ifneq (,$(filter spiffs,$(USEMODULE)))
@ -661,6 +52,7 @@ ifneq (,$(filter spiffs,$(USEMODULE)))
USEMODULE += spiffs_fs
USEMODULE += mtd
endif
ifneq (,$(filter littlefs,$(USEMODULE)))
USEPKG += littlefs
USEMODULE += vfs
@ -668,25 +60,11 @@ ifneq (,$(filter littlefs,$(USEMODULE)))
USEMODULE += mtd
endif
ifneq (,$(filter l2filter_%,$(USEMODULE)))
USEMODULE += l2filter
endif
ifneq (,$(filter gcoap,$(USEMODULE)))
USEMODULE += nanocoap
USEMODULE += gnrc_sock_udp
endif
ifneq (,$(filter luid,$(USEMODULE)))
FEATURES_OPTIONAL += periph_cpuid
endif
ifneq (,$(filter nanocoap_%,$(USEMODULE)))
USEMODULE += nanocoap
endif
ifneq (,$(filter ccn-lite,$(USEPKG)))
USEMODULE += ccn-lite-utils
ifneq (,$(filter littlefs2,$(USEMODULE)))
USEPKG += littlefs2
USEMODULE += vfs
USEMODULE += littlefs2_fs
USEMODULE += mtd
endif
ifneq (,$(filter fatfs_vfs,$(USEMODULE)))
@ -694,57 +72,49 @@ ifneq (,$(filter fatfs_vfs,$(USEMODULE)))
USEMODULE += vfs
endif
ifneq (,$(filter benchmark,$(USEMODULE)))
USEMODULE += xtimer
ifneq (,$(filter nimble_%,$(USEMODULE)))
USEPKG += nimble
endif
ifneq (,$(filter skald_%,$(USEMODULE)))
USEMODULE += skald
ifneq (,$(filter tlsf-malloc,$(USEMODULE)))
USEPKG += tlsf
endif
ifneq (,$(filter skald,$(USEMODULE)))
FEATURES_REQUIRED += radio_ble
USEMODULE += xtimer
USEMODULE += random
endif
ifneq (,$(filter rdcli_simple_standalone,$(USEMODULE)))
USEMODULE += rdcli_simple
USEMODULE += xtimer
endif
ifneq (,$(filter rdcli_simple,$(USEMODULE)))
USEMODULE += rdcli_common
USEMODULE += fmt
endif
ifneq (,$(filter rdcli_common,$(USEMODULE)))
USEMODULE += fmt
USEMODULE += gcoap
USEMODULE += luid
ifneq (,$(filter tinydtls_sock_dtls, $(USEMODULE)))
USEPKG += tinydtls
endif
# always select gpio (until explicit dependencies are sorted out)
FEATURES_OPTIONAL += periph_gpio
# always select power management if available
FEATURES_OPTIONAL += periph_pm
# include package dependencies
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)
# remove required features from optional features
FEATURES_OPTIONAL := $(filter-out $(FEATURES_REQUIRED),$(FEATURES_OPTIONAL))
# add all optional but provided features to the list of used features
FEATURES_USED := $(sort $(FEATURES_REQUIRED) $(filter $(FEATURES_OPTIONAL),$(FEATURES_PROVIDED)))
# all periph features correspond to a periph submodule
USEMODULE += $(filter periph_%,$(FEATURES_USED))
# recursively catch transitive dependencies
USEMODULE := $(sort $(USEMODULE))
USEPKG := $(sort $(USEPKG))
ifneq ($(OLD_USEMODULE) $(OLD_USEPKG),$(USEMODULE) $(USEPKG))
include $(RIOTBASE)/Makefile.dep
# always select power management unless building the bootloader
# pm is not needed by the bootloader and omitting it saves some ROM
ifneq (1, $(RIOTBOOT_BUILD))
FEATURES_OPTIONAL += periph_pm
endif
# always select provided architecture features
FEATURES_REQUIRED += $(filter arch_%,$(FEATURES_PROVIDED))
# always select CPU core features
FEATURES_REQUIRED += $(filter cpu_core_%,$(FEATURES_PROVIDED))
# don't use idle thread if architecture has needed support
FEATURES_OPTIONAL += no_idle_thread
ifneq (,$(filter libstdcpp,$(FEATURES_USED)))
# Also use C++ if libstdc++ is used
USEMODULE += cpp
USEMODULE += libstdcpp
endif
ifneq (,$(filter cpp,$(FEATURES_USED)))
# Also use C++ if libstdc++ is used
USEMODULE += cpp
endif
ifneq (,$(filter test_utils_interactive_sync,$(USEMODULE)))
ifneq (,$(filter shell,$(USEMODULE)))
DEFAULT_MODULE += test_utils_interactive_sync_shell
endif
endif

26
Makefile.features Normal file
View File

@ -0,0 +1,26 @@
# Process provided FEATURES
#
# The board/board common are responsible for defining the CPU and CPU_MODEL
# variables in their Makefile.features.
# This makes them available when setting features based on CPU_MODEL in the cpu
# Makefile.features and also during dependency resolution.
# Transition:
# Moving 'CPU/CPU_MODEL' to Makefile.features is an ongoing work and may not
# reflect the state of all boards for the moment.
include $(BOARDDIR)/Makefile.features
# Sanity check
ifeq (,$(CPU))
$(error CPU must be defined by board / board_common Makefile.features)
endif
include $(RIOTCPU)/$(CPU)/Makefile.features
# Provide CPU as a feature to allow listing all boards with a CPU
FEATURES_PROVIDED += cpu_$(CPU)
# Features that are conflicting for all architectures
FEATURES_CONFLICT += picolibc:newlib
FEATURES_CONFLICT_MSG += "Only one standard C library can be used"

File diff suppressed because it is too large Load Diff

112
README.md
View File

@ -1,5 +1,15 @@
[![Nightly CI status master](https://ci.riot-os.org/RIOT-OS/RIOT/master/latest/badge.svg)](https://ci.riot-os.org/RIOT-OS/RIOT/master/latest/output.html)
[![Nightly CI status master][master-ci-badge]][master-ci-link]
[![Nightly HiL CI overview][hil-ci-badge]][hil-ci-link]
[![GitHub release][release-badge]][release-link]
[![License][license-badge]][license-link]
[![API docs][api-badge]][api-link]
[![Wiki][wiki-badge]][wiki-link]
[![Merge chance][merge-chance-badge]][merge-chance-link]
[![Stack Overflow questions][stackoverflow-badge]][stackoverflow-link]
[![Twitter][twitter-badge]][twitter-link]
[![Matrix][matrix-badge]][matrix-link]
<p align="center"><img src="doc/doxygen/src/riot-logo.svg" width="66%"><!--
ZZZZZZ
ZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZ
@ -24,12 +34,12 @@
ZZZZZZ ZZZZZZ ZZZZZ 777 7777777777 777
ZZZZZZZZZZZZZZZ ZZZZ 777 77777777 777
ZZZZZZZZZZZ Z
ZZZZZ
ZZZZZ --></p>
The friendly Operating System for IoT!
RIOT is a real-time multi-threading operating system that supports a range of
devices that are typically found in the Internet of Things (IoT):
devices that are typically found in the Internet of Things (IoT):
8-bit, 16-bit and 32-bit microcontrollers.
RIOT is based on the following design principles: energy-efficiency, real-time
@ -52,7 +62,8 @@ but not limited to:
* a preemptive, tickless scheduler with priorities
* flexible memory management
* high resolution, long-term timers
* support 100+ boards based on AVR, MSP430, MIPS, ARM7 and ARM Cortex-M
* support 100+ boards based on AVR, MSP430, ESP8266, ESP32, MIPS, RISC-V,
ARM7 and ARM Cortex-M
* the native port allows to run RIOT as-is on Linux, BSD, and MacOS. Multiple
instances of RIOT running on a single machine can also be interconnected via
a simple virtual Ethernet bridge
@ -62,43 +73,60 @@ but not limited to:
* RPL (storing mode, P2P mode)
* CoAP
* CCN-Lite
* Sigfox
* LoRaWAN
## GETTING RIOT
The most convenient way to get RIOT is to clone it via Git
```console
$ git clone https://github.com/RIOT-OS/RIOT
```
this will ensure that you get all the newest features and bug fixes with the
caveat of an ever changing work environment.
If you prefer things more stable, you can download the source code of one of our
quarter annual releases [via Github][releases] as ZIP file or tarball. You can
also checkout a release in a cloned Git repository using
```console
$ git pull --tags
$ git checkout <YYYY.MM>
```
For more details on our release cycle, check our [documentation][release cycle].
[releases]: https://github.com/RIOT-OS/RIOT/releases
[release cycle]: https://doc.riot-os.org/release-cycle.html
## GETTING STARTED
* You want to start the RIOT? Just follow our [quickstart guide](http://doc.riot-os.org/index.html#the-quickest-start) or try this [tutorial](https://github.com/RIOT-OS/Tutorials/blob/master/README.md). For specific toolchain installation, follow instructions in the [getting started](http://doc.riot-os.org/getting-started.html) page.
* You want to start the RIOT? Just follow our
[quickstart guide](https://doc.riot-os.org/index.html#the-quickest-start) or
try this
[tutorial](https://github.com/RIOT-OS/Tutorials/blob/master/README.md).
For specific toolchain installation, follow instructions in the
[getting started](https://doc.riot-os.org/getting-started.html) page.
* The RIOT API itself can be built from the code using doxygen. The latest
version of the documentation is uploaded daily to [riot-os.org/api](http://riot-os.org/api).
version of the documentation is uploaded daily to
[doc.riot-os.org](https://doc.riot-os.org).
### USING THE NATIVE PORT WITH NETWORKING
If you compile RIOT for the native cpu and include the `netdev_tap` module,
you can specify a network interface like this: `PORT=tap0 make term`
## FORUM
Do you have a question, want to discuss a new feature, or just want to present
your latest project using RIOT? Come over to our [forum] and post to your hearts
content.
#### SETTING UP A TAP NETWORK
There is a shell script in `RIOT/dist/tools/tapsetup` called `tapsetup` which
you can use to create a network of tap interfaces.
*USAGE*
To create a bridge and two (or `count` at your option) tap interfaces:
./dist/tools/tapsetup/tapsetup [-c [<count>]]
[forum]: https://forum.riot-os.org
## CONTRIBUTE
To contribute something to RIOT, please refer to the [development
procedures](https://github.com/RIOT-OS/RIOT/wiki/Development-procedures) and
read all notes for best practice.
To contribute something to RIOT, please refer to our
[contributing document](CONTRIBUTING.md).
## MAILING LISTS
* RIOT OS kernel developers list
* devel@riot-os.org (http://lists.riot-os.org/mailman/listinfo/devel)
* RIOT OS users list
* users@riot-os.org (http://lists.riot-os.org/mailman/listinfo/users)
* RIOT commits
* commits@riot-os.org (http://lists.riot-os.org/mailman/listinfo/commits)
* Github notifications
* notifications@riot-os.org
(http://lists.riot-os.org/mailman/listinfo/notifications)
* RIOT commits: [commits@riot-os.org](https://lists.riot-os.org/mailman/listinfo/commits)
* Github notifications: [notifications@riot-os.org](https://lists.riot-os.org/mailman/listinfo/notifications)
## LICENSE
* Most of the code developed by the RIOT community is licensed under the GNU
@ -111,4 +139,26 @@ All code files contain licensing information.
For more information, see the RIOT website:
http://www.riot-os.org
https://www.riot-os.org
[api-badge]: https://img.shields.io/badge/docs-API-informational.svg
[api-link]: https://doc.riot-os.org/
[license-badge]: https://img.shields.io/github/license/RIOT-OS/RIOT
[license-link]: https://github.com/RIOT-OS/RIOT/blob/master/LICENSE
[master-ci-badge]: https://ci.riot-os.org/RIOT-OS/RIOT/master/latest/badge.svg
[master-ci-link]: https://ci.riot-os.org/nightlies.html#master
[matrix-badge]: https://img.shields.io/badge/chat-Matrix-brightgreen.svg
[matrix-link]: https://matrix.to/#/#riot-os:matrix.org
[merge-chance-badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fmerge-chance.info%2Fbadge%3Frepo%3DRIOT-OS/RIOT&color=informational
[merge-chance-link]: https://merge-chance.info/target?repo=RIOT-OS/RIOT
[release-badge]: https://img.shields.io/github/release/RIOT-OS/RIOT.svg
[release-link]: https://github.com/RIOT-OS/RIOT/releases/latest
[stackoverflow-badge]: https://img.shields.io/badge/stackoverflow-%5Briot--os%5D-yellow
[stackoverflow-link]: https://stackoverflow.com/questions/tagged/riot-os
[twitter-badge]: https://img.shields.io/badge/social-Twitter-informational.svg
[twitter-link]: https://twitter.com/RIOT_OS
[wiki-badge]: https://img.shields.io/badge/docs-Wiki-informational.svg
[wiki-link]: https://github.com/RIOT-OS/RIOT/wiki
[hil-ci-link]: https://hil.riot-os.org/results/nightly/latest/overview
[hil-ci-badge]: https://img.shields.io/badge/CI-HiL-blue

31
SECURITY.md Normal file
View File

@ -0,0 +1,31 @@
# RIOT Security Policy
All security bugs reported will be silently fixed in `master` and backported
to the previous release.
## Reporting a Vulnerability
If a security issue is discovered, please report it to security@riot-os.org.
A response will be provided within one week.
The issue will be tracked in the [security mailing list](security@riot-os.org).
The original reporter will be included in the discussion of the issue.
## Notification of a Vulnerability
After a fix is provided the security issue will be privately disclosed to the
original reporter, RIOT security maintainers, and "Trusted RIOT Users".
A public announcement of the security fix will be made two weeks after the
point release, though this may vary depending on the severity and ability of
trusted RIOT users to provide the fix.
## Trusted RIOT Users
To access the "Trusted RIOT Users" notifications on the
[RIOT forum](https://forum.riot-os.org) please send information
on the RIOT based service or product as well as your
[forum](https://forum.riot-os.org) username to the
[security mailing list](mailto:security@riot-os.org).
Early notification of security bugs will be available and should not be shared
publicly.
If done, it will result in access removal from the "Trusted RIOT Users"
notifications.

34
Vagrantfile vendored
View File

@ -5,28 +5,20 @@ require 'fileutils'
RIOTBASE ||= "./"
Vagrant.configure(2) do |config|
# For a complete reference, please see the online documentation at https://docs.vagrantup.com.
Vagrant.configure("2") do |config|
config.vm.define "RIOT-VM"
config.vm.box = "RIOT/ubuntu1804"
config.ssh.username = "user"
config.vm.synced_folder RIOTBASE, "/home/user/RIOT"
config.vm.box = "RIOT/ubuntu1604"
if File.exists?(File.join(Dir.home, ".gitconfig"))
config.vm.provision "file", source: File.join(Dir.home, ".gitconfig"), destination: ".gitconfig"
end
config.vm.provider "virtualbox" do |vb|
vb.name = "RIOT-VM"
config.vm.provider :virtualbox do |v, override|
v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore", 0]
vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-interval", 10000]
vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust", 100]
vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore", 1]
vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
# additional USB passthrough entries
# vb.customize ['usbfilter', 'add', '0', '--target', :id, '--name', '<custom_name>', '--vendorid', '<vID>', '--productid', '<pID>']
end
config.vm.synced_folder RIOTBASE, "/home/vagrant/RIOT"
if File.exists?(File.join(Dir.home, ".gitconfig"))
config.vm.provision "file", source: File.join(Dir.home, ".gitconfig"), destination: ".gitconfig"
end
# use a custom provisioning script
# config.vm.provision "shell", path: "dist/tools/vagrant/bootstrap.sh"
# additional USB passthrough entries
# v.customize ['usbfilter', 'add', '0', '--target', :id, '--name', '<custom_name>', '--vendorid', '<vID>', '--productid', '<pID>']
end
end

View File

@ -0,0 +1,15 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
config BOARD
default "6lowpan-clicker" if BOARD_6LOWPAN_CLICKER
config BOARD_6LOWPAN_CLICKER
bool
default y
select CPU_MODEL_P32MX470F512H
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART

View File

@ -0,0 +1,5 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
USEMODULE += newlib_syscalls_mips_uhi

View File

@ -0,0 +1,6 @@
CPU = mips_pic32mx
CPU_MODEL = p32mx470f512h
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart

View File

@ -0,0 +1,15 @@
# use pic32prog by default to program this board
PROGRAMMER ?= pic32prog
PROGRAMMERS_SUPPORTED += pic32prog
ifeq ($(PROGRAMMER),pic32prog)
# pic32prog
#
# For PICkit3:
#
# * Connect the chipKIT-Wi-Fire to USB
# * Connect the PICkit3 to ICSP holes
# * https://docs.creatordev.io/wifire/guides/wifire-programming/
# * The triangle `▶` goes into the port number 1 (a hole with a square around it)
# opposite side of the JP1 ICSP text.
FLASHFILE ?= $(HEXFILE)
endif

View File

@ -0,0 +1,29 @@
/*
* Copyright(C) 2016,2017, Imagination Technologies Limited and/or its
* affiliated group companies.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
*/
#include "board.h"
#include "periph/gpio.h"
extern void dummy(void);
void board_init(void)
{
/* Turn off all LED's */
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
LED1_OFF;
LED2_OFF;
/* initialize the CPU */
cpu_init();
/* Stop the linker from throwing away the PIC32 config register settings */
dummy();
}

View File

@ -0,0 +1,93 @@
/**
@defgroup boards_6lowpan-clicker MikroE 6LoWPAN Clicker
@ingroup boards
@brief Support for the MikroE 6LoWPAN Clicker
## Overview
The `6lowpan clicker` is an evaluation board by Mikroe featuring a
PIC32MX470F512H, a 6lowpan radio (CA810) by Cascoda and a Mikrobus
socket for expansion boards.
More general information on the board and related documentation can be found
[here](https://www.mikroe.com/clicker-6lowpan). Schematics for the board can be
found in the [manual](https://download.mikroe.com/documents/starter-boards/clicker/6lowpan/6lowpan-clicker-manual-v100.pdf).
## Hardware
### MCU
| MCU | PIC32MX470F512H |
|:---------- |:-------------------- |
| Family | PIC32MX (MIPS M4K) |
| Vendor | Microchip |
| RAM | 128KiB |
| Flash | 512KiB |
| Frequency | 120MHz |
| FPU | no |
| Timers | 5 (all 16-bit) |
| ADCs | 1x 28-channel 10-bit |
| USB 2.0 | 1 |
| UARTs | 4 |
| SPIs | 2 |
| I2Cs | 2 |
| RTC | yes |
| RNG | no |
| Vcc | 2.3V - 3.6V |
| Datasheet | [Datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/PIC32MX330350370430450470_Datasheet_DS60001185H.pdf) |
### User Interface
2 Buttons:
| NAME | T1 | T2 |
|:----- |:--- |:--- |
| Pin | RE7 | RB0 |
2 LEDs:
| NAME | LD1 | LD2 |
| ----- | --- | --- |
| Color | red | red |
| Pin | RB1 | RB2 |
## Implementation Status
| Device | ID | Supported | Comments |
|:---------------- |:--------------- |:--------- |:---------------------- |
| MCU | pic32mx470f512h | partly | |
| Low-level driver | GPIO | partly | gpio_irq not supported |
| | ADC | no | |
| | PWM | no | |
| | UART | yes | |
| | I2C | no | |
| | SPI | no | |
| | USB | no | |
| | RTT | no | |
| | RTC | no | |
| | Timer | no | |
## Using UART
This board doesn't open an UART or serial interface through the USB
automatically, and the USB device driver hasn't been implemented to RIOT.
Therefore, to open an UART interface one has to connect a usb/ttl converter to
the UART3 pins RF5 (RX) and RF4 (TX) available on the Mikrobus socket.
## Flashing the device
There are two ways to flash the MCU:
* Using MPLAB-IPE and a PICkit 3 (The RIOT build generates a hexfile
compatible with MPLAB-IPE)
* Using pic32prog and a PICkit 2 or a PICkit 3 (other devices might be
supported by pic32prog but were not tested). This is the preferred option
as it makes possible to flash the device using `make flash` command.
## Supported Toolchains
For using the 6lowpan-clicker board we strongly recommend the usage of the
[Codescape GNU Tools](https://codescape.mips.com) toolchain.
*/

View File

@ -0,0 +1,82 @@
/*
* Copyright(C) 2016,2017, Imagination Technologies Limited and/or its
* affiliated group companies.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
*/
/**
* @ingroup boards_6lowpan-clicker
* @details
* see:
* https://www.mikroe.com/clicker-6lowpan
* For more information on the board.
*
* @{
*
* @file
* @brief board configuration for the MikroE 6LoWPAN Clicker
*
* @author Neil Jones <Neil.Jones@imgtec.com>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "periph_conf.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Set how many increments of the count register per uS
* needed by the timer code.
*/
#define TICKS_PER_US (48)
/**
* @name LED pin configuration
* @{
*/
#define LED1_PIN GPIO_PIN(PORT_B, 1)
#define LED2_PIN GPIO_PIN(PORT_B, 2)
#define LED1_MASK (1 << 1)
#define LED2_MASK (1 << 2)
#define LED1_ON (LATBSET = LED1_MASK)
#define LED1_OFF (LATBCLR = LED1_MASK)
#define LED1_TOGGLE (LATBINV = LED1_MASK)
#define LED2_ON (LATBSET = LED2_MASK)
#define LED2_OFF (LATBCLR = LED2_MASK)
#define LED2_TOGGLE (LATBINV = LED2_MASK)
/** @} */
/**
* @name Button pin configuration
* @{
*/
#define BTN0_PIN GPIO_PIN(PORT_E, 7)
#define BTN0_MODE GPIO_IN
#define BTN1_PIN GPIO_PIN(PORT_B, 0)
#define BTN1_MODE GPIO_IN
/** @} */
/**
* @brief Board level initialization
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,61 @@
/*
* Copyright (C) 2020 Francois Berder
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_6lowpan-clicker
* @{
*
* @file
* @brief Configuration of SAUL mapped GPIO pins
*
* @author Francois Berder <fberder@outlook.fr>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief GPIO configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LD1",
.pin = LED1_PIN,
.mode = GPIO_OUT,
},
{
.name = "LD2",
.pin = LED2_PIN,
.mode = GPIO_OUT,
},
{
.name = "T1",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
},
{
.name = "T2",
.pin = BTN1_PIN,
.mode = BTN1_MODE,
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,82 @@
/*
* Copyright(C) 2016,2017, Imagination Technologies Limited and/or its
* affiliated group companies.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
*/
/**
* @ingroup boards_6lowpan-clicker
* @{
*
* @file
* @brief peripheral configuration for the MikroE 6LoWPAN Clicker
*
* @author Neil Jones <Neil.Jones@imgtec.com>
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include "cpu.h"
#include "macros/units.h"
#include "periph_cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Clock configurations
* @{
*/
/**
* @brief The peripheral clock is required for the UART Baud rate calculation
* It is configured by the 'config' registers (see pic32_config_settings.c)
* Note 120MHz is the max F for this device.
*/
#define PERIPHERAL_CLOCK MHZ(96)
#define CLOCK_CORECLOCK MHZ(120)
/** @} */
/**
* @name Timer definitions
* @{
*/
#define TIMER_NUMOF (1)
#define TIMER_0_CHANNELS (3)
/** @} */
/**
* @name UART Definitions
* @{
*/
static const uart_conf_t uart_config[] = {
{ /* UART port available on MikroBus */
.base = (volatile unsigned int *)_UART3_BASE_ADDRESS,
.clock = PERIPHERAL_CLOCK,
.rx_pin = GPIO_PIN(PORT_F, 5),
.tx_pin = GPIO_PIN(PORT_F, 4),
.rx_mux_reg = &U3RXR,
.tx_mux_reg = &RPF4R,
.rx_af = GPIO_AF2,
.tx_af = GPIO_AF1,
.vector = _UART_3_VECTOR,
.irq = _UART3_RX_IRQ,
},
};
#define UART_0_ISR (isr_usart3)
#define UART_NUMOF ((unsigned int)ARRAY_SIZE(uart_config))
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H */
/** @} */

View File

@ -31,8 +31,6 @@ volatile uint32_t _DEVCFG3 __attribute__((used, section(".devcfg3"))) =
| (_DEVCFG3_FUSBIDIO_MASK & 0 << _DEVCFG3_FUSBIDIO_POSITION)
| (_DEVCFG3_FVBUSONIO_MASK & 1 << _DEVCFG3_FVBUSONIO_POSITION);
/* Note this sets the PLL to 96MHz (8/2 * 24) which is only supported by 3xx
* and 4xx parts and assumes an 8MHz XTAL.
*
@ -86,7 +84,6 @@ volatile uint32_t _DEVCFG1 __attribute__ ((used, section(".devcfg1"))) =
& (~_DEVCFG1_FWDTEN_MASK | 0 << _DEVCFG1_FWDTEN_POSITION)
& (~_DEVCFG1_FWDTWINSZ_MASK | 3 << _DEVCFG1_FWDTWINSZ_POSITION);
/*
* DEVCFG0 @ 0x1FC02FFC
*

17
boards/Kconfig Normal file
View File

@ -0,0 +1,17 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config BOARD
string
help
Name of the currently selected board.
config MODULE_BOARD
bool
default y
depends on TEST_KCONFIG
help
Module which holds all board-specific files.

19
boards/acd52832/Kconfig Normal file
View File

@ -0,0 +1,19 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
config BOARD
default "acd52832" if BOARD_ACD52832
config BOARD_ACD52832
bool
default y
select BOARD_COMMON_NRF52
select CPU_MODEL_NRF52832XXAA
select HAS_PERIPH_I2C
select HAS_PERIPH_SPI
select HAS_PERIPH_UART
source "$(RIOTBOARD)/common/nrf52/Kconfig"

View File

@ -1 +1,8 @@
include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.features
CPU_MODEL = nrf52832xxaa
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_uart
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -1,7 +1,4 @@
# define the cpu used by the acd52832
export CPU_MODEL = nrf52832xxaa
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.include
include $(RIOTBOARD)/common/nrf52/Makefile.include

10
boards/acd52832/doc.txt Normal file
View File

@ -0,0 +1,10 @@
/**
@defgroup boards_acd52832 ACD52832
@ingroup boards
@brief Support for the aconno™ ACD52832
## Flash the board
See the `Flashing` section in @ref boards_common_nrf52.
*/

View File

@ -7,9 +7,7 @@
*/
/**
* @defgroup boards_acd52832 ACD52832
* @ingroup boards
* @brief Support for the aconno ACD52832
* @ingroup boards_acd52832
*
* For more information: http://aconno.de/acd52832/
*

View File

@ -46,7 +46,6 @@ static const saul_gpio_params_t saul_gpio_params[] =
}
};
#ifdef __cplusplus
}
#endif

View File

@ -23,6 +23,9 @@
#define PERIPH_CONF_H
#include "periph_cpu.h"
#include "cfg_clock_32_1.h"
#include "cfg_rtt_default.h"
#include "cfg_timer_default.h"
#ifdef __cplusplus
extern "C" {
@ -31,44 +34,9 @@ extern "C" {
/**
* @name Clock configuration
*
* @note The radio will not work with the internal RC oscillator!
*
* @{
*/
#define CLOCK_CORECLOCK (64000000U) /* fixed for all nRF52832 */
#define CLOCK_HFCLK (32U) /* set to 0: internal RC oscillator
* 32: 32MHz crystal */
#define CLOCK_LFCLK (1) /* set to 0: internal RC oscillator
* 1: 32.768 kHz crystal
* 2: derived from HFCLK */
/** @} */
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_config[] = {
{
.dev = NRF_TIMER1,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_32Bit,
.irqn = TIMER1_IRQn
}
};
#define TIMER_0_ISR isr_timer1
#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
/** @} */
/**
* @name Real time counter configuration
* @{
*/
#define RTT_NUMOF (1U)
#define RTT_DEV (1) /* NRF_RTC1 */
#define RTT_MAX_VALUE (0x00ffffff)
#define RTT_FREQUENCY (1024)
/** @} */
/**
@ -86,14 +54,15 @@ static const timer_conf_t timer_config[] = {
*/
static const spi_conf_t spi_config[] = {
{
.dev = NRF_SPI0,
.dev = NRF_SPIM0,
.sclk = 4,
.mosi = 3,
.miso = 13
.miso = 13,
.ppi = 0
}
};
#define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */
/**
@ -104,11 +73,12 @@ static const i2c_conf_t i2c_config[] = {
{
.dev = NRF_TWIM1,
.scl = 28,
.sda = 29
.sda = 29,
.speed = I2C_SPEED_NORMAL
}
};
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
#ifdef __cplusplus
@ -116,3 +86,4 @@ static const i2c_conf_t i2c_config[] = {
#endif
#endif /* PERIPH_CONF_H */
/** @} */

View File

@ -0,0 +1,21 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
config BOARD
default "adafruit-clue" if BOARD_ADAFRUIT_CLUE
config BOARD_ADAFRUIT_CLUE
bool
default y
select BOARD_COMMON_NRF52
select CPU_MODEL_NRF52840XXAA
select HAS_PERIPH_I2C
select HAS_PERIPH_SPI
select HAS_PERIPH_UART
select HAS_PERIPH_USBDEV
select HAS_HIGHLEVEL_STDIO
source "$(RIOTBOARD)/common/nrf52/Kconfig"

View File

@ -0,0 +1,14 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
USEMODULE += apds9960
USEMODULE += bmp280_i2c
USEMODULE += lis3mdl
USEMODULE += sht3x
endif
ifneq (,$(filter disp_dev,$(USEMODULE)))
USEMODULE += ili9341
endif
include $(RIOTBOARD)/common/nrf52/bootloader_nrfutil.dep.mk
include $(RIOTBOARD)/common/nrf52/Makefile.dep

View File

@ -0,0 +1,12 @@
CPU_MODEL = nrf52840xxaa
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev
# Various other features (if any)
FEATURES_PROVIDED += highlevel_stdio
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -0,0 +1,25 @@
# Adafruit-nrfutil is the default programmer
PROGRAMMER ?= adafruit-nrfutil
include $(RIOTBOARD)/common/nrf52/Makefile.include
PROGRAMMERS_SUPPORTED += adafruit-nrfutil
ifeq ($(PROGRAMMER),adafruit-nrfutil)
# The preinstalled bootloader must also be taken into account so
# ROM_OFFSET skips the space taken by such bootloader.
ROM_OFFSET = 0x26000
ifneq (,$(filter reset flash flash-only, $(MAKECMDGOALS)))
# Add 2 seconds delay before opening terminal: this is required when opening
# the terminal right after flashing. In this case, the stdio over USB needs
# some time after reset before being ready.
TERM_DELAY = 2
TERMDEPS += term-delay
endif
endif
term-delay:
sleep $(TERM_DELAY)
TESTRUNNER_CONNECT_DELAY ?= $(TERM_DELAY)
$(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY)

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2020 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-clue
* @{
*
* @file
* @brief Board initialization for the Adafruit Clue
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/
#include "cpu.h"
#include "board.h"
#include "periph/gpio.h"
void board_init(void)
{
/* initialize the CPU */
cpu_init();
/* initialize the boards LEDs */
gpio_init(LED0_PIN, GPIO_OUT); /* Red LED */
/* initialize the screen backlight, turn it off by default */
gpio_init(BACKLIGHT_PIN, GPIO_OUT);
gpio_clear(BACKLIGHT_PIN);
}

View File

@ -0,0 +1,45 @@
/**
@defgroup boards_adafruit-clue Adafruit Clue
@ingroup boards
@brief Support for the Adafruit Clue
### General information
The [Adafruit Clue](https://www.adafruit.com/clue) board
is an opensource, micro development kit using the nRF52840 SoC.
This board provides 802.15.4 and BLE connectivity.
<img src="https://raw.githubusercontent.com/adafruit/Adafruit-CLUE-PCB/master/assets/4500.jpg"
alt="Adafruit Clue" style="height:800px;"/>
### Schematics
The board detailed description and schematic is available
[here](https://github.com/adafruit/Adafruit-CLUE-PCB).
### Flash the board
The board is flashed using the `adafruit-nrfutil` Python package:
```
$ pip install --user adafruit-nrfutil
```
Example with `hello-world` application:
```
make BOARD=adafruit-clue -C examples/hello-world flash
```
### Accessing STDIO via UART
The STDIO is directly accessible via the USB port. On a Linux host, it's
generally mapped to `/dev/ttyACM0`.
Use the `term` target to connect to the board serial port<br/>
```
make BOARD=adafruit-clue -C examples/hello-world term
```
The `TERM_DELAY` environment variable can be used to add a delay (in second)
before opening the serial terminal. The default value is 2s which should be
enough in most of the situations.
*/

View File

@ -0,0 +1,118 @@
/*
* Copyright (C) 2020 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-clue
* @{
*
* @file
* @brief Board specific configuration for the Adafruit Clue board
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LEDs pin configuration
* @{
*/
#define LED0_PIN GPIO_PIN(1, 1) /**< LED0 pin */
#define LED0_MASK (1 << 1) /**< LED0 mask */
#define LED0_ON (NRF_P1->OUTSET = LED0_MASK) /**< Turn LED0 on */
#define LED0_OFF (NRF_P1->OUTCLR = LED0_MASK) /**< Turn LED0 off */
#define LED0_TOGGLE (NRF_P1->OUT ^= LED0_MASK) /**< Toggle LED0 */
/** @} */
/**
* @name Buttons pin configuration
* @{
*/
#define BTN0_PIN GPIO_PIN(1, 2) /**< Button A pin */
#define BTN0_MODE GPIO_IN_PU /**< Button A mode */
#define BTN1_PIN GPIO_PIN(1, 10) /**< Button B pin */
#define BTN1_MODE GPIO_IN_PU /**< Button B mode */
/** @} */
/**
* @name APDS9960 sensor configuration
* @{
*/
#define APDS99XX_PARAM_DEV I2C_DEV(1) /**< I2C device */
#define APDS99XX_PARAM_INT_PIN GPIO_PIN(0, 9) /**< Interrupt pin */
/** @} */
/**
* @name BMP280 sensor configuration
* @{
*/
#define BMX280_PARAM_I2C_DEV I2C_DEV(1) /**< I2C device */
/** @} */
/**
* @name LIS3MDL 3-axis magnetometer
* @{
*/
#define LIS3MDL_PARAM_I2C I2C_DEV(1) /**< I2C device */
#define LIS3MDL_PARAM_ADDR (0x1C) /**< I2C address */
/** @} */
/**
* @name STH31 temperature and humidity sensor
* @{
*/
#define SHT3X_PARAM_I2C_DEV I2C_DEV(1) /**< I2C device */
#define SHT3X_PARAM_I2C_ADDR (SHT3X_I2C_ADDR_1) /**< I2C address */
/** @} */
/**
* @name Speaker pin
* @{
*/
#define SPKR_PIN GPIO_PIN(1, 0) /**< Speaker pin */
/** @} */
/**
* @name Backlight control defines, default uses LCD_BACKLIGHT_LOW values
* @{
*/
#define BACKLIGHT_PIN GPIO_PIN(1, 5) /**< Backlight pin */
#define BACKLIGHT_MASK (1 << 5) /**< Backlight pin mask */
#define BACKLIGHT_ON (NRF_P1->OUTSET = BACKLIGHT_MASK) /**< Turn backlight on */
#define BACKLIGHT_OFF (NRF_P1->OUTCLR = BACKLIGHT_MASK) /**< Turn backlight off */
/** @ */
/**
* @name Display configuration
* @{
*/
#define ILI9341_PARAM_SPI SPI_DEV(1) /**< SPI device */
#define ILI9341_PARAM_CS GPIO_PIN(0, 12) /**< Chip select pin */
#define ILI9341_PARAM_DCX GPIO_PIN(0, 13) /**< DCX pin */
#define ILI9341_PARAM_RST GPIO_PIN(1, 3) /**< Reset pin */
#define ILI9341_PARAM_NUM_LINES (240U) /**< Number of screen lines */
#define ILI9341_PARAM_RGB (1) /**< RGB configuration */
#define ILI9341_PARAM_INVERTED (1) /**< Inversion configuration */
#define ILI9341_PARAM_ROTATION (ILI9341_ROTATION_HORZ_FLIP) /**< Rotation mode */
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,58 @@
/*
* Copyright (C) 2020 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-clue
* @{
*
* @file
* @brief Configuration of SAUL mapped GPIO pins
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LED configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED0 (Red)",
.pin = LED0_PIN,
.mode = GPIO_OUT,
},
{
.name = "Button A",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED,
},
{
.name = "Button B",
.pin = BTN1_PIN,
.mode = BTN1_MODE,
.flags = SAUL_GPIO_INVERTED,
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,123 @@
/*
* Copyright (C) 2020 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-clue
* @{
*
* @file
* @brief Peripheral configuration for the Adafruit Clue board
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include "periph_cpu.h"
#include "cfg_clock_32_1.h"
#include "cfg_rtt_default.h"
#include "cfg_timer_default.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name UART configuration
* @{
*/
/**
* @brief UART configuration.
*/
static const uart_conf_t uart_config[] = {
{
.dev = NRF_UARTE0,
.rx_pin = GPIO_PIN(0, 4),
.tx_pin = GPIO_PIN(0, 5),
#ifdef MODULE_PERIPH_UART_HW_FC
.rts_pin = GPIO_UNDEF,
.cts_pin = GPIO_UNDEF,
#endif
.irqn = UARTE0_UART0_IRQn,
},
};
/**
* @brief UART 0 Interrupt Service Routine.
*/
#define UART_0_ISR (isr_uart0)
/**
* @brief Number of UART peripherals.
*/
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @name I2C configuration
* @{
*/
/**
* @brief I2C configuration.
*/
static const i2c_conf_t i2c_config[] = {
{ /* External connectors */
.dev = NRF_TWIM0,
.scl = GPIO_PIN(0, 0), /* D19 */
.sda = GPIO_PIN(0, 30), /* D20 */
.speed = I2C_SPEED_NORMAL
},
{ /* On board sensors */
.dev = NRF_TWIM1,
.scl = GPIO_PIN(0, 25),
.sda = GPIO_PIN(0, 24),
.speed = I2C_SPEED_NORMAL
},
};
/**
* @brief Number of I2C peripherals.
*/
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
/** @} */
/**
* @name SPI configuration
* @{
*/
/**
* @brief SPI configuration.
*/
static const spi_conf_t spi_config[] = {
{ /* External connectors */
.dev = NRF_SPIM0,
.sclk = GPIO_PIN(0, 23), /* D13 */
.mosi = GPIO_PIN(0, 21), /* D15 */
.miso = GPIO_PIN(0, 22), /* D14 */
},
{ /* TFT LCD screen */
.dev = NRF_SPIM1,
.sclk = GPIO_PIN(0, 14),
.mosi = GPIO_PIN(0, 15),
.miso = GPIO_PIN(0, 0),
},
};
/**
* @brief Number of SPI peripherals.
*/
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H */
/** @} */

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2020 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-clue
* @{
* @file
* @brief Implementation for managing the nrfutil bootloader
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/
#ifdef MODULE_USB_BOARD_RESET
#define USB_H_USER_IS_RIOT_INTERNAL
#include "cpu.h"
#include "usb_board_reset.h"
/* Set the value used by the bootloader to select between boot in
application and boot in bootloader mode. */
#define NRF52_DOUBLE_TAP_MAGIC_NUMBER (0x4e)
void usb_board_reset_in_bootloader(void)
{
NRF_POWER->GPREGRET = NRF52_DOUBLE_TAP_MAGIC_NUMBER;
usb_board_reset_in_application();
}
#endif /* MODULE_USB_BOARD_RESET */

View File

@ -0,0 +1,24 @@
# Copyright (c) 2021 ML!PA Consulting GmbH
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
config BOARD
default "adafruit-itsybitsy-m4" if BOARD_ADAFRUIT_ITSYBITSY_M4
config BOARD_ADAFRUIT_ITSYBITSY_M4
bool
default y
select CPU_MODEL_SAMD51G19A
select HAS_HIGHLEVEL_STDIO
select HAS_PERIPH_DAC
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_RTC
select HAS_PERIPH_RTT
select HAS_PERIPH_PWM
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_PERIPH_USBDEV

View File

@ -0,0 +1,5 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/samdx1-arduino-bootloader
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,11 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
ifneq (,$(filter mtd,$(USEMODULE)))
FEATURES_REQUIRED += periph_spi_on_qspi
USEMODULE += mtd_spi_nor
endif
# setup the samd21 arduino bootloader related dependencies
include $(RIOTBOARD)/common/samdx1-arduino-bootloader/Makefile.dep

View File

@ -0,0 +1,15 @@
CPU = samd5x
CPU_MODEL = samd51g19a
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += highlevel_stdio
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dac
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev

View File

@ -0,0 +1,6 @@
CFLAGS += -DBOOTLOADER_UF2
# Include all definitions for flashing with bossa other USB
include $(RIOTBOARD)/common/samdx1-arduino-bootloader/Makefile.include
# Include handling of serial and non-bossa programmers (if selected by user)
include $(RIOTMAKE)/boards/sam0.inc.mk

View File

@ -0,0 +1,66 @@
/*
* Copyright (C) 2021 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-m4
* @{
*
* @file
* @brief Board specific implementations for the Adafruit ItsyBitsy M4
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
* @}
*/
#include "board.h"
#include "periph/gpio.h"
#include "mtd_spi_nor.h"
#include "timex.h"
#ifdef MODULE_MTD
/* GD25x16 */
static const mtd_spi_nor_params_t _samd51_nor_params = {
.opcode = &mtd_spi_nor_opcode_default,
.wait_chip_erase = 15 * US_PER_SEC,
.wait_32k_erase = 150 * US_PER_MS,
.wait_64k_erase = 250 * US_PER_MS,
.wait_sector_erase = 50 * US_PER_MS,
.wait_chip_wake_up = 1 * US_PER_MS,
.clk = MHZ(54),
.flag = SPI_NOR_F_SECT_4K
| SPI_NOR_F_SECT_32K
| SPI_NOR_F_SECT_64K,
.spi = SPI_DEV(1),
.mode = SPI_MODE_0,
.cs = SAM0_QSPI_PIN_CS,
.wp = SAM0_QSPI_PIN_DATA_2,
.hold = SAM0_QSPI_PIN_DATA_3,
.addr_width = 3,
};
static mtd_spi_nor_t samd51_nor_dev = {
.base = {
.driver = &mtd_spi_nor_driver,
.page_size = 256,
.pages_per_sector = 16,
},
.params = &_samd51_nor_params,
};
mtd_dev_t *mtd0 = (mtd_dev_t *)&samd51_nor_dev;
#endif /* MODULE_MTD */
void board_init(void)
{
/* initialize the on-board LED */
gpio_init(LED0_PIN, GPIO_OUT);
LED0_OFF;
/* initialize the CPU */
cpu_init();
}

View File

@ -0,0 +1,37 @@
/**
@defgroup boards_adafruit-itsybitsy-m4 Adafruit-Itsybitsy-M4
@ingroup boards
@brief Support for the Adafruit-Itsybitsy-M4
### General information
![Adafruit-Itsybitsy-M4 compared to a quarter dollar](https://cdn-learn.adafruit.com/assets/assets/000/055/465/large1024/adafruit_products_3800_quarter_ORIG_2018_06.jpg?1529192175)
This is a small formfactor (only 1.4" long by 0.7" wide) SAM D51 board made by Adafruit.
The board features one red LED (LD1), one DotStar / APA102 RGB LED, a reset button as well as
21 configurable external pins(6 of which can be analog in).
### Links
- [Overview](https://learn.adafruit.com/introducing-adafruit-itsybitsy-m4?view=all)
- [Schematics](https://learn.adafruit.com/assets/55481)
### Flash the board
The board is flashed using its on-board [boot loader](https://github.com/adafruit/uf2-samdx1).
The process is automated in the usual `make flash` target.
If RIOT is already running on the board, it will automatically reset the CPU and enter
the bootloader.
If some other firmware is running or RIOT crashed, you need to enter the bootloader
manually by double tapping the board's reset button.
Readiness of the bootloader is indicated by LD1 pulsing in red.
### Accessing STDIO
The usual way to obtain a console on this board is using an emulated USB serial port.
*/

View File

@ -0,0 +1,78 @@
/*
* Copyright (C) 2021 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-m4
* @{
*
* @file
* @brief Board specific definitions for the Adafruit ItsyBitsy M4
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "mtd.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PA, 22)
#define LED_PORT PORT->Group[PA]
#define LED0_MASK (1 << 22)
#define LED0_ON (LED_PORT.OUTSET.reg = LED0_MASK)
#define LED0_OFF (LED_PORT.OUTCLR.reg = LED0_MASK)
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
/** @} */
/**
* @name APA102 / DotStar configuration
* @{
*/
#define APA102_PARAM_LED_NUMOF (1)
#define APA102_PARAM_DATA_PIN GPIO_PIN(PB, 3)
#define APA102_PARAM_CLK_PIN GPIO_PIN(PB, 2)
/** @} */
/**
* @name MTD configuration
* @{
*/
extern mtd_dev_t *mtd0;
#define MTD_0 mtd0
/** @} */
/**
* @name Xtimer configuration
* @{
*/
#define XTIMER_WIDTH (32)
#define XTIMER_HZ (1000000ul)
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,46 @@
/*
* Copyright (C) 2021 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-m4
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief GPIO pin configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED(red)",
.pin = LED0_PIN,
.mode = GPIO_OUT,
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,273 @@
/*
* Copyright (C) 2021 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-m4
* @{
*
* @file
* @brief Configuration of CPU peripherals for the Adafruit ItsyBitsy M4
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include "periph_cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name desired core clock frequency
* @{
*/
#ifndef CLOCK_CORECLOCK
#define CLOCK_CORECLOCK MHZ(120)
#endif
/** @} */
/**
* @name 32kHz Oscillator configuration
* @{
*/
#define EXTERNAL_OSC32_SOURCE 0
#define ULTRA_LOW_POWER_INTERNAL_OSC_SOURCE 1
/** @} */
/**
* @brief Enable the internal DC/DC converter
* The board is equipped with the necessary inductor.
*/
#define USE_VREG_BUCK (1)
/**
* @name Timer peripheral configuration
* @{
*/
static const tc32_conf_t timer_config[] = {
{ /* Timer 0 - System Clock */
.dev = TC0,
.irq = TC0_IRQn,
.mclk = &MCLK->APBAMASK.reg,
.mclk_mask = MCLK_APBAMASK_TC0 | MCLK_APBAMASK_TC1,
.gclk_id = TC0_GCLK_ID,
.gclk_src = SAM0_GCLK_TIMER,
.flags = TC_CTRLA_MODE_COUNT32,
},
{ /* Timer 1 */
.dev = TC2,
.irq = TC2_IRQn,
.mclk = &MCLK->APBBMASK.reg,
.mclk_mask = MCLK_APBBMASK_TC2 | MCLK_APBBMASK_TC3,
.gclk_id = TC2_GCLK_ID,
.gclk_src = SAM0_GCLK_TIMER,
.flags = TC_CTRLA_MODE_COUNT32,
}
};
/* Timer 0 configuration */
#define TIMER_0_CHANNELS 2
#define TIMER_0_ISR isr_tc0
/* Timer 1 configuration */
#define TIMER_1_CHANNELS 2
#define TIMER_1_ISR isr_tc2
#define TIMER_NUMOF ARRAY_SIZE(timer_config)
/** @} */
/**
* @name UART configuration
* @{
*/
static const uart_conf_t uart_config[] = {
{
.dev = &SERCOM3->USART,
.rx_pin = GPIO_PIN(PA, 16),
.tx_pin = GPIO_PIN(PA, 17),
#ifdef MODULE_PERIPH_UART_HW_FC
.rts_pin = GPIO_UNDEF,
.cts_pin = GPIO_UNDEF,
#endif
.mux = GPIO_MUX_D,
.rx_pad = UART_PAD_RX_1,
.tx_pad = UART_PAD_TX_0,
.flags = UART_FLAG_NONE,
.gclk_src = SAM0_GCLK_PERIPH,
},
};
/* interrupt function name mapping */
#define UART_0_ISR isr_sercom3_2
#define UART_0_ISR_TX isr_sercom3_0
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @name PWM configuration
* @{
*/
#define PWM_0_EN 1
#if PWM_0_EN
/* PWM0 channels */
static const pwm_conf_chan_t pwm_chan0_config[] = {
/* GPIO pin, MUX value, TCC channel */
{ GPIO_PIN(PA, 22), GPIO_MUX_G, 2 },
};
#endif
/* PWM device configuration */
static const pwm_conf_t pwm_config[] = {
#if PWM_0_EN
{ .tim = TCC_CONFIG(TCC0),
.chan = pwm_chan0_config,
.chan_numof = ARRAY_SIZE(pwm_chan0_config),
.gclk_src = SAM0_GCLK_PERIPH,
},
#endif
};
/* number of devices that are actually defined */
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
/** @} */
/**
* @name SPI configuration
* @{
*/
static const spi_conf_t spi_config[] = {
{
.dev = &(SERCOM1->SPI),
.miso_pin = GPIO_PIN(PB, 23),
.mosi_pin = GPIO_PIN(PA, 0),
.clk_pin = GPIO_PIN(PA, 1),
.miso_mux = GPIO_MUX_C,
.mosi_mux = GPIO_MUX_D,
.clk_mux = GPIO_MUX_D,
.miso_pad = SPI_PAD_MISO_3,
.mosi_pad = SPI_PAD_MOSI_0_SCK_1,
.gclk_src = SAM0_GCLK_PERIPH,
#ifdef MODULE_PERIPH_DMA
.tx_trigger = SERCOM1_DMAC_ID_TX,
.rx_trigger = SERCOM1_DMAC_ID_RX,
#endif
},
#ifdef MODULE_PERIPH_SPI_ON_QSPI
{ /* QSPI in SPI mode */
.dev = QSPI,
.miso_pin = SAM0_QSPI_PIN_DATA_1,
.mosi_pin = SAM0_QSPI_PIN_DATA_0,
.clk_pin = SAM0_QSPI_PIN_CLK,
.miso_mux = SAM0_QSPI_MUX,
.mosi_mux = SAM0_QSPI_MUX,
.clk_mux = SAM0_QSPI_MUX,
.miso_pad = SPI_PAD_MISO_0, /* unused */
.mosi_pad = SPI_PAD_MOSI_0_SCK_1, /* unused */
.gclk_src = SAM0_GCLK_MAIN, /* unused */
#ifdef MODULE_PERIPH_DMA
.tx_trigger = QSPI_DMAC_ID_TX,
.rx_trigger = QSPI_DMAC_ID_RX,
#endif
},
#endif
};
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */
/**
* @name I2C configuration
* @{
*/
static const i2c_conf_t i2c_config[] = {
{
.dev = &(SERCOM2->I2CM),
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PA, 12),
.sda_pin = GPIO_PIN(PA, 13),
.mux = GPIO_MUX_C,
.gclk_src = SAM0_GCLK_PERIPH,
.flags = I2C_FLAG_NONE
},
};
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
/**
* @name RTT configuration
* @{
*/
#ifndef RTT_FREQUENCY
#define RTT_FREQUENCY (32768U)
#endif
/** @} */
/**
* @name USB peripheral configuration
* @{
*/
static const sam0_common_usb_config_t sam_usbdev_config[] = {
{
.dm = GPIO_PIN(PA, 24),
.dp = GPIO_PIN(PA, 25),
.d_mux = GPIO_MUX_H,
.device = &USB->DEVICE,
.gclk_src = SAM0_GCLK_PERIPH,
}
};
/** @} */
/**
* @name ADC Configuration
* @{
*/
/* ADC Default values */
#define ADC_PRESCALER ADC_CTRLA_PRESCALER_DIV128
#define ADC_NEG_INPUT ADC_INPUTCTRL_MUXNEG(0x18u)
#define ADC_REF_DEFAULT ADC_REFCTRL_REFSEL_INTVCC1
#define ADC_DEV ADC0
static const adc_conf_chan_t adc_channels[] = {
/* port, pin, muxpos */
{GPIO_PIN(PA, 2), ADC_INPUTCTRL_MUXPOS(ADC_INPUTCTRL_MUXPOS_AIN0)},
{GPIO_PIN(PA, 5), ADC_INPUTCTRL_MUXPOS(ADC_INPUTCTRL_MUXPOS_AIN5)},
{GPIO_PIN(PB, 8), ADC_INPUTCTRL_MUXPOS(ADC_INPUTCTRL_MUXPOS_AIN2)},
{GPIO_PIN(PB, 9), ADC_INPUTCTRL_MUXPOS(ADC_INPUTCTRL_MUXPOS_AIN3)},
{GPIO_PIN(PA, 4), ADC_INPUTCTRL_MUXPOS(ADC_INPUTCTRL_MUXPOS_AIN4)},
{GPIO_PIN(PA, 6), ADC_INPUTCTRL_MUXPOS(ADC_INPUTCTRL_MUXPOS_AIN6)},
};
#define ADC_NUMOF ARRAY_SIZE(adc_channels)
/** @} */
/**
* @name DAC configuration
* @{
*/
/* Must not exceed 12 MHz */
#define DAC_CLOCK SAM0_GCLK_TIMER
/* Use external reference voltage on PA03 */
/* (You have to manually connect PA03 with Vcc) */
/* Internal reference only gives 1V */
#define DAC_VREF DAC_CTRLB_REFSEL_VREFPU
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H */
/** @} */

View File

@ -0,0 +1,21 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
config BOARD
default "adafruit-itsybitsy-nrf52" if BOARD_ADAFRUIT_ITSYBITSY_NRF52
config BOARD_ADAFRUIT_ITSYBITSY_NRF52
bool
default y
select BOARD_COMMON_NRF52
select CPU_MODEL_NRF52840XXAA
select HAS_PERIPH_I2C
select HAS_PERIPH_SPI
select HAS_PERIPH_UART
select HAS_PERIPH_USBDEV
select HAS_HIGHLEVEL_STDIO
source "$(RIOTBOARD)/common/nrf52/Kconfig"

View File

@ -0,0 +1,6 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
include $(RIOTBOARD)/common/nrf52/bootloader_nrfutil.dep.mk
include $(RIOTBOARD)/common/nrf52/Makefile.dep

View File

@ -0,0 +1,12 @@
CPU_MODEL = nrf52840xxaa
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev
# Various other features (if any)
FEATURES_PROVIDED += highlevel_stdio
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -0,0 +1,31 @@
# This board uses the vendor's serial bootloader
PROGRAMMER ?= nrfutil
ifeq (nrfutil,$(PROGRAMMER))
# For this board it is required to use Adafruit's implementation of nrfutil.
# https://github.com/adafruit/Adafruit_nRF52_nrfutil
#
# This boards comes with Adafruit's bootloader:
# https://github.com/adafruit/Adafruit_nRF52_Bootloader
# In order to burn the application in the correct location, a offset of
# 0x26000 is required
ROM_OFFSET = 0x26000
ROM_LEN = 0xda000
FLASHFILE = $(HEXFILE)
FLASHDEPS += $(HEXFILE).zip
FLASHER = adafruit-nrfutil
FFLAGS = --verbose dfu serial -p ${PORT} -b 115200 --singlebank --package=$(HEXFILE).zip
include $(RIOTMAKE)/tools/usb_board_reset.mk
endif
%.hex.zip: %.hex
$(call check_cmd,$(FLASHER),Flash program and preparation tool)
$(FLASHER) dfu genpkg --dev-type 0x0052 --sd-req 0x00B6 --application $< $@
include $(RIOTBOARD)/common/nrf52/Makefile.include
PROGRAMMERS_SUPPORTED += nrfutil

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2020 Bruno Chianca <brunobcf@gmail.com>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-nrf52
* @{
*
* @file
* @brief Board initialization for the Adafruit ItsyBitsy nRF52840
*
* @author Bruno Chianca <brunobcf@gmail.com>
*
* @}
*/
#include "cpu.h"
#include "board.h"
#include "periph/gpio.h"
void board_init(void)
{
/* initialize the board's single LED */
gpio_init(LED0_PIN, GPIO_OUT);
gpio_set(LED0_PIN);
/* initialize the CPU */
cpu_init();
}

View File

@ -0,0 +1,50 @@
/**
@defgroup boards_adafruit-itsybitsy-nrf52 Adafruit-Itsybitsy-nRF52
@ingroup boards
@brief Support for the Adafruit-Itsybitsy-nRF52
### General information
This is a small formfactor (only 1.4" long by 0.7" wide) nRF52840 board made by Adafruit.
The board features one LED (LD1: blue), a user (SW1) and a
reset button as well as 21 configurable external pins(6 of which can be analog in).
### Links
- [Overview](https://learn.adafruit.com/adafruit-itsybitsy-nrf52840-express?view=all)
- [Pinouts](https://learn.adafruit.com/adafruit-itsybitsy-nrf52840-express/pinouts)
### Flash the board
The board is flashed using its on-board [boot loader](https://github.com/adafruit/Adafruit_nRF52_Bootloader).
Adafruit has a special version of the [nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) that program needs to
be installed. It can turn the binary into a suitable zip file and send it to the DFU
bootloader.
The process is automated in the usual `make flash` target.
If RIOT is already running on the board, it will automatically reset the CPU and enter
the bootloader.
If some other firmware is running or RIOT crashed, you need to enter the bootloader
manually by double tapping the board's reset button.
Readiness of the bootloader is indicated by LD1 pulsing in blue.
Important to note that Adafruit's nrfutil is not compatible with Nordic's nrfutil.
#### nrfutil installation
On systems with Python 3, a recent version of pip is required to install all dependencies;
you may need to run `pip3 install --upgrade pip3` before being able to run `pip3 install adafruit-nrfutil` successfully.
### Accessing STDIO
The usual way to obtain a console on this board is using an emulated USB serial port.
### Todo
Add support for the mini DotStar RGB LED
*/

View File

@ -0,0 +1,68 @@
/*
* Copyright (C) 2020 Bruno Chianca <brunobcf@gmail.com>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-nrf52
* @{
*
* @file
* @brief Board specific configuration for Adafruit ItsyBitsy nRF52840
*
* @author Bruno Chianca <brunobcf@gmail.com>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "board_common.h"
#include "periph/gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LED pin configuration
* @{
*/
/** @brief The LED labelled LD1 */
#define LED0_PIN GPIO_PIN(0, 6)
/** @} */
/**
* @name LED access macros
* @{
*/
/** Enable LD1 */
#define LED0_ON gpio_clear(LED0_PIN)
/** Disable LD1 */
#define LED0_OFF gpio_set(LED0_PIN)
/** Toggle LD1 */
#define LED0_TOGGLE gpio_toggle(LED0_PIN)
/** @} */
/**
* @name Button pin configuration
* @{
*/
/** @brief The button labelled SW1 */
#define BTN0_PIN GPIO_PIN(0, 29)
/** @brief The GPIO pin mode of the button labelled SW1 */
#define BTN0_MODE GPIO_IN_PU
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2020 Bruno Chianca <brunobcf@gmail.com>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-nrf52
* @{
*
* @file
* @brief Configuration of SAUL mapped GPIO pins for the Adafruit
* ItsyBitsy nRF52840
*
* @author Bruno Chianca <brunobcf@gmail.com>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LED and button configuration for SAUL
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LD 1",
.pin = LED0_PIN,
.mode = GPIO_OUT,
.flags = SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR,
},
{
.name = "SW 1",
.pin = BTN0_PIN,
.mode = GPIO_IN_PU,
.flags = SAUL_GPIO_INVERTED,
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,93 @@
/*
* Copyright (C) 2020 Bruno Chianca <brunobcf@gmail.com>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-nrf52
* @{
*
* @file
* @brief Peripheral configuration for the Adafruit ItsyBitsy nRF52840
*
* @author Bruno Chianca <brunobcf@gmail.com>
*
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include "periph_cpu.h"
#include "cfg_clock_32_1.h"
#include "cfg_rtt_default.h"
#include "cfg_timer_default.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name UART configuration
*
* This board does RX and TX defined as pins 0 and 1 on the board.
*
* @{
*/
static const uart_conf_t uart_config[] = {
{
.dev = NRF_UARTE0,
.rx_pin = GPIO_PIN(0, 25),
.tx_pin = GPIO_PIN(0, 24),
#ifdef MODULE_PERIPH_UART_HW_FC
.rts_pin = GPIO_UNDEF,
.cts_pin = GPIO_UNDEF,
#endif
.irqn = UARTE0_UART0_IRQn,
},
};
#define UART_0_ISR isr_uart0
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @name SPI configuration
* @{
*/
static const spi_conf_t spi_config[] = {
{
.dev = NRF_SPIM0,
.sclk = GPIO_PIN(0, 13),
.mosi = GPIO_PIN(0, 15),
.miso = GPIO_PIN(0, 20),
}
};
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */
/**
* @name I2C configuration
* @{
*/
static const i2c_conf_t i2c_config[] = {
{
.dev = NRF_TWIM1,
.scl = GPIO_PIN(0, 14),
.sda = GPIO_PIN(0, 16),
.speed = I2C_SPEED_NORMAL
}
};
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H */

View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2020 Bruno Chianca
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_adafruit-itsybitsy-nrf52
* @{
* @file
* @brief Allows reboot into bootloader via prompt
*
* @author Bruno Chianca
*
* @}
*/
#ifdef MODULE_USB_BOARD_RESET
#include "periph/gpio.h"
#include "usb_board_reset.h"
#define NRF52_DOUBLE_TAP_MAGIC_NUMBER (0x4e)
void usb_board_reset_in_bootloader(void)
{
NRF_POWER->GPREGRET = NRF52_DOUBLE_TAP_MAGIC_NUMBER;
usb_board_reset_in_application();
}
#endif /* MODULE_USB_BOARD_RESET */

View File

@ -0,0 +1,20 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
config BOARD
default "airfy-beacon" if BOARD_AIRFY_BEACON
config BOARD_AIRFY_BEACON
bool
default y
select BOARD_COMMON_NRF51
select CPU_MODEL_NRF51X22XXAA
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_SPI
select HAS_PERIPH_UART
source "$(RIOTBOARD)/common/nrf51/Kconfig"

View File

@ -1,3 +1,4 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/nrf51
include $(RIOTBASE)/Makefile.base

View File

@ -1,3 +1,4 @@
ifneq (,$(filter gnrc_netdev_default netdev_default,$(USEMODULE)))
USEMODULE += nrfmin
endif
# include common nrf51 boards module into the build
USEMODULE += boards_common_nrf51
include $(RIOTBOARD)/common/nrf51/Makefile.dep

View File

@ -1,16 +1,10 @@
CPU_MODEL = nrf51x22xxaa
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
# Various other features (if any)
FEATURES_PROVIDED += radio_nrfmin
# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m0_2
-include $(RIOTCPU)/nrf51/Makefile.features
# include common nrf51 based boards features
include $(RIOTBOARD)/common/nrf51/Makefile.features

View File

@ -1,16 +1,10 @@
# define the used CPU
export CPU = nrf51
export CPU_MODEL = nrf51x22xxaa
# define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk
# this board uses an ST-Link v2 debug adapter
OPENOCD_DEBUG_ADAPTER ?= stlink
STLINK_VERSION ?= 2
export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2
# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
# include nrf51 boards common configuration
include $(RIOTBOARD)/common/nrf51/Makefile.include

View File

@ -1,28 +0,0 @@
/*
* Copyright (C) 2014 Christian Mehlis <mehlis@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup boards_airfy-beacon
* @{
*
* @file
* @brief Board specific implementations for the Airfy Beacon board
*
* @author Christian Mehlis <mehlis@inf.fu-berlin.de>
*
* @}
*/
#include "board.h"
#include "cpu.h"
void board_init(void)
{
/* initialize the CPU */
cpu_init();
}

251
boards/airfy-beacon/doc.txt Normal file
View File

@ -0,0 +1,251 @@
/**
@defgroup boards_airfy-beacon Airfy Beacon
@ingroup boards
@brief Support for the Airfy Beacon board
## Overview
The Airfy Beacon is utilizing a Nordics NRF51822QFAA SoC.
The SoC features 16KiB of RAM, 256KiB of flash ROM and comes on top of the
usual micro-controller peripherals with a 2.4GHz radio that supports both
Nordics proprietary ShockBurst as well as Bluetooth Low Energy (BLE).
The board was available via
[Indiegogo]
(https://www.indiegogo.com/projects/airfy-beacon-make-your-smart-home-even-smarter).
## Hardware
![airfy-beacon]
(https://raw.githubusercontent.com/wiki/RIOT-OS/RIOT/images/airfy-beacon.jpg)
| MCU | NRF51822QFAA |
|:--------------------- |:--------------------------------- |
| Family | ARM Cortex-M0 |
| Vendor | Nordic Semiconductor |
| RAM | 16KiB |
| Flash | 256KiB |
| Frequency | 16MHz |
| FPU | no |
| Timers | 3 (2x 16-bit, 1x 32-bit [TIMER0]) |
| ADCs | 1x 10-bit (8 channels) |
| UARTs | 1 |
| SPIs | 2 |
| I2Cs | 2 |
| Vcc | 1.8V - 3.6V |
| Product Specification | [Product Specification](https://infocenter.nordicsemi.com/pdf/nRF51822_PS_v3.3.pdf) |
| Reference Manual | [Reference Manual](https://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf) |
## Unlocking the flash memory
If you're holding a new device in your hands, there is a high change that
your device's flash memory is locked and RIOT's `make flash` command will fail,
saying something like erasing the flash was not possible.
A solution for this is to reset the chips code memory and user information
registers. Just follow these steps:
1. Follow the steps described above for manually flashing the device:
1. start openocd using the correct config file
`openocd -f boards/airfy-beacon/dist/openocd.cfg`
2. connect to openocd using telnet `telnet localhost 4444`
2. type `halt` to stop the device
3. type `nrf51 mass_erase` to reset the code memory
4. all done, `make flash` should now work as expected.
## Flashing and Debugging
The Airfy Beacon comes without any on-board programming and flashing
capabilities. It supports however to be programmed using off-the-shelf
programmers such as Segger's JLink or STM's STLink.
A very simple and affordable way to program and debug this module is to use
the integrated ST-Link/V2 programmer of any STM32Fx-discovery board. The needed
steps are described in the following sections. If you want to use a standalone
ST-Link adapter, you just simply have to alter the wiring to fit for your
programmer, the software part is identical.
### Hardware
First of all make sure the your ST-Link device is detected and can be
accessed properly. In Linux you might have to adept your `udev` rules
accordingly:
```
> cat 49-stlinkv2.rules
# stm32 discovery boards, with onboard st/linkv2
# ie, STM32L, STM32F4.
# STM32VL has st/linkv1, which is quite different
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", \
MODE:="0666", \
SYMLINK+="stlinkv2_%n"
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.
> sudo cp 49-stlinkv2.rules /etc/udev/rules.d/
> sudo udevadm control --reload-rules
> sudo udevadm trigger
```
now replug the usb cable and flash.
Have a look at the 'Setting up udev rules' section in the
[README file](https://github.com/texane/stlink) if you need help.
Second you need to enable the standalone ST-Link mode of the discovery board
by removing the two `CN2` jumpers, found somewhere in the upper left part of the
board. This disconnects the ST-Link programmer from the micro-controller part of
the port and enables direct access through the pin-header `CN3`, also labeled
`SWD`.
This module supports the Serial Wire Debug (SWD) interface. To access the
device the following four lines need to be connected with the STM32x-discovery
board:
```
Airfy Beacon STM32Fx-discovery
common ground: GND <-----------> GND
supply voltage: VDD <-----------> 3V
SWD clock: SWDCLK <-----------> SWCLK (CN3, pin2)
SWD data I/O: SWDIO <-----------> SWDIO (CN3, pin4)
```
The following image shows the wiring for an SWD flasher board:
![airfy-beacon-flash-connect]
(https://raw.githubusercontent.com/wiki/RIOT-OS/RIOT/images/airfy-beacon-flash-connect.jpg)
### Software
Debugging and programming this module works well with
[OpenOCD](http://openocd.org/).
We suggest to use a fairly recent version, best use the upstream version from
their [git repository](http://sourceforge.net/p/openocd/code/ci/master/tree/).
Version `Open On-Chip Debugger 0.9.0-dev-00184-g885f438 (2014-10-19-14:49)`
is reported to work.
### Programming the Device
To program the Airfy Beacon, just go to your RIOT application and type:
```
make flash
```
and voila, the new firmware should be flashed onto your device.
### Resetting the Device
As the Airfy Beacon module does not provide a reset button, RIOT includes a
target to reset the board. To do that, just type
```
make reset
```
and your board will reboot.
### Debugging the Device
The debugging setup comprises of two parts: a GDB server and a GDB client. To
usual workflow is to start the GDB server first and then connect to it with some
kind of front-end (e.g. command line, IDE, ...).
To start the GDB server, just type
```
make debug-server
```
This will start a local GDB server on `port 3333`.
If you are fine with working with the GDB command line client, you can start
debugging your device by just typing
```
make debug
```
in a second terminal window. This will automatically connect to your
previously opened GDB server and will also load your corresponding .elf file.
Alternatively you can configure your IDE (e.g. eclipse or similar) to connect
directly to the GDB server. [See here for more information on how to configure
Eclipse](https://github.com/RIOT-OS/RIOT/wiki/Using-the-Eclipse-IDE-for-C-and-
CPP-Developers,-Howto)
### Program the device manually
For OpenOCD to work correctly, you need the following configuration file
(which you can also find in `RIOTDIR/boards/airfy-beacon/dist/openocd.cfg`:
```
$ cat RIOTDIR/boards/airfy-beacon/openocd.cfg
# nRF51822 Target
source [find interface/stlink-v2.cfg]
transport select hla_swd
set WORKAREASIZE 0x4000
source [find target/nrf51.cfg]
# use hardware reset, connect under reset
#reset_config srst_only srst_nogate
```
You can now program your device by doing the following:
1. start openocd with: `openocd -d3 -f RIOTDIR/boards/airfy-
beacon/dist/openocd.cfg`
2. open a new terminal an connect with telnet: `telnet 127.0.0.1 4444`
3. do the following steps to flash (only use bank #0 starting from address
0):
```
> flash banks
#0 : nrf51.flash (nrf51) at 0x00000000, size 0x00040000, buswidth 1,
chipwidth 1
#1 : nrf51.uicr (nrf51) at 0x10001000, size 0x000000fc, buswidth 1, chipwidth
1
> halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x00000e1a msp: 0x20001b2c
> flash write_image erase PATH-TO-YOUR-BINARY/YOUR-BINARY.bin 0
wrote xxx bytes from file PATH-TO-YOUR-BINARY/YOUR-BINARY.bin in xx.yys
(x.yyy KiB/s)
> reset
```
### Debugging manually
First you have to start OpenOCD as described in the section above.
Then enter the following in a new terminal:
```
$ arm-none-eabi-gdb -tui "<your binary ELF>"
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x000119ce in ?? ()
(gdb) load
Loading section .text, size 0x2284 lma 0x16000
Loading section .ARM.exidx, size 0x8 lma 0x18284
Loading section .data, size 0x458 lma 0x1828c
Loading section .jcr, size 0x4 lma 0x186e4
Transfer rate: x KB/sec, xxxx bytes/write.
(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
(gdb) break main
Breakpoint 3 at 0x123123: file ../main.c, line xx.
(gdb) continue
Continuing.
```
### Using UART
The UART pins are configured in `boards/airfy-beacon/include/periph_conf.h`.
The default values are PIN 17 and 18.
The default Baud rate is `115 200`.
*/

View File

@ -7,9 +7,7 @@
*/
/**
* @defgroup boards_airfy-beacon Airfy Beacon
* @ingroup boards
* @brief Support for the Airfy Beacon board
* @ingroup boards_airfy-beacon
* @{
*
* @file
@ -21,27 +19,10 @@
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Xtimer configuration
* @{
*/
#define XTIMER_WIDTH (24)
#define XTIMER_BACKOFF (40)
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
} /* end extern "C" */
extern "C" {}
#endif
#endif /* BOARD_H */

View File

@ -21,40 +21,14 @@
#define PERIPH_CONF_H
#include "periph_cpu.h"
#include "cfg_clock_16_1.h"
#include "cfg_timer_012.h"
#include "cfg_rtt_default.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Clock configuration
*
* @note The radio will not work with the internal RC oscillator!
*
* @{
*/
#define CLOCK_HFCLK (16U) /* set to 0: internal RC oscillator
16: 16MHz crystal
32: 32MHz crystal */
#define CLOCK_LFCLK (1) /* set to 0: internal RC oscillator
* 1: 32.768 kHz crystal
* 2: derived from HFCLK */
/** @} */
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_config[] = {
/* dev, channels, width */
{ NRF_TIMER0, 3, TIMER_BITMODE_BITMODE_24Bit, TIMER0_IRQn }
};
#define TIMER_0_ISR isr_timer0
#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
/** @} */
/**
* @name UART configuration
*
@ -66,16 +40,6 @@ static const timer_conf_t timer_config[] = {
#define UART_PIN_TX 18
/** @} */
/**
* @name Real time counter configuration
* @{
*/
#define RTT_NUMOF (1U)
#define RTT_DEV (1) /* NRF_RTC1 */
#define RTT_MAX_VALUE (0x00ffffff)
#define RTT_FREQUENCY (1024)
/** @} */
/**
* @name SPI configuration
* @{
@ -89,7 +53,7 @@ static const spi_conf_t spi_config[] = {
}
};
#define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */
/**
@ -101,17 +65,19 @@ static const i2c_conf_t i2c_config[] = {
.dev = NRF_TWI0,
.pin_scl = 7,
.pin_sda = 8,
.ppi = 0
.ppi = 0,
.speed = I2C_SPEED_NORMAL,
},
{
.dev = NRF_TWI1,
.pin_scl = 9,
.pin_sda = 10,
.ppi = 1
.ppi = 1,
.speed = I2C_SPEED_NORMAL,
}
};
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
/**
@ -120,18 +86,9 @@ static const i2c_conf_t i2c_config[] = {
* The configuration consists simply of a list of channels that should be used
* @{
*/
#define ADC_CONFIG {3, 4, 5, 6}
#define ADC_NUMOF (4)
/** @} */
static const adc_conf_t adc_config[] = {3, 4, 5, 6};
/**
* @name Radio device configuration
*
* The radio is not guarded by a NUMOF define, as the radio is selected by its
* own module in the build system.
* @{
*/
#define RADIO_IRQ_PRIO 1
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */
#ifdef __cplusplus

View File

@ -0,0 +1,15 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
config BOARD
default "arduino-due" if BOARD_ARDUINO_DUE
config BOARD_ARDUINO_DUE
bool
default y
select BOARD_COMMON_ARDUINO_DUE
source "$(RIOTBOARD)/common/arduino-due/Kconfig"

View File

@ -1,13 +1,7 @@
/*
* Copyright (C) 2017 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup boards_arduino-due Arduino Due
* @ingroup boards
* @brief Support for the Arduino Due board
@defgroup boards_arduino-due Arduino Due
@ingroup boards
@brief Support for the Arduino Due board
@see boards_common_arduino_due for details
*/

Some files were not shown because too many files have changed in this diff Show More