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

1061 Commits

Author SHA1 Message Date
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
bors[bot]
718a4513b5
Merge #19368 #19529 #19531
19368: debug: add DEBUG_BREAKPOINT() macro, set breakpoint on failed assertion r=benpicco a=benpicco



19529: cpu/stm32/periph/dac: optimize setting DAC r=benpicco a=Enoch247

### Contribution description

The current implmentation right shifted the 16 bit value passed into `dac_set()` down to the 12 bits that the DAC is actually capable of. This patch drops the shift and instead writes the 16 bit value to the DAC's left aligned 12 bit wide data holding register.


### Testing procedure

do something like:
``` c
#include "perip/dac.h"

int main(void)
{
    dac_set(DAC_LINE(0), 0xffff/2);
    return 0;
}
```
- observe DAC's output is half of vref


### Issues/PRs references

- none known


19531: tests/unittests: allow passing `UNIT_TESTS` via env r=benpicco a=kaspar030



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
2023-05-02 18:08:42 +00:00
5d2948c5fe core: move macros/math.h to core/lib/include/macros 2023-05-02 14:02:15 +02:00
bors[bot]
7213c0ad3e
Merge #19354
19354: core/compiler_hints: add assume() hint r=maribu a=benpicco



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-04-27 15:23:25 +00:00
Benjamin Valentin
a5bc1b3722 core/compiler_hints: fix detection of __builtin_unreachable() 2023-04-27 16:15:16 +02:00
Benjamin Valentin
b2d54b8459 core/assert: set breakpoint on failed assertion 2023-04-27 13:19:17 +02:00
Benjamin Valentin
b88c9c5f1f debug: add DEBUG_BREAKPOINT() macro 2023-04-27 13:19:17 +02:00
Marian Buschsieweke
3e86e39646
core: add core_mutex_debug to aid debugging deadlocks
Adding `USEMODULE += core_mutex_debug` to your `Makefile` results in
on log messages such as

    [mutex] waiting for thread 1 (pc = 0x800024d)

being added whenever `mutex_lock()` blocks. This makes tracing down
deadlocks easier.
2023-04-25 15:10:34 +02:00
Benjamin Valentin
c1f63cafa8 core/compiler_hints: add assume() hint 2023-03-06 20:22:39 +01:00
Keith Packard
0ceb0804b0 core/thread: Fix up stack and TLS alignments
Make sure both the stack and TLS blocks are correctly aligned by
adjusting the TLS base address to the most strict alignment of the TLS
block and the stack.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-03-04 01:18:36 -08:00
Teufelchen1
a8c9af901c core/xfa: disable asan on llvm 2023-02-15 17:41:35 +01:00
Benjamin Valentin
ea799e738d core/init: allow to run callback on main exit 2023-01-20 17:41:30 +01:00
bors[bot]
d11a358b1d
Merge #18472 #19175
18472: drivers/mrf24j40: add support for IEEE 802.15.4 Radio HAL r=benpicco a=jia200x



19175: drivers/periph_common/flashpage: fix silent error r=benpicco a=Enoch247

### Contribution description

This patch removes a test that silently hides failed writes to NULL. Instead, assert is used to ensure that the address is not NULL.


### Testing procedure

I am not certain how to update the tests to catch asserts. If this is possible, I will add a test, if someone will point me to a good example to learn from.


### Issues/PRs references

- none


Co-authored-by: Jose Alamos <jose@alamos.cc>
Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
2023-01-19 18:17:13 +00:00
bors[bot]
71f783f1c8
Merge #19156 #19174
19156: core/compiler_hints: add likely() / unlikely() hints r=kfessel a=benpicco



19174: tests/periph_spi clearly say when init succeeds r=benpicco a=jdavid

When the `tests/periph_spi` program succeeds the output can be interpreted as an error happened.
This PR makes it clearer when it does succeed.

### Contribution description

In `tests/periph_spi`:

- Explicitely say that the init operation was successful
- Rephrase the note to avoid misinterpretations 


### Testing procedure

Run the `tests/periph_spi` program.
There is not much to test, just to verify the output, should be like this:

```
2023-01-19 10:42:33,768 # Trying to initialize SPI_DEV(1): mode: 0, clk: 0, cs_port: 0, cs_pin: 0
2023-01-19 10:42:33,777 # (if below the program crashes with a failed assertion, then it means the configuration is not supported)
2023-01-19 10:42:33,779 # Success.
```


### Issues/PRs references

