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

104 Commits

Author SHA1 Message Date
Marian Buschsieweke
faa3727b1f
cpu/cortexm_common: Make cpu.h IWYU clean
There is clearly no reason `cpu.h` should `#include <stdio.h>`.

Also add an export pragma to `cpu_conf.h`, as portable code is
expected to include `cpu.h` (which exists across MCU families in RIOT),
and not `cpu_conf.h` (which only exists for some MCU families).
2024-11-27 11:57:20 +01:00
Benjamin Valentin
79b51efc15 cpu/cortexm_common: Cortex M0/M23 needs 4 cycles/busy loop 2024-01-09 19:03:15 +01:00
Marian Buschsieweke
1c281d2768
cpu/cortexm_common: work around bug on WFI for STM32
See [1] for details. (archive.org backup at [2]).

Fixes https://github.com/RIOT-OS/RIOT/issues/13918
Fixes https://github.com/RIOT-OS/RIOT/issues/14015

[1]: https://cliffle.com/blog/stm32-wfi-bug/
[2]: https://web.archive.org/web/20231205101603/https://cliffle.com/blog/stm32-wfi-bug/
2023-12-05 15:16:55 +01: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
9b32854b13
cpu/cortexm_common: remove CMSIS vendor code 2023-05-14 21:08:28 +02:00
Benjamin Valentin
e850dcd921 cpu/cortexm_common: define ARCHITECTURE_BREAKPOINT() 2023-04-27 13:19:17 +02:00
Benjamin Valentin
59a3e613fe cpu/cortexm_common: measure time spent with IRQ disabled 2022-11-24 21:27:20 +01:00
Benjamin Valentin
04287b4795 cpu/cortexm_common: improve formatting of irq_arch.h 2022-10-24 18:08:33 +02:00
Benjamin Valentin
ea917f4b07 cpu: cpu_print_last_instruction() -> cpu_get_caller_pc() 2022-09-15 10:49:56 +02:00
Benjamin Valentin
8cf20a286d cpu/cortexm_common: allow to overwrite nmi_handler
If a user wants to handle NMI events, let them do so by
providing an implementation for nmi_handler() instead of
paniking.
2022-06-20 18:22:22 +02:00
Benjamin Valentin
41a5b7ef7a core: change return type of irq_is_in(), irq_is_enabled() to bool
This only cleans up the API, no change in behavior or users of the API
is expected.
2021-12-08 15:53:15 +01:00
Benjamin Valentin
3e20e939c6 cpu: drop cpu_init() from public headers
Boards are no longer supposed fo call the function, so drop it from
public header files.
2021-10-18 17:31:26 +02:00
Jean-Pierre De Jesus DIAZ
51bab0a5a9 cpu/cortexm_common: fix doxygen grouping warnings
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2021-09-11 12:45:15 +02:00
Hauke Petersen
65b7f84568 cpu/cortexm_common: implement irq_is_enabled() 2021-08-25 08:01:05 +02:00
Jan Romann
4384795cb9
treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
benpicco
4c403d6559
Merge pull request #15788 from bergzand/pr/core/inline_thread_yield_higher
core/thread: Allow for inline thread_yield_higher
2021-01-22 20:25:11 +01:00
Marian Buschsieweke
716441d0c3
cpu/cortexm_common: fix atomic_utils_arch.h
Only use bit-banding if all of SRAM supports bit-banding
2021-01-20 09:19:33 +01:00
0129e73ec0
cpu/cortexm_common: Inline thread_yield_higher function 2021-01-19 11:03:21 +01:00
Benjamin Valentin
e300dfe47e sys/bit: move bit.h from cortexm_common/ to sys/
The bit access functions are not tied to Cortex-M CPUs, here they only
provide optimisations via bit-banding.

