1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00
bors[bot] 7da2817d4c
Merge #20017
20017: tests/core/thread_cooperation: clean up test r=maribu a=maribu

### Contribution description

- add `static` qualifiers where sensible
- drop `volatile` qualifier that was incorrectly used
- add a comment on use of shared memory for inter-thread communication

### Testing procedure

<details><summary><code>make BOARD=nrf52840dk -j -C tests/core/thread_cooperation flash test</code></summary>

```
make: Entering directory '/home/maribu/Repos/software/RIOT/master/tests/core/thread_cooperation'
Building application "tests_thread_cooperation" for "nrf52840dk" with MCU "nrf52".

"make" -C /home/maribu/Repos/software/RIOT/master/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/master/boards/nrf52840dk
"make" -C /home/maribu/Repos/software/RIOT/master/core
"make" -C /home/maribu/Repos/software/RIOT/master/core/lib
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/nrf52
"make" -C /home/maribu/Repos/software/RIOT/master/drivers
"make" -C /home/maribu/Repos/software/RIOT/master/sys
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/nrf52xxxdk
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/nrf52/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/nrf52/vectors
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/nrf5x_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/master/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/master/sys/div
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/nrf5x_common/periph
"make" -C /home/maribu/Repos/software/RIOT/master/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/master/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/master/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tsrb
   text	  data	   bss	   dec	   hex	filename
  10844	   124	 15004	 25972	  6574	/home/maribu/Repos/software/RIOT/master/tests/core/thread_cooperation/bin/nrf52840dk/tests_thread_cooperation.elf
/home/maribu/Repos/software/RIOT/master/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/master/tests/core/thread_cooperation/bin/nrf52840dk/tests_thread_cooperation.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2023-06-12-09:31)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter serial' not 'jlink serial'
swd
Info : J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 20 2022 16:43:31
Info : Hardware version: 1.00
Info : VTarget = 3.300 V
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : [nrf52.cpu] Cortex-M4 r0p1 processor detected
Info : [nrf52.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for nrf52.cpu on 0
Info : Listening on port 33571 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* nrf52.cpu          cortex_m   little nrf52.cpu          unknown
[nrf52.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000838 msp: 0x20000200
Info : nRF52840-xxAA(build code: D0) 1024kB Flash, 256kB RAM
Warn : Adding extra erase range, 0x00002ad8 .. 0x00002fff
auto erase enabled
wrote 10968 bytes from file /home/maribu/Repos/software/RIOT/master/tests/core/thread_cooperation/bin/nrf52840dk/tests_thread_cooperation.elf in 0.710183s (15.082 KiB/s)
verified 10968 bytes in 0.107174s (99.940 KiB/s)
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyACM1" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Connect to serial port /dev/ttyACM1
Welcome to pyterm!
Type '/exit' to exit.
READY
s
START
main(): This is RIOT! (Version: 2023.10-devel-433-g647a1)
[START] compute 12! (factorial).
MAIN: create thread, arg: 1
MAIN: msg to T-2
T-02: alive
T-02: got arg 1
MAIN: create thread, arg: 2
MAIN: msg to T-3
T-03: alive
T-03: got arg 2
MAIN: create thread, arg: 3
MAIN: msg to T-4
T-04: alive
T-04: got arg 3
MAIN: create thread, arg: 4
MAIN: msg to T-5
T-05: alive
T-05: got arg 4
MAIN: create thread, arg: 5
MAIN: msg to T-6
T-06: alive
T-06: got arg 5
MAIN: create thread, arg: 6
MAIN: msg to T-7
T-07: alive
T-07: got arg 6
MAIN: create thread, arg: 7
MAIN: msg to T-8
T-08: alive
T-08: got arg 7
MAIN: create thread, arg: 8
MAIN: msg to T-9
T-09: alive
T-09: got arg 8
MAIN: create thread, arg: 9
MAIN: msg to T-10
T-10: alive
T-10: got arg 9
MAIN: create thread, arg: 10
MAIN: msg to T-11
T-11: alive
T-11: got arg 10
MAIN: create thread, arg: 11
MAIN: msg to T-12
T-12: alive
T-12: got arg 11
MAIN: create thread, arg: 12
MAIN: msg to T-13
T-13: alive
T-13: got arg 12
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-2
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-3
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-4
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-5
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-6
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-7
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-8
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-9
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-10
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-11
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-12
{ "threads": [{ "name": "thread", "stack_size": 1024, "stack_used": 388 }]}
MAIN: reply from T-13
MAIN: 12! = 479001600
[SUCCESS]
```

