1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

1045 Commits

Author SHA1 Message Date
Benjamin Valentin
02fe256a06 core/thread: don't try to align end of stack 2024-06-04 16:57:05 +02:00
Marian Buschsieweke
e93b5e4b98
core/thread: fix thread_measure_stack_free()
`thread_measure_stack_free()` previously assumed that reading past the
stack is safe. When the stack was indeed part of a thread, the
`thread_t` structure is put after the stack, increasing the odds of
this assumption to hold. However, `thread_measure_stack_free()` could
also be used on the ISR stack, which may be allocated at the end of
SRAM.

A second parameter had to be added to indicate the stack size, so that
reading past the stack can now be prevented.

This also makes valgrind happy on `native`/`native64`.
2024-05-31 19:54:10 +02:00
Mikolai Gütschow
d5d5e9f602
core/lib/assert: consistify output and cleanup documentation 2024-05-27 17:12:49 +02:00
Marian Buschsieweke
2e9ce4d6b4
Merge pull request #20633 from dylad/pr/cpu/cortexm33/add_splim_support
cpu/cortexm: add stack limit support for Cortex-M33
2024-05-06 17:05:20 +00:00
Dylan Laduranty
683d4a249d cpu/cortexm: add stack limit support for CM33
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-05-06 17:14:49 +02:00
benpicco
6c154958a3
Merge pull request #20627 from benpicco/assert-zombi
core/assert: halt running thread instead of panic
2024-04-29 09:16:46 +00:00
Benjamin Valentin
731ada03e5 core/assert: halt running thread instead of panic 2024-04-28 01:43:18 +02:00
Benjamin Valentin
9e0a32e011 core/panic: make reboot on panic configurable 2024-04-26 15:44:49 +02:00
Benjamin Valentin
3359f26689 core/assert: move common code to inline function 2024-04-26 14:07:24 +02:00
Marian Buschsieweke
cf6fa4edf0
tree wide: add IWYU pragma: export where needed
We occasionally have some public `foo.h` header that includes a private
`foo_arch.h` header. Users are expected to include the `foo.h` header
and not the `foo_arch.h`. However, clangd will claim that the `#include`
of `foo.h` is unused if only functions / macros/ types / ... from
`foor_arch.h` is used and nothing from `foo.h`.

This adds the `IWYU pragma: export` comment to the include of
`foo_arch.h` in `foo.h`, so that clangd treats functions / macros /
types provided by `foo_arch.h` as if they were instead provided by
`foo.h`, which fixes the false positives.
2024-04-14 14:26:05 +02:00
MrKevinWeiss
1fcdb107ba
core/lib: guard pm_off 2024-04-02 11:47:50 +02:00
Marian Buschsieweke
04620d471c
Merge pull request #20438 from MrKevinWeiss/pr/kconfig/dep/removal
Remove Kconfig dependency modelling
2024-03-27 16:39:56 +00:00
MrKevinWeiss
e0fdc3c16c
*Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
benpicco
84bf9215b7
Merge pull request #20508 from Teufelchen1/core/guard_pm
core: Guard pm_set_lowest with module_periph_pm
2024-03-26 23:19:46 +00:00
Teufelchen1
e3da305ae2 core: Guard pm_set_lowest with module periph_pm 2024-03-26 19:56:33 +01:00
Teufelchen
52425330a3
Merge pull request #15485 from miri64/mbox/enh/mbox-unset
mbox: provide function to unset initialized mbox
2024-03-19 13:23:22 +00:00
Martine Lenders
12194ad9e6
mbox: provide function to unset initialized mbox 2024-03-19 12:27:33 +01:00
Joshua DeWeese
b6481654ba core/lib/cib: add several new peek functions
This patch adds calls to be able to peek at items other than just the
oldest item in a cib based FIFO. It also adds an "unsafe" peek to match
the existing "unsafe" put and get functions.
2024-03-18 10:14:34 -04:00
Joshua DeWeese
e2b4e4160a core/lib/cib: apply doc best practice
This patch updates the doxygen comments to follow suggested practice of
using retval.
2024-03-12 12:54:46 -04:00
Benjamin Valentin
deaa17cc27 core/init: set _native_retval to retval of main() 2024-03-04 14:41:20 +01:00
Benjamin Valentin
d39dc587f5 core/init: clean up !core_thread init path 2024-02-16 17:14:57 +01:00
Joshua DeWeese
45c1441e4d macros/utils: add ABS() macro
This patch adds the classic ABS() macro to exist along side of the
MAX/MIN macros.
2024-02-08 09:52:22 -05:00
Joshua DeWeese
78a1a18683 macros/utils: add LIMIT() macro
This patch adds a macro that can be used to limit a value to a given
range.
2024-02-08 09:52:22 -05:00
Frederik Haxel
0c2cfe99e6 native64: Add Linux/x86_64 board
Adds a separate board for native64 instead of the `NATIVE_64BIT` workaround.
The files in `boards/native64` are more or less dummy files and just include
the `boards/native` logic (similar to `openlabs-kw41z-mini-256kib`).
The main logic for native is in `makefiles/arch/native.inc.mk`, `cpu/native`
and `boards/native`.