But the functions are generally useful - so move them to an arch independent
location.
2020-12-08 17:07:41 +01:00
Marian Buschsieweke
dd48ced151
cpu/*/atomic_utils_arch.h: Add volatile qualifier 2020-11-24 14:00:52 +01:00
792e031a95
Merge pull request #14331 from maribu/atomic_utils
sys/atomic_utils: Functions for atomic access
2020-11-12 21:44:53 +01:00
Marian Buschsieweke
a3e2d27799
cpu/cortexm_common: Add atomic_utils_arch.h 2020-11-10 10:55:13 +01:00
benpicco
c979fda1f3
Merge pull request #14367 from basilfx/feature/cortex_m33
cpu/cortex: add initial support for Cortex-M33
2020-10-08 22:55:06 +02:00
Bas Stottelaar
0f8cecb50b cpu/cortexm_common: add support for Cortex-M33 2020-10-06 17:11:26 +02:00
e5ca237318
cpu/cortexm_common: fix typo 'pre-empt' -> 'preempt'
Also fix typo 'efficency' -> 'efficiency'
2020-10-02 07:53:54 +02:00
Marian Buschsieweke
30bebdb3ff
cpu/cortexm_common: Add architecture_arch.h 2020-09-29 12:34:00 +02:00
ba58273b04
cortexm_common: Enable using pendsv IRQ at lower priority
This modifies the cortex-m thread specifics to allow running the PendSV
interrupt continuously at lower priority and removes the priority
modifications during the interrupt itself. Interrupts are disabled
during the scheduling itself, but enabled briefly after the sleep to
ensure that they are handled if activated during the scheduling or the
sleep.
2020-09-23 11:01:29 +02:00
Marian Buschsieweke
234a720571
Merge pull request #14516 from benpicco/bitband_hw
cortexm_common: fix check for bitbanding feature
2020-08-08 14:26:49 +02:00
Benjamin Valentin
a8904edd7d core/bitarithm: add bitarithm_test_and_clear() 2020-07-21 16:03:59 +02:00
Benjamin Valentin
95ec5890b0 cortexm_common: fix bit-banding check
Not all MCUs ≥ Cortex-M3 provide the Bit-Banding feature.
It is up to the manufacturer to implement it.

Instead, rely on the CPU_HAS_BITBAND being set in `periph_cpu.h`.
2020-07-16 14:44:28 +02:00
Leandro Lanzieri
4d65bc8e0a
cpu: Rename CPU_ARCH to CPU_CORE 2020-06-16 12:05:40 +02:00
Francisco Molina
b5e4224a6f
cpu/cortexm_common: remove special cortexm_sleep handle for stm32l152re
__set_PRIMASK(state) had been directly inlined to avoid a hardfault that
occured when branching after waking up from sleep with DBG_STANDBY,
DBG_STOP or DBG_SLEEP set in DBG_CR.

The hardfault occured when returning from the branch to irq_restore,
since the function is now inlined the branch does not happen either.

Refer to #14015 for more details.
2020-05-12 16:37:34 +02:00
Francisco Molina
4ad3164599
cpu/cortexm_common/irq_arch: fix irq_enable return type 2020-05-12 16:37:34 +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
Pekka Nikander
4534e9b773
cpu/cortexm_common: add irq sub-priorities
This commit enables Cortex-M CPU interrupt sub-priorities
and allows the PendSV interrupt to have a priority different
from the default one.  Together these two preprocessor
defines can be used to have PendSV always run as the last interrupt
before returning from the interrupt stack back to the user space.

Running PendSV as the last interrupt before returning to the
user space is recommended by ARM, as it increases efficiency.
Furthermore, that change enhances stability a lot with the
new nRF52 SoftDevice support, currently being worked in
PR #9473.

This commit merely enables sub-priorities and a separate
PendSV priority to be used without changing the default
RIOT behaviour.
2020-04-03 17:49:31 +02:00
Benjamin Valentin
a11bcdcd5c cpu/cortexm_common: define BACKUP_RAM attribute 2020-03-19 13:37:58 +01:00
Marian Buschsieweke
314184adb5
cpu: Platform specific C11 atomics compat headers
Added headers to define platform specific sizes and types for the C11 atomics
compatibility module for C++.
2019-10-24 23:08:36 +02:00
a7f6508109 cpu/cortexm: don't disable IRQs in cpu_jump_to_image() 2019-09-26 23:38:43 +02:00
Francisco Molina
d075e55bb4 cpu/cortexm_common: replace irq_restore by __set_PRIMASK for stm32l152re
- The __NOP() that was added in #8518 is now remooved.
- When DBG_STANDBY, DBG_STOP or DBG_SLEEP are set in DBG_CR a hardfault
  occurs on wakeup from sleep. This was first diagnosed in #8518. When
  enabled, a hardfault occured when returning from a branch to irq_restore()
  we avoid the call by inlining the function call. See #11830 for more
  details.
2019-08-05 10:40:28 +02:00
Oleg Artamonov
a5ce6deb02 cpu/cortexm_common: function to check address validity 2019-05-13 09:35:34 +02:00
emmanuelsearch
61c793aa4c cpu/cortexm_common: Add image_baseaddr support for Cortex-M23 2019-03-26 11:46:00 +01:00
Dylan Laduranty
fdcac731eb cpu/cortexm_common: Update ARM CMSIS to V5.4.0
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2019-01-15 17:35:40 +01:00
9cfdf6e379 cpu/cortexm_common: introduce cpu_jump_to_image()
This new function allows to jump to another execution
environment (VTOR) located at a certain (aligned) address.
It's used to boot firmwares at another location than
`CPU_FLASH_BASE`.

The user needs to ensure that the CPU using this feature
is able to be initialised at least twice while jumping
to the RIOT `reset_handler_default` function, since it
initialises the CPU again (calls cpu_init()).

Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
2018-12-18 19:31:35 +01:00
PeterKietzmann
0be350e352 sys/puf_sram: CPU specific attributes for variables 2018-11-20 08:34:53 +01:00
Pekka Nikander
6aa0a48558 cpu/cortexm_common/cortexm_init: Allow piecewise calling
Refactor cortexm_init to allow bits and pieces of
   it to be called separately, while retaining the
   current API, too.  Needed for non-standard
   Cortex-M initialisation, such as with nRF52
   SoftDevice.
2018-08-28 14:07:50 +03:00
c9c7cd4951 cpu: cortexm_common: use thread_yield_higher() in cortexm_isr_end() 2018-04-13 10:12:39 +02:00
Francisco Acosta
ac9328381c cpu/cortexm_common: add NOP after WFI to avoid hardfault on stm32l152 2018-02-12 15:10:34 +01:00
99d484f336 cpu/cortexm_common: select bitarithm_lsb() by available instructions 2018-01-16 23:35:14 +01:00
Joakim Nohlgård
e3d5a70e0c cpu/cortexm: Remove leftover _estack declarations
These are leftovers from before the Cortex-M common ISR vectors were
split into vectors_cortexm.c
2017-11-10 15:38:14 +01:00
Hauke Petersen
5920d99752 pm: fix weak-based default implementations
Instead of using `weak` function definitions, this PR handles
default implementations using `PROVIDES_x` defines, allowing
for cpus/pm realted modules to use their own implementations.
2017-10-16 14:27:35 +02:00