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

231 Commits

Author SHA1 Message Date
2f30aaaf06 cpu/cortexm_common: use mpu stack guard if DEVELHELP is enabled 2020-08-18 10:26:21 +02:00
Marian Buschsieweke
aeedb3ad16
cpu/cortexm_common: Don't access sched_active_*
Replaced accesses to sched_active_* with API calls in C files
2020-08-17 11:27:52 +02:00
Leandro Lanzieri
7dc6639f59
cpu/cortexm_common: add default Kconfig configuration 2020-08-12 12:22:43 +02:00
Leandro Lanzieri
b98527ef53
cpu: Add 'periph' module to Kconfig
Select it from cortexm_common module as it is always needed.
2020-08-12 12:22:39 +02:00
Leandro Lanzieri
2d53003ee2
cpu/cortexm_common: Model cortexm_common modules
This models cortexm_common and cortexm_common_periph modules.
2020-08-12 12:22:39 +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
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
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
benpicco
f3bce19646
Merge pull request #14503 from maribu/cpp-feature
build system: Add libstdcpp feature and doc
2020-07-23 19:05:10 +02:00
Benjamin Valentin
a8904edd7d core/bitarithm: add bitarithm_test_and_clear() 2020-07-21 16:03:59 +02:00
fc1d642113
cpu/cortexm_init: add specific case for stm32g0 svcall irq 2020-07-21 12:45:25 +02:00
0b549c6e0c
Merge pull request #14152 from aabadie/pr/pkg/stm32cube
pkg/stm32cmsis: retrieve STM32 CMSIS header from a package
2020-07-21 12:27:19 +02:00
0eb66a429f
cortexm_common: Clear PendSV request after idle sleep
The PendSV interrupt is used to request a scheduling operation. An
interrupt during the idle sleep can re-request the PendSV interrupt,
while the PendSV is still busy scheduling the next thread. This clears
the request after sleep to prevent triggering an extra PendSV interrupt
after the current PendSV handler finished.
2020-07-21 11:23:49 +02:00
Leandro Lanzieri
c71c2b79a7
cpu/arm7_common: Add Kconfig symbols
HAS_ARCH_ARM features now is moved to Kconfig.features as it is being
used by multiple architectures.
2020-07-16 19:03:38 +02:00
1f0a3a6bae
cpu/cortexm_common: add special case for SVC interrupt configuration
by default stm32f0/l0/l1 families simply call the interrupt enum SVC_IRQn
2020-07-16 17:35:48 +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
eec7aa2e42
cortexm_common: disable IRQ during thread_sched_idle
A race condition is present where an IRQ is serviced between the
priority increase of the PENDSV and the sleep. When the IRQ
is serviced before the WFI sleep, the core will sleep until the next
IRQ and the thread activated by the IRQ will not be scheduled until
a new IRQ triggers.

This commit wraps an IRQ disable and restore around the priority
modification and sleep to prevent interrupts from being serviced until
the WFI call returns.
2020-07-16 11:11:15 +02:00
Marian Buschsieweke
cf482c5d46
build system: Add libstdcpp feature and doc
- Add libstdcpp feature to indicate a platform is providing a libstdc++
  implementation ready for use
- The existing cpp feature now only indicates a working C++ toolchain without
  libstdc++. (E.g. still useful for the Arduino compatibility layer.)
- Added libstdcpp as required feature were needed
- Added some documentation on C++ on RIOT
2020-07-15 11:45:22 +02:00
Marian Buschsieweke
91a294aa45
cpu/cortexm_common: Drop LTO workaround for Cortex M thread_arch.c
The `ldr    r1, =sched_active_thread` instruction couldn't be assembled with
LTO, as the no immediate offset could be found to construct the address of
`sched_active_thread`. This commit instructs the assembler to generate a
literate pool which can be used to construct the address. While this issue
was only triggered during LTO, it theoretically could also pop up without LTO
due to unrelated changes. Thus, it is a good idea to create the literate pool
even without LTO enabled.
2020-07-15 10:37:15 +02:00
Marian Buschsieweke
0feebcb094
cpu/cortexm_common: Drop #7776's LTO workaround
The workaround from #7776 is no longer needed with recent toolchains, e.g. such
as the toolchain in the riot/riotbuild docker image.
2020-07-15 10:37:15 +02:00
Marian Buschsieweke
056100c1ca
cpu/cortexm_common: Fix cpu_switch_context_exit()
- Use `irq_enable()` over `bl irq_enable`, as `irq_enable()` is an inline
  function and not a C function any more
- Drop `__attribute__((naked))` qualifier
    - It must be used with the declaration of the function, but there it is
      missing. (And it cannot be added there, as this function would need to
      be implemented as "naked" by every platform; which is impossible for
      platforms not supporting `__attribute__((naked))`.)
    - Only functions consisting completely of basic asm may be marked as naked.
      But both the assembly used to trigger the SVC interrupt as well as the
      assembly used in `irq_enable()` are extended asm, not basic asm
