Compare commits

...

200 Commits

Author SHA1 Message Date
benpicco
361d41db05
Merge pull request #17586 from benpicco/dist/tools/topogen-doc
tools/zep_dispatch: document topogen usage
2022-01-31 11:49:26 +01:00
Francisco
ba325e8a35
Merge pull request #17354 from bergzand/pr/gnrc_netif/ztimer
gnrc/netif: convert to ztimer
2022-01-31 09:42:28 +01:00
Francisco
5bde360689
Merge pull request #17588 from benpicco/tests/pkg_mbedtls-blacklist
tests/pkg_mbedtls-blacklist: blacklist samr21-xpro
2022-01-31 09:27:15 +01:00
benpicco
d0d4497162
Merge pull request #17589 from kfessel/p-fix-ztimer64-print
sys/ztimer64: PRIu64 requires stdio before inttypes
2022-01-30 22:28:38 +01:00
chrysn
b2b434d064
Merge pull request #17592 from chrysn-pull-requests/fix-17591
cpu/nrf52 radio: Populate info
2022-01-30 21:52:34 +01:00
Francisco
f29f73dea5
Merge pull request #17551 from NikLeberg/feature/pkg_paths
buildsystem/pkg: expand packages from USEPKG early as path into PKG_PATHS
2022-01-30 20:57:08 +01:00
NikLeberg
e5365adb93 pkg/esp32_sdk_libs: add requirements to PKG_PREPARE
The shared `build-libs` directory needs to be available for
modules/packages that depend on the SDK before that package
is eventually compiled.

Packages are downloaded, patched, prepared before any module
is compiled. By adding the directory creation as a dependency
of `PKG_PREPARE` we make sure the rule is run before compilation
starts.
2022-01-30 20:00:09 +01:00
NikLeberg
18dca48510 pkg/esp32_sdk: add requirements to PKG_PREPARE
The shared `build-libs` directory needs to be available for
modules/packages that depend on the SDK before that package
is eventually compiled.

This also includes header files such as `esp32_idf_version.h`.

Packages are downloaded, patched, prepared before any module
is compiled. By adding the directory creation and header as
a dependency of `PKG_PREPARE` we make sure the rules are ran
before compilation starts.
2022-01-30 19:59:35 +01:00
NikLeberg
044701d3cc pkg/esp8266_sdk: add requirements to PKG_PREPARE
The shared `build-libs` directory needs to be available for
modules/packages that depend on the SDK before that package
is eventually compiled.

Packages are downloaded, patched and prepared before any
module is compiled. By adding the directory creation and
header as a dependency of `PKG_PREPARE` we make sure the
rule is run before compilation starts.
2022-01-30 19:59:05 +01:00
NikLeberg
140824e69c buildsystem/pkg: expand paths early 2022-01-30 19:58:52 +01:00
chrysn
716cd8f48b cpu/nrf52 radio: Populate info
According to ieee802154_radio_confirm_transmit docs, the parameter of
confirm_op for IEEE802154_HAL_OP_TRANSMIT is to be populated as an out
parameter -- but this implementation unconditionally left info
unpopulated. Thus, when run with LLVM, _fsm_state_tx_process_tx_done
looked into an uninitialized info and thus crashed into failing
assertions.

Closes: https://github.com/RIOT-OS/RIOT/issues/17591
2022-01-30 16:13:04 +01:00
benpicco
4aa173d37e
Merge pull request #17590 from benpicco/tests/pkg_edhoc_c-blacklist_esp32
tests/pkg_edhoc_c: blacklist esp32-wroom-32
2022-01-28 22:02:15 +01:00
benpicco
5a57dec71a
Merge pull request #17093 from maribu/core/change_prio
core/sched: add sched_change_priority()
2022-01-28 20:01:20 +01:00
Benjamin Valentin
c5df19bfa4 tests/pkg_edhoc_c: blacklist esp32-wroom-32
This test fails rather regularly on CI, so disable it.

socat - open:/dev/ttyUSB0,b115200,echo=0,raw
Traceback (most recent call last):
  File "/tmp/dwq.0.5480675865160537/2c1d3acc7a86753de0db3a13fc04973d/tests/pkg_edhoc_c/tests/01-run.py", line 101, in <module>
    sys.exit(run(testfunc))
  File "/tmp/dwq.0.5480675865160537/2c1d3acc7a86753de0db3a13fc04973d/dist/pythonlibs/testrunner/__init__.py", line 28, in run
    logfile=sys.stdout if echo else None)
  File "/tmp/dwq.0.5480675865160537/2c1d3acc7a86753de0db3a13fc04973d/dist/pythonlibs/testrunner/spawn.py", line 88, in setup_child
    sync_child(child, env)
  File "/tmp/dwq.0.5480675865160537/2c1d3acc7a86753de0db3a13fc04973d/dist/pythonlibs/testrunner/spawn.py", line 123, in sync_child
    TEST_INTERACTIVE_DELAY)
  File "/tmp/dwq.0.5480675865160537/2c1d3acc7a86753de0db3a13fc04973d/dist/pythonlibs/testrunner/utils.py", line 41, in test_utils_interactive_sync_shell
    _test_utils_interactive_sync(child, retries, delay, '\n', '>')
  File "/tmp/dwq.0.5480675865160537/2c1d3acc7a86753de0db3a13fc04973d/dist/pythonlibs/testrunner/utils.py", line 17, in _test_utils_interactive_sync
    ret = child.expect_exact([ready_exp, pexpect.TIMEOUT], timeout=delay)
  File "/usr/local/lib/python3.5/dist-packages/pexpect/spawnbase.py", line 421, in expect_exact
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.5/dist-packages/pexpect/expect.py", line 179, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.5/dist-packages/pexpect/expect.py", line 122, in eof
    raise exc
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
2022-01-28 18:12:40 +01:00
Karl Fessel
6321a958a9 sys/ztimer64: PRIu64 requires stdio before inttypes 2022-01-28 17:48:47 +01:00
Benjamin Valentin
3c6241b8f4 tests/pkg_mbedtls-blacklist: blacklist samr21-xpro
The ENTROPY test always fails on this board

main(): This is RIOT! (Version: buildtest)
mbedtls test

  SHA-224 test #1: passed
  SHA-224 test #2: passed
  SHA-224 test #3: passed
  SHA-256 test #1: passed
  SHA-256 test #2: passed
  SHA-256 test #3: passed

  ENTROPY test: failed
2022-01-28 17:48:02 +01:00
Benjamin Valentin
40f71284b3 tools/zep_dispatch: document topogen usage 2022-01-28 17:09:38 +01:00
Koen Zandberg
546202fe51
Merge pull request #17568 from emmanuelsearch/pr-release-notes-2022-01
release-notes.txt: add 2022.01 release notes
2022-01-28 16:06:22 +01:00
Emmanuel Baccelli
56d343de6e release-notes.txt: add 2022.01 release notes 2022-01-28 15:48:31 +01:00
Koen Zandberg
93ac9d91d1
tests/drivers_at86rf215: Exclude z1 2022-01-28 14:04:47 +01:00
Koen Zandberg
fe0b297aec
tests/gnrc_netif_ipv6_wait_for_global_address: convert to ztimer 2022-01-28 13:38:56 +01:00
Koen Zandberg
3b5662e116
gnrc/netif: convert to ztimer 2022-01-28 13:38:50 +01:00
Juergen Fitschen
617eb359c0
Merge pull request #17565 from fjmolinas/pr_dose_to_ztimer
drivers/dose: migrate to ztimer_usec
2022-01-28 13:04:44 +01:00
Marian Buschsieweke
755652b6cf
tests/sched_change_priority: add test app 2022-01-28 11:29:18 +01:00
benpicco
39ad2012ba
Merge pull request #17583 from benpicco/cpu/native-afl_gcc_fix
cpu/native: fix build with afl-gcc 11.2
2022-01-28 10:19:32 +01:00
Benjamin Valentin
4c9f1e0ca4 cpu/native: fix build with afl-gcc 11.2
Building `fuzzing/gcoap` with afl-gcc 11.2 gives

/home/benpicco/dev/RIOT/cpu/native/native_cpu.c: In function ‘thread_stack_init’:
/home/benpicco/dev/RIOT/cpu/native/native_cpu.c:120:11: error: variable ‘stk’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
  120 |     char *stk = NULL;
      |           ^~~
/home/benpicco/dev/RIOT/cpu/native/native_cpu.c:118:72: error: argument ‘stack_start’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
  118 | char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_start, int stacksize)
      |