Issue https://github.com/RIOT-OS/RIOT/issues/19025

Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: J. David Ibáñez <jdavid.ibp@gmail.com>
2023-01-19 15:38:47 +00:00
Jose Alamos
1f30cbc0c5
core/bitarithm: guard BIT1x definition 2023-01-19 15:34:17 +01:00
bors[bot]
d4d91492cd
Merge #18100 #19121 #19164 #19169
18100: core/assert: print backtrace on failed assertion r=kaspar030 a=benpicco



19121: socket_zep: only report size of single datagram r=kaspar030 a=benpicco



19164: cpu/sam0_common: move adc_res_t to common code r=dylad a=benpicco



19169: tests/driver_ws281x: don't overwrite board definition r=benpicco a=benpicco





Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
2023-01-18 23:59:58 +00:00
Benjamin Valentin
6b34691abe core/assert: print backtrace on failed assertion 2023-01-18 01:57:11 +01:00
Benjamin Valentin
2f1d4f5a49 core/assert: mark assert() condition as likely true 2023-01-18 01:17:31 +01:00
Benjamin Valentin
75f666f6b3 core/compiler_hints: add likely() / unlikely() hints 2023-01-18 01:17:31 +01:00
Benjamin Valentin
59f067171f core/init: call vfs_bind_stdio() in early_init() 2023-01-08 22:26:13 +01:00
Benjamin Valentin
092b235845 core/init: add early_init()
Add a function to initialize LEDs and UART in early boot.
2023-01-08 22:25:10 +01:00
Marian Buschsieweke
86fdbd7054
core/lib: Add macros/utils.h header
The macros CONCAT(), MIN(), and MAX() are defined over and over again in
RIOT's code base. This de-duplicates the code by moving the macros to a
common place.
2023-01-07 09:47:44 +01:00
benpicco
1a73fb0593
Merge pull request #18795 from benpicco/irq-track
debug_irq_disable: add module to debug time spent in irq_disable
2022-11-25 19:10:10 +01:00
Benjamin Valentin
59a3e613fe cpu/cortexm_common: measure time spent with IRQ disabled 2022-11-24 21:27:20 +01:00
ad5f02d119
Merge pull request #18955 from maribu/core/mbox/fix-race
core/mbox: fix race condition
2022-11-23 13:09:13 +01:00
Marian Buschsieweke
42b9334784
core/mbox: fix race condition
The mbox code contains a race condition in `mbox_put()`: When it
waits for a slot in the queue to become available, it is woken up with
IRQs enabled. It disables IRQs again as first thing, but by then
another thread may already have preempted the running thread and filled
the queue back up. In this case, a message in the queue would be
silently overwritten.
2022-11-22 22:35:13 +01:00
benpicco
0621150bf0
Merge pull request #18884 from kfessel/p-macro-maybe-unused
core/lib: define MAYBE_UNUSED
2022-11-22 12:54:36 +01:00
Benjamin Valentin
37116d359e core: replace RIOT_FILE_RELATIVE with __FILE__ 2022-11-19 01:48:42 +01:00
Karl Fessel
b4feefa334 core/lib: define MAYBE_UNUSED 2022-11-17 12:26:35 +01:00
Karl Fessel
fe325ecdd2 core/lib: compiler_hints guard NORETURN and PURE 2022-11-17 12:26:35 +01:00
Karl Fessel
045bd7a1a2 core/lib: split kernel defines by its concerns 2022-11-11 13:41:33 +01:00
Karl Fessel
aa31dd7d66 core/macros: rewrite DIV_ROUND, DIV_ROUND_UP; add DIV_ROUND_INF 2022-11-09 17:59:18 +01:00
Benjamin Valentin
8f8bb6ce84 tests/unittests: core: add test for SIGNOF(size_t) 2022-11-09 14:23:51 +01:00
Benjamin Valentin
1eb02f7fda core/macros: fix SIGNOF() macro with size_t 2022-11-04 23:53:15 +01:00
Gunar Schorcht
de632b4df8 core/lib/xfa: fix parameter documentation 2022-11-03 10:25:37 +01:00
Marian Buschsieweke
2d2bb4b308
core/mutex: clean up
This restores a pre-existing design decision to implement both
blocking and non-blocking mutex locking with the same code. Those
implementations have been split prior to the introduction of
the `core_mutex_priority_inheritance` module when `mutex_trylock()`
indeed was trivial. This decision didn't age well, so undo it.
2022-09-29 13:12:33 +02:00
benpicco
4737d8148a
Merge pull request #17702 from benpicco/core/macros/math
core/macros: add math helper macros
2022-09-22 14:14:24 +02:00
Benjamin Valentin
c53051f72f core/macros: add math helper macros 2022-09-21 16:00:26 +02:00
Sören Tempel
80116651c2 core: Treat stack overflows as an unrecoverable error
Presently, RIOT just emits a warning when a stack overflow is
encountered but still resumes execution. In my view, execution should be
aborted as the detection of a stack overflows via the heuristic provided
by the scheduler is an unrecoverable error.

