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

48 Commits

Author SHA1 Message Date
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
Benjamin Valentin
7293e43167 cortexm_common: drop TODO about Cortex-M4F FPU
This should have been dropped in 06f0c14460
2023-10-30 13:08:12 +01:00
5cc43e5d5e cpu/cortexm: clear FPU state in cpu_switch_context_exit() 2022-10-05 22:17:26 +02:00
Erik Ekman
b5f96d2040 cpu/cortexm_common: Suppress cppcheck errors
cpu/cortexm_common/thread_arch.c:262: error (comparePointers): Comparing pointers that point to different objects
cpu/cortexm_common/thread_arch.c:266: error (comparePointers): Subtracting pointers that point to different objects
2021-11-25 13:08:51 +01: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
0129e73ec0
cpu/cortexm_common: Inline thread_yield_higher function 2021-01-19 11:03:21 +01:00
6d3d067443
cpu/cortexm_common: Do not use SVC for cpu_switch_context_exit
Directly use the pendsv interrupt instead of chaining through the SVC
interrupt
2021-01-18 16:27:17 +01:00
8f1a42cbbf
cpu/cortexm_common: fix r12 clobber in pendsv for Cortex-M0 2020-12-15 13:16:02 +01:00
04ca147f59 cpu/cortexm_common: fix r12 clobber in pendsv for Cortex-M3+ 2020-12-08 13:29:54 +01:00
977f0dfd70 cpu/cortexm_common: split isr_pendsv() 2020-12-08 10:14:45 +01:00
benpicco
1f7fdbc97a
Merge pull request #15099 from maribu/cortexm-common-cast-align
cpu/cortexm_common: Silence -Wcast-align false positives
2020-11-18 00:38:03 +01:00
Bas Stottelaar
22243aec7a cpu/*: realign ENABLE_DEBUG 2020-10-23 00:46:26 +02:00
Benjamin Valentin
c48b331051 cpu/cortexm_common: flush pipeline before disabling interrupts in idle
When enabling & disabling interrupts back-to-back pending interrupts
are not serviced on Cortex-M23/M33.

Flush the pipeline to give interrupts a chance of executing in `sched_arch_idle()`.

This fixes `no_idle_thread` on Cortex-M23.
2020-10-16 15:36:28 +02:00
Bas Stottelaar
0f8cecb50b cpu/cortexm_common: add support for Cortex-M33 2020-10-06 17:11:26 +02:00
Marian Buschsieweke
0e097b54a4
cpu/cortexm_common: Silence -Wcast-align false positives
Verified that each warning generated by -Wcast-align is indeed a false positive
and used an (intermediate) cast to `uintptr_t` to silence the warnings.
2020-09-28 10:45:50 +02:00
Marian Buschsieweke
49f3d1056d
cpu/cortexm_common: Code style
Fix code alignment
2020-09-25 13:58:25 +02:00
Marian Buschsieweke
304f4ec7d4
cpu/cortexm_common: flush pipeline after PendSV
https://interrupt.memfault.com/blog/arm-cortex-m-exceptions-and-nvic#pendsv-example
2020-09-25 13:58:06 +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
5db55360cc
cortexm_common: Determine next thread before unscheduling 2020-09-10 20:42:55 +02:00
22252337b6
cortexm_common: simplify FPU guards
The FPU is only enabled on platforms where it is available. The extra
checks for these platforms are redundant and removed here
2020-09-03 21:00:40 +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
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
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
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
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
4d65bc8e0a
cpu: Rename CPU_ARCH to CPU_CORE 2020-06-16 12:05:40 +02:00
dbe7331d10 cpu/cortexm: "free" SVC 2020-06-10 23:12:58 +02:00
Dylan Laduranty
6d3fda7260 cpu/cortexm: add cortex-m23 support 2019-01-21 17:04:20 +01:00
Vincent Dupont
06f0c14460 cortexm_common: enable FPU on cortex-m4f 2019-01-03 15:24:20 +01:00
32c10ae2c9 core, cpu: rename thread_start_threading() -> cpu_switch_context_exit() 2017-11-16 14:40:16 +01:00
86665b71bf cpu: adapt to COREIF_NG removal 2017-11-16 14:40:16 +01:00
Hauke Petersen
10a7486246 cpu/cortex_common: added support for Cortex-M7 2017-05-08 09:16:11 +02:00
0bd2805b0c cpu: cortexm_common: explicitly define isr_pendsv and isr_svc 2016-08-29 13:30:17 +02:00
Joakim Nohlgård
b02e0eca47 ps: Add current stack pointer and start of stack to isr_stack ps output (DEVELHELP) 2016-07-12 10:17:49 +02:00
Joakim Nohlgård
cb19a4c709 cortexm_common: Fix isr_stack_usage
Refactor and add multiply by word size to get the usage in number of
bytes instead of in number of words.

Verified implementation by manual memory inspection in GDB.
2016-06-20 14:33:17 +02:00
MohmadAyman
53df3e8b57 core: cpu: provide function to acquire ISR stack usage 2016-06-01 23:01:35 +02:00
c3f7186d4e unify usage of inline assembly 2016-03-31 22:23:35 +02:00
9082273746 core: header cleanup 2016-02-28 22:46:28 +01:00
Joakim Nohlgård
98c465008b all: Update @gebart family name, email 2015-09-20 13:47:39 +02:00
Hauke Petersen
b8dd144e03 cpu: unified cortexm_common folder
- removed coretx-m[0|3|4]
- moved their content to cortexm_common
- adjusted cortex Makefiles to this new name
- adjusted cortex Makefiles new structure
2015-05-28 19:30:07 +02:00
Hauke Petersen
ebb496cc26 cpu: renamed cortexm_common->cortex-m3_common and cleanup 2014-06-11 00:24:10 +02:00
René Kijewski
b6dc5c9b76 core/cortex-m: add missing NORETURNs to thread_arch 2014-06-05 21:01:35 +02:00
Oleg Hahm
ef5ec344fd core: prefix API functions correctly
Also changed names for bitarithm functions and rename thread_pid to sched_active_pid.
2014-05-18 08:53:20 +02:00
Hauke Petersen
31915bfe61 cpu: Initial import of SAM3X8E
- fixed spelling in uart driver
- marked cortexm-common a phony target
- fixed Makefiles
- added reboot interface implementation
- fixed documentation

- added UART0_BUFSIZE define

- added license header

- fixed documentation issues
2014-05-13 21:19:38 +02:00
Hauke Petersen
27133d25fe cpu: Initial import of cortexm_common files
- fixes to cortexm-common
- Added ARM CMSIS headers to cortexm_common
- thread_exit fixes to cortexm-common
- cortexm-common adjusted documentation

- cortexm_common added eINT dINT defines for now
2014-05-13 21:19:18 +02:00