- Use ` UNREACHABLE();` over a custom asm construct
2020-07-03 12:48:42 +02:00
0ff9e554eb cpu/cortexm: implement sched_arch_idle() and disable idle thread 2020-06-25 16:02:28 +02:00
d7c1510b0f
cortexm_common: Remove read in ICSR register operations
All bits in the ICSR register in the cortexm system control block are
either read-only or don't have an effect when writing a zero. A
read-modify-write cycle is thus not required when writing bit flags in
the register. This commit removes the reads in the read-modify-store
patterns for this register.
2020-06-23 11:53:53 +02:00
Leandro Lanzieri
2c4c04d11b
cpu/cortexm_common: Unify Kconfig and Makefile arch identifiers 2020-06-16 12:05:41 +02:00
Leandro Lanzieri
649017f0b2
cpu/cortexm_common: Rename arch_cortexm feature to cpu_core_cortexm 2020-06-16 12:05:41 +02:00
Leandro Lanzieri
4d65bc8e0a
cpu: Rename CPU_ARCH to CPU_CORE 2020-06-16 12:05:40 +02:00
8466946ea1 cpu/cortexm_common/Kconfig: add cortexm_svc feature 2020-06-10 23:13:43 +02:00
dbe7331d10 cpu/cortexm: "free" SVC 2020-06-10 23:12:58 +02:00
Jean Pierre Dudey
fea44e8b35
cpu/cortexm_common: add HAS_CORTEX_MPU feature
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2020-06-04 22:16:43 -05:00
José Alamos
917cc66e48
Merge pull request #14162 from jia200x/pr/kconfig/cortex
Kconfig/armv7_m/cortexm: declare CPU_ARCH and CPU_CORE symbols
2020-05-28 14:59:37 +02:00
Leandro Lanzieri
be8289bd8d cpu/cortexm_common: Add Kconfig symbols
This declares the architecture and core specific Kconfig symbols and the
features provided by it are selected.
2020-05-28 14:11:21 +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
iosabi
7e7b6e1cfe Allow to define reserved fields in CortexM vector table.
The ARM CortexM vector table has some reserved fields which are used by
some manufacturers to store their custom image information. In
particular, NXP QN908X stores the checksum, Code Read Protection, image
type and boot block pointer in this region.

This patch allows the cpu and board modules to define the value of these
fields at build time by defining a macro.
2020-04-10 10:37:41 +00: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
Leandro Lanzieri
ea2f963302
cpu/cortexm: Add 'cortexm_fpu' as a DEFAULT_MODULE if possible
This adds cortexm_fpu to the DEFAULT_MODULE list when the feature
cortexm_fpu is provided by the architecture. It also moves the
dependency resolution of this module to the architecture-specific
Makefile.dep file.
2020-04-01 09:46:29 +02:00
Leandro Lanzieri
64552a3b9a
cpu/cortexm_common: Move common modules to Makefile.dep
This moves the following modules to a architecture-specific Makefile.dep
file:
- cortexm_common
- cortexm_common_periph
- newlib
- newlib_nano
- periph
2020-04-01 09:46:21 +02:00
Benjamin Valentin
a11bcdcd5c cpu/cortexm_common: define BACKUP_RAM attribute 2020-03-19 13:37:58 +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
Sören Tempel
2c1a627118 Add mpu_noexec_ram pseudomodule 2020-03-07 13:09:55 +01:00
Gunar Schorcht
f688f84a15
Merge pull request #12928 from benpicco/newlib-multiheap
sys/newlib: enable multiple heaps in _sbrk_r()
2020-02-25 19:16:42 +01:00
Benjamin Valentin
cfd0ef415e cpu/sam0_common: hook up low power RAM as extra heap
This enables unused low-lower RAM on saml21/samd5x to be used for
heap memory.
2020-02-20 17:11:25 +01:00
496ae49692
Merge pull request #13091 from bergzand/pr/mpu/enable_once
cortexm_common/mpu: Only enable during low low level init
2020-02-11 11:11:13 +01:00
Sören Tempel
5ef5ab7e4b Add CPU feature for stack smash protections 2020-01-22 15:59:02 +01:00
c1cd286ec5
mpu: remove harmful assertion 2020-01-11 13:37:20 +01:00
88bdf166ec
cortexm_common: Enable the mpu only in the low level init 2020-01-11 13:36:23 +01:00
84bf543d78 cpu/cortexm_common: fix typos 2019-11-23 22:39:36 +01:00
Francois Berder
4a31f94cfc many typo fixes
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
2019-11-23 22:39:07 +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