</details>

### Issues/PRs references

None


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
2023-10-26 19:04:38 +00:00
2023-10-19 19:01:12 +00:00
2023-10-19 19:01:12 +00:00
2023-08-31 14:38:49 +02:00
2023-10-19 19:01:12 +00:00
2020-04-28 11:58:44 +02:00
2023-07-18 12:24:10 +02:00
2021-10-22 10:21:57 +02:00
2017-12-08 09:10:01 +01:00
2022-08-23 09:46:56 +02:00
2023-06-28 11:55:34 +02:00
2023-04-05 11:28:52 +02:00
2023-06-13 15:03:01 +02:00

Nightly CI status master GitHub release License API docs Wiki Stack Overflow questions Twitter Matrix

The friendly Operating System for IoT!

RIOT is a real-time multi-threading operating system that supports a range of devices that are typically found in the Internet of Things (IoT): 8-bit, 16-bit and 32-bit microcontrollers.

RIOT is based on the following design principles: energy-efficiency, real-time capabilities, small memory footprint, modularity, and uniform API access, independent of the underlying hardware (this API offers partial POSIX compliance).

RIOT is developed by an international open source community which is independent of specific vendors (e.g. similarly to the Linux community). RIOT is licensed with LGPLv2.1, a copyleft license which fosters indirect business models around the free open-source software platform provided by RIOT, e.g. it is possible to link closed-source code with the LGPL code.

FEATURES

RIOT provides features including, but not limited to:

  • a preemptive, tickless scheduler with priorities
  • flexible memory management
  • high resolution, long-term timers
  • MTD abstraction layer
  • File System integration
  • support 200+ boards based on AVR, MSP430, ESP8266, ESP32, RISC-V, ARM7 and ARM Cortex-M
  • the native port allows to run RIOT as-is on Linux and BSD. Multiple instances of RIOT running on a single machine can also be interconnected via a simple virtual Ethernet bridge or via a simulated IEEE 802.15.4 network (ZEP)
  • IPv6
  • 6LoWPAN (RFC4944, RFC6282, and RFC6775)
  • UDP
  • RPL (storing mode, P2P mode)
  • CoAP
  • OTA updates via SUIT
  • MQTT
  • USB (device mode)
  • Display / Touchscreen support
  • CCN-Lite
  • LoRaWAN
  • UWB
  • Bluetooth (BLE) via NimBLE

GETTING RIOT

The most convenient way to get RIOT is to clone it via Git

$ git clone https://github.com/RIOT-OS/RIOT

this will ensure that you get all the newest features and bug fixes with the caveat of an ever changing work environment.

If you prefer things more stable, you can download the source code of one of our quarter annual releases via Github as ZIP file or tarball. You can also checkout a release in a cloned Git repository using

$ git pull --tags
$ git checkout <YYYY.MM>

For more details on our release cycle, check our documentation.

GETTING STARTED

  • You want to start the RIOT? Just follow our quickstart guide or try this tutorial. For specific toolchain installation, follow instructions in the getting started page.
  • The RIOT API itself can be built from the code using doxygen. The latest version of the documentation is uploaded daily to doc.riot-os.org.

FORUM

Do you have a question, want to discuss a new feature, or just want to present your latest project using RIOT? Come over to our forum and post to your hearts content.

CONTRIBUTE

To contribute something to RIOT, please refer to our contributing document.

MAILING LISTS

LICENSE

  • Most of the code developed by the RIOT community is licensed under the GNU Lesser General Public License (LGPL) version 2.1 as published by the Free Software Foundation.
  • Some external sources, especially files developed by SICS are published under a separate license.

All code files contain licensing information.

For more information, see the RIOT website:

https://www.riot-os.org

Languages
C 92%
C++ 3%
Makefile 2.6%
Python 2.2%