I ran into this while performing automated tests of a RIOT application
where a stack overflow occurred but I only noticed this after inspecting
the application output more closely.

Similar to SSP failures, I added crash_code for stack overflows.
2022-08-12 05:26:22 +02:00
c2a1afa12a
Merge pull request #18606 from jan-mo/fix/20220916__core_msg_queue_print_restore_irq
core/msg.c: irq was not restored properly
2022-09-17 03:45:39 +02:00
Jan Mohr
e0febd08e8 core/msg.c: irq was not restored properly 2022-09-16 15:56:17 +02:00
Gregory Holder
4d4c595185
core/mutex: fix typo in docs 2022-09-16 14:52:13 +02:00
Marian Buschsieweke
6790167a18
Merge pull request #18226 from benpicco/cpu_get_last_instruction
cpu: cpu_print_last_instruction() -> cpu_get_caller_pc()
2022-09-15 20:06:10 +02:00
Benjamin Valentin
7abaae7bbd treewide: fix typos 2022-09-15 12:12:23 +02:00
Benjamin Valentin
ea917f4b07 cpu: cpu_print_last_instruction() -> cpu_get_caller_pc() 2022-09-15 10:49:56 +02:00
Marian Buschsieweke
c07181c1c4
core/mutex: fix priority inheritance on AVR
This fixes https://github.com/RIOT-OS/RIOT/issues/18545 as the code
previously relied on `sched_change_priority()` not directly scheduling
a new thread while IRQs are disabled, but rather later when IRQs are
restored. This is true for Cortex-M MCUs (where the PendSV IRQ is used
to trigger the scheduler), but not e.g. for AVR.
2022-09-12 21:40:54 +02:00
Marian Buschsieweke
d53cd19142
core/sched.c: fix undefined behavior on 8-bit/16-bit
An `1 << x` with `x >= 15` is undefined behavior on 8-bit / 16-bit
machines (which typically have `sizeof(int) == 2`).

Using `1UL << x` is safe for `x <= 31`, which is large enough to make
use of the full 32 bits in `runqueue_bitcache`.

In addition, a `static_assert()` is added to enforce that
`SCHED_PRIO_LEVELS` is never set to anything larger than 32.
2022-09-09 21:55:17 +02:00
Marian Buschsieweke
8be03dc055
core: implement core_mutex_mitigate_priority_inversion 2022-08-05 13:08:52 +02:00
Benjamin Valentin
2e7d35f760 core/kernel_defines: drop CONST definition
This is not used anywhere in RIOT, but causes conflicts with external
library code.

So let's just get rid of this.
2022-06-16 15:26:27 +02:00
Benjamin Valentin
605f77f766 core/assert: print last instruction in assert() 2022-06-12 14:18:53 +02:00
chrysn
bdbde49753 bitarithm: Move extern const out of static inline functions
Workaround-For: https://github.com/immunant/c2rust/issues/423
2022-05-29 13:59:39 +02:00
ebdcccbd99
Merge pull request #16899 from kaspar030/queue_msg_thread_flags_yield_v2
core/msg: yield after thread_flags_wake() in queue_msg()
2022-05-06 19:04:19 +02:00
benpicco
b1715feb03
Merge pull request #17959 from benpicco/core-dummy
core: provide dummy implementation of thread and mutex for riotboot
2022-05-04 14:46:50 +02:00
Benjamin Valentin
8100203e95 core/thread, mutex: provide dummy implementation for riotboot
This is intended for the bootloader module where we don't enter thread
mode, so mutex must never attempt to switch context.

Instead use a simple busy wait that is enough to make the possible mutex
users (e.g. interrupt based SPI) in bootloader mode work.
2022-05-02 13:18:39 +02:00
Marian Buschsieweke
a405599986
core/xfa: Silence clangd warning
Use `uintptr_t` for arithmetic rather than `const char *` to fix the
following warning:

> comparePointers: Subtracting pointers that point to different objects
2022-04-26 22:15:00 +02:00
0c87335a45 core/msg: yield after thread_flags_wake() in queue_msg() 2022-04-21 17:28:41 +02:00
2ba85c1bc8 core: add support for test_utils_print_stack_usage
- activate THREAD_CREATE_STACKTEST also if test_utils_print_stack_usage
  is used

- make thread_measure_stack_free() available unconditionally

- if DEVELHELP is active, call test_utils_print_stack_usage() on any
  thread exit

- if DEVELHELP is active, call test_utils_print_stack_usage() after main
  for the idle thread, if that is used
