Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
4.1.99
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
Zephyr API Documentation
►
Introduction
Deprecated List
►
Topics
►
Data Structures
▼
Files
▼
File List
►
doc
►
kernel
►
lib
►
subsys
▼
zephyr
►
acpi
►
app_memory
▼
arch
►
arc
▼
arm
►
cortex_a_r
►
cortex_m
►
mmu
►
mpu
►
arch.h
►
arch_inlines.h
asm_inline.h
►
asm_inline_gcc.h
barrier.h
error.h
exception.h
►
gdbstub.h
►
irq.h
►
misc.h
nmi.h
structs.h
►
syscall.h
thread.h
►
arm64
►
common
►
mips
►
posix
►
riscv
►
rx
►
sparc
►
x86
►
xtensa
arch_inlines.h
►
arch_interface.h
►
cache.h
cpu.h
exception.h
structs.h
syscall.h
►
audio
►
bluetooth
►
canbus
►
console
►
crypto
►
data
►
debug
►
devicetree
►
dfu
►
display
►
drivers
►
dsp
►
dt-bindings
►
fs
►
input
►
internal
►
ipc
►
kernel
►
linker
►
llext
►
logging
►
lorawan
►
math
►
mem_mgmt
►
mgmt
►
misc
►
modbus
►
modem
►
multi_heap
►
net
►
platform
►
pm
►
pmci
►
portability
►
posix
►
psa
►
random
►
retention
►
rtio
►
sd
►
sensing
►
settings
►
shell
►
sip_svc
►
stats
►
storage
►
sys
►
task_wdt
►
timing
►
toolchain
►
tracing
►
usb
►
usb_c
►
xen
►
zbus
►
zvfs
►
bindesc.h
►
cache.h
►
device.h
►
devicetree.h
►
fatal.h
►
fatal_types.h
►
init.h
►
irq.h
►
irq_multilevel.h
►
irq_nextlevel.h
►
irq_offload.h
►
kernel.h
kernel_includes.h
►
kernel_structs.h
►
kernel_version.h
►
net_buf.h
►
shared_irq.h
►
smf.h
►
spinlock.h
►
sw_isr_table.h
►
sys_clock.h
►
syscall.h
►
toolchain.h
types.h
►
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013-2014 Wind River Systems, Inc.
3
* Copyright (c) 2023 Arm Limited
4
*
5
* SPDX-License-Identifier: Apache-2.0
6
*/
7
16
#ifndef ZEPHYR_INCLUDE_ARCH_ARM_ERROR_H_
17
#define ZEPHYR_INCLUDE_ARCH_ARM_ERROR_H_
18
19
#include <
zephyr/arch/arm/syscall.h
>
20
#include <
zephyr/arch/arm/exception.h
>
21
#include <
stdbool.h
>
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
27
#if defined(CONFIG_CPU_CORTEX_M)
28
/* ARMv6 will hard-fault if SVC is called with interrupts locked. Just
29
* force them unlocked, the thread is in an undefined state anyway
30
*
31
* On ARMv7m we won't get a HardFault, but if interrupts were locked the
32
* thread will continue executing after the exception and forbid PendSV to
33
* schedule a new thread until they are unlocked which is not what we want.
34
* Force them unlocked as well.
35
*/
36
#define ARCH_EXCEPT(reason_p) \
37
do {\
38
arch_irq_unlock(0); \
39
__asm__ volatile( \
40
"mov r0, %[_reason]\n" \
41
"svc %[id]\n" \
42
:: [_reason] "r" (reason_p), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
43
: "r0", "memory"); \
44
} while (false)
45
#elif defined(CONFIG_ARMV7_R) || defined(CONFIG_AARCH32_ARMV8_R) \
46
|| defined(CONFIG_ARMV7_A)
47
/*
48
* In order to support using svc for an exception while running in an
49
* isr, stack $lr_svc before calling svc. While exiting the isr,
50
* z_check_stack_sentinel is called. $lr_svc contains the return address.
51
* If the sentinel is wrong, it calls svc to cause an oops. This svc
52
* call will overwrite $lr_svc, losing the return address from the
53
* z_check_stack_sentinel call if it is not stacked before the svc.
54
*/
55
#define ARCH_EXCEPT(reason_p) \
56
do { \
57
register uint32_t r0 __asm__("r0") = reason_p; \
58
__asm__ volatile ( \
59
"push {lr}\n\t" \
60
"cpsie i\n\t" \
61
"svc %[id]\n\t" \
62
"pop {lr}\n\t" \
63
: \
64
: "r" (r0), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
65
: "memory"); \
66
} while (false)
67
#else
68
#error Unknown ARM architecture
69
#endif
/* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
70
71
#ifdef __cplusplus
72
}
73
#endif
74
75
#endif
/* ZEPHYR_INCLUDE_ARCH_ARM_ERROR_H_ */
syscall.h
ARM AArch32 specific syscall header.
exception.h
ARM AArch32 public exception handling.
stdbool.h
zephyr
arch
arm
error.h
Generated on Sun May 18 2025 21:05:51 for Zephyr API Documentation by
1.12.0