The remaining changes concern the build system, and change native board checks
to native CPU checks to cover both boards.
2024-02-05 22:01:40 +01:00
Marian Buschsieweke
a1d2089e04
Merge pull request #20253 from maribu/tests/periph/uart_locate_pins
tests/periph/uart_locate_pins: new test/utility app
2024-01-18 11:20:02 +00:00
Marian Buschsieweke
b17b2b0444
core/lib/init: skip boot message if stdio_null is used
With `stdio_null` no one is reading the boot message anyway, so let's
safe some ROM.
2024-01-18 10:42:14 +01:00
Frederik Haxel
394cd0e3a8 sys: 64 bit compatibility
* priority_queue_t: Replaced `-1U` literal with PRIORITY_QUEUE_DATA_SIGNALING define
* architecture.h: Added 64-bit
* bloom.h: Fixed typedef for the hashfp_t function pointer
* vfs.h: Increased default vfs buffer sizes for 64 bit
* bytes.h: Check if socklen_t is already defined
* ztimer: Use PRIxPTR format specifier
2024-01-17 16:05:12 +01:00
Frederik Haxel
cb83a2ea8a core: 64 bit compatibility
Only minor changes are required to make the kernel 64 bit compatible.
Most of the changes are either DEBUG/printf formatting or different types for void pointer casting.

