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

790 Commits

Author SHA1 Message Date
5dbcfa3391
Merge pull request #14698 from benpicco/core/bitarithm-msb_clz
core/bitarithm: use __builtin_clz() for bitarithm_msb()
2020-08-06 13:00:34 +02:00
c9883cebfd core/atomic_c11: fix I2 typedef for 16bit platforms 2020-08-05 14:32:57 +02:00
Marian Buschsieweke
315cdcdb5f
core/thread: Make thread_get inlineable 2020-08-05 10:51:16 +02:00
Benjamin Valentin
14144030fa core/bitarithm: use __builtin_clz() for bitarithm_msb()
The `clz` instruction pretty much implements getting the most significant bit
in hardware, so use it instead of the software implementation.

This reults in both a reduction in code size as in a speedup:

master:

  text    data     bss     dec     hex filename
 14816     136    2424   17376    43e0 tests/bitarithm_timings/bin/same54-xpro/tests_bitarithm_timings.elf

 + bitarithm_msb: 3529411 iterations per second

this patch:

  text    data     bss     dec     hex filename
 14768     136    2424   17328    43b0 tests/bitarithm_timings/bin/same54-xpro/tests_bitarithm_timings.elf

 + bitarithm_msb: 9230761 iterations per second
2020-08-04 17:50:09 +02:00
benpicco
2d4d29367e
Merge pull request #14642 from maribu/fix-byteorder-big-endian
core/byteorder: Fix be byte buffer conversion on big endian systems
2020-07-29 01:25:03 +02:00
Marian Buschsieweke
e4387c84fd
core/byteorder: Fix from/to be buffers on be
Big endian buffers on big endian systems are already in big endian byte order,
so no byte shuffling is needed. However, byte buffers might be unaligned, so
copy operations that are safe with unaligned memory accesses need to be
used.
2020-07-28 22:34:25 +02:00
Martine Lenders
b1bf8ab981
Merge pull request #14565 from bergzand/pr/sched/fix_retrigger
sched: Prevent retriggering the scheduler interrupt during idle sleep
2020-07-28 22:11:25 +02:00
Leandro Lanzieri
72d6d9047f
Merge pull request #14429 from benpicco/core/boot_msg
core/init: make boot message configurable
2020-07-28 16:40:08 +02:00
Benjamin Valentin
25e67e019e core/init: make boot message configurable
It can be desirable to not have the boot message printed each time
(e.g. logs are transferred over a wireless link on battery) while
still retaining the ability to receive INFO level logs.

This adds the option to disable the boot-up message (and also to customize
it if that is desireable).
2020-07-28 11:04:55 +02:00
benpicco
6ef4276c35
Merge pull request #14621 from benpicco/core/byteorder-be
core/byteorder: add Big Endian implementations
2020-07-28 10:30:27 +02:00
d59233baf1
Merge pull request #14556 from benpicco/bitarithm_test_and_clear
core/bitarithm: add bitarithm_test_and_clear()
2020-07-28 10:11:47 +02:00
Benjamin Valentin
df18bfb459 core/byteorder: add Big Endian implementations 2020-07-27 18:36:07 +02:00
Benjamin Valentin
4d34cee72f core: add comments to symbols used by OpenOCD
OpenOCD makes assumptions about those symbol names / enum entries,
so add a note about it as a comment.
2020-07-27 16:14:42 +02:00
Benjamin Valentin
46b89eb723 core/msg_bus: fix shift on 8-bit platforms
The previous shift would wrap if the compiler defaults to 16 bit words.
Use explicit `unsigned long` integer constants to mitigate that.

before:

2020-07-22 15:25:17,063 # THREAD 1 start
2020-07-22 15:25:17,063 # THREAD 2 start
2020-07-22 15:25:17,065 # THREAD 3 start
2020-07-22 15:25:17,066 # THREADS CREATED
2020-07-22 15:25:17,068 # Posted event 22 to 0 threads
2020-07-22 15:25:17,071 # Posted event 23 to 0 threads
2020-07-22 15:25:17,076 # Posted event 24 to 0 threads
2020-07-22 15:25:17,076 # SUCCESS
2020-07-22 15:26:00,188 # Exiting Pyterm

after:

2020-07-22 15:26:10,374 # THREAD 1 start
2020-07-22 15:26:10,374 # THREAD 2 start
2020-07-22 15:26:10,377 # THREAD 3 start
2020-07-22 15:26:10,377 # THREADS CREATED
2020-07-22 15:26:10,380 # Posted event 22 to 0 threads
2020-07-22 15:26:10,383 # T1 recv: Hello Threads! (type=23)
2020-07-22 15:26:10,386 # T3 recv: Hello Threads! (type=23)
2020-07-22 15:26:10,388 # Posted event 23 to 2 threads
2020-07-22 15:26:10,391 # T2 recv: Hello Threads! (type=24)
2020-07-22 15:26:10,394 # Posted event 24 to 1 threads
2020-07-22 15:26:10,396 # SUCCESS
2020-07-22 15:27:31 +02:00
Benjamin Valentin
a8904edd7d core/bitarithm: add bitarithm_test_and_clear() 2020-07-21 16:03:59 +02:00
2d74651237
sched: Clear context_switch_request after potential idle sleep
An interrupt serviced during the idle sleep can re-request a context
switch while the scheduler is already going to switch contexts after the
idle sleep. Thi sched_context_switch_request should thus be cleared
after the idle sleep and not before where it could be modified during
the idle sleep and get out of sync.
2020-07-21 11:27:08 +02:00
e1b810b613
core/sched: tiny logic optimization in idle case
In the case that the no_thread_idle feature is active, the
runqueue_bitcache is checked twice in the case no thread is available to
schedule. This changes the inner while loop to a do-while loop to save
one check from the initial loop iteration, saving a cycle or so in the
idle case.
2020-07-20 23:26:47 +02:00
benpicco
e2e51ae7ef
Merge pull request #14368 from jia200x/pr/byteorder_bebuftohs
core/byteorder: add uint32 from/to buffer funcs
2020-07-13 12:31:43 +02:00
Jose Alamos
244d5191c8 core/byteorder: add uint32 from/to buffer funcs 2020-07-13 11:21:30 +02:00
Benjamin Valentin
b71fde68e9 core/panic: launch USB bootloader for easy recovery
If a board was flashed via USB bootloader, a crash means the user has to
perform a procedure to manually enter the bootloader again for recovery.

To allow for easier recovery, automatically lauch the bootloader on crash
if `DEVELHELP` is enabled.
2020-07-01 20:36:59 +02:00
d199865a12 core: sched: correctly unschedule when there's no idle thread 2020-06-25 16:02:29 +02:00
e3f6c0f340 core: make idle thread optional 2020-06-25 16:02:28 +02:00
c4b4e66422
sched_cb: Add function documentation 2020-06-23 15:40:57 +02:00
Martine Lenders
379d113af7
Merge pull request #14076 from miri64/cib/doc/fix-max-size
core/cib: fix documented maximum size restrictions
2020-06-19 17:18:20 +02:00
Martine S. Lenders
c2e1b8afea
core/cib: fix documented maximum size restrictions
MAXINT is not a defined value and since the types are unsigned also
misleading.
2020-06-19 15:08:58 +02:00
benpicco
7ea26cb118
Merge pull request #14295 from benpicco/core/include/macros/units_convenience
core/include: don't use 64 bit for MHZ & MiB macros
2020-06-17 15:01:44 +02:00
Benjamin Valentin
0862a3c512 core/include: Don't use 64 bit for MHZ & MiB macros
Those macros are all about convenience. However, always using 64 bit makes casts
nececcary that goes against the idea of having a convenience macro.

E.g. when printing a frequency in KHZ one might want to do

	printf("freq: %lu kHz\n", freq / KHZ(1));

leads to an error

> error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int'

Now we would have to cast - `%llu` is not available with newlib-nano and wholly
uneccecary.

Only use 64 bit artithmetic where necessary (GHZ, GiB), not for smaller units.
2020-06-17 12:50:50 +02:00
Leandro Lanzieri
4d65bc8e0a
cpu: Rename CPU_ARCH to CPU_CORE 2020-06-16 12:05:40 +02:00
Benjamin Valentin
8e83584f1c core/include: add macros for common units
I got tired of counting zeros in frequency defines, so add a few
helper macros to make defining frequency and sizes easier.
2020-06-03 16:00:19 +02:00
Benjamin Valentin
c29f133a63 core/msg_bus: clarify API of msg_bus_post()
Receiving threads must not modify the contents of the message as this
is racy by definition.