2022-03-29 21:49:35 +02:00
Leandro Lanzieri
a7cc59d9f0
core/Kconfig: move MODULE_CORE_LIB symbol to fix menuconfig display 2022-03-18 08:23:46 +01:00
d248b2d785 core/lib: hide _XTSTR() from doxygen 2022-03-10 15:35:02 +01:00
003d64dd6c core/lib: add doxygen for LOG_* macros 2022-03-10 10:15:14 +01:00
ca4f1ec05b core/lib: add doxygen for BIT0 - BIT31 2022-03-10 10:03:14 +01:00
f94d72b7fe core: add core_lib to Kconfig 2022-03-09 21:43:05 +01:00
3db7c1150a core: split out library code
This commit splits core into it's scheduler/IPC part and into other code
that is either used or uses the scheduler, through defined APIs.
2022-03-09 21:43:05 +01:00
Martine Lenders
bb89334322
core: add functionality to check queue state of another thread 2022-03-03 16:50:34 +01:00
7c0ddbd1d8
Merge pull request #17472 from chrysn-pull-requests/doc-flags-msgs
core (largely doc): Differentiate message types from thread flags
2022-02-27 21:10:47 +01:00
chrysn
b923fec952 core/thread: Add constant value to check custom flags against
Co-authored-by: benpicco <benpicco@googlemail.com>
2022-02-26 22:17:33 +01:00
chrysn
4bbe0ec42d core/msg doc: No need for system-wide uniqueness 2022-02-26 22:08:31 +01:00
Benjamin Valentin
1bf151f01f core/init: declare board_init() 2022-02-25 15:08:58 +01:00
Karl Fessel
726c461cb5
Merge pull request #17574 from kfessel/p-fix-asserth
core/assert: avoid including panic.h with assert.h
2022-02-15 11:57:55 +01:00
Karl Fessel
ca112c224a core/assert.h: doxygen brief for __NORETURN 2022-02-15 10:34:54 +01:00
Karl Fessel
29caf39a9a core/panic.c: cleanup unneeded includes 2022-02-12 18:30:58 +01:00
Karl Fessel
0b52b3e62e core/assert: remove panic include from assert.h 2022-02-12 18:30:58 +01:00
benpicco
4aa90d3dc6
Merge pull request #16919 from maribu/core/rmutex
core/rmutex: use atomic utils
2022-02-04 11:56:05 +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
chrysn
fef782f735 core/thread doc: Point to helper function 2022-01-20 14:18:40 +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
Marian Buschsieweke
b6b7065ddc
core/rmutex: use atomic utils
Replace use of C11 atomics with atomic utils. This fixes

> error: address argument to atomic operation must be a pointer to a
>        trivially-copyable type ('_Atomic(int) *' invalid)

error when compiling on AVR with LLVM.
2022-01-14 09:52:17 +01:00
Marian Buschsieweke
d4e051596c
core/init: minor code cleanup 2022-01-12 16:15:48 +01:00
chrysn
b4a185132a core/msg: Document caution needed when having queue on the stack 2022-01-11 21:51:14 +01:00
5083061995
Merge pull request #17273 from maribu/core/IS_CT_CONSTANT
core: Add IS_CT_CONSTANT()
2022-01-08 00:21:07 +01:00
Marian Buschsieweke
68424a924c
core: Add IS_CT_CONSTANT()
This adds a simple macro to check (at C level) whether a given
expression is proven to be compile time constant and suitable for
constant folding. This allows writing code like this:

```C
int gpio_read(gpio_t pin) {
    if (IS_CT_CONSTANT(pin)) {
        /* this implementation should even be able to use the port and
         * pin number as immediate in inline assembly */
    }
    else {
        /* less efficient implementation that cannot use port and pin
         * number as immediate in inline assembly */
    }
}
```
2022-01-06 23:30:56 +01:00
8272e4fbd2
Merge pull request #17359 from benpicco/irq_is_in-bool
core: change return type of irq_is_in(), irq_is_enabled() to bool
2022-01-06 18:13:20 +01:00
chrysn
79e0e94312 core/thread doc: Contrast to messages 2022-01-05 19:33:51 +01:00
chrysn
5e7d65fc1f core/thread: Fix documentation
This has been wrong since 317b0133 when a third predefined flag was
removed.
2022-01-05 19:04:35 +01:00
Marian Buschsieweke
8608104fe5
core/kernel_defines.h: drop BUILD_BUG_ON()
This provides the same functionality as `static_assert()` provided by
C11 and has no advantages compared to it. Hence, encourage users to use
standard C functionality instead.
2022-01-05 15:41:39 +01:00