The only other change is the type of the `data` member in priority_queue_node_t, as `data` must be able to store a pointer.
For current architectures, the assumption `sizeof(unsigned int) == sizeof(void *)` holds, but not for 64 bit.
Therefore, the type is changed to `uintptr_t', which has the same size for the current architectures, but can also store a pointer in 64 bits.
2024-01-15 10:16:30 +01:00
benpicco
31da90ea7f
Merge pull request #20246 from benpicco/microkernel
doc/mainpage: don't claim to be a microkernel
2024-01-12 08:37:49 +00:00
Benjamin Valentin
ce36ca50ab core/panic: fix build with !periph_pm 2024-01-11 21:21:30 +01:00
Benjamin Valentin
ca97f8ab2b doc/mainpage: don't claim to be a microkernel
We are clearly not and this just sets wrong expectations.
2024-01-11 16:59:50 +01:00
benpicco
2e3037c3aa
Merge pull request #20240 from benpicco/cpu/atmega-no_thread
cpu/avr8_common: fix build with !core_thread
2024-01-09 22:13:30 +00:00
Benjamin Valentin
b9a76ea094 core/init: avoid context switch with !core_thread 2024-01-09 18:59:28 +01:00
Frederik Haxel
0fe0a6d957 core/mutex: fix debug message for mutex priority inheritance
Fixed wrong variable in debug output in `core/mutex.c` when
using MODULE_CORE_MUTEX_PRIORITY_INHERITANCE.
2023-12-14 16:43:28 +01:00
Marian Buschsieweke
d252eb7395
Merge pull request #19998 from fabian18/gnrc_static_messge_queues
gnrc: make message queues static
2023-12-04 11:21:08 +00:00
Benjamin Valentin
cd79dfb5a8 core/mutex: include cpu.h
This is needed for core_mutex_debug
2023-12-01 19:46:27 +01:00
Fabian Hüßler
85e3988133 core/msg: better DEBUG() in queue_msg 2023-10-22 10:50:00 +02:00
bors[bot]
910e0e28ed
Merge #19963 #19971 #19974 #19975 #19976
19963: sys/event/timeout: add event_timeout_is_pending() r=benpicco a=benpicco



19971: sys/shell/gnrc_netif: Fix a few blockers for sharing ifconfig shell r=benpicco a=yarrick



19974: gnrc_ipv6_ext_frag: _completed: Add comment why list head is not checked for NULL pointer dereference r=benpicco a=miri64

 


19975: pkg/nanocbor: Bump to latest commit r=benpicco a=bergzand

### Contribution description

Not much to see here

Important changes:
- Add stream-like interface for encoder
- Separate functions for number of items left in arrays and maps

### Testing procedure

The usual test should still work

### Issues/PRs references

None

19976: core: Express -1 as ~0 in thread_status_t cast r=benpicco a=SimonIT



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Erik Ekman <eekman@google.com>
Co-authored-by: Martine Lenders <m.lenders@fu-berlin.de>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: SimonIT <simonit.orig@gmail.com>
2023-10-16 15:31:25 +00:00
Marian Buschsieweke
edc43201db
tree-wide: fix typos in doc and comments
This should not change any generated binary
2023-10-16 12:17:48 +02:00
SimonIT
d778e2eb5f
core: Express -1 as ~0 in thread_status_t cast 2023-10-15 23:54:16 +02:00
bors[bot]
f0dc0e7c47
Merge #19606 #19753 #19757
19606: doc: add board selection guide r=benpicco a=maribu

### Contribution description

This adds a board selection guide to the documentation to aid new users picking good hardware for their use case.


19753: cpu/atmega8: new cpu r=benpicco a=hugueslarrive

### Contribution description
Splitted from:
- #19740

### Testing procedure
Tested on atmega8 with:
- #19755

### Issues/PRs references

Dependencies:
- #19752
- #19751


19757: core: fix null pointer dereference r=benpicco a=szsam

Check return values of following functions for null:
  - thread_get
  - thread_get_unchecked



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Hugues Larrive <hlarrive@pm.me>
Co-authored-by: Mingjie Shen <shen497@purdue.edu>
2023-07-05 21:36:31 +00:00
Mingjie Shen
3fad959eb6 core: fix null pointer dereference
Check return values of following functions for null:
  - thread_get
  - thread_get_unchecked
2023-07-05 14:50:27 -04:00
bors[bot]
755442fe27
Merge #19712
19712: cpu/riscv: Add PMP driver r=MrKevinWeiss a=Teufelchen1

### Contribution description

Hi! 🐘 

this adds a basic RISC-V physical memory protection (PMP) driver to RIOT. Well, 'driver' might be a stretched, feels more like a little utility :)

EDIT: Also added  a no-execute RAM option for the hifive & a corresponding test

Since I only have an Hifive rev b, it's only enabled on this board / cpu. I also tested the code on an ESP32-C but the feature can't be enabled there, as `cpu/riscv_common/` is not used by the ESP32...

### Testing procedure

* Grab a hifive rev b
* go to `examples/hello-world`
* Add `USEMODULES += periph_pmp` to the `Makefile`
* Include `pmp.h` in `main.c`
* Add code e.g. `print_pmpcfg(0);`
* compile & flash & term 

You should see something like this:
```
# Hello World!
# You are running RIOT on a(n) hifive1b board.
# This board features a(n) fe310 MCU.
# pmp00cfg: - R-X OFF   0x00000000 - 0x00000000
```



Co-authored-by: Teufelchen1 <bennet.blischke@outlook.com>
2023-06-29 09:57:31 +00:00
Teufelchen1
0e839654e8 cpu/riscv: Add PMP driver 2023-06-28 11:55:34 +02:00
Gunar Schorcht
c9a9a5901b core/lib: do not use DEBUG_BREAKPOINT by default 2023-06-27 17:04:27 +02:00
bors[bot]
a272abb15d
Merge #19618 #19639 #19644 #19649 #19656
19618: cpu/stm32: fix riotboot settings for L4 and WB r=benpicco a=gschorcht

### Contribution description

This PR fixes the `riotboot` configuration for L4 and WB.

The family is not called `stm32l4` or `stm32wb` but `l4` and `wb`. That is, the `riotboot` configuration didn't work at all. Furthermore, a minimum `RIOTBOOT_LEN` of `0x2000` is required for L4.

Found when investigating the compilation errors for `bootloaders/riotboot_serial` in PR #19576.

### Testing procedure

1. Green CI.
2. Use the following commands:
    ```
    BOARD=nucleo-l496zg make -C tests/riotboot info-debug-variable-RIOTBOOT_HDR_LEN
    BOARD=p-nucleo-wb55 make -C tests/riotboot info-debug-variable-RIOTBOOT_HDR_LEN
    ```
    In master these commands give
    ```
    0x400
    ```
    With this PR these commands give
    ```
    0x200
    ```
    as expected.
3. Use the following commands:
    ```
    BOARD=nucleo-l496zg make -C tests/riotboot info-debug-variable-RIOTBOOT_LEN
    BOARD=p-nucleo-wb55 make -C tests/riotboot info-debug-variable-RIOTBOOT_LEN
    ```
    In master these commands give
    ```
    0x1000
    ```
    With this PR these commands give
    ```
    0x2000
    ```
    as expected.

### Issues/PRs references


19639: tests/net/gnrc_mac_timeout: add automated test r=aabadie a=aabadie



19644: gnrc_ipv6_nib: include RIO with all subnets in downstream RA r=benpicco a=benpicco



19649: gnrc_sixlowpan_iphc: prefix bits outside context must be zero r=benpicco a=benpicco



19656: gnrc/ipv6_auto_subnets: allow to configure minimal prefix length r=benpicco a=benpicco



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-05-23 20:02:58 +00:00
Benjamin Valentin
0ee46e8d42 core/compiler_hints: add may_be_zero() 2023-05-23 17:46:39 +02:00
Benjamin Valentin
abe5949cd2 core/bitarithm: add bitarithm_clzb() 2023-05-23 16:15:25 +02:00
Marian Buschsieweke
aed175b14b
core/thread: drop unused thread_arch_t
No architecture makes use of thread_arch_t anymore, so let's drop it.
2023-05-21 22:17:52 +02:00
ad9baab7f5 core/lib: drop read only XFA's const volatile modifiers 2023-05-04 10:53:08 +02:00