We can re-write the function to not use this temporary variable and the error goes away.
2022-01-27 21:09:59 +01:00
Alexandre Abadie
b795a26781
Merge pull request #17582 from aabadie/pr/boards/p-nucleo-doc-update
boards/p-nucleo-wb55: update documentation
2022-01-27 20:20:26 +01:00
Alexandre Abadie
6371051bc3
Merge pull request #17545 from fjmolinas/pr_iotlab_node_docker_riotci_build
Makefile.include: pass IOTLAB_NODE to docker
2022-01-27 20:20:03 +01:00
benpicco
f90bc7e827
Merge pull request #17576 from benpicco/boards/wlr089-xpro
boards/samr34-xpro: add minimal support for WLR089 Xplained Pro
2022-01-27 18:06:47 +01:00
benpicco
4ed9d8fd5c
Merge pull request #17581 from nmeum/riscv-linker-rom-region
cpu/riscv_common: fix undeclared memory region linker error
2022-01-27 17:06:43 +01:00
Alexandre Abadie
1768b46f81
boards/p-nucleo-wb55: add new supported features 2022-01-27 16:04:36 +01:00
Alexandre Abadie
a7d71930c9
boards/p-nucleo-wb55: update notes about OpenOCD version 2022-01-27 16:04:27 +01:00
Alexandre Abadie
0d2b58bdfb
boards/p-nucleo-wb55: fix doxygen parent group 2022-01-27 16:03:56 +01:00
chrysn
f7dfa2f84d
Merge pull request #17133 from chrysn-pull-requests/doc-develhelp-stackoverflow-precision
doc: Start documenting pseudomodules
2022-01-27 15:09:22 +01:00
Sören Tempel
e41063d40e cpu/riscv_common: fix undeclared memory region linker error
Since commit 3a11b1fbd280b2b46ef0a8011bead180800f83c2 (#16972)
building RIOT applications with `BOARD=hifive1` causes the following
linker error to be emitted on my system:

	/opt/rv32imc/lib/gcc/riscv32-unknown-elf/10.2.0/../../../../riscv32-unknown-elf/bin/ld:riscv_base.ld:220: warning: memory region `rom' not declared

This is due to the fact that the RISC-V linker script doesn't have a rom
memory region. While many other ARM-based boards have a rom memory
region defined in the linker script, the corresponding region name in
the RISC-V linker script is flash and rom is not declared as a memory
region hence the warning.

I think this was accidentally overlooked in
3a11b1fbd280b2b46ef0a8011bead180800f83c2. It is fixed in this commit by
replacing the rom region with the flash region. The linker script
identifiers (e.g. _srom and _erom) are not renamed.
2022-01-27 15:02:50 +01:00
Francisco Molina
d2b9b4ce8c Makefile.include: pass IOTLAB_NODE to docker
By default if IoT-LAB Cli Tools V3 is used then BINFILE is used to
flash on IoT-LAB. But BINFILE is not built by default when RIOT_CI_BUILD
is set as a ci optimization.

But since before IOTLAB_NODE was not passed to docker when building it
did not know that it should BUILD BINFILE as well, which led to failures
if doing:

$ IOTLAB_NODE=iotlab-m3.grenoble.iot-lab.info BOARD=iotlab-m3 \
  RIOT_CI_BUILD=1 BUILD_IN_DOCKER=1 make -C examples/hello-world/ flash

But if IOTLAB_NODE is passed at is checks for IoT-LAB cli Tools also
happen in the docker container which leads to a make error since those
are not present in docker.

Therefore add BINFILE to BUILD_FILES if RIOT_CI_BUILD is set, but unset
IOTLAB_NODE once INSIDE_DOCKER.
2022-01-27 14:56:00 +01:00
chrysn
4f085222cf
Merge pull request #17577 from chrysn-pull-requests/compile_commands-updates
tools/compile_commands: Update --clangd set
2022-01-27 14:29:26 +01:00
Francisco
137d99de42
Merge pull request #17578 from aabadie/pr/testbed/iotlab_nodes
testbed/iotlab: add mapping for samr34-xpro and nucleo-wl55jc
2022-01-27 14:08:30 +01:00
chrysn
1e8209f80e pseudomodules: Documentation for board_software_reset 2022-01-27 13:49:25 +01:00
chrysn
15398a53cb doc: Sharpen list of pseudomodules in documentation
Not all pseudomodules should go here; this is mainly for those that
don't belon anywhere else.
2022-01-27 13:49:25 +01:00
chrysn
dcd08c257b doc: Link concrete measures from DEVELHELP documentation 2022-01-27 13:49:25 +01:00
chrysn
bb8402fc0b doc: Document the MPU pseudomodules 2022-01-27 13:49:25 +01:00
chrysn
68d0c291a9 doc: Initial documentation of pseudomodules
Co-authored-by: Francisco <femolina@uc.cl>
2022-01-27 13:49:14 +01:00
Benjamin Valentin
a471f3583e drivers/sx127x: add support for WLR089/SAM R34
The device ID returned on WLR089 is 0x13 instead of 0x12, but it appears to
work just like sx1276.

Also check for the other device ID to make the driver work on this module.
2022-01-27 13:36:26 +01:00
Benjamin Valentin
b67de309a4 boards/samr34-xpro: add doc.txt 2022-01-27 13:36:26 +01:00
Alexandre Abadie
8a869217f3
gh_action/test-on-iotlab: add nucleo-wl55jc and samr34-xpro 2022-01-27 11:47:06 +01:00
Alexandre Abadie
a18c95e524
testbed-support: add iotlab mapping for nucleo-wl55jc and samr34-xpro 2022-01-27 11:46:39 +01:00
Alexandre Abadie
541b23ce03
gh_action/test-on-iotlab: fix alphabetical order in boards list 2022-01-27 11:45:51 +01:00
chrysn
4fb9f46e62 tools/compile_commands: use -Wno-unknown-warning-option
... instead of manual filtering

Some -Wwarning-type flags were removed because in combination with
-Werror they caused clang to fail when the warning type was unknown.
Rather than enumerating them (a manual process with the extra risk of
leaving warnings disabled longer than necessary), this adds
`-Wno-unknown-arning-option` which disables the warnings (that are
becoming erors through -Werror) raised when a warning's name is unknown.
2022-01-27 09:10:49 +01:00
chrysn
c3fa026226 tools/compile_commands: Filter out -msmall-data-limit=8
It is not available in the libclang version currently shipped with
riotdocker.
2022-01-27 08:58:35 +01:00
chrysn
99d245f538
Merge pull request #17520 from chrysn-pull-requests/rust-enable-riscv
cpu/riscv_common: Enable Rust applications
2022-01-26 19:14:50 +01:00
chrysn
07a4756242
Merge pull request #17569 from chrysn-pull-requests/unit-tesla
phydat: Add Tesla unit
2022-01-25 16:43:16 +01:00
chrysn
206bea0a1d phydat: Add Tesla unit
While this is equivalent to the existing Gs (1 T = 10^-4 Gs), this is
the SI (and thus preferred) unit.
2022-01-25 13:46:08 +01:00
Leandro Lanzieri
fca7ed3943
Merge pull request #17567 from fjmolinas/pr_test_uart_non_blocking_to_ztimer
tests/periph_uart_nonblocking: migrate to ztimer
2022-01-25 11:43:01 +01:00
Alexandre Abadie
7b06dc2bb2
Merge pull request #17557 from fjmolinas/pr_twr_ci_blacklist
examples/twr_aloha: blacklist test on ci
2022-01-25 11:18:15 +01:00
Alexandre Abadie
f184b11453
Merge pull request #17566 from fjmolinas/pr_xtimer_init_in_test
tests/*: remove uneeded xtimer_init
2022-01-25 11:16:06 +01:00
Alexandre Abadie
6ba8962a45
Merge pull request #17563 from fjmolinas/pr_lis2dh12_fix_ifdef
drivers/lis2dh12: use ifdef instead of IS_USED
2022-01-25 11:14:17 +01:00
benpicco
09ddd400c8
Merge pull request #17546 from gschorcht/cpu/esp32/gcc_8_4_0
cpu/esp32: changes for toolchain update to gcc version 8.4.0
2022-01-25 10:12:54 +01:00
Francisco Molina
eec37975d5 examples/twr_aloha: change test to tests-with-config
Test can only run on dwm1001 BOARDs.
2022-01-25 09:19:06 +01:00
Francisco Molina
621d81756c tests/driver_motor_driver: remove uneeded xtimer_init() 2022-01-25 08:58:24 +01:00
Francisco Molina
b229f77ac1 drivers/lis2dh12: use ifdef instead of IS_USED
Using IS_USED leads to undefined API references
2022-01-25 08:45:09 +01:00
Francisco Molina
dc27c080ea drivers/dose: migrate to ztimer_usec 2022-01-25 08:43:33 +01:00
Francisco Molina
7782866efc tests/periph_uart_nonblocking: migrate to ztimer 2022-01-25 08:42:53 +01:00
Francisco Molina
30dcfb8202 tests/thread_priority_inversion: remove unneeded xtimer_init() 2022-01-25 08:42:06 +01:00
Gunar Schorcht
c0dc6ccc71 cpu/esp32: set SDK configuration dependent on newlib_nano module 2022-01-25 00:37:08 +01:00
Gunar Schorcht
fdabe050ed cpu/esp32: skip inclusion of toolchain pthread types
The toolchain provides POSIX type definitions for pthread which conflicts with that in RIOT. With the CFLAGS/CXXFLAGS skip the inclusion of the types shipped by the toolchain.
2022-01-25 00:36:51 +01:00
Gunar Schorcht
2ccfb145a1 cpu/esp32: add missing POSIX functions 2022-01-25 00:36:51 +01:00
Gunar Schorcht
1d20f88bb0 cpu/esp32: set stdout/stderr to be non-buffering 2022-01-25 00:36:51 +01:00
Gunar Schorcht
e1c6306bf4 cpu/esp32: replace bzero by memset 2022-01-25 00:36:51 +01:00
Gunar Schorcht
e15e18b195 cpu/esp32: fix compilation errors 2022-01-25 00:36:51 +01:00
Gunar Schorcht
839cf4223d cpu/esp32: changes for retagetable locking 2022-01-25 00:36:51 +01:00
Gunar Schorcht
881a92fe47 cpu/esp32: remove types.h in sys include 2022-01-25 00:36:51 +01:00
benpicco
cbe9d6967b
Merge pull request #17552 from HendrikVE/pr/examples/gcoap_dtls
examples/gcoap_dtls: match Makefile of examples/gcoap
2022-01-24 22:05:15 +01:00
ae210fcf46
Merge pull request #17561 from fjmolinas/pr_ztimer64_flag
sys/ztimer64/util.c: fix ztimer64_set_timeout_flag
2022-01-24 21:19:15 +01:00
Marian Buschsieweke
780530ad33
Merge pull request #17560 from ststrell/nucleo_f767zi_fix_adc_pin_config
boards/nucleo-f767zi: Fix adc pin config in periph_conf.h
2022-01-24 20:30:49 +01:00
Francisco Molina
de50d557d8 sys/ztimer64/util.c: fix ztimer64_set_timeout_flag 2022-01-24 18:37:18 +01:00
Stefan Strell
ccf31eb15d boards/nucleo-f767zi: Fix adc pin config in periph_conf.h 2022-01-24 18:12:25 +01:00
benpicco
c18f1c2a9b
Merge pull request #17455 from gschorcht/cpu/esp32/sdk-as-package
cpu/esp32: download Espressif SDK ESP-IDF as package
2022-01-24 16:13:04 +01:00
benpicco
db0a984ca7
Merge pull request #17553 from gschorcht/makefiles/libc_newlib_nano_dir
makefiles/libc/newlibc: allow toolchains with nano version only
2022-01-24 16:12:22 +01:00
Alexandre Abadie
0b0e7620db
Merge pull request #17558 from fjmolinas/pr_iotlab_wf_dwm1001
.github/workflows/test-on-iotlab: add dwm1001
2022-01-24 15:51:48 +01:00
Francisco Molina
7ce6b06367 .github/workflows/test-on-iotlab: add dwm1001 2022-01-24 15:00:13 +01:00
Kevin "Tristate Tom" Weiss
c94033016e
Merge pull request #17458 from aabadie/pr/boards/stm32f429i-disc1_kconfig_deps_fix
{disp,touch}_dev: improve Kconfig at different levels
2022-01-24 12:00:44 +01:00
Francisco
b985a74894
Merge pull request #17367 from fjmolinas/pr_driver_ztimer_corner_cases
drivers: migrate xtimer64 and xtimer/ticks users to ztimer
2022-01-24 10:41:24 +01:00
Gunar Schorcht
d6f86a9b7a makefiles/libc/newlibc: allow toolchains with nano version only
The check for `newlib-nano` assumes that a toolchain which provides `newlib-nano` provides both the normal version and the nano version of the `newlib`.The nano version of `newlib.h` is therefore stored in its own include directory. This is the case for toolchains which allow to use both the normal and the nano version, e.g. for ARM and RISC-V.
However, if the toolchain provides `newlib_nano` but only allows the use of the nano version, it will only have the nano version of `newlib.h` and no separate directory for it, e.g. for ESP32.
To still be able to use such toolchains with `newlib_nano`, the check is changed so that the setting of the `-isystem` option depends on the existence of the separate directory.
2022-01-23 10:48:26 +01:00
Hendrik van Essen
e6242ae205 examples/gcoap_dtls: match Makefile of examples/gcoap 2022-01-23 01:33:23 +01:00
Alexandre Abadie
c78589763e
tests/disp_dev: add Kconfig config 2022-01-22 15:14:26 +01:00
Alexandre Abadie
8e56da3658
drivers/stmpe811: don't use a choice to select the bus 2022-01-22 15:14:26 +01:00
Alexandre Abadie
3a80354d92
tests/touch_dev: add Kconfig config 2022-01-22 15:14:18 +01:00
Alexandre Abadie
6ef50cab12
tests/touch_dev: migrate to ztimer 2022-01-22 15:14:18 +01:00
Alexandre Abadie
7c9bce25e1
boards/stm32f429i-disc1: add ili9341 and stmpe811 in Kconfig 2022-01-22 15:14:17 +01:00
Alexandre Abadie
240f80e43a
drivers/stmpe811: extend Kconfig 2022-01-22 15:14:17 +01:00
Alexandre Abadie
96f338bafc
drivers/stmpe811: cleanup Kconfig 2022-01-22 15:14:17 +01:00
benpicco
2520b5c608
Merge pull request #16870 from fabian18/cpu_stm32_add_periph_backup_ram
cpu/stm32: make backup SRAM available
2022-01-21 18:09:42 +01:00
benpicco
f8272b0c62
Merge pull request #17548 from gschorcht/cpu/esp/cleanup_nvs_flash_cpp_dependencies
cpu/esp*: nvs-flash / cpp dependencies cleanup
2022-01-21 17:20:19 +01:00
Fabian Hüßler
70d3d647d1 cpu/{cortexm_common, stm32}: add support for backup RAM 2022-01-21 15:53:18 +01:00
Alexandre Abadie
2cb8ffe307
Merge pull request #17540 from leandrolanzieri/pr/drivers/ft5x06/fix_multiple_models
drivers/ft5x06: allow multiple device types
2022-01-21 15:43:45 +01:00
Leandro Lanzieri
91012bc3f9
drivers/ft5x06: remove unnecessary pseudomodules 2022-01-21 14:13:49 +01:00
Gunar Schorcht
6c3e7c5db7 cpu/esp*: nfs_flash/cpp dependency cleanup
Module `esp_idf_nvs_flash` uses C++ code. Since  `esp_idf_nvs_flash` module is always enabled on ESP8266, the permanent dependency on `cpp` is correct. But on ESP32, the `esp_idf_nvs_flash` module is only enabled if `esp_wifi_any` is used. Only in that case the compilation should depend on module `cpp`.
2022-01-21 13:32:56 +01:00
Leandro Lanzieri
4eb58d74b5
drivers/ft5x06: allow multiple device types 2022-01-21 13:13:09 +01:00
Alexandre Abadie
c21730a765
Merge pull request #17406 from fjmolinas/pr_twr_aloha_rework
examples/twr_aloha: refactor
2022-01-21 10:08:46 +01:00
Francisco Molina
cd3fa25f06 examples/twr_aloha: refactor 2022-01-21 09:17:00 +01:00
chrysn
9bcc40a4cc
Merge pull request #17539 from benpicco/drivers/dose-doc
drivers/dose: add documentation for dose_watchdog
2022-01-20 20:37:17 +01:00
Benjamin Valentin
a8983d288f drivers/dose: add documentation for dose_watchdog 2022-01-20 18:37:23 +01:00
Koen Zandberg
6a6424b427
Merge pull request #17541 from chrysn-pull-requests/post-16818-doc-fix
core/thread doc: Point to helper function
2022-01-20 14:26:57 +01:00
chrysn
fef782f735 core/thread doc: Point to helper function 2022-01-20 14:18:40 +01:00
Fabian Hüßler
5fdf8d2d88 tests/periph_backup_ram: FEATURES_REQUIRED += periph_rtc 2022-01-20 14:13:10 +01:00
Alexandre Abadie
f511a64302
Merge pull request #17538 from leandrolanzieri/pr/doc/pkg_includes
pkg: fix documentation on includes
2022-01-19 16:50:14 +01:00
benpicco
038b41453e
Merge pull request #17210 from benpicco/drivers/dose-ringbuffer
drivers/dose: make use of ringbuffer for RX
2022-01-19 14:45:47 +01:00
Alexandre Abadie
1c43257fbc
Merge pull request #17537 from benpicco/pkg/mbedtls-bump
pkg/mbedtls: bump version to v2.28.0
2022-01-19 13:08:39 +01:00
Benjamin Valentin
a8ad618a71 drivers/dose: make use of ringbuffer for RX 2022-01-19 11:43:35 +01:00
Benjamin Valentin
c4b32a426f tests/unittests: add tests for chunked_ringbuffer 2022-01-19 11:43:35 +01:00
Benjamin Valentin
77ab8a657a sys/chunked_ringbuffer: add chunked ringbuffer 2022-01-19 11:43:35 +01:00
Benjamin Valentin
023ef291c6 pkg/mbedtls: bump version to v2.28.0
https://github.com/ARMmbed/mbedtls/releases/tag/v2.28.0
2022-01-19 11:24:20 +01:00
Francisco Molina
849c800e28 pkg/uwb-core: fix dependencies add uwb-core_uwb_rng_trx_info 2022-01-19 10:32:33 +01:00
Francisco Molina
dda5441c6c sys/event/periodic: model in Kconfig 2022-01-19 10:32:33 +01:00
Leandro Lanzieri
6257442e4e
doc: Add project name 2022-01-19 10:17:52 +01:00
Leandro Lanzieri
d8e84434a8
sys/Makefile.dep: Remove unneeded include 2022-01-19 10:16:34 +01:00
Leandro Lanzieri
e470a9ab57
pkg/doc: Fix documentation on package header files 2022-01-19 10:15:52 +01:00
Alexandre Abadie
74239561b8
Merge pull request #17534 from fjmolinas/pr_edhoc_test_netif_multi
tests/pkg_edhoc: handle multiple interfaces
2022-01-19 08:42:20 +01:00
Francisco Molina
ec7926f6c4 tests/pkg_edhoc: handle multiple interfaces 2022-01-19 08:17:14 +01:00
Francisco
007f8d07ce
Merge pull request #17535 from fjmolinas/pr_cc2538_set_counter
cpu/cc2538/rtt: fix rtt_set_counter
2022-01-19 08:15:22 +01:00
Francisco
bc6624e67b
Merge pull request #17180 from benpicco/drivers/dose-watchdog
drivers/dose: introduce watchdog timer
2022-01-18 23:43:29 +01:00
Alexandre Abadie
5e599a82dd
Merge pull request #17531 from fjmolinas/pr_spi_gpio_init_reference
drivers/periph_spi: spi_init_with_gpio_mode mode by reference
2022-01-18 18:44:54 +01:00
Alexandre Abadie
52781dc96d
Merge pull request #17530 from fjmolinas/pr_rtt_rtc_utils
drivers/rtt_rtc: select rtc_utils
2022-01-18 17:02:11 +01:00
Francisco Molina
8c8ab47806 cpu/cc2538/rtt: fix rtt_set_counter 2022-01-18 16:39:04 +01:00
Francisco Molina
c19a78765a drivers/pir: migrate to ztimer64 2022-01-18 16:27:44 +01:00
Francisco Molina
d8126864ea tests/driver_ltc4150: migrate to ztimer_usec 2022-01-18 16:27:44 +01:00
Francisco Molina
a1fe17c698 drivers/ltc4150: migrate to ztimer64 2022-01-18 16:27:44 +01:00
Francisco Molina
0398fb3f83 drivers/nvmram_spi: convert to ztimer_usec 2022-01-18 16:27:44 +01:00
Francisco Molina
24a848e844 drivers/nrf24l01p: migrate to ztimer 2022-01-18 16:27:44 +01:00
Francisco Molina
579ca6d941 drivers/periph_spi: spi_init_with_gpio_mode mode by reference 2022-01-18 16:22:18 +01:00
Benjamin Valentin
3e1076e3b9 drivers/dose: set backoff timer before send 2022-01-18 15:41:38 +01:00
Benjamin Valentin
527d1bf559 tests/driver_dose: test dose_watchdog on select boards 2022-01-18 15:41:38 +01:00
Benjamin Valentin
ddf80a8bdb drivers/dose: introduce watchdog timer 2022-01-18 15:41:38 +01:00
Francisco Molina
8b45ed87be drivers/rtt_rtc: select rtc_utils 2022-01-18 15:32:38 +01:00
Alexandre Abadie
728aefa541
Merge pull request #17528 from fjmolinas/pr_test_pkg_relic_stacksize
tests/pkg_relic: increase stacksize
2022-01-18 13:28:16 +01:00
Francisco Molina
1025341ff3 tests/pkg_relic: increase stacksize 2022-01-18 13:19:34 +01:00
benpicco
2542195cdf
Merge pull request #15671 from PeterKietzmann/pr_add_pkg_mbedtls
pkg/mbedtls: initial pkg import to use entropy module
2022-01-18 08:22:50 +01:00
PeterKietzmann
b05f93405e pkg/mbedtls:initial port of the entropy module 2022-01-17 23:22:14 +01:00
Alexandre Abadie
75f5048b68
Merge pull request #17497 from jia200x/pr/lora/fix_rssi_val
[treewide] lora: use int16_t for RSSI value
2022-01-17 18:57:37 +01:00
Jose Alamos
d6899f40a7
drivers/atwinc15x0: adapt NETOPT_RSSI to int16_t 2022-01-17 17:54:18 +01:00
Jose Alamos
9955a35c63
[treewide] lora: use int16_t for RSSI value
The RSSI values reported by LoRa transceiver can be less than -127.
Therefore, `int8_t` is not enough. This commit defines the RSSI of
`netdev_lora_rx_info` as `int16_t` and adapt the drivers accordingly
(sx126x, sx127x).
2022-01-17 17:54:18 +01:00
Marian Buschsieweke
d788bd327d
Merge pull request #17504 from chrysn-pull-requests/doc-c2rust-locked
doc: Fix C2Rust installation procedure
2022-01-17 17:40:38 +01:00
José Alamos
c326be00f6
Merge pull request #16940 from chrysn-pull-requests/6lo-docs
net/ieee802154: Add overview documentation
2022-01-17 17:33:05 +01:00
benpicco
e07fb44408
Merge pull request #17363 from fjmolinas/pr_lpc23xx-mci_ztimer
cpu/lpc23xx-mci: migrate to ztimer_msec
2022-01-17 16:11:25 +01:00
Gunar Schorcht
183562b947
Merge pull request #16341 from fjmolinas/pr_esp_rename_clock_coreclock
cpu/esp32: use macros/units
2022-01-17 15:22:23 +01:00
Marian Buschsieweke
8549ff2f7d
Merge pull request #17479 from gschorcht/cxxexflags_cpp+14
makefiles: use C++14 standard by default for C++ compilations
2022-01-17 13:42:41 +01:00
Francisco Molina
91c67c7a0e cpu/lpc23xx-mci: migrate to ztimer_msec 2022-01-17 12:47:03 +01:00
Francisco Molina
b9d1461b38 cpu/esp32: use macros/units 2022-01-17 12:28:11 +01:00
Francisco
000e6fa99d
Merge pull request #17228 from miri64/gnrc_pktbuf_cmd/enh/add-od-dep
gnrc_pktbuf_cmd: add od dependency with gnrc_pktbuf_static
2022-01-17 12:10:49 +01:00
Francisco Molina
90da7dcdfe tests/driver_si1133: remove uneeded xtimer dependency 2022-01-17 12:04:12 +01:00
Francisco Molina
393c78b8e2 drivers/si1133: migrate to ztimer 2022-01-17 12:04:12 +01:00
Francisco
54d62f1303
Merge pull request #17517 from aabadie/pr/sys/lora_remove_deprecated_define
sys/lora: remove deprecated LORA_PAYLOAD_CRC_ON_DEFAULT define
2022-01-17 11:09:00 +01:00
benpicco
7cd9b6c1b0
Merge pull request #17514 from chrysn-pull-requests/riot-wrappers-0.7.15
rust: Update to riot-wrappers 0.7.15
2022-01-17 10:29:50 +01:00
chrysn
13036c1bc4 net/iee802154 doc: Add overview / introduction documentation
The module previously called net_ieee802154 is renamed to capture that
it is about interacting the frames and headers, and moved "into" the new
topic in the documentation tree.

Exceptions for undocumented headers are updated.
2022-01-16 11:29:32 +01:00
chrysn
fdf3c324b9 net/ieee802154 doc: Group security with existing 802154 2022-01-16 11:24:22 +01:00
chrysn
2637a9f17e net/ieee802154 doc: Consistent spacing
This ensures that the the 802.15.4 modules are grouped together in the
built documentation (vs. "IEEE 802.15.4" / "IEEE EUI-..." /
"IEEE802.15.4" sorting).
2022-01-16 11:24:22 +01:00
chrysn
95b5052be4
Merge pull request #17502 from chrysn-pull-requests/queue-on-stack-never-quit
tests: Fix thread return with local message queue
2022-01-15 23:26:14 +01:00
benpicco
ca7dd943ee
Merge pull request #17522 from krzysztof-cabaj/doc-board-cc1352
boards/cc1352-launchpad doc: adding information concerning shell acccess
2022-01-15 14:45:24 +01:00
Alexandre Abadie
d792bc2b35
Merge pull request #17516 from aabadie/pr/sys/loramac_use_new_private_network_config
sys/loramac: remove deprecated LORAMAC_DEFAULT_PUBLIC_NETWORK
2022-01-15 12:29:00 +01:00
benpicco
44cf68f174
Merge pull request #17500 from aabadie/pr/drivers/at_remove_deprecated_define
drivers/at: remove deprecated AT_SEND_ECHO define
2022-01-15 11:05:09 +01:00
Alexandre Abadie
b18cc7737c
Merge pull request #17518 from kaspar030/fix_murdock_nocommitinfo
murdock: fix exit -> return in subfunction
2022-01-15 09:40:26 +01:00
benpicco
43b9a82806
Merge pull request #17506 from maribu/core/init
core/init: minor code cleanup
2022-01-15 03:59:54 +01:00
Karl Fessel
2bebcb62b5
Merge pull request #17411 from kfessel/p-nib-no-minutes
gnrc/ipv6nib: remove the need for evtimer-minutes
2022-01-15 02:33:30 +01:00
benpicco
739c3d25e4
Merge pull request #17511 from benpicco/sock_has_ipv4
sys/net/sock: introduce SOCK_HAS_IPV4
2022-01-15 01:06:51 +01:00
krzysztof-cabaj
3c424107cc doc/boards/cc1352-launchpad: adding information concerning shell acccess 2022-01-14 11:47:32 -05:00
chrysn
210ad505aa makefiles: Reuse some of Rust's ~/.cargo in Docker container
Without passing this through, any crate downloads would go to the
container's image's scratch space, to be re-downloaded for each build,
and with new time stamps that cause compilation to start anew as well.
2022-01-14 14:59:04 +01:00
chrysn
d391b1c5f4 cpu/riscv_common: Enable Rust applications
This contains a workaround for
https://github.com/rust-lang/rust-bindgen/issues/1555 (withouot which
bindgen would fail, with little information helping remedy the cause)
2022-01-14 13:42:32 +01:00
2ba5d5976d murdock: fix exit -> return in subfunction 2022-01-14 12:52:19 +01:00
Alexandre Abadie
ed155f82ce
sys/lora: remove deprecated LORA_PAYLOAD_CRC_ON_DEFAULT define 2022-01-14 10:37:42 +01:00
Alexandre Abadie
e809952ca4
drivers/sx12{6,7}x: use inverse CONFIG_LORA_PAYLOAD_CRC_OFF_DEFAULT 2022-01-14 10:31:55 +01:00
Alexandre Abadie
cceaf45389
sys/loramac: remove deprecated LORAMAC_DEFAULT_PUBLIC_NETWORK define 2022-01-14 10:21:20 +01:00
Alexandre Abadie
4f9c28eee8
pkg/semtech-loramac: use CONFIG_LORAMAC_DEFAULT_PRIVATE_NETWORK 2022-01-14 10:21:20 +01:00
Alexandre Abadie
50c5d84277
sys/net/gnrc_lorawan: use CONFIG_LORAMAC_DEFAULT_PRIVATE_NETWORK 2022-01-14 10:21:19 +01:00
Alexandre Abadie
37bc47e21c
drivers/at: remove deprecated AT_SEND_ECHO define 2022-01-14 09:06:17 +01:00
chrysn
deffb350a7 rust: Update to riot-wrappers 0.7.15 2022-01-13 18:52:05 +01:00
Benjamin Valentin
67ef5faeed sys/net/sock_util: make use of SOCK_HAS_IPV4 2022-01-13 18:40:12 +01:00
Gunar Schorcht
93d15ac2d3 tests/cpp11_*: remove -std=c++11 2022-01-13 17:50:59 +01:00
Gunar Schorcht
20dfe40330 sys: remove -std=c++11 2022-01-13 17:50:59 +01:00
Gunar Schorcht
aa44c8ab78 pkg: remove -std=c++11 2022-01-13 17:50:59 +01:00
Gunar Schorcht
60793f14ae cpu/esp*/vendor: remove -std=c++11 2022-01-13 17:50:59 +01:00
Gunar Schorcht
a0f0d2ea43 sys/cpp_new_delete: add deleted operators required by C++14 2022-01-13 17:50:59 +01:00
Karl Fessel
505ce8481b gnrc/ipv6nib: remove the need for evtimer-minutes
gnrc/nib: add unitmarker to valid_untils that where min and are now ms
2022-01-13 15:17:24 +01:00
Benjamin Valentin
22c46b04c9 sys/net/sock: introduce SOCK_HAS_IPV4 2022-01-13 12:53:41 +01:00
Marian Buschsieweke
d4e051596c
core/init: minor code cleanup 2022-01-12 16:15:48 +01:00
chrysn
acbbb405b0 doc: Fix C2Rust installation procedure
The `--locked` is required since dependencies increased their MSRV to
something later than C2Rust's fixed nightly. That was already reflected
in the riotdocker installation steps, but not here where the line was
taken from upstream's docs.

Closes: https://github.com/RIOT-OS/RIOT/issues/17492
2022-01-12 08:56:13 +01:00
chrysn
b4a185132a core/msg: Document caution needed when having queue on the stack 2022-01-11 21:51:14 +01:00
chrysn
87847b1de4 tests: Fix thread return with local message queue
When a message queue is configured from the stack, that main function
must never return -- otherwise, during sched_task_exit (which the
thread's function "returns" to), message senders might still send
messages into already freed stack space (which would be reused by
sched_task_exit).

Co-authored-by: Marian Buschsieweke <maribu@users.noreply.github.com>
2022-01-11 21:51:09 +01:00
Gunar Schorcht
3e2de3590e sys/cpp11-compat: add deleted operators required by C++14 2022-01-06 11:18:33 +01:00
Gunar Schorcht
181f6423ae makefiles/cflags: enable C++14 by default 2022-01-06 11:15:23 +01:00
Gunar Schorcht
2e820a09fc cpu/esp32: print SDK version with esp_log_startup 2022-01-04 16:35:47 +01:00
Gunar Schorcht
81727fb1f1 pkg/esp32_sdk_libs: add ESP SDK libraries as package
The vendor binary libraries of ESP-IDF are provided as a separate GIT repository. These libraries are defined as separate package for two reasons: 1. RIOT packages don't support to clone GIT repositories recursively; 2. ESP-IDF pulls a lot of other GIT repositories that are not needed when it is cloned recursively.
2022-01-04 16:34:31 +01:00
Gunar Schorcht
f9105c3cc1 cpu/esp32: use INCLUDES as defined in pkg/esp32_sdk
The include pathes for the ESP32 SDK are now defined by `pkg/esp32_sdk`. They can be used in Makefiles directly.
2022-01-04 16:34:31 +01:00
Gunar Schorcht
d6c2926933 pkg/esp32_sdk: add ESP32 SDK without libraries as package
The vendor binary libraries of ESP-IDF are provided as a separate GIT repository. These libraries are defined as separate package for two reasons: 1. RIOT packages don't support to clone GIT repositories recursively; 2. ESP-IDF pulls a lot of other GIT repositories that are not needed when it is cloned recursively.
2022-01-04 16:34:31 +01:00
Gunar Schorcht
7addf3ae5b pkg/esp8266_sdk: small changes in doc and Kconfig
Some small changes to use a common document and naming style for all ESP SDK packages. The @defgroup command should start with the name to keep alphabetical order in doc as well as Kconfig
2022-01-04 16:34:31 +01:00
Francisco Molina
efeecae3a5 sys/Makefile.dep: remove ztimer_periodic dep
This module does not exist, its part of ztimer core.
2021-12-15 15:52:08 +01:00
Martine Lenders
d4f7f9182b
gnrc_pktbuf_cmd: add od dependency with gnrc_pktbuf_static 2021-11-17 15:52:44 +01:00
Martine Lenders
35b7ea44ac
tests/gnrc_udp: remove od from used modules
The test does not use the module, it is merely used as a dependency for
`gnrc_pktbuf_cmd`.
2021-11-17 15:51:48 +01:00
Marian Buschsieweke
ed9bf358c5
sys/shell: Add nice shell command via module nice 2021-11-02 20:44:32 +01:00
Hauke Petersen
3d7d797a57
core/sched: add sched_change_priority() function
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2021-11-02 20:44:32 +01:00
289 changed files with 5863 additions and 1156 deletions

View File

@ -33,6 +33,10 @@ jobs:
fail-fast: false
matrix:
boards:
- riot: dwm1001
iotlab:
archi: dwm1001:dw1000
site: saclay
- riot: iotlab-m3
iotlab:
archi: m3:at86rf231
@ -53,10 +57,18 @@ jobs:
iotlab:
archi: nrf52832mdk:ble
site: saclay
- riot: nucleo-wl55jc
iotlab:
archi: nucleo-wl55jc:stm32wl
site: grenoble
- riot: samr21-xpro
iotlab:
archi: samr21:at86rf233
site: saclay
- riot: samr34-xpro
iotlab:
archi: samr34:sx1276
site: grenoble
- riot: b-l072z-lrwan1
iotlab:
archi: st-lrwan1:sx1276
@ -70,10 +82,6 @@ jobs:
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

View File

@ -585,7 +585,7 @@ basename_list () {
update_changed_modules() {
# early out if there's no base commit info
if [ -z "${CI_BASE_COMMIT}" ]; then
exit 0
return 0
fi
# early out if a full build is requested

View File

@ -97,8 +97,8 @@ compile-commands: | $(DIRS:%=COMPILE-COMMANDS--%)
$(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)
# include makefile snippets for packages in $(PKG_PATHS) that modify GENSRC:
-include $(PKG_PATHS:%=%Makefile.gensrc)
GENOBJC := $(GENSRC:%.c=%.o)
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)

View File

@ -20,7 +20,7 @@ include $(RIOTBASE)/drivers/Makefile.dep
-include $(sort $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep))
# pull dependencies from packages
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)
-include $(PKG_PATHS:%=%Makefile.dep)
ifneq (,$(filter mpu_stack_guard,$(USEMODULE)))
FEATURES_REQUIRED += cortexm_mpu

View File

@ -386,6 +386,17 @@ ifneq (,$(IOTLAB_NODE))
PROGRAMMER ?= iotlab
# iotlab uses ELFFILE by default for flashing boards.
FLASHFILE ?= $(ELFFILE)
# RIOT_CI_BUILD disables the build of BINFILE which is required for flashing
# on IoT-LAB
ifeq (1,$(RIOT_CI_BUILD))
BUILD_FILES += $(BINFILE)
endif
# Disable IOTLAB_NODE if inside Docker to avoid including the
# iotlab.single.inc.mk file which is useless there: it's only useful for
# flashing and this is done outside of Docker.
ifeq (1,$(INSIDE_DOCKER))
IOTLAB_NODE :=
endif
endif
# Add standard include directories
@ -416,6 +427,10 @@ ifeq (1,$(TEST_KCONFIG))
USEMODULE := $(KCONFIG_MODULES)
KCONFIG_PACKAGES := $(call lowercase,$(patsubst CONFIG_PACKAGE_%,%,$(filter CONFIG_PACKAGE_%,$(.VARIABLES))))
USEPKG := $(KCONFIG_PACKAGES)
# Locate used packages in $(RIOTPKG).
PKG_PATHS := $(sort $(foreach dir,$(RIOTPKG),\
$(foreach pkg,$(USEPKG),$(dir $(wildcard $(dir)/$(pkg)/Makefile)))))
else
# always select provided architecture features
FEATURES_REQUIRED += $(filter arch_%,$(FEATURES_PROVIDED))
@ -559,8 +574,8 @@ include $(RIOTBASE)/sys/Makefile.include
# include Makefile.includes of each driver modules if they exist
-include $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.include)
# include Makefile.includes for packages in $(USEPKG)
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
# include Makefile.includes for packages in $(PKG_PATHS)
-include $(PKG_PATHS:%=%Makefile.include)
# include external modules configuration
-include $(EXTERNAL_MODULE_PATHS:%=%/Makefile.include)
@ -760,31 +775,30 @@ endif
# The `clean` needs to be serialized before everything else.
all $(BASELIBS) $(ARCHIVES) $(BUILDDEPS) ..in-docker-container: | $(CLEAN)
.PHONY: pkg-prepare pkg-build pkg-build-%
.PHONY: pkg-prepare pkg-build
pkg-prepare:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i prepare ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) prepare $(NEWLINE))
pkg-build: $(USEPKG:%=pkg-build-%)
pkg-build-%: $(BUILDDEPS)
$(QQ)"$(MAKE)" -C $(RIOTPKG)/$*
pkg-build: $(BUILDDEPS)
$(foreach dir,$(PKG_PATHS),$(QQ)"$(MAKE)" -C $(dir) $(NEWLINE))
clean:
ifndef MAKE_RESTARTS
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i clean ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) clean $(NEWLINE))
-@rm -rf $(BINDIR)
-@rm -rf $(SCANBUILD_OUTPUTDIR)
endif
# Remove intermediates, but keep the .elf, .hex and .map etc.
clean-intermediates:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE))
-@rm -rf $(BINDIR)/*.a $(BINDIR)/*/
clean-pkg:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE))
distclean:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE))
-@rm -rf $(BINDIRBASE)
# Include PROGRAMMER_FLASH/PROGRAMMER_RESET variables

View File

@ -9,6 +9,8 @@
2. [Hardware](#cc1352_launchpad_hardware)
3. [Board pinout](#cc1352_launcpad_pinout)
4. [Flashing the Device](#cc1352_launchpad_flashing)
5. [Accessing RIOT shell](#cc1352_launchpad_shell)
6. [More information](#cc1352_launchpad_moreinfo)
## <a name="cc1352_launchpad_overview"> Overview </a> &nbsp;[[TOC]](#cc1352_launchpad_toc)
@ -63,6 +65,22 @@ export PROGRAMMER=openocd
Now we can just do `make flash` and `make debug`, this all using OpenOCD.
## <a name="cc1352_launchpad_shell"> Accessing RIOT shell </a> &nbsp;[[TOC]](#cc1352_launchpad_toc)
Default RIOT shell access utilize XDS110 debug probe integrated with launchpad board.
It provides virtual serials via USB interface - for connecting to RIOT shell, use
the first one.
If a physical connection to UART is needed, disconnect jumpers RXD and TXD joining
cc1352 microcontroller with XDS110 and connect UART to pin RXD/DIO12 and TXD/DIO13.
The default baud rate is 115 200 - in both connection types.
@warning Launchpad cc1352 board is not 5V tolerant. Use voltage divider or logic
level shifter when connecting to 5V UART.
## <a name="cc1352_launchpad_moreinfo"> More information </a> &nbsp;[[TOC]](#cc1352_launchpad_toc)
For detailed information about CC1352R1 MCUs as well as configuring, compiling
RIOT and installation of flashing tools for CC1352R1 boards,
see \ref cc26xx_cc13xx_riot.

View File

@ -28,7 +28,8 @@
#include "periph/spi.h"
#include "nvram-spi.h"
#include "nvram.h"
#include "xtimer.h"
#include "ztimer.h"
#include "timex.h"
#include "vfs.h"
#include "fs/devfs.h"
#include "mtd_spi_nor.h"
@ -115,7 +116,7 @@ void board_init(void)
/* NVRAM requires xtimer for timing */
xtimer_init();
ztimer_init();
/* Initialize NVRAM */
status = mulle_nvram_init();

View File

@ -198,12 +198,12 @@ static const eth_conf_t eth_config = {
* @{
*/
static const adc_conf_t adc_config[] = {
{GPIO_PIN(PORT_A, 3), 0, 0},
{GPIO_PIN(PORT_C, 0), 0, 1},
{GPIO_PIN(PORT_C, 3), 0, 4},
{GPIO_PIN(PORT_F, 3), 0, 8},
{GPIO_PIN(PORT_F, 5), 0, 11},
{GPIO_PIN(PORT_F, 10), 0, 10},
{GPIO_PIN(PORT_A, 3), 2, 3},
{GPIO_PIN(PORT_C, 0), 2, 10},
{GPIO_PIN(PORT_C, 3), 2, 13},
{GPIO_PIN(PORT_F, 3), 2, 9},
{GPIO_PIN(PORT_F, 5), 2, 15},
{GPIO_PIN(PORT_F, 10), 2, 8},
};
#define ADC_NUMOF ARRAY_SIZE(adc_config)

View File

@ -1,6 +1,6 @@
/**
@defgroup boards_p-nucleo-wb55 STM32 p-nucleo-wb55
@ingroup boards_common_nucleo
@ingroup boards
@brief Support for the STM32 p-nucleo-wb55
Hardware
@ -45,11 +45,7 @@ Flashing the device
-------------------
The ST p-nucleo-wb55 board includes an on-board ST-LINK programmer and can be
flashed using OpenOCD.
@note The latest release of OpenOCD doesn't contain support for this board,
so a recent development version must be built from source to be able to flash
this board.
flashed using OpenOCD (use version 0.11.0 at least).
To flash this board, just use the following command:
@ -102,8 +98,8 @@ Implementation Status
| | RTC | yes | |
| | RNG | yes | |
| | Timer | yes | TIM2 |
| | WDT | no | |
| | USB | no | |
| | WDT | yes | |
| | USB | yes | |
| | PWM | no | |
| | AES | no | |

View File

@ -0,0 +1,40 @@
/**
@defgroup boards_samr34-xpro Microchip SAM R34 Xplained Pro
@ingroup boards
@brief Support for the Microchip SAM R34 Xplained Pro and WLR089 Xplained Pro
## Overview
The `SAMR34 Xplained Pro` is a compact evaluation board by Microchip featuring a
SAMR34J18 SoC. The SoC includes a SAML21 ARM Cortex-M0+ micro-controller
bundled with Semtech's SX1276, a 868/915 MHz LoRa compatible radio.
For programming the MCU comes with 40Kb of RAM and 256Kb of flash memory.
## Hardware
![samr34-xpro image](https://www.microchip.com/content/dam/mchp/mrt-dam/devtools/3072-180605-wpd-dm320111-2.jpg)
An evaluation board for the radio certified WLR089 module exists as the WLR089 Xplained Pro, it is compatible with the `samr34-xpro`.
![wlr089-xpro](https://www.microchip.com/content/dam/mchp/mrt-dam/devtools/3411-264438-1598368489-c14679-200616-wsg-ev23m25a-wlr089-explained-pro-evaluation-board.jpg)
### MCU
| MCU | SAMR34J18B |
|:---------- |:--------------------- |
| Family | ARM Cortex-M0+ |
| Vendor | Atmel |
| RAM | 32 kiB + 8 kiB battery RAM |
| Flash | 256 KiB |
| Frequency | up to 48MHz |
| FPU | no |
| Timers | 6 (3xTC (8,16,32 bit), 3xTCC (16 bit)) |
| ADCs | 1x 12-bit (8 channels)|
| UARTs | max 5 (shared with SPI and I2C) |
| SPIs | max 5 (see UART) |
| I2Cs | max 5 (see UART) |
| Vcc | 1.8V - 3.6V |
| Datasheet | [Datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/SAMR34-R35-Low-Power-LoRa-Sub-GHz-SiP-Data-Sheet-DS70005356B.pdf) |
| Board Manual | [SAM R34 XPro](https://www.microchip.com/en-us/development-tool/DM320111)<br>[WLR089 XPro](https://www.microchip.com/en-us/development-tool/EV23M25A)|
*/

View File

@ -7,9 +7,7 @@
*/
/**
* @defgroup boards_samr34-xpro Microchip SAM R34 Xplained Pro
* @ingroup boards
* @brief Support for the Microchip SAM R34 Xplained Pro board.
* @ingroup boards_samr34-xpro
* @{
*
* @file
@ -32,50 +30,50 @@ extern "C" {
* @name Semtech SX1276 configuration
* @{
*/
#define SX127X_PARAM_SPI (SPI_DEV(0))
#define SX127X_PARAM_SPI_NSS GPIO_PIN(1, 31) /* D10 */
#define SX127X_PARAM_RESET GPIO_PIN(1, 15) /* A0 */
#define SX127X_PARAM_DIO0 GPIO_PIN(1, 16) /* D2 */
#define SX127X_PARAM_DIO1 GPIO_PIN(0, 11) /* D3 */
#define SX127X_PARAM_DIO2 GPIO_PIN(0, 12) /* D4 */
#define SX127X_PARAM_DIO3 GPIO_PIN(1, 17) /* D5 */
#define SX127X_PARAM_PASELECT (SX127X_PA_RFO)
#define SX127X_PARAM_SPI SPI_DEV(0) /**< internal SPI */
#define SX127X_PARAM_SPI_NSS GPIO_PIN(1, 31) /**< D10 */
#define SX127X_PARAM_RESET GPIO_PIN(1, 15) /**< A0 */
#define SX127X_PARAM_DIO0 GPIO_PIN(1, 16) /**< D2 */
#define SX127X_PARAM_DIO1 GPIO_PIN(0, 11) /**< D3 */
#define SX127X_PARAM_DIO2 GPIO_PIN(0, 12) /**< D4 */
#define SX127X_PARAM_DIO3 GPIO_PIN(1, 17) /**< D5 */
#define SX127X_PARAM_PASELECT SX127X_PA_RFO /**< no boost */
/** @}*/
/**
* @name Board specific configuration
* @{
*/
#define TCXO_PWR_PIN GPIO_PIN(PA, 9)
#define TX_OUTPUT_SEL_PIN GPIO_PIN(PA, 13)
#define TCXO_PWR_PIN GPIO_PIN(PA, 9) /**< 32 MHz oscillator for radio enable */
#define TX_OUTPUT_SEL_PIN GPIO_PIN(PA, 13) /**< BAND_SEL */
/** @}*/
/**
* @name LED pin definitions and handlers
* @{
*/
#define LED_PORT PORT->Group[0]
#define LED_PORT PORT->Group[0] /**< GPIO port */
#define LED0_PIN GPIO_PIN(PA, 18)
#define LED0_MASK (1 << 18)
#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
#define LED0_PIN GPIO_PIN(PA, 18) /**< GPIO pin */
#define LED0_MASK (1 << 18) /**< GPIO pin mask */
#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK) /**< enable LED */
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK) /**< disable LED */
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK) /**< toggle LED */
#define LED1_PIN GPIO_PIN(PA, 19)
#define LED1_MASK (1 << 19)
#define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK)
#define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK)
#define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK)
#define LED1_PIN GPIO_PIN(PA, 19) /**< GPIO pin */
#define LED1_MASK (1 << 19) /**< GPIO pin mask */
#define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK) /**< enable LED */
#define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK) /**< disable LED */
#define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK) /**< toggle LED */
/** @} */
/**
* @name BTN0 (SW0 Button) pin definitions
* @{
*/
#define BTN0_PORT PORT->Group[0]
#define BTN0_PIN GPIO_PIN(PA, 28)
#define BTN0_MODE GPIO_IN_PU
#define BTN0_PORT PORT->Group[0] /**< GPIO port */
#define BTN0_PIN GPIO_PIN(PA, 28) /**< GPIO pin */
#define BTN0_MODE GPIO_IN_PU /**< Pull Up GPIO */
/** @} */
/**

View File

@ -29,5 +29,7 @@ config BOARD_STM32F429I_DISC1
select BOARD_HAS_LSE
select HAVE_SAUL_GPIO
select HAVE_ILI9341
select HAVE_STMPE811_I2C
source "$(RIOTBOARD)/common/stm32/Kconfig"

View File

@ -28,7 +28,7 @@ config BOARD_STM32F723E_DISCO
select BOARD_HAS_LSE
select HAVE_SAUL_GPIO
select HAVE_FT6X06
select HAVE_FT5X06
select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC
# Workaround due to stdout only working with stdin enabled
select MODULE_STDIN if TEST_KCONFIG

View File

@ -5,7 +5,7 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
endif
ifneq (,$(filter touch_dev,$(USEMODULE)))
USEMODULE += ft6x06
USEMODULE += ft5x06
endif
# TODO: remove the stdin dependency

View File

@ -68,6 +68,7 @@ extern "C" {
#define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_I, 9) /**< Interrupt pin */
#define FT5X06_PARAM_XMAX (240) /**< Max width */
#define FT5X06_PARAM_YMAX (240) /**< Max height */
#define FT5X06_PARAM_TYPE FT5X06_TYPE_FT6X06 /**< Device type */
/** @} */
/**

View File

@ -29,6 +29,6 @@ config BOARD_STM32F746G_DISCO
select BOARD_HAS_LSE
select HAVE_SAUL_GPIO
select HAVE_FT5336
select HAVE_FT5X06
source "$(RIOTBOARD)/common/stm32/Kconfig"

View File

@ -11,5 +11,5 @@ ifneq (,$(filter disp_dev,$(USEMODULE)))
endif
ifneq (,$(filter touch_dev,$(USEMODULE)))
USEMODULE += ft5336
USEMODULE += ft5x06
endif

View File

@ -73,6 +73,7 @@ extern "C" {
#define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_I, 13) /**< Interrupt pin */
#define FT5X06_PARAM_XMAX (480) /**< Max width */
#define FT5X06_PARAM_YMAX (272) /**< Max height */
#define FT5X06_PARAM_TYPE FT5X06_TYPE_FT5336 /**< Device type */
/** @} */
/**

View File

@ -375,6 +375,9 @@ unsigned msg_avail(void);
* not be NULL.
* @param[in] num Number of ``msg_t`` structures in array.
* **MUST BE POWER OF TWO!**
*
* If array resides on the stack, the containing stack frame must never be
* left, not even if it is the current thread's entry function.
*/
void msg_init_queue(msg_t *array, int num);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
* Copyright (C) 2014-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
@ -75,6 +75,7 @@
* @brief Scheduler API definition
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef SCHED_H
@ -252,6 +253,19 @@ extern clist_node_t sched_runqueues[SCHED_PRIO_LEVELS];
*/
NORETURN void sched_task_exit(void);
/**
* @brief Change the priority of the given thread
*
* @note This functions expects interrupts to be disabled when called!
*
* @pre (thread != NULL)
* @pre (priority < SCHED_PRIO_LEVELS)
*
* @param[in,out] thread target thread
* @param[in] priority new priority to assign to @p thread
*/
void sched_change_priority(thread_t *thread, uint8_t priority);
/**
* @brief Set CPU to idle mode (CPU dependent)
*

View File

@ -444,7 +444,7 @@ const char *thread_getname(kernel_pid_t pid);
*
* Only works if the thread was created with the flag THREAD_CREATE_STACKTEST.
*
* @param[in] stack the stack you want to measure. Try `thread_get_active()->stack_start`
* @param[in] stack the stack you want to measure. Try `thread_get_stackstart(thread_get_active())`
*
* @return the amount of unused space of the thread's stack
*/

View File

@ -19,19 +19,16 @@
* @}
*/
#include <stdint.h>
#include <stdbool.h>
#include <errno.h>
#include "kernel_init.h"
#include "thread.h"
#include <stdbool.h>
#include <stdint.h>
#include "auto_init.h"
#include "irq.h"
#include "kernel_init.h"
#include "log.h"
#include "periph/pm.h"
#ifdef MODULE_AUTO_INIT
#include <auto_init.h>
#endif
#include "thread.h"
#define ENABLE_DEBUG 0
#include "debug.h"
@ -47,9 +44,9 @@ static void *main_trampoline(void *arg)
{
(void)arg;
#ifdef MODULE_AUTO_INIT
auto_init();
#endif
if (IS_USED(MODULE_AUTO_INIT)) {
auto_init();
}
if (!IS_ACTIVE(CONFIG_SKIP_BOOT_MSG)) {
LOG_INFO(CONFIG_BOOT_MSG_STRING "\n");

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
* Copyright (C) 2014-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
@ -15,6 +15,7 @@
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @author René Kijewski <rene.kijewski@fu-berlin.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*
* @}
*/
@ -86,21 +87,21 @@ static void (*sched_cb)(kernel_pid_t active_thread,
* and readout away, switching between the two orders depending on the CLZ
* instruction availability
*/
static inline void _set_runqueue_bit(thread_t *process)
static inline void _set_runqueue_bit(uint8_t priority)
{
#if defined(BITARITHM_HAS_CLZ)
runqueue_bitcache |= BIT31 >> process->priority;
runqueue_bitcache |= BIT31 >> priority;
#else
runqueue_bitcache |= 1 << process->priority;
runqueue_bitcache |= 1 << priority;
#endif
}
static inline void _clear_runqueue_bit(thread_t *process)
static inline void _clear_runqueue_bit(uint8_t priority)
{
#if defined(BITARITHM_HAS_CLZ)
runqueue_bitcache &= ~(BIT31 >> process->priority);
runqueue_bitcache &= ~(BIT31 >> priority);
#else
runqueue_bitcache &= ~(1 << process->priority);
runqueue_bitcache &= ~(1 << priority);
#endif
}
@ -218,41 +219,54 @@ thread_t *__attribute__((used)) sched_run(void)
return next_thread;
}
/* Note: Forcing the compiler to inline this function will reduce .text for applications
* not linking in sched_change_priority(), which benefits the vast majority of apps.
*/
static inline __attribute__((always_inline)) void _runqueue_push(thread_t *thread, uint8_t priority)
{
DEBUG("sched_set_status: adding thread %" PRIkernel_pid " to runqueue %" PRIu8 ".\n",
thread->pid, priority);
clist_rpush(&sched_runqueues[priority], &(thread->rq_entry));
_set_runqueue_bit(priority);
/* some thread entered a runqueue
* if it is the active runqueue
* inform the runqueue_change callback */
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
thread_t *active_thread = thread_get_active();
if (active_thread && active_thread->priority == priority) {
sched_runq_callback(priority);
}
#endif
}
/* Note: Forcing the compiler to inline this function will reduce .text for applications
* not linking in sched_change_priority(), which benefits the vast majority of apps.
*/
static inline __attribute__((always_inline)) void _runqueue_pop(thread_t *thread)
{
DEBUG("sched_set_status: removing thread %" PRIkernel_pid " from runqueue %" PRIu8 ".\n",
thread->pid, thread->priority);
clist_lpop(&sched_runqueues[thread->priority]);
if (!sched_runqueues[thread->priority].next) {
_clear_runqueue_bit(thread->priority);
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
sched_runq_callback(thread->priority);
#endif
}
}
void sched_set_status(thread_t *process, thread_status_t status)
{
if (status >= STATUS_ON_RUNQUEUE) {
if (!(process->status >= STATUS_ON_RUNQUEUE)) {
DEBUG(
"sched_set_status: adding thread %" PRIkernel_pid " to runqueue %" PRIu8 ".\n",
process->pid, process->priority);
clist_rpush(&sched_runqueues[process->priority],
&(process->rq_entry));
_set_runqueue_bit(process);
/* some thread entered a runqueue
* if it is the active runqueue
* inform the runqueue_change callback */
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
thread_t *active_thread = thread_get_active();
if (active_thread && active_thread->priority == process->priority) {
sched_runq_callback(process->priority);
}
#endif
_runqueue_push(process, process->priority);
}
}
else {
if (process->status >= STATUS_ON_RUNQUEUE) {
DEBUG(
"sched_set_status: removing thread %" PRIkernel_pid " from runqueue %" PRIu8 ".\n",
process->pid, process->priority);
clist_lpop(&sched_runqueues[process->priority]);
if (!sched_runqueues[process->priority].next) {
_clear_runqueue_bit(process);
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
sched_runq_callback(process->priority);
#endif
}
_runqueue_pop(process);
}
}
@ -306,3 +320,40 @@ void sched_register_cb(void (*callback)(kernel_pid_t, kernel_pid_t))
sched_cb = callback;
}
#endif
void sched_change_priority(thread_t *thread, uint8_t priority)
{
assert(thread && (priority < SCHED_PRIO_LEVELS));
if (thread->priority == priority) {
return;
}
unsigned irq_state = irq_disable();
if (thread_is_active(thread)) {
_runqueue_pop(thread);
_runqueue_push(thread, priority);
}
thread->priority = priority;
irq_restore(irq_state);
thread_t *active = thread_get_active();
if ((active == thread)
|| ((active != NULL) && (active->priority > priority) && thread_is_active(thread))
) {
/* If the change in priority would result in a different decision of
* the scheduler, we need to yield to make sure the change in priority
* takes effect immediately. This can be due to one of the following:
*
* 1) The priority of the thread currently running has been reduced
* (higher numeric value), so that other threads now have priority
* over the currently running.
* 2) The priority of a pending thread has been increased (lower numeric value) so that it
* now has priority over the running thread.
*/
thread_yield_higher();
}
}

View File

@ -92,7 +92,7 @@ uint32_t rtt_get_counter(void)
void rtt_set_counter(uint32_t counter)
{
rtt_alarm -= rtt_offset;
rtt_offset = _rtt_get_counter() + counter;
rtt_offset = _rtt_get_counter() - counter;
rtt_alarm += rtt_offset;
/* re-set the overflow callback */

View File

@ -137,6 +137,9 @@ void reset_handler_default(void)
}
#ifdef CPU_HAS_BACKUP_RAM
#if BACKUP_RAM_HAS_INIT
backup_ram_init();
#endif
if (!cpu_woke_from_backup() ||
CPU_BACKUP_RAM_NOT_RETAINED) {
@ -158,10 +161,7 @@ void reset_handler_default(void)
#endif /* CPU_HAS_BACKUP_RAM */
#ifdef MODULE_MPU_NOEXEC_RAM
/* Mark the RAM non executable. This is a protection mechanism which
* makes exploitation of buffer overflows significantly harder.
*
* This marks the memory region from 0x20000000 to 0x3FFFFFFF as non
/* This marks the memory region from 0x20000000 to 0x3FFFFFFF as non
* executable. This is the Cortex-M SRAM region used for on-chip RAM.
*/
mpu_configure(

View File

@ -18,6 +18,8 @@ config CPU_FAM_ESP32
select HAS_ESP_WIFI_ENTERPRISE
select HAS_PERIPH_ADC_CTRL
select PACKAGE_ESP32_SDK if TEST_KCONFIG
select PACKAGE_ESP32_SDK_LIBS if TEST_KCONFIG
select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
select MODULE_PS if MODULE_SHELL

View File

@ -2,6 +2,9 @@
include $(RIOTCPU)/esp_common/Makefile.dep
USEPKG += esp32_sdk
USEPKG += esp32_sdk_libs
USEMODULE += esp_idf_driver
USEMODULE += esp_idf_esp32
USEMODULE += esp_idf_soc

View File

@ -1,12 +1,3 @@
# check some environment variables first
ifndef ESP32_SDK_DIR
$(info ESP32_SDK_DIR should be defined as /path/to/esp-idf directory)
$(info ESP32_SDK_DIR is set by default to /opt/esp/esp-idf)
export ESP32_SDK_DIR=/opt/esp/esp-idf
endif
ESP_SDK_DIR = $(ESP32_SDK_DIR)
# ESP32 specific flashing options
FLASH_CHIP = esp32
FLASH_MODE ?= dout
@ -35,21 +26,23 @@ INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/esp32
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/heap
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/spi_flash
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/tcpip_adapter
INCLUDES += -I$(ESP32_SDK_DIR)/components/
INCLUDES += -I$(ESP32_SDK_DIR)/components/driver/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/esp32/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/heap/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/esp32/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/include
INCLUDES += -I$(RIOTCPU)/$(CPU)
ifneq (,$(filter esp_eth,$(USEMODULE)))
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet
INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include
endif
CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM
CFLAGS += -DLOG_TAG_IN_BRACKETS
CFLAGS += -D_CONST=const
ifneq (,$(filter pthread,$(USEMODULE)))
# The toolchain provides POSIX type definitions for pthread which
# conflicts with that in RIOT. With the following CFLAGS/CXXFLAGS skip
# the inclusion of the types shipped by the toolchain.
CFLAGS += -D_SYS__PTHREADTYPES_H_
CXXFLAGS += -D_SYS__PTHREADTYPES_H_
endif
LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ld/
LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.ld

View File

@ -408,31 +408,13 @@ export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin
[Back to table of contents](#esp32_toc)
### Installation of ESP-IDF (Espressif IoT Development Framework) {#esp32_installation_of_esp_idf}
### ESP-IDF (Espressif IoT Development Framework) {#esp32_installation_of_esp_idf}
ESP-IDF, the official SDK from Espressif, can be downloaded and installed as GIT repository.
RIOT-OS uses the ESP-IDF, the official SDK from Espressif, as part of the
build. It is downloaded as a package at build-time and there is no need to
install it separately.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cd $HOME/esp
git clone https://github.com/espressif/esp-idf.git
cd esp-idf
git checkout f198339ec09e90666150672884535802304d23ec
git submodule init
git submodule update
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@note Please take care to checkout correct branches which were used for the port. Newer versions
might also work but were not tested.
Since we only use a few header files, ESP-IDF does not need to be compiled in any way. To use the
installed ESP-IDF, just set the variable `ESP32_SDK_DIR` accordingly.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export ESP32_SDK_DIR=$HOME/esp/esp-idf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Back to table of contents](#esp32_toc)
### Installation of esptool.py (ESP flash programmer tool) {#esp32_installation_of_esptool}
### Installation of `esptool.py` (ESP flash programmer tool) {#esp32_installation_of_esptool}
The RIOT port does not work with the `esptool.py` ESP flasher program
available on [GitHub](https://github.com/espressif/esptool) or

View File

@ -28,6 +28,15 @@
extern "C" {
#endif
/**
* @brief SDK version number
*
* Determined with `git describe --tags` in `$ESP32_SDK_DIR`
*/
#if !defined(IDF_VER) || DOXYGEN
#include "esp32_idf_version.h"
#endif
/**
* @name Clock configuration
* @{
@ -102,7 +111,9 @@ extern "C" {
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
#define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4
#ifdef MODULE_NEWLIB_NANO
#define CONFIG_NEWLIB_NANO_FORMAT 1
#endif
#define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000
/**

View File

@ -0,0 +1,73 @@
/*
* Copyright (C) 2022 Gunar Schorcht
*
* 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 cpu_esp32
* @{
*
* @file
* @brief Wrapper for sys/lock.h
*
* @author Gunar Schorcht <gunar@schorcht.net>
*
* This file is a wrapper for sys/lock.h to ensure source code compatibility
* even if retargetable locking is enabled in newlib.
*/
#ifndef SYS_LOCK_H
#define SYS_LOCK_H
#ifndef DOXYGEN
#ifdef __cplusplus
extern "C" {
#endif
#include_next <sys/lock.h>
#if defined(_RETARGETABLE_LOCKING)
/*
* The structured lock type has to be large enough to hold a recursive mutex.
* Since `rmutex.h` cannot be included in this stage of header inclusion,
* `sizeof` cannot be used here and an array of sufficient size has to be
* defined. This is ensured by a `static_assert` in `cpu/esp_common/syscalls.c`.
*/
typedef struct __lock {
void *reserved[2];
} __lock_t;
#endif /* defined(_RETARGETABLE_LOCKING) */
/*
* Declarations for source code compatibility. These functions were used
* in earlier newlib versions. In newer newlib versions, either the
* __lock_* or __retarget_* functions are used. They are still used in
* ESP-IDF.
*/
typedef _LOCK_T _lock_t;
void _lock_init(_lock_t *lock);
void _lock_init_recursive(_lock_t *lock);
void _lock_close(_lock_t *lock);
void _lock_close_recursive(_lock_t *lock);
void _lock_acquire(_lock_t *lock);
void _lock_acquire_recursive(_lock_t *lock);
int _lock_try_acquire(_lock_t *lock);
int _lock_try_acquire_recursive(_lock_t *lock);
void _lock_release(_lock_t *lock);
void _lock_release_recursive(_lock_t *lock);
#ifdef __cplusplus
}
#endif
#endif /* DOXYGEN */
#endif /* SYS_LOCK_H */
/** @} */

View File

@ -28,7 +28,7 @@ extern "C" {
#endif
/** Time since boot in us (64bit version) */
uint64_t system_get_time_64 (void);
int64_t system_get_time_64 (void);
/** initialize system watchdog timer and start it */
void system_wdt_init (void);

View File

@ -82,14 +82,6 @@ struct _pwm_hw_t {
const gpio_t* gpios; /* GPIOs used as channel outputs */
};
#ifdef PWM0_GPIOS
static const gpio_t _pwm_channel_gpios_0[] = PWM0_GPIOS;
#endif
#ifdef PWM1_GPIOS
static const gpio_t _pwm_channel_gpios_1[] = PWM1_GPIOS;
#endif
/* static configuration of PWM devices */
static const struct _pwm_hw_t _pwm_hw[] =
{

View File

@ -24,6 +24,7 @@
#include <string.h>
#include <sys/reent.h>
#include "macros/units.h"
#include "board.h"
#include "esp_attr.h"
#include "exceptions.h"
@ -69,7 +70,6 @@
#define ENABLE_DEBUG 0
#include "debug.h"
#define MHZ 1000000UL
#define STRINGIFY(s) STRINGIFY2(s)
#define STRINGIFY2(s) #s
@ -156,6 +156,9 @@ NORETURN void IRAM call_start_cpu0 (void)
ets_printf("%02x", cpu_id[i]);
}
ets_printf("\n");
extern char* esp_get_idf_version(void);
LOG_STARTUP("ESP-IDF SDK Version %s\n\n", esp_get_idf_version());
#endif
if (reset_reason == DEEPSLEEP_RESET) {
@ -167,7 +170,7 @@ NORETURN void IRAM call_start_cpu0 (void)
LOG_STARTUP("Current clocks in Hz: CPU=%d APB=%d XTAL=%d SLOW=%d\n",
rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()),
rtc_clk_apb_freq_get(), rtc_clk_xtal_freq_get()*MHZ,
rtc_clk_apb_freq_get(), MHZ(rtc_clk_xtal_freq_get()),
rtc_clk_slow_freq_get_hz());
if (IS_ACTIVE(ENABLE_DEBUG)) {
@ -256,7 +259,7 @@ static void IRAM system_clk_init (void)
set to 2 MHz and handled later */
}
uint32_t freq_before = rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()) / MHZ;
uint32_t freq_before = rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()) / MHZ(1);
if (freq_before != CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ) {
/* set configured CPU frequency */
@ -324,7 +327,7 @@ static NORETURN void IRAM system_init (void)
/* print some infos */
LOG_STARTUP("Used clocks in Hz: CPU=%d APB=%d XTAL=%d FAST=%d SLOW=%d\n",
rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()),
rtc_clk_apb_freq_get(), rtc_clk_xtal_freq_get()*MHZ,
rtc_clk_apb_freq_get(), MHZ(rtc_clk_xtal_freq_get()),
RTC_FAST_FREQ_8M_MHZ, rtc_clk_slow_freq_get_hz());
LOG_STARTUP("XTAL calibration value: %d\n", esp_clk_slowclk_cal_get());
LOG_STARTUP("Heap free: %u bytes\n", get_free_heap_size());
@ -333,6 +336,10 @@ static NORETURN void IRAM system_init (void)
/* initialize stdio */
stdio_init();
/* disable buffering in stdio */
setvbuf(_stdout_r(_REENT), NULL, _IONBF, 0);
setvbuf(_stderr_r(_REENT), NULL, _IONBF, 0);
/* trigger static peripheral initialization */
periph_init();

View File

@ -18,8 +18,12 @@
* @}
*/
#include <stdlib.h>
#include <sys/lock.h>
#include <sys/unistd.h>
#include <sys/time.h>
#include "div.h"
#include "esp/common_macros.h"
#include "irq_arch.h"
#include "periph_cpu.h"
@ -27,6 +31,7 @@
#include "syscalls.h"
#include "timex.h"
#include "macros/units.h"
#include "rom/ets_sys.h"
#include "rom/libc_stubs.h"
#include "soc/rtc.h"
@ -43,8 +48,6 @@
#define ENABLE_DEBUG 0
#include "debug.h"
#define MHZ 1000000UL
#ifdef MODULE_ESP_IDF_HEAP
/* if module esp_idf_heap is used, this function has to be defined for ESP32 */
@ -91,6 +94,55 @@ void _exit_r(struct _reent *r, int status)
_exit(status);
}
#if !IS_USED(MODULE_VFS)
int _fcntl_r(struct _reent *r, int fd, int cmd, int arg)
__attribute__((weak,alias("_no_sys_func")));
#endif
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME (clockid_t)1
#endif
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC (clockid_t)4
#endif
int clock_gettime_r(struct _reent *r, clockid_t clock_id, struct timespec *tp)
{
if (tp == NULL) {
r->_errno = EINVAL;
return -1;
}
struct timeval tv;
uint64_t now = 0;
switch (clock_id) {
case CLOCK_REALTIME:
if (_gettimeofday_r(r, &tv, NULL)) {
return -1;
}
tp->tv_sec = tv.tv_sec;
tp->tv_nsec = tv.tv_usec * NS_PER_US;
break;
case CLOCK_MONOTONIC:
now = system_get_time_64();
tp->tv_sec = div_u64_by_1000000(now);
tp->tv_nsec = (now - (tp->tv_sec * US_PER_SEC)) * NS_PER_US;
break;
default:
r->_errno = EINVAL;
return -1;
}
return 0;
}
int clock_gettime(clockid_t clock_id, struct timespec *tp)
{
return clock_gettime_r(_GLOBAL_REENT, clock_id, tp);
}
static int _no_sys_func(struct _reent *r)
{
DEBUG("%s: system function does not exist\n", __func__);
@ -120,8 +172,8 @@ static struct syscall_stub_table s_stub_table =
._calloc_r = &_calloc_r,
._sbrk_r = &_sbrk_r,
._system_r = (int (*)(struct _reent *, const char*))&_no_sys_func,
._raise_r = (void (*)(struct _reent *))&_no_sys_func,
._system_r = (void *)&_no_sys_func,
._raise_r = (void *)&_no_sys_func,
._abort = &_abort,
._exit_r = &_exit_r,
._getpid_r = &_getpid_r,
@ -138,8 +190,8 @@ static struct syscall_stub_table s_stub_table =
._write_r = (int (*)(struct _reent *r, int, const void *, int))&_write_r,
._read_r = (int (*)(struct _reent *r, int, void *, int))&_read_r,
._unlink_r = &_unlink_r,
._link_r = (int (*)(struct _reent *r, const char*, const char*))&_no_sys_func,
._rename_r = (int (*)(struct _reent *r, const char*, const char*))&_no_sys_func,
._link_r = (void *)&_no_sys_func,
._rename_r = (void *)&_no_sys_func,
._lock_init = &_lock_init,
._lock_init_recursive = &_lock_init_recursive,
@ -164,7 +216,7 @@ static struct syscall_stub_table s_stub_table =
void IRAM syscalls_init_arch(void)
{
/* enable the system timer in us (TMG0 is enabled by default) */
TIMER_SYSTEM.config.divider = rtc_clk_apb_freq_get()/MHZ;
TIMER_SYSTEM.config.divider = rtc_clk_apb_freq_get() / MHZ(1);
TIMER_SYSTEM.config.autoreload = 0;
TIMER_SYSTEM.config.enable = 1;
@ -185,7 +237,7 @@ uint32_t system_get_time_ms(void)
return system_get_time_64() / US_PER_MS;
}
uint64_t system_get_time_64(void)
int64_t system_get_time_64(void)
{
uint64_t ret;
/* latch 64 bit timer value before read */

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stddef.h>
#include <stdlib.h>
#include <sys/lock.h>
#include <sys/param.h>
#include "esp_attr.h"

View File

@ -411,8 +411,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._version = ESP_WIFI_OS_ADAPTER_VERSION,
._set_isr = set_isr_wrapper,
#ifdef RIOT_VERSION
._ints_on = (void (*)(unsigned int))xt_ints_on,
._ints_off = (void (*)(unsigned int))xt_ints_off,
._ints_on = (void *)xt_ints_on,
._ints_off = (void *)xt_ints_off,
#else
._ints_on = xt_ints_on,
._ints_off = xt_ints_off,

View File

@ -482,6 +482,11 @@ void IRAM_ATTR esp_restart_noos(void)
}
}
const char* esp_get_idf_version(void)
{
return IDF_VER;
}
/*
* source: /path/to/esp-idf/components/wpa_supplicant/port/os_xtensa.c
*/

View File

@ -309,7 +309,7 @@ IRAM_ATTR void *heap_caps_calloc( size_t n, size_t size, uint32_t caps)
void *r;
r = heap_caps_malloc(n*size, caps);
if (r != NULL) {
bzero(r, n*size);
memset(r, 0, n*size);
}
return r;
}
@ -347,7 +347,7 @@ size_t heap_caps_get_largest_free_block( uint32_t caps )
void heap_caps_get_info( multi_heap_info_t *info, uint32_t caps )
{
bzero(info, sizeof(multi_heap_info_t));
memset(info, 0, sizeof(multi_heap_info_t));
heap_t *heap;
SLIST_FOREACH(heap, &registered_heaps, next) {

View File

@ -290,7 +290,7 @@ inline static uint32_t get_ccount(void)
static IRAM_ATTR __attribute__((noinline)) void get_call_stack(void **callers)
{
const int offset = 2; // Caller is 2 stack frames deeper than we care about
bzero(callers, sizeof(void *) * STACK_DEPTH);
memset(callers, 0, sizeof(void *) * STACK_DEPTH);
TEST_STACK(0);
TEST_STACK(1);
TEST_STACK(2);

View File

@ -9,6 +9,7 @@ config MODULE_ESP_IDF_NVS_FLASH
bool
depends on TEST_KCONFIG
depends on MODULE_ESP_IDF
select MODULE_CPP
select MODULE_MTD
help
Non-volatile storage library.

View File

@ -3,7 +3,6 @@ MODULE=esp_idf_nvs_flash
include $(RIOTBASE)/Makefile.base
CFLAGS += -DESP_PLATFORM
CXXFLAGS += -std=c++11
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES += -I$(ESP32_SDK_DIR)/components/nvs_flash/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/spi_flash/include

View File

@ -4,13 +4,13 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first
INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__
include $(RIOTCPU)/$(CPU)/Makefile.include
INCLUDES += -I$(RIOTBASE)/core/include
INCLUDES += -I$(RIOTBASE)/drivers/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
# This converts INCLUDES to a simply evaluated variable instead of a recursively
# one but only for this module.
INCLUDES := $(PRE_INCLUDES) $(INCLUDES)

View File

@ -0,0 +1,240 @@
/*-
* Copyright (c) 2002 Thomas Moestl <tmm@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef ENDIAN_H
#define ENDIAN_H
#ifdef __cplusplus
extern "C" {
#endif
#include "byteswap.h"
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
#ifndef BYTE_ORDER
#ifdef __IEEE_LITTLE_ENDIAN
#define BYTE_ORDER LITTLE_ENDIAN
#else
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif
#define _UINT8_T_DECLARED
#ifndef _UINT8_T_DECLARED
typedef __uint8_t uint8_t;
#define _UINT8_T_DECLARED
#endif
#define _UINT16_T_DECLARED
#ifndef _UINT16_T_DECLARED
typedef __uint16_t uint16_t;
#define _UINT16_T_DECLARED
#endif
#define _UINT32_T_DECLARED
#ifndef _UINT32_T_DECLARED
typedef __uint32_t uint32_t;
#define _UINT32_T_DECLARED
#endif
#define _UINT64_T_DECLARED
#ifndef _UINT64_T_DECLARED
typedef __uint64_t uint64_t;
#define _UINT64_T_DECLARED
#endif
/*
* General byte order swapping functions.
*/
#define bswap16(x) __bswap16(x)
#define bswap32(x) __bswap32(x)
#define bswap64(x) __bswap64(x)
/*
* Host to big endian, host to little endian, big endian to host, and little
* endian to host byte order functions as detailed in byteorder(9).
*/
#if 1 //BYTE_ORDER == _LITTLE_ENDIAN
#if __GNUC__ <= 5
#define __bswap16 __bswap_16
#define __bswap32 __bswap_32
#endif
#define htobe16(x) bswap16((x))
#define htobe32(x) bswap32((x))
#define htobe64(x) bswap64((x))
#define htole16(x) ((uint16_t)(x))
#define htole32(x) ((uint32_t)(x))
#define htole64(x) ((uint64_t)(x))
#define be16toh(x) bswap16((x))
#define be32toh(x) bswap32((x))
#define be64toh(x) bswap64((x))
#define le16toh(x) ((uint16_t)(x))
#define le32toh(x) ((uint32_t)(x))
#define le64toh(x) ((uint64_t)(x))
#ifndef htons
#define htons htobe16
#endif //htons
#else /* _BYTE_ORDER != _LITTLE_ENDIAN */
#define htobe16(x) ((uint16_t)(x))
#define htobe32(x) ((uint32_t)(x))
#define htobe64(x) ((uint64_t)(x))
#define htole16(x) bswap16((x))
#define htole32(x) bswap32((x))
#define htole64(x) bswap64((x))
#define be16toh(x) ((uint16_t)(x))
#define be32toh(x) ((uint32_t)(x))
#define be64toh(x) ((uint64_t)(x))
#define le16toh(x) bswap16((x))
#define le32toh(x) bswap32((x))
#define le64toh(x) bswap64((x))
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
#define INLINE __inline__
static INLINE uint16_t
be16dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return ((p[0] << 8) | p[1]);
}
static INLINE uint32_t
be32dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
}
static INLINE uint64_t
be64dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((uint64_t)be32dec(p) << 32) | be32dec(p + 4));
}
static INLINE uint16_t
le16dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return ((p[1] << 8) | p[0]);
}
static INLINE uint32_t
le32dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((unsigned)p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
}
static INLINE uint64_t
le64dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((uint64_t)le32dec(p + 4) << 32) | le32dec(p));
}
static INLINE void
be16enc(void *pp, uint16_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = (u >> 8) & 0xff;
p[1] = u & 0xff;
}
static INLINE void
be32enc(void *pp, uint32_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = (u >> 24) & 0xff;
p[1] = (u >> 16) & 0xff;
p[2] = (u >> 8) & 0xff;
p[3] = u & 0xff;
}
static INLINE void
be64enc(void *pp, uint64_t u)
{
uint8_t *p = (uint8_t *)pp;
be32enc(p, (uint32_t)(u >> 32));
be32enc(p + 4, (uint32_t)(u & 0xffffffffU));
}
static INLINE void
le16enc(void *pp, uint16_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = u & 0xff;
p[1] = (u >> 8) & 0xff;
}
static INLINE void
le32enc(void *pp, uint32_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = u & 0xff;
p[1] = (u >> 8) & 0xff;
p[2] = (u >> 16) & 0xff;
p[3] = (u >> 24) & 0xff;
}
static INLINE void
le64enc(void *pp, uint64_t u)
{
uint8_t *p = (uint8_t *)pp;
le32enc(p, (uint32_t)(u & 0xffffffffU));
le32enc(p + 4, (uint32_t)(u >> 32));
}
#ifdef __cplusplus
}
#endif
#endif /* ENDIAN_H */

View File

@ -26,6 +26,7 @@ extern "C" {
#include "esp_types.h"
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include "esp_err.h"
@ -213,7 +214,7 @@ char * os_readfile(const char *name, size_t *len);
#endif
#ifndef os_bzero
#define os_bzero(s, n) bzero(s, n)
#define os_bzero(s, n) memset(s, 0, n)
#endif
@ -221,6 +222,7 @@ char * os_readfile(const char *name, size_t *len);
#ifdef _MSC_VER
#define os_strdup(s) _strdup(s)
#else
char *strdup(const char *s);
#define os_strdup(s) strdup(s)
#endif
#endif

View File

@ -4,15 +4,16 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first
INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1
include $(RIOTCPU)/$(CPU)/Makefile.include
INCLUDES += -I$(RIOTBASE)/core/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
# This converts INCLUDES to a simply evaluated variable instead of a recursively
# one but only for this module.
INCLUDES := $(PRE_INCLUDES) $(INCLUDES)

View File

@ -4,16 +4,18 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first
INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1
CFLAGS += -DEAP_PEER_METHOD -DEAP_TLS -DEAP_PEAP -DEAP_TTLS -DEAP_MSCHAPv2 -DUSE_WPA2_TASK
CFLAGS += -Wno-stringop-truncation
include $(RIOTCPU)/$(CPU)/Makefile.include
INCLUDES += -I$(RIOTBASE)/core/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
# This converts INCLUDES to a simply evaluated variable instead of a recursively
# one but only for this module.
INCLUDES := $(PRE_INCLUDES) $(INCLUDES)

View File

@ -4,15 +4,17 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first
INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1
CFLAGS += -Wno-implicit-fallthrough
include $(RIOTCPU)/$(CPU)/Makefile.include
INCLUDES += -I$(RIOTBASE)/core/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
# This converts INCLUDES to a simply evaluated variable instead of a recursively
# one but only for this module.
INCLUDES := $(PRE_INCLUDES) $(INCLUDES)

View File

@ -4,15 +4,16 @@ include $(RIOTBASE)/Makefile.base
# we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto
# is found first
INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa
PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include
CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1
include $(RIOTCPU)/$(CPU)/Makefile.include
INCLUDES += -I$(RIOTBASE)/core/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
# This converts INCLUDES to a simply evaluated variable instead of a recursively
# one but only for this module.
INCLUDES := $(PRE_INCLUDES) $(INCLUDES)

View File

@ -9,5 +9,6 @@ config MODULE_ESP_IDF_NVS_FLASH
bool
depends on TEST_KCONFIG
depends on MODULE_ESP_IDF
select MODULE_CPP
help
Non-volatile storage library.

View File

@ -3,6 +3,5 @@ MODULE=esp_idf_nvs_flash
include $(RIOTBASE)/Makefile.base
CFLAGS += -DESP_PLATFORM -DNVS_CRC_HEADER_FILE=\"crc.h\"
CXXFLAGS += -std=c++11
INCLUDES += -I$(ESP8266_RTOS_SDK_DIR)/components/nvs_flash/include
INCLUDES += -I$(ESP8266_RTOS_SDK_DIR)/components/util/include

View File

@ -25,7 +25,10 @@ USEMODULE += xtensa
# Features used by ESP*
FEATURES_REQUIRED += newlib
FEATURES_REQUIRED += cpp # Vendor code uses C++
ifneq (,$(filter esp_idf_nvs_flash,$(USEMODULE)))
FEATURES_REQUIRED += cpp
endif
ifneq (,$(filter esp_wifi_ap,$(USEMODULE)))
FEATURES_REQUIRED += esp_wifi_ap

View File

@ -81,11 +81,11 @@ CFLAGS += $(if $(findstring dout,$(FLASH_MODE)),-DFLASH_MODE_DOUT=1)
ARCHIVES += -lhal -lg -lc
LINKFLAGS += $(CFLAGS_OPT) $(CFLAGS_DBG)
ifneq ($(CPU),esp8266)
#ifneq ($(CPU),esp8266)
# esp8266 flags are added by the SDK pkg in pkg/esp8266_sdk
LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)
LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)/lib
endif
#LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)
#LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)/lib
#endif
LINKFLAGS += -nostdlib -Wl,-gc-sections -Wl,-static
# use the wrapper functions for calloc to add correct overflow detection missing

View File

@ -6,6 +6,3 @@ CONFIG_MODULE_PRNG_MUSL_LCG=y
CONFIG_MODULE_PERIPH_HWRNG=y
CONFIG_MODULE_PERIPH_UART=y
CONFIG_MODULE_NEWLIB=y
# Vendor code uses C++
CONFIG_MODULE_CPP=y

View File

@ -78,7 +78,7 @@ BaseType_t xTaskCreatePinnedToCore (TaskFunction_t pvTaskCode,
uxPriority,
THREAD_CREATE_WOUT_YIELD |
THREAD_CREATE_STACKTEST,
(thread_task_func_t)pvTaskCode,
(void *)pvTaskCode,
pvParameters, pcName);
DEBUG("pid=%d\n", pid);

View File

@ -88,6 +88,7 @@ static uint32_t _flash_size; /* resulting size of the flash drive in SPI flash *
static esp_rom_spiflash_chip_t* _flashchip = NULL;
#ifdef MCU_ESP8266
/* flash_id determines the flash size in kByte */
static const uint32_t flash_sizes[] = {
256, /* last byte of id is 0x12 */
@ -98,6 +99,7 @@ static const uint32_t flash_sizes[] = {
8 * 1024, /* last byte of id is 0x17 */
16 * 1024 /* last byte of id is 0x18 */
};
#endif
void spi_flash_drive_init (void)
{
@ -460,7 +462,7 @@ const esp_partition_t* esp_partition_find_first(esp_partition_type_t type,
part->address = info->pos.offset;
part->size = info->pos.size;
part->encrypted = info->flags & PART_FLAG_ENCRYPTED;
strncpy(part->label, (const char*)info->label, sizeof(info->label));
strncpy(part->label, (const char*)info->label, sizeof(part->label));
part->label[sizeof(part->label) - 1] = 0x0;
return part;

View File

@ -252,6 +252,77 @@ void IRAM_ATTR _lock_release_recursive(_lock_t *lock)
rmutex_unlock((rmutex_t*)*lock);
}
#if defined(_RETARGETABLE_LOCKING)
/* check whether `struct __lock` is large enough to hold a recursive mutex */
static_assert(sizeof(struct __lock) >= sizeof(rmutex_t),
"struct __lock is too small to hold a recursive mutex of type rmutex_t");
/* definition of locks required by the newlib if retargetable locking is used */
struct __lock __lock___sinit_recursive_mutex;
struct __lock __lock___sfp_recursive_mutex;
struct __lock __lock___atexit_recursive_mutex;
struct __lock __lock___at_quick_exit_mutex;
struct __lock __lock___malloc_recursive_mutex;
struct __lock __lock___env_recursive_mutex;
struct __lock __lock___tz_mutex;
struct __lock __lock___dd_hash_mutex;
struct __lock __lock___arc4random_mutex;
/* map newlib's `__retarget_*` functions to the existing `_lock_*` functions */
void __retarget_lock_init(_LOCK_T *lock)
{
_lock_init(lock);
}
extern void __retarget_lock_init_recursive(_LOCK_T *lock)
{
_lock_init_recursive(lock);
}
void __retarget_lock_close(_LOCK_T lock)
{
_lock_close(&lock);
}
void __retarget_lock_close_recursive(_LOCK_T lock)
{
_lock_close_recursive(&lock);
}
void __retarget_lock_acquire(_LOCK_T lock)
{
_lock_acquire(&lock);
}
void __retarget_lock_acquire_recursive(_LOCK_T lock)
{
_lock_acquire_recursive(&lock);
}
int __retarget_lock_try_acquire(_LOCK_T lock)
{
return _lock_try_acquire(&lock);
}
int __retarget_lock_try_acquire_recursive(_LOCK_T lock)
{
return _lock_try_acquire_recursive(&lock);
}
void __retarget_lock_release(_LOCK_T lock)
{
_lock_release(&lock);
}
void __retarget_lock_release_recursive(_LOCK_T lock)
{
_lock_release(&lock);
}
#endif /* _RETARGETABLE_LOCKING */
/**
* @name Memory allocation functions
*/
@ -284,7 +355,7 @@ void* IRAM_ATTR __wrap__calloc_r(struct _reent *r, size_t count, size_t size)
}
void *result = heap_caps_malloc_default(size_total);
if (result) {
bzero(result, size_total);
memset(result, 0, size_total);
}
return result;
}

View File

@ -3,7 +3,8 @@ USEMODULE += bitfield
USEMODULE += periph
ifneq (,$(filter mci,$(USEMODULE)))
USEMODULE += xtimer
USEMODULE += ztimer
USEMODULE += ztimer_usec
endif
include $(RIOTCPU)/arm7_common/Makefile.dep

View File

@ -9,4 +9,4 @@ config MODULE_MCI
bool "LPC23XX Multimedia Card Interface (MCI) driver"
depends on CPU_FAM_LPC23XX
depends on TEST_KCONFIG
select MODULE_XTIMER
select ZTIMER_USEC

View File

@ -16,7 +16,8 @@
#include <string.h>
#include "cpu.h"
#include "VIC.h"
#include "xtimer.h"
#include "ztimer.h"
#include "timex.h"
#include "diskio.h"
#define ENABLE_DEBUG 0
@ -319,7 +320,7 @@ static void power_on(void)
MCI_POWER = 0x01; /* Power on */
//for (Timer[0] = 10; Timer[0]; ) ; /* 10ms */
xtimer_usleep(1000);
ztimer_sleep(ZTIMER_USEC, 1 * US_PER_MS);
MCI_POWER = 0x03; /* Enable signals */
}
@ -400,12 +401,12 @@ static int send_cmd(unsigned int idx, unsigned long arg, unsigned int rt, unsign
MCI_COMMAND = mc; /* Initiate command transaction */
//Timer[1] = 100;
uint32_t timerstart = xtimer_now_usec();
uint32_t timerstart = ztimer_now(ZTIMER_USEC);
while (1) { /* Wait for end of the cmd/resp transaction */
//if (!Timer[1]) return 0;
if ((xtimer_now_usec() - timerstart) > 10000) {
if ((ztimer_now(ZTIMER_USEC) - timerstart) > 10 * US_PER_MS) {
return 0;
}
@ -459,10 +460,10 @@ static int wait_ready(unsigned short tmr)
{
unsigned long rc;
uint32_t stoppoll = xtimer_now_usec() + tmr * US_PER_MS;
uint32_t stoppoll = ztimer_now(ZTIMER_USEC) + tmr * US_PER_MS;
bool bBreak = false;
while (xtimer_now_usec() < stoppoll/*Timer[0]*/) {
while (ztimer_now(ZTIMER_USEC) < stoppoll/*Timer[0]*/) {
if (send_cmd(CMD13, (unsigned long) CardRCA << 16, 1, &rc) && ((rc & 0x01E00) == 0x00800)) {
bBreak = true;
break;
@ -509,12 +510,12 @@ diskio_sta_t mci_initialize(void)
power_off();
xtimer_usleep(1000);
ztimer_sleep(ZTIMER_USEC, 1 * US_PER_MS);
power_on(); /* Force socket power on */
MCI_CLOCK = 0x100 | (PCLK / MCLK_ID / 2 - 1); /* Set MCICLK = MCLK_ID */
//for (Timer[0] = 2; Timer[0]; );
xtimer_usleep(250);
ztimer_sleep(ZTIMER_USEC, 250);
send_cmd(CMD0, 0, 0, resp); /* Enter idle state */
CardRCA = 0;
@ -522,7 +523,7 @@ diskio_sta_t mci_initialize(void)
/*---- Card is 'idle' state ----*/
/* Initialization timeout of 1000 msec */
uint32_t start = xtimer_now_usec();
uint32_t start = ztimer_now(ZTIMER_USEC);
/* SDC Ver2 */
if (send_cmd(CMD8, 0x1AA, 1, resp) && (resp[0] & 0xFFF) == 0x1AA) {
@ -532,7 +533,7 @@ diskio_sta_t mci_initialize(void)
do {
/* Wait while card is busy state (use ACMD41 with HCS bit) */
/* This loop will take a time. Insert wai_tsk(1) here for multitask envilonment. */
if (xtimer_now_usec() > (start + 1000000/* !Timer[0] */)) {
if (ztimer_now(ZTIMER_USEC) > (start + 1 * US_PER_SEC /* !Timer[0] */)) {
DEBUG("%s, %d: Timeout #1\n", RIOT_FILE_RELATIVE, __LINE__);
goto di_fail;
}
@ -558,9 +559,9 @@ diskio_sta_t mci_initialize(void)
DEBUG("%s, %d: %lX\n", RIOT_FILE_RELATIVE, __LINE__, resp[0]);
/* This loop will take a time. Insert wai_tsk(1) here for multitask envilonment. */
if (xtimer_now_usec() > (start + 1000000/* !Timer[0] */)) {
DEBUG("now: %" PRIu32 ", started at: %" PRIu32 "\n",
xtimer_now_usec(), start);
if (ztimer_now(ZTIMER_USEC) > (start + 1 * US_PER_SEC/* !Timer[0] */)) {
DEBUG("now: %" PRIu32 "us, started at: %" PRIu32 "\n",
(uint32_t) ztimer_now(ZTIMER_USEC), start);
DEBUG("%s, %d: Timeout #2\n", RIOT_FILE_RELATIVE, __LINE__);
goto di_fail;
}

View File

@ -102,11 +102,10 @@ int thread_isr_stack_usage(void)
return -1;
}
static inline void *align_stack(void *stack_start, int *stacksize)
static inline void *align_stack(uintptr_t start, int *stacksize)
{
const size_t alignment = sizeof(uintptr_t);
const uintptr_t align_mask = alignment - 1;
uintptr_t start = (uintptr_t)stack_start;
size_t unalignment = (start & align_mask)
? (alignment - (start & align_mask)) : 0;
start += unalignment;
@ -117,10 +116,9 @@ static inline void *align_stack(void *stack_start, int *stacksize)
char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_start, int stacksize)
{
char *stk;
ucontext_t *p;
stack_start = align_stack(stack_start, &stacksize);
stack_start = align_stack((uintptr_t)stack_start, &stacksize);
VALGRIND_STACK_REGISTER(stack_start, (char *)stack_start + stacksize);
VALGRIND_DEBUG("VALGRIND_STACK_REGISTER(%p, %p)\n",
@ -128,18 +126,16 @@ char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_sta
DEBUG("thread_stack_init\n");
stk = stack_start;
/* Use intermediate cast to uintptr_t to silence -Wcast-align. The stack
* is aligned to word size above. */
p = (ucontext_t *)(uintptr_t)(stk + (stacksize - sizeof(ucontext_t)));
p = (ucontext_t *)(uintptr_t)((uint8_t *)stack_start + (stacksize - sizeof(ucontext_t)));
stacksize -= sizeof(ucontext_t);
if (getcontext(p) == -1) {
err(EXIT_FAILURE, "thread_stack_init: getcontext");
}
p->uc_stack.ss_sp = stk;
p->uc_stack.ss_sp = stack_start;
p->uc_stack.ss_size = stacksize;
p->uc_stack.ss_flags = 0;
p->uc_link = &end_context;

View File

@ -259,6 +259,7 @@ static int _confirm_op(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
int radio_state = NRF_RADIO->STATE;
switch (op) {
case IEEE802154_HAL_OP_TRANSMIT:
info = ctx;
eagain = (state != STATE_IDLE
&& state != STATE_CCA_BUSY && NRF_RADIO->STATE != RADIO_STATE_STATE_Disabled);

View File

@ -12,7 +12,7 @@ config CPU_ARCH_RISCV
select HAS_NEWLIB
select HAS_PERIPH_CORETIMER
select HAS_PICOLIBC if '$(RIOT_CI_BUILD)' != '1'
#select HAS_RUST_TARGET
select HAS_RUST_TARGET
select HAS_SSP
select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG

View File

@ -8,7 +8,7 @@ FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += periph_coretimer
#FEATURES_PROVIDED += rust_target
FEATURES_PROVIDED += rust_target
FEATURES_PROVIDED += ssp
# RISC-V toolchain on CI does not work properly with picolibc yet

View File

@ -35,8 +35,8 @@ SECTIONS
__stack_size = DEFINED(__stack_size) ? __stack_size : 256;
/* Populate information about rom size */
_srom = ORIGIN(rom);
_erom = ORIGIN(rom) + LENGTH(rom);
_srom = ORIGIN(flash);
_erom = ORIGIN(flash) + LENGTH(flash);
.init :
{
@ -220,5 +220,5 @@ SECTIONS
.end_fw (NOLOAD) : ALIGN(4) {
_end_fw = . ;
} > rom
} > flash
}

View File

@ -24,6 +24,16 @@ ifneq (,$(filter $(CPU_FAM),f0 f2 f3 f4 f7 l0 l1 l4 l5 u5 wb wl))
endif
endif
STM32_WITH_BKPRAM = stm32f205% stm32f207% stm32f215% stm32f217% \
stm32f405% stm32f407% stm32f415% stm32f417% \
stm32f427% stm32f429% stm32f437% stm32f439% \
stm32f446% stm32f469% stm32f479% \
stm32f7% \
stm32u5%
ifneq (,$(filter $(STM32_WITH_BKPRAM),$(CPU_MODEL)))
FEATURES_PROVIDED += backup_ram
endif
# The f2, f4 and f7 do not support the pagewise api
ifneq (,$(filter $(CPU_FAM),f2 f4 f7))
FEATURES_PROVIDED += periph_flashpage

View File

@ -372,3 +372,43 @@ void cpu_init(void)
_wlx5xx_init_subghz_debug_pins();
}
}
void backup_ram_init(void)
{
/* see reference manual "Battery backup domain" */
#if defined(RCC_APB1ENR_PWREN)
periph_clk_en(APB1, RCC_APB1ENR_PWREN);
#elif defined(RCC_APBENR1_PWREN)
periph_clk_en(APB1, RCC_APBENR1_PWREN);
#elif defined(RCC_APB1ENR1_PWREN)
periph_clk_en(APB1, RCC_APB1ENR1_PWREN);
#elif defined(RCC_AHB3ENR_PWREN)
periph_clk_en(AHB3, RCC_AHB3ENR_PWREN);
#endif
stmclk_dbp_unlock();
#if defined(RCC_AHB1ENR_BKPSRAMEN)
periph_clk_en(AHB1, RCC_AHB1ENR_BKPSRAMEN);
#endif
}
#ifndef BACKUP_RAM_MAGIC
#define BACKUP_RAM_MAGIC {'R', 'I', 'O', 'T'}
#endif
bool cpu_woke_from_backup(void)
{
#if IS_ACTIVE(CPU_HAS_BACKUP_RAM)
static const char _signature[] BACKUP_RAM_DATA = BACKUP_RAM_MAGIC;
/* switch off regulator to save power */
#ifndef RIOTBOOT
pm_backup_regulator_off();
#endif
for (unsigned i = 0; i < sizeof(_signature); i++) {
if (_signature[i] != ((char[])BACKUP_RAM_MAGIC)[i]) {
return false;
}
}
return true;
#endif /* CPU_HAS_BACKUP_RAM */
return false;
}

View File

@ -67,7 +67,7 @@
#elif CPU_FAM_STM32U5
#include "stm32u5xx.h"
#include "irqs/u5/irqs.h"
#define NUM_HEAPS 2
#define NUM_HEAPS 3
#elif CPU_FAM_STM32WB
#include "stm32wbxx.h"
#include "irqs/wb/irqs.h"

View File

@ -0,0 +1,46 @@
/*
* Copyright (C) 2022 Otto-von-Guericke-Universität Magdeburg
*
* 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 cpu_stm32
* @{
*
* @file
* @brief Backup SRAM CPU specific definitions for the STM32 family
*
* @author Fabian Hüßler <fabian.huessler@ovgu.de>
*/
#ifndef PERIPH_CPU_BACKUP_RAM_H
#define PERIPH_CPU_BACKUP_RAM_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Backup RAM must be initialized with @ref backup_ram_init on reset
*/
#define BACKUP_RAM_HAS_INIT 1
/**
* @brief Enable backup RAM access
*/
void backup_ram_init(void);
/**
* @brief Returns true if the CPU woke up from deep sleep (backup/standby)
*/
bool cpu_woke_from_backup(void);
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CPU_BACKUP_RAM_H */
/** @} */

View File

@ -50,6 +50,22 @@ extern "C" {
#endif
/** @} */
/**
* @brief Check whether the backup domain voltage regulator is on
*/
bool pm_backup_regulator_is_on(void);
/**
* @brief Enable the backup domain voltage regulator to retain backup
* register content during standby and VBAT mode
*/
void pm_backup_regulator_on(void);
/**
* @brief Disable the backup domain voltage regulator
*/
void pm_backup_regulator_off(void);
#ifdef __cplusplus
}
#endif

View File

@ -58,6 +58,7 @@
#include "periph/wl/periph_cpu.h"
#endif
#include "periph/cpu_backup_ram.h"
#include "periph/cpu_common.h"
#include "periph/cpu_dma.h"
#include "periph/cpu_eth.h"

View File

@ -22,6 +22,8 @@
#ifndef STMCLK_H
#define STMCLK_H
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -84,6 +86,14 @@ void stmclk_dbp_unlock(void);
*/
void stmclk_dbp_lock(void);
/**
* @brief Check whether write access to the backup domain is locked
*
* @retval true: locked
* @retval false: unlocked
*/
bool stmclk_dbp_is_locked(void);
#ifdef __cplusplus
}
#endif

View File

@ -9,6 +9,7 @@ config CPU_FAM_F2
bool
select CPU_STM32
select CPU_CORE_CORTEX_M3
select HAS_BACKUP_RAM
select HAS_CPU_STM32F2
select HAS_CORTEXM_MPU
select HAS_PERIPH_FLASHPAGE

View File

@ -23,12 +23,14 @@ config CPU_LINE_STM32F401XE
config CPU_LINE_STM32F405XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F407XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ
@ -83,12 +85,14 @@ config CPU_LINE_STM32F413XX
config CPU_LINE_STM32F415XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F417XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F423XX
@ -99,37 +103,44 @@ config CPU_LINE_STM32F423XX
config CPU_LINE_STM32F427XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F429XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F437XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F439XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F446XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F469XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select HAS_PERIPH_HWRNG
select CLOCK_MAX_180MHZ
config CPU_LINE_STM32F479XX
bool
select CPU_FAM_F4
select HAS_BACKUP_RAM
select CLOCK_MAX_180MHZ

View File

@ -9,6 +9,7 @@ config CPU_FAM_F7
bool
select CPU_STM32
select CPU_CORE_CORTEX_M7
select HAS_BACKUP_RAM
select HAS_CPU_STM32F7
select HAS_CORTEXM_MPU
select HAS_PERIPH_FLASHPAGE

View File

@ -9,6 +9,7 @@ config CPU_FAM_U5
bool
select CPU_STM32
select CPU_CORE_CORTEX_M33
select HAS_BACKUP_RAM
select HAS_CPU_STM32U5
select HAS_PERIPH_FLASHPAGE
select HAS_PERIPH_FLASHPAGE_PAGEWISE

View File

@ -31,8 +31,8 @@ SECTIONS
{
.heap2 ALIGN(4) (NOLOAD) :
{
_sheap1 = . ;
_eheap1 = ORIGIN(sram4) + LENGTH(sram4);
_sheap2 = . ;
_eheap2 = ORIGIN(sram4) + LENGTH(sram4);
} > sram4
}

View File

@ -29,6 +29,7 @@
#include "irq.h"
#include "periph/pm.h"
#include "periph/cpu_pm.h"
#include "stmclk.h"
#define ENABLE_DEBUG 0
@ -137,6 +138,7 @@ void pm_set(unsigned mode)
PWR_WUP_REG |= PM_EWUP_CONFIG;
/* Set SLEEPDEEP bit of system control block */
deep = 1;
pm_backup_regulator_on();
break;
#endif
case STM32_PM_STOP:
@ -159,3 +161,61 @@ void pm_set(unsigned mode)
#endif
}
}
/**
* @name Registers and related configuration bits to retain
* the backup domain registers, using the backup regulator
* @{
*/
#if defined(PWR_CSR1_BRE)
#define PWR_BACKUP_REGULATOR_REG PWR->CSR1
#define BKPREG_CONFIG (PWR_CSR1_BRE | PWR_CSR1_EIWUP)
#define BKPREG_READY (PWR_CSR1_BRR)
#elif defined(PWR_CSR_BRE)
#define PWR_BACKUP_REGULATOR_REG PWR->CSR
#define BKPREG_CONFIG (PWR_CSR_BRE)
#define BKPREG_READY (PWR_CSR_BRR)
#elif defined(PWR_CR2_BREN)
#define PWR_BACKUP_REGULATOR_REG PWR->CR2
#define BKPREG_CONFIG (PWR_CR2_BREN)
#define BKPREG_READY (PWR_CR2_BRRDY)
#endif
/** @} */
bool pm_backup_regulator_is_on(void)
{
#if defined(PWR_BACKUP_REGULATOR_REG)
return (PWR_BACKUP_REGULATOR_REG & BKPREG_READY) == BKPREG_READY;
#else
return false;
#endif
}
void pm_backup_regulator_on(void)
{
#if defined(PWR_BACKUP_REGULATOR_REG)
bool locked = stmclk_dbp_is_locked();
if (locked) {
stmclk_dbp_unlock();
}
PWR_BACKUP_REGULATOR_REG |= BKPREG_CONFIG;
while (!(PWR_BACKUP_REGULATOR_REG & BKPREG_READY));
if (locked) {
stmclk_dbp_lock();
}
#endif
}
void pm_backup_regulator_off(void)
{
#if defined(PWR_BACKUP_REGULATOR_REG)
bool locked = stmclk_dbp_is_locked();
if (locked) {
stmclk_dbp_unlock();
}
PWR_BACKUP_REGULATOR_REG &= ~BKPREG_CONFIG;
if (locked) {
stmclk_dbp_lock();
}
#endif
}

View File

@ -192,7 +192,7 @@ int spi_init_cs(spi_t bus, spi_cs_t cs)
}
#ifdef MODULE_PERIPH_SPI_GPIO_MODE
int spi_init_with_gpio_mode(spi_t bus, spi_gpio_mode_t mode)
int spi_init_with_gpio_mode(spi_t bus, const spi_gpio_mode_t* mode)
{
assert(bus < SPI_NUMOF);
@ -203,17 +203,17 @@ int spi_init_with_gpio_mode(spi_t bus, spi_gpio_mode_t mode)
return ret;
#else
if (gpio_is_valid(spi_config[bus].mosi_pin)) {
ret += gpio_init(spi_config[bus].mosi_pin, mode.mosi);
ret += gpio_init(spi_config[bus].mosi_pin, mode->mosi);
gpio_init_af(spi_config[bus].mosi_pin, spi_config[bus].mosi_af);
}
if (gpio_is_valid(spi_config[bus].miso_pin)) {
ret += gpio_init(spi_config[bus].miso_pin, mode.miso);
ret += gpio_init(spi_config[bus].miso_pin, mode->miso);
gpio_init_af(spi_config[bus].miso_pin, spi_config[bus].miso_af);
}
if (gpio_is_valid(spi_config[bus].sclk_pin)) {
ret += gpio_init(spi_config[bus].sclk_pin, mode.sclk);
ret += gpio_init(spi_config[bus].sclk_pin, mode->sclk);
gpio_init_af(spi_config[bus].sclk_pin, spi_config[bus].sclk_af);
}
return ret;

View File

@ -90,6 +90,10 @@ ifeq ($(STM32_TYPE), F)
else ifeq ($(STM32_MODEL3), 7)
RAM_LEN = 128K
endif
ifneq (, $(filter $(STM32_MODEL), 205 207 215 217))
BACKUP_RAM_ADDR = 0x40024000
BACKUP_RAM_LEN = 0x4K
endif
else ifeq ($(STM32_FAMILY), 3)
ifeq ($(STM32_MODEL), 301)
RAM_LEN = 16K
@ -167,6 +171,10 @@ ifeq ($(STM32_TYPE), F)
ifneq (, $(filter $(STM32_MODEL3), 5 7 9))
CCMRAM_LEN = 64K
endif
ifneq (, $(filter $(STM32_MODEL), 405 407 415 417 427 429 437 439 446 469 479))
BACKUP_RAM_ADDR = 0x40024000
BACKUP_RAM_LEN = 0x4K
endif
else ifeq ($(STM32_FAMILY),7)
ifneq (, $(filter $(STM32_MODEL2), 2 3))
RAM_LEN = 256K
@ -175,6 +183,8 @@ ifeq ($(STM32_TYPE), F)
else ifneq (, $(filter $(STM32_MODEL2), 6 7))
RAM_LEN = 512K
endif
BACKUP_RAM_ADDR = 0x40024000
BACKUP_RAM_LEN = 0x4K
endif
else ifeq ($(STM32_TYPE), G)
ifeq ($(STM32_FAMILY), 0)
@ -271,6 +281,8 @@ else ifeq ($(STM32_TYPE), U)
ifneq (, $(filter $(STM32_MODEL2), 7 8))
RAM_LEN = 768K
SRAM4_LEN = 16K
BACKUP_RAM_ADDR = 0x40036400
BACKUP_RAM_LEN = 0x2K
endif
endif
else ifeq ($(STM32_TYPE), W)

View File

@ -115,5 +115,14 @@ void stmclk_dbp_unlock(void)
void stmclk_dbp_lock(void)
{
PWR->REG_PWR_CR &= ~(BIT_CR_DBP);
if (!IS_ACTIVE(CPU_HAS_BACKUP_RAM)) {
/* The DBP must be unlocked all the time, if we modify
backup RAM content by comfortable BACKUP_RAM variables */
PWR->REG_PWR_CR &= ~(BIT_CR_DBP);
}
}
bool stmclk_dbp_is_locked(void)
{
return !(PWR->REG_PWR_CR & BIT_CR_DBP);
}

View File

@ -246,6 +246,11 @@ void stmclk_init_sysclk(void)
/* Wait Until the Voltage Regulator is ready */
while (!(PWR->VOSR & PWR_VOSR_VOSRDY)) {}
/* Backup RAM retention in Standby and VBAT modes:
This bit can be written only when the regulator is LDO,
which must be configured before switching to SMPS */
PWR->BDCR1 |= PWR_BDCR1_BREN;
/* Switch to SMPS regulator instead of LDO */
PWR->CR3 |= PWR_CR3_REGSEL;
while (!(PWR->SVMSR & PWR_SVMSR_REGS)) {}

View File

@ -13,8 +13,10 @@ IOTLAB_ARCHI_nrf52dk = nrf52dk:ble
IOTLAB_ARCHI_nrf52832-mdk = nrf52832mdk:ble
IOTLAB_ARCHI_nrf52840dk = nrf52840dk:multi
IOTLAB_ARCHI_nrf52840-mdk = nrf52840mdk:multi
IOTLAB_ARCHI_nucleo-wl55jc = nucleo-wl55jc:stm32wl
IOTLAB_ARCHI_pba-d-01-kw2x = phynode:kw2xrf
IOTLAB_ARCHI_samr21-xpro = samr21:at86rf233
IOTLAB_ARCHI_samr30-xpro = samr30:at86rf212b
IOTLAB_ARCHI_samr34-xpro = samr34:sx1276
IOTLAB_ARCHI_zigduino = zigduino:atmega128rfa1
IOTLAB_ARCHI := $(IOTLAB_ARCHI_$(BOARD))

View File

@ -228,6 +228,9 @@ def generate_module_compile_commands(path, state, args):
except ValueError:
pass
if args.clangd:
cdetails.cflags.append('-Wno-unknown-warning-option')
c_extra_includes = []
cxx_extra_includes = []
@ -288,14 +291,16 @@ if __name__ == '__main__':
help='Drop the given flag, if present (repeatable)')
parser.add_argument('--clangd', default=False, action='store_const', const=True,
help='Shorthand for --add-built-in-includes --add-libstdxx-includes ' +
'--filter-out=-Wformat-truncation --filter-out=-Wformat-overflow ' +
'--filter-out=-mno-thumb-interwork')
'and some CFLAG adjustments throughy --filter-out, and ignores ' +
'unknown warning flags')
_args = parser.parse_args()
if _args.clangd:
_args.add_built_in_includes = True
_args.add_libstdcxx_includes = True
_args.filter_out = ['-Wformat-truncation', '-Wformat-overflow', '-mno-thumb-interwork',
_args.filter_out = ['-mno-thumb-interwork',
# Only even included for versions of GCC that support it
'-malign-data=natural',
# Only supported starting with clang 11
'-msmall-data-limit=8',
]
generate_compile_commands(_args)

View File

@ -13357,6 +13357,7 @@ drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_RE
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_REG_MODEM_CONFIG2 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1272 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276_WLR089 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member B_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_OFFSET_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.
@ -14368,22 +14369,22 @@ sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_SYSTEM_PORTRANGE_
sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_SYSTEM_PORTRANGE_MIN \(macro definition\) of group net_iana_portrange is not documented\.
sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_USER_PORTRANGE_MAX \(macro definition\) of group net_iana_portrange is not documented\.
sys/include/net/iana/portrange\.h:[0-9]+: warning: Member IANA_USER_PORTRANGE_MIN \(macro definition\) of group net_iana_portrange is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_DST_ADDR_MASK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_LEN \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_SRC_ADDR_MASK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_ACK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_BEACON \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_DATA \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_MACCMD \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_MASK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_MASK \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_V0 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_V1 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCS_LEN \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_MIN_FRAME_LEN \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_1 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_0 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_1 \(macro definition\) of group net_ieee802154 is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_DST_ADDR_MASK \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_LEN \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_SRC_ADDR_MASK \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_ACK \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_BEACON \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_DATA \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_MACCMD \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_TYPE_MASK \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_MASK \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_V0 \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCF_VERS_V1 \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_FCS_LEN \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_MIN_FRAME_LEN \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_1 \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_0 \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/ieee802154\.h:[0-9]+: warning: Member IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_1 \(macro definition\) of group net_ieee802154_header is not documented\.
sys/include/net/lora\.h:[0-9]+: warning: unbalanced grouping commands
sys/include/net/loramac\.h:[0-9]+: warning: unbalanced grouping commands
sys/include/net/mqttsn\.h:[0-9]+: warning: Member MQTTSN_CLI_ID_MAXLEN \(macro definition\) of group net_mqttsn is not documented\.
@ -14705,3 +14706,4 @@ drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE
drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_SHIFT \(macro definition\) of file ft5x06_constants\.h is not documented\.
drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_POLLING \(macro definition\) of file ft5x06_constants\.h is not documented\.
drivers/ft5x06/include/ft5x06_constants\.h:[0-9]+: warning: Member FT5X06_G_MODE_INTERRUPT_TRIGGER \(macro definition\) of file ft5x06_constants\.h is not documented\.
drivers/ft5x06/include/ft5x06_params\.h:[0-9]+: warning: Member FT5X06_PARAM_TYPE \(macro definition\) of file ft5x06_params\.h is not documented\.

View File

@ -144,3 +144,20 @@ instance [0 | Iface: 7 | mop: 2 | ocp: 0 | mhri: 256 | mri 0]
```
This should also be visible in Foren6.
Topology generation
-------------------
To generate a random topology use the `topogen.sh` script.
This will randomly distribute *N* nodes on on a *W* × *H* map.
Each node has a radio range *R* ± *V* where *V* is a random variance that can also be set to 0.
The further away a node is from a sending node, the higher the packet loss probability.
Nodes outside the sending radius have a zero probability of receiving a packet.
If you have `gnuplot` installed this will also generate a plot of the resulting node distribution:
![example topology](https://gist.githubusercontent.com/benpicco/6fd6f7c79a30cbbc41c3a65e53ed3682/raw/33afb859b65d949238129096858d14e2319fb5fb/network.topo.svg)
A light color means that a node only has a one-way connection to the network, gray means a node is
entirely isolated.

View File

@ -16,11 +16,11 @@ else
CRESET=
fi
WIDTH=100
HEIGHT=100
RANGE=30
VARIANCE=15
NUM=10
WIDTH=100 # X dimension of the simulated world
HEIGHT=100 # Y dimension of the simulated world
RANGE=30 # base node radio range
VARIANCE=15 # random offset to radio range
NUM=10 # number of nodes
echo "writing to $FILE"

View File

@ -41,7 +41,8 @@
* The following list of what `DEVELHELP=1` enables is not comprehensive, but
* should give a rough impression of what to expect:
*
* * Many runtime checks are enabled (stack overflow protection, warnings when
* * Many runtime checks are enabled (stack overflow protection by means of
* @ref pseudomodule_mpu_stack_guard or @ref SCHED_TEST_STACK, warnings when
* sending messages to invalid PIDs, …), some of which just log errors to
* stdout, some even halt the system.
* * Some structures contain additional information, e.g. threads store their

View File

@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME =
PROJECT_NAME = "RIOT OS"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@ -275,7 +275,9 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
EXTENSION_MAPPING =
# Python is close enough that we can have Makefile comments starting with `##`
# that are both recognized by Doxygen and comments to Make
EXTENSION_MAPPING = mk=Python
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@ -771,7 +773,8 @@ INPUT = ../../doc.txt \
src/emulators.md \
src/release-cycle.md \
src/changelog.md \
../../LOSTANDFOUND.md
../../LOSTANDFOUND.md \
../../makefiles/pseudomodules.inc.mk
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View File

@ -125,7 +125,7 @@ $ rustup component add --toolchain nightly-2019-12-05 rustfmt rustc-dev
$ cargo +nightly-2019-12-05 install c2rust
$ git clone https://github.com/chrysn-pull-requests/c2rust -b for-riot
$ cd c2rust
$ cargo +nightly-2019-12-05 install --path c2rust
$ cargo +nightly-2019-12-05 install --locked --path c2rust
```
[cargo]: https://doc.rust-lang.org/cargo/

View File

@ -174,7 +174,7 @@ int at_send_cmd(at_dev_t *dev, const char *command, uint32_t timeout)
uart_write(dev->uart, (const uint8_t *)command, cmdlen);
uart_write(dev->uart, (const uint8_t *)CONFIG_AT_SEND_EOL, AT_SEND_EOL_LEN);
if (AT_SEND_ECHO) {
if (!IS_ACTIVE(CONFIG_AT_SEND_SKIP_ECHO)) {
if (at_expect_bytes(dev, command, timeout)) {
return -1;
}

View File

@ -372,7 +372,7 @@ static int _atwinc15x0_get(netdev_t *netdev, netopt_t opt, void *val,
return sizeof(uint16_t);
case NETOPT_RSSI:
assert(max_len == sizeof(int8_t));
assert(max_len == sizeof(int16_t));
_rssi_info_ready = false;
/* trigger the request current RSSI (asynchronous function) */
if (m2m_wifi_req_curr_rssi() != M2M_SUCCESS) {
@ -384,8 +384,8 @@ static int _atwinc15x0_get(netdev_t *netdev, netopt_t opt, void *val,
ztimer_sleep(ZTIMER_MSEC, ATWINC15X0_WAIT_TIME_MS);
}
/* return the RSSI */
*((int8_t *)val) = dev->rssi;
return sizeof(int8_t);
*((int16_t *)val) = dev->rssi;
return sizeof(int16_t);
default:
return netdev_eth_get(netdev, opt, val, max_len);

View File

@ -3,8 +3,13 @@ FEATURES_REQUIRED += periph_uart
FEATURES_OPTIONAL += periph_uart_collision
FEATURES_OPTIONAL += periph_uart_rxstart_irq
ifneq (,$(filter dose_watchdog,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer_periodic
endif
USEMODULE += chunked_ringbuffer
USEMODULE += eui_provider
USEMODULE += iolist
USEMODULE += netdev_eth
USEMODULE += random
USEMODULE += xtimer
USEMODULE += ztimer_usec

View File

@ -1,2 +1,4 @@
USEMODULE_INCLUDES_dose := $(LAST_MAKEFILEDIR)/include
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_dose)
PSEUDOMODULES += dose_watchdog

View File

@ -14,7 +14,7 @@
* @brief Implementation of the Differentially Operated Serial Ethernet driver
*
* @author Juergen Fitschen <me@jue.yt>
*
* Benjamin Valentin <benjamin.valentin@ml-pa.com>
* @}
*/
@ -24,9 +24,11 @@
#include "dose.h"
#include "random.h"
#include "irq.h"
#include "periph/timer.h"
#include "net/eui_provider.h"
#include "net/netdev/eth.h"
#include "timex.h"
#define ENABLE_DEBUG 0
#include "debug.h"
@ -39,7 +41,7 @@ static dose_signal_t state_transit_send(dose_t *ctx, dose_signal_t signal);
static void state(dose_t *ctx, dose_signal_t src);
static void _isr_uart(void *arg, uint8_t c);
static void _isr_gpio(void *arg);
static void _isr_xtimer(void *arg);
static void _isr_ztimer(void *arg);
static void clear_recv_buf(dose_t *ctx);
static void _isr(netdev_t *netdev);
static int _recv(netdev_t *dev, void *buf, size_t len, void *info);
@ -62,6 +64,14 @@ static uint16_t crc16_update(uint16_t crc, uint8_t octet)
return crc;
}
static void _crc_cb(void *ctx, uint8_t *data, size_t len)
{
uint16_t *crc = ctx;
for (uint8_t *end = data + len; data != end; ++data) {
*crc = crc16_update(*crc, *data);
}
}
static void _init_standby(dose_t *ctx, const dose_params_t *params)
{
ctx->standby_pin = params->standby_pin;
@ -107,35 +117,76 @@ static inline void _disable_sense(dose_t *ctx)
#endif
}
#ifdef MODULE_DOSE_WATCHDOG
static unsigned _watchdog_users;
static dose_t *_dose_base;
static uint8_t _dose_numof;
static inline void _watchdog_start(void)
{
if (_watchdog_users) {
return;
}
_watchdog_users++;
timer_start(DOSE_TIMER_DEV);
}
static inline void _watchdog_stop(void)
{
if (_watchdog_users == 0 || --_watchdog_users) {
return;
}
timer_stop(DOSE_TIMER_DEV);
}
static void _dose_watchdog_cb(void *arg, int chan)
{
(void) chan;
(void) arg;
for (unsigned i = 0; i < _dose_numof; ++i) {
dose_t *ctx = &_dose_base[i];
switch (ctx->state) {
case DOSE_STATE_RECV:
if (ctx->recv_buf_ptr_last != ctx->rb.cur) {
ctx->recv_buf_ptr_last = ctx->rb.cur;
break;
}
if (ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY) {
break;
}
DEBUG_PUTS("timeout");
state(&_dose_base[i], DOSE_SIGNAL_ZTIMER);
break;
default:
break;
}
}
}
static void _watchdog_init(unsigned timeout_us)
{
timer_init(DOSE_TIMER_DEV, US_PER_SEC, _dose_watchdog_cb, NULL);
timer_set_periodic(DOSE_TIMER_DEV, 0, timeout_us, TIM_FLAG_RESET_ON_MATCH);
timer_stop(DOSE_TIMER_DEV);
}
#else
static inline void _watchdog_start(void) {}
static inline void _watchdog_stop(void) {}
#endif
static dose_signal_t state_transit_blocked(dose_t *ctx, dose_signal_t signal)
{
uint32_t backoff;
(void) signal;
uint32_t backoff;
if (ctx->state == DOSE_STATE_RECV) {
/* We got here from RECV state. The driver's thread has to look
* if this frame should be processed. By queuing NETDEV_EVENT_ISR,
* the netif thread will call _isr at some time. */
SETBIT(ctx->flags, DOSE_FLAG_RECV_BUF_DIRTY);
netdev_trigger_event_isr(&ctx->netdev);
}
/* Enable interrupt for start bit sensing */
_enable_sense(ctx);
/* The timeout will bring us back into IDLE state by a random time.
* If we entered this state from RECV state, the random time lays
* in the interval [1 * timeout, 2 * timeout]. If we came from
* SEND state, a time in the interval [2 * timeout, 3 * timeout]
* will be picked. This ensures that responding nodes get preferred
* bus access and sending nodes do not overwhelm listening nodes. */
if (ctx->state == DOSE_STATE_SEND) {
backoff = random_uint32_range(2 * ctx->timeout_base, 3 * ctx->timeout_base);
}
else {
backoff = random_uint32_range(1 * ctx->timeout_base, 2 * ctx->timeout_base);
}
xtimer_set(&ctx->timeout, backoff);
backoff = random_uint32_range(0, 2 * ctx->timeout_base);
ztimer_set(ZTIMER_USEC, &ctx->timeout, backoff);
return DOSE_SIGNAL_NONE;
}
@ -145,6 +196,30 @@ static dose_signal_t state_transit_idle(dose_t *ctx, dose_signal_t signal)
(void) ctx;
(void) signal;
_watchdog_stop();
if (ctx->state == DOSE_STATE_RECV) {
bool dirty = ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY;
bool done = ctx->flags & DOSE_FLAG_END_RECEIVED;
/* We got here from RECV state. The driver's thread has to look
* if this frame should be processed. By queuing NETDEV_EVENT_ISR,
* the netif thread will call _isr at some time. */
if (crb_end_chunk(&ctx->rb, !dirty && done)) {
netdev_trigger_event_isr(&ctx->netdev);
}
clear_recv_buf(ctx);
}
/* Enable interrupt for start bit sensing */
_enable_sense(ctx);
/* Execute pending send */
if (ctx->flags & DOSE_FLAG_SEND_PENDING) {
return DOSE_SIGNAL_SEND;
}
return DOSE_SIGNAL_NONE;
}
@ -156,11 +231,14 @@ static dose_signal_t state_transit_recv(dose_t *ctx, dose_signal_t signal)
/* We freshly entered this state. Thus, no start bit sensing is required
* anymore. Disable RX Start IRQs during the transmission. */
_disable_sense(ctx);
_watchdog_start();
crb_start_chunk(&ctx->rb);
}
if (signal == DOSE_SIGNAL_UART) {
/* We received a new octet */
int esc = (ctx->flags & DOSE_FLAG_ESC_RECEIVED);
bool esc = ctx->flags & DOSE_FLAG_ESC_RECEIVED;
bool dirty = ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY;
if (!esc && ctx->uart_octet == DOSE_OCTET_ESC) {
SETBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED);
}
@ -172,19 +250,16 @@ static dose_signal_t state_transit_recv(dose_t *ctx, dose_signal_t signal)
if (esc) {
CLRBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED);
}
/* Since the dirty flag is set after the RECV state is left,
* it indicates that the receive buffer contains unprocessed data
* from a previously received frame. Thus, we just ignore new data. */
if (!(ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY)
&& ctx->recv_buf_ptr < DOSE_FRAME_LEN) {
ctx->recv_buf[ctx->recv_buf_ptr++] = ctx->uart_octet;
if (!dirty && !crb_add_byte(&ctx->rb, ctx->uart_octet)) {
SETBIT(ctx->flags, DOSE_FLAG_RECV_BUF_DIRTY);
}
}
}
if (rc == DOSE_SIGNAL_NONE) {
if (rc == DOSE_SIGNAL_NONE && !IS_ACTIVE(MODULE_DOSE_WATCHDOG)) {
/* No signal is returned. We stay in the RECV state. */
xtimer_set(&ctx->timeout, ctx->timeout_base);
ztimer_set(ZTIMER_USEC, &ctx->timeout, ctx->timeout_base);
}
return rc;
@ -203,8 +278,9 @@ static dose_signal_t state_transit_send(dose_t *ctx, dose_signal_t signal)
* will bring us back to the BLOCKED state after _send has emitted
* its last octet. */
#ifndef MODULE_PERIPH_UART_COLLISION
xtimer_set(&ctx->timeout, ctx->timeout_base);
ztimer_set(ZTIMER_USEC, &ctx->timeout, ctx->timeout_base);
#endif
return DOSE_SIGNAL_NONE;
}
@ -220,16 +296,16 @@ static void state(dose_t *ctx, dose_signal_t signal)
* last 4 bits of a uint8_t, they can be added together and hence
* be checked together. */
switch (ctx->state + signal) {
case DOSE_STATE_INIT + DOSE_SIGNAL_INIT:
case DOSE_STATE_RECV + DOSE_SIGNAL_END:
case DOSE_STATE_RECV + DOSE_SIGNAL_XTIMER:
case DOSE_STATE_SEND + DOSE_SIGNAL_END:
case DOSE_STATE_SEND + DOSE_SIGNAL_XTIMER:
case DOSE_STATE_IDLE + DOSE_SIGNAL_SEND:
signal = state_transit_blocked(ctx, signal);
ctx->state = DOSE_STATE_BLOCKED;
break;
case DOSE_STATE_BLOCKED + DOSE_SIGNAL_XTIMER:
case DOSE_STATE_SEND + DOSE_SIGNAL_END:
case DOSE_STATE_SEND + DOSE_SIGNAL_ZTIMER:
case DOSE_STATE_INIT + DOSE_SIGNAL_INIT:
case DOSE_STATE_RECV + DOSE_SIGNAL_END:
case DOSE_STATE_RECV + DOSE_SIGNAL_ZTIMER:
signal = state_transit_idle(ctx, signal);
ctx->state = DOSE_STATE_IDLE;
break;
@ -243,14 +319,14 @@ static void state(dose_t *ctx, dose_signal_t signal)
ctx->state = DOSE_STATE_RECV;
break;
case DOSE_STATE_IDLE + DOSE_SIGNAL_SEND:
case DOSE_STATE_BLOCKED + DOSE_SIGNAL_ZTIMER:
case DOSE_STATE_SEND + DOSE_SIGNAL_UART:
signal = state_transit_send(ctx, signal);
ctx->state = DOSE_STATE_SEND;
break;
default:
DEBUG("dose state(): unexpected state transition (STATE=0x%02d SIGNAL=0x%02d)\n", ctx->state, signal);
DEBUG("dose state(): unexpected state transition (STATE=0x%02x SIGNAL=0x%02x)\n", ctx->state, signal);
signal = DOSE_SIGNAL_NONE;
}
} while (signal != DOSE_SIGNAL_NONE);
@ -275,18 +351,30 @@ static void _isr_gpio(void *arg)
state(dev, DOSE_SIGNAL_GPIO);
}
static void _isr_xtimer(void *arg)
static void _isr_ztimer(void *arg)
{
dose_t *dev = arg;
state(dev, DOSE_SIGNAL_XTIMER);
switch (dev->state) {
#ifndef MODULE_DOSE_WATCHDOG
case DOSE_STATE_RECV:
#endif
case DOSE_STATE_BLOCKED:
case DOSE_STATE_SEND:
state(dev, DOSE_SIGNAL_ZTIMER);
break;
default:
;
}
}
static void clear_recv_buf(dose_t *ctx)
{
unsigned irq_state = irq_disable();
ctx->recv_buf_ptr = 0;
#ifdef MODULE_DOSE_WATCHDOG
ctx->recv_buf_ptr_last = NULL;
#endif
CLRBIT(ctx->flags, DOSE_FLAG_RECV_BUF_DIRTY);
CLRBIT(ctx->flags, DOSE_FLAG_END_RECEIVED);
CLRBIT(ctx->flags, DOSE_FLAG_ESC_RECEIVED);
@ -295,58 +383,39 @@ static void clear_recv_buf(dose_t *ctx)
static void _isr(netdev_t *netdev)
{
uint8_t dst[ETHERNET_ADDR_LEN];
dose_t *ctx = container_of(netdev, dose_t, netdev);
unsigned irq_state;
int dirty, end;
/* Get current flags atomically */
irq_state = irq_disable();
dirty = (ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY);
end = (ctx->flags & DOSE_FLAG_END_RECEIVED);
irq_restore(irq_state);
/* If the receive buffer does not contain any data just abort ... */
if (!dirty) {
DEBUG("dose _isr(): no frame -> drop\n");
return;
}
/* If we haven't received a valid END octet just drop the incomplete frame. */
if (!end) {
DEBUG("dose _isr(): incomplete frame -> drop\n");
clear_recv_buf(ctx);
return;
}
/* The set dirty flag prevents recv_buf or recv_buf_ptr from being
* touched in ISR context. Thus, it is safe to work with them without
* IRQs being disabled or mutexes being locked. */
size_t len;
/* Check for minimum length of an Ethernet packet */
if (ctx->recv_buf_ptr < sizeof(ethernet_hdr_t) + DOSE_FRAME_CRC_LEN) {
if (!crb_get_chunk_size(&ctx->rb, &len) ||
len < sizeof(ethernet_hdr_t) + DOSE_FRAME_CRC_LEN) {
DEBUG("dose _isr(): frame too short -> drop\n");
clear_recv_buf(ctx);
crb_consume_chunk(&ctx->rb, NULL, 0);
return;
}
/* Check the dst mac addr if the iface is not in promiscuous mode */
if (!(ctx->opts & DOSE_OPT_PROMISCUOUS)) {
ethernet_hdr_t *hdr = (ethernet_hdr_t *) ctx->recv_buf;
if ((hdr->dst[0] & 0x1) == 0 && memcmp(hdr->dst, ctx->mac_addr.uint8, ETHERNET_ADDR_LEN) != 0) {
/* get destination address - length of RX frame has ben checked before */
crb_peek_bytes(&ctx->rb, dst, offsetof(ethernet_hdr_t, dst), sizeof(dst));
/* destination has to be either broadcast or our address */
if ((dst[0] & 0x1) == 0 && memcmp(dst, ctx->mac_addr.uint8, ETHERNET_ADDR_LEN) != 0) {
DEBUG("dose _isr(): dst mac not matching -> drop\n");
clear_recv_buf(ctx);
crb_consume_chunk(&ctx->rb, NULL, 0);
return;
}
}
/* Check the CRC */
uint16_t crc = 0xffff;
for (size_t i = 0; i < ctx->recv_buf_ptr; i++) {
crc = crc16_update(crc, ctx->recv_buf[i]);
}
crb_chunk_foreach(&ctx->rb, _crc_cb, &crc);
if (crc != 0x0000) {
DEBUG("dose _isr(): wrong crc 0x%04x -> drop\n", crc);
clear_recv_buf(ctx);
crb_consume_chunk(&ctx->rb, NULL, 0);
return;
}
@ -361,28 +430,21 @@ static int _recv(netdev_t *dev, void *buf, size_t len, void *info)
(void)info;
size_t pktlen = ctx->recv_buf_ptr - DOSE_FRAME_CRC_LEN;
if (!buf && !len) {
size_t pktlen;
/* Return the amount of received bytes */
return pktlen;
if (crb_get_chunk_size(&ctx->rb, &pktlen)) {
return pktlen - DOSE_FRAME_CRC_LEN;
} else {
return 0;
}
}
else if (!buf && len) {
/* The user drops the packet */
clear_recv_buf(ctx);
return pktlen;
}
else if (len < pktlen) {
/* The provided buffer is too small! */
DEBUG("dose _recv(): receive buffer too small\n");
clear_recv_buf(ctx);
if (crb_consume_chunk(&ctx->rb, buf, len)) {
return len;
} else {
return -1;
}
else {
/* Copy the packet to the provided buffer. */
memcpy(buf, ctx->recv_buf, pktlen);
clear_recv_buf(ctx);
return pktlen;
}
}
static uint8_t wait_for_state(dose_t *ctx, uint8_t state)
@ -451,7 +513,7 @@ static inline void _send_done(dose_t *ctx, bool collision)
#ifdef MODULE_PERIPH_UART_COLLISION
uart_collision_detect_disable(ctx->uart);
if (collision) {
state(ctx, DOSE_SIGNAL_XTIMER);
state(ctx, DOSE_SIGNAL_ZTIMER);
}
#else
(void)ctx;
@ -480,11 +542,13 @@ send:
crc = 0xffff;
pktlen = 0;
/* Switch to state SEND */
do {
wait_for_state(ctx, DOSE_STATE_IDLE);
state(ctx, DOSE_SIGNAL_SEND);
} while (wait_for_state(ctx, DOSE_STATE_ANY) != DOSE_STATE_SEND);
/* Indicate intention to send */
SETBIT(ctx->flags, DOSE_FLAG_SEND_PENDING);
state(ctx, DOSE_SIGNAL_SEND);
/* Wait for transition to SEND state */
wait_for_state(ctx, DOSE_STATE_SEND);
CLRBIT(ctx->flags, DOSE_FLAG_SEND_PENDING);
_send_start(ctx);
@ -667,9 +731,9 @@ static int _init(netdev_t *dev)
/* Set state machine to defaults */
irq_state = irq_disable();
ctx->opts = 0;
ctx->recv_buf_ptr = 0;
ctx->flags = 0;
ctx->state = DOSE_STATE_INIT;
crb_init(&ctx->rb, ctx->recv_buf, sizeof(ctx->recv_buf));
irq_restore(irq_state);
state(ctx, DOSE_SIGNAL_INIT);
@ -688,8 +752,6 @@ static const netdev_driver_t netdev_driver_dose = {
void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index)
{
static const xtimer_ticks32_t min_timeout = {.ticks32 = XTIMER_BACKOFF};
ctx->netdev.driver = &netdev_driver_dose;
mutex_init(&ctx->state_mtx);
@ -710,17 +772,21 @@ void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index)
);
/* The timeout base is the minimal timeout base used for this driver.
* We have to ensure it is above the XTIMER_BACKOFF. Otherwise state
* transitions are triggered from another state transition setting up the
* timeout.
* To calculate how long it takes to transfer one byte we assume
* 8 data bits + 1 start bit + 1 stop bit per byte.
*/
ctx->timeout_base = CONFIG_DOSE_TIMEOUT_BYTES * 10UL * US_PER_SEC / params->baudrate;
if (ctx->timeout_base < xtimer_usec_from_ticks(min_timeout)) {
ctx->timeout_base = xtimer_usec_from_ticks(min_timeout);
}
DEBUG("dose timeout set to %" PRIu32 " µs\n", ctx->timeout_base);
ctx->timeout.callback = _isr_xtimer;
ctx->timeout.callback = _isr_ztimer;
ctx->timeout.arg = ctx;
#ifdef MODULE_DOSE_WATCHDOG
if (index >= _dose_numof) {
_dose_numof = index + 1;
}
if (index == 0) {
_dose_base = ctx;
_watchdog_init(ctx->timeout_base * 2);
}
#endif /* MODULE_DOSE_WATCHDOG */
}

View File

@ -13,97 +13,12 @@ config MODULE_FT5X06
select MODULE_PERIPH_I2C
select MODULE_ZTIMER
select MODULE_ZTIMER_MSEC
config MODULE_FT5606
bool "FT5606 touch panel driver"
select MODULE_FT5X06
config MODULE_FT5X16
bool "FT5X16 touch panel driver"
select MODULE_FT5X06
config MODULE_FT6X06
bool "FT6X06 touch panel driver"
select MODULE_FT5X06
config MODULE_FT6X36
bool "FT6X36 touch panel driver"
select MODULE_FT5X06
config MODULE_FT5X06I
bool "FT5X06I touch panel driver"
select MODULE_FT5X06
config MODULE_FT5336
bool "FT5336 touch panel driver"
select MODULE_FT5X06
config MODULE_FT3316
bool "FT3316 touch panel driver"
select MODULE_FT5X06
config MODULE_FT5436I
bool "FT5436I touch panel driver"
select MODULE_FT5X06
config MODULE_FT5336I
bool "FT5336I touch panel driver"
select MODULE_FT5X06
config MODULE_FT5X46
bool "FT5X46 touch panel driver"
select MODULE_FT5X06
config HAVE_FT5606
bool
select MODULE_FT5606 if MODULE_TOUCH_DEV
help
Indicates that an FT5606 touch panel is present.
This driver is compatible with the following controllers: ft5x06, ft5606, ft5x16, ft6x06,
ft6x36, ft5x06i, ft5336, ft3316, ft5436i, ft5336i and ft5x46.
config HAVE_FT5X16
config HAVE_FT5X06
bool
select MODULE_FT5X16 if MODULE_TOUCH_DEV
select MODULE_FT5X06 if MODULE_TOUCH_DEV
help
Indicates that an FT5X16 touch panel is present.
config HAVE_FT6X06
bool
select MODULE_FT6X06 if MODULE_TOUCH_DEV
help
Indicates that an FT6X06 touch panel is present.
config HAVE_FT6X36
bool
select MODULE_FT6X36 if MODULE_TOUCH_DEV
help
Indicates that an FT6X36 touch panel is present.
config HAVE_FT5X06I
bool
select MODULE_FT5X06I if MODULE_TOUCH_DEV
help
Indicates that an FT5X06I touch panel is present.
config HAVE_FT5336
bool
select MODULE_FT5336 if MODULE_TOUCH_DEV
help
Indicates that an FT5336 touch panel is present.
config HAVE_FT3316
bool
select MODULE_FT3316 if MODULE_TOUCH_DEV
help
Indicates that an FT3316 touch panel is present.
config HAVE_FT5436I
bool
select MODULE_FT5436I if MODULE_TOUCH_DEV
help
Indicates that an FT5436I touch panel is present.
config HAVE_FT5X46
bool
select MODULE_FT5X46 if MODULE_TOUCH_DEV
help
Indicates that an FT5X46 touch panel is present.
Indicates that an FT5X06 touch panel is present.

View File

@ -1,13 +1,2 @@
USEMODULE_INCLUDES_ft5x06 := $(LAST_MAKEFILEDIR)/include
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_ft5x06)
PSEUDOMODULES += ft5606
PSEUDOMODULES += ft5x16
PSEUDOMODULES += ft6x06
PSEUDOMODULES += ft6x36
PSEUDOMODULES += ft5x06i
PSEUDOMODULES += ft5336
PSEUDOMODULES += ft3316
PSEUDOMODULES += ft5436i
PSEUDOMODULES += ft5336i
PSEUDOMODULES += ft5x46

View File

@ -27,6 +27,7 @@
#include "ztimer.h"
#include "ft5x06.h"
#include "ft5x06_internal.h"
#include "ft5x06_constants.h"
#include "ft5x06_params.h"
@ -53,15 +54,24 @@ int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params, ft5x06_event_cb_t
return -EPROTO;
}
if (vendor_id != FT5X06_VENDOR_ID) {
uint8_t expected_id;
if (dev->params.type == FT5X06_TYPE_FT6X06 || dev->params.type == FT5X06_TYPE_FT6X36) {
expected_id = FT6XX6_VENDOR_ID;
}
else {
expected_id = FT5X06_VENDOR_ID;
}
if (expected_id != vendor_id) {
DEBUG("[ft5x06] init: invalid vendor ID: '0x%02x' (expected: 0x%02x)\n",
vendor_id, FT5X06_VENDOR_ID);
vendor_id, expected_id);
i2c_release(FT5X06_BUS);
return -ENODEV;
}
/* Auto-calibrate if needed */
if (IS_ACTIVE(FT5X06_AUTO_CALIB_NEEDED)) {
if (dev->params.type == FT5X06_TYPE_FT5606|| dev->params.type == FT5X06_TYPE_FT5X16 ||
dev->params.type == FT5X06_TYPE_FT5X06I) {
DEBUG("[ft5x06] init: enable device auto-calibration\n");
i2c_write_reg(FT5X06_BUS, FT5X06_ADDR, FT5X06_G_AUTO_CLB_MODE_REG, 0, 0);
}
@ -81,11 +91,9 @@ int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params, ft5x06_event_cb_t
static const uint8_t touch_reg_map[FT5X06_TOUCHES_COUNT_MAX] = {
FT5X06_TOUCH1_XH_REG,
FT5X06_TOUCH2_XH_REG,
#if FT5X06_TOUCHES_COUNT_MAX > 2
FT5X06_TOUCH3_XH_REG,
FT5X06_TOUCH4_XH_REG,
FT5X06_TOUCH5_XH_REG,
#endif
};
int ft5x06_read_touch_positions(const ft5x06_t *dev, ft5x06_touch_position_t *positions, size_t len)
@ -113,7 +121,7 @@ int ft5x06_read_touch_count(const ft5x06_t *dev, uint8_t *count)
i2c_release(FT5X06_BUS);
*count &= FT5X06_TD_STATUS_MASK;
if (*count > FT5X06_TOUCHES_COUNT_MAX) {
if (*count > ft5x06_get_touches_count_max(dev)) {
*count = 0;
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2022 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.
*/
/**
* @{
* @file
* @brief Implementation of internal functions for ft5x06
*
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
* @}
*/
#include <inttypes.h>
#include "ft5x06.h"
#include "ft5x06_internal.h"
uint8_t ft5x06_get_touches_count_max(const ft5x06_t *dev) {
if (dev->params.type == FT5X06_TYPE_FT6X06 || dev->params.type == FT5X06_TYPE_FT6X36) {
return FT6XX6_TOUCHES_COUNT_MAX;
}
else {
return FT5X06_TOUCHES_COUNT_MAX;
}
}

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