Also make `msg_bus_post()` accept `const void*` instead of `char *`.
2020-05-20 10:44:11 +02:00
Francisco Molina
cb5cbe7431
cpu/cortexm_common: add inlined header only def for irq_%
irq_% are not inlined by the compiler which leads to it branching
to a function that actually implement a single machine instruction.

Inlining these functions makes the call more efficient as well as
saving some bytes in ROM.
2020-05-12 16:37:34 +02:00
Benjamin Valentin
b3eb59c30e core/msg: add message bus 2020-04-28 13:35:05 +02:00
Benjamin Valentin
866c37c6b0 core/msg: split msg_send_int() into helper function
So it can be re-used for the message bus.
2020-04-28 11:30:56 +02:00
Francisco Molina
57938de035
core/doc: fix alignment 2020-04-21 15:10:56 +02:00
Francisco Molina
cbcb882454
core/include: add xtstr macro 2020-04-21 15:10:55 +02:00
46b6a95309
Merge pull request #13671 from jia200x/pr/move_thread_flags_error
core/thread_flags: remove #error from header file
2020-03-31 15:48:41 +02:00
8efe5960aa core: uncrustify 2020-03-30 17:02:08 +02:00
f99bc894de core: make some formatting uncrustify friendly (or ignore) 2020-03-30 17:00:32 +02:00
4a31068d15 core: disable uncrustify for atomic_*.c 2020-03-30 17:00:32 +02:00
JulianHolzwarth
dd6e51b1eb core/mutex.c _mutex_lock uses an int pointer
_mutex_lock uses a volatile int pointer for the parameter blocking instead of an int.
2020-03-26 17:26:07 +01:00
benpicco
a3dca87a78
Merge pull request #13300 from JulianHolzwarth/pr/thread_status_t/zombie_fixup
core/thread.c: thread_zombify small fix
2020-03-23 20:53:00 +01:00
Jose Alamos
027a47e3a8 core/thread_flags: remove #error from header file
This commit removes the #error from the thread_flags header.
This #error makes the usage of
if(IS_USED(MODULE_THAT_DEPENDS_ON_THREAD_FLAGS)) pattern harder,
because the error is triggered each time the header is included.
If a module uses any thread_flags function it will fail in link time
anyway.
2020-03-20 16:59:34 +01:00
Sören Tempel
59676a1f5e Make sure the mpu_noexec_ram regions has the lowest priority
From the ARMv7-M ARM section B3.5.3:

	Where there is an overlap between two regions, the register with
	the highest region number takes priority.

We want to make sure the mpu_noexec_ram region has the lowest
priority to allow the mpu_stack_guard region to overwrite the first N
bytes of it.

This change fixes using mpu_noexec_ram and mpu_stack_guard together.
2020-03-10 11:16:22 +01:00
1b8ec38e34 core/panic: add PANIC_EXPECT_FAIL 2020-02-24 10:48:43 +01:00
Leandro Lanzieri
ea8c85ae8b core/debug: Fix code style errors 2020-02-18 13:20:06 +01:00
Leandro Lanzieri
981b4eb8d0 core/debug: Fix documentation of ENABLE_DEBUG macro 2020-02-18 13:20:06 +01:00
JulianHolzwarth
ebe1bf1889 core/thread.c:thread_zombify always enables interrupts before yield 2020-02-05 18:00:13 +01:00
Karl Fessel
4445faaa3a core/shed: remove not needed bitarithm include add missing
bitarithm.h is not needed for the interface of shed but may cause conflicts
due to different definitions of SETBIT and CLRBIT

common implementations are: (value, offset) xor (value, mask) bitarithm
implements the later

frac.c and nrf52/usbdev.c use bitarithm.h but where missing the include

sam0/rtt.c defined a bit using mask from bitarithm,
changed that to the soulution used in sam0/rtc.c
2020-02-05 12:45:29 +01:00
c2534ad8f3 core: turn panic.c into a submodule 2020-01-31 13:55:26 +01:00
b6703f41dc core: turn kernel_init.c into core_init submodule 2020-01-31 13:52:13 +01:00