Skip to content

Commit 43087cc

Browse files
authored
Merge branch 'main' into sonarcloudconfig
2 parents 56d2119 + 06c6605 commit 43087cc

File tree

510 files changed

+22369
-4462
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

510 files changed

+22369
-4462
lines changed

.github/test-spec.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@
9494
- "tests/bluetooth/mesh/**/*"
9595
- "tests/bluetooth/mesh_shell/**/*"
9696

97-
"CI-zigbee-test":
98-
- "subsys/mgmt/mcumgr/**/*"
99-
- "subsys/dfu/**/*"
100-
- "include/mgmt/mcumgr/**/*"
101-
- "include/dfu/**/*"
102-
10397
"CI-thingy91-test":
10498
- "boards/nordic/nrf9160dk/**/*"
10599
- "arch/x86/core/**/*"

MAINTAINERS.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3931,6 +3931,19 @@ OpenTitan Platforms:
39313931
description: >-
39323932
OpenTitan boards, SOCs, dts files and related drivers.
39333933
3934+
Realtek EC Platforms:
3935+
status: maintained
3936+
maintainers:
3937+
- JasonLin-RealTek
3938+
files:
3939+
- boards/realtek/
3940+
- drivers/*/*rts5912*
3941+
- dts/bindings/*/*rts5912*
3942+
- dts/arm/realtek/ec/
3943+
- soc/realtek/ec/
3944+
labels:
3945+
- "platform: Realtek EC"
3946+
39343947
Renesas SmartBond Platforms:
39353948
status: maintained
39363949
maintainers:

arch/arm/core/cortex_m/pm_s2ram.S

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,7 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend)
178178
/*
179179
* Mark entering suspend to RAM.
180180
*/
181-
mov r1, lr
182-
bl pm_s2ram_mark_set
183-
mov lr, r1
181+
bl pm_s2ram_mark_set
184182

185183
/*
186184
* Call the system_off function passed as parameter. This should never
@@ -199,9 +197,7 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend)
199197
/*
200198
* Reset the marking of suspend to RAM, return is ignored.
201199
*/
202-
mov r1, lr
203-
bl pm_s2ram_mark_check_and_clear
204-
mov lr, r1
200+
bl pm_s2ram_mark_check_and_clear
205201

206202
/* Move the stored return value of system_off back to r0,
207203
* setting it as return value for this function.
@@ -216,15 +212,18 @@ GTEXT(arch_pm_s2ram_resume)
216212
SECTION_FUNC(TEXT, arch_pm_s2ram_resume)
217213
/*
218214
* Check if reset occurred after suspending to RAM.
215+
* Store LR to ensure we can continue boot when we are not suspended
216+
* to RAM. In addition to LR, R0 is pushed too, to ensure "SP mod 8 = 0",
217+
* as stated by ARM rule 6.2.1.2 for AAPCS32.
219218
*/
220-
mov r1, lr
221-
bl pm_s2ram_mark_check_and_clear
222-
mov lr, r1
223-
cmp r0, #0x1
224-
beq resume
225-
bx lr
226-
227-
resume:
219+
push {r0, lr}
220+
bl pm_s2ram_mark_check_and_clear
221+
cmp r0, #0x1
222+
pop {r0, lr}
223+
beq .L_resume
224+
bx lr
225+
226+
.L_resume:
228227
/*
229228
* Restore the CPU context
230229
*/

arch/arm/core/cortex_m/pm_s2ram.c

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,20 @@ __noinit _cpu_context_t _cpu_context;
2222
*/
2323
static __noinit uint32_t marker;
2424

25-
void __attribute__((naked)) pm_s2ram_mark_set(void)
25+
void pm_s2ram_mark_set(void)
2626
{
27-
__asm__ volatile(
28-
/* Set the marker to MAGIC value */
29-
"str %[_magic_val], [%[_marker]]\n"
30-
31-
"bx lr\n"
32-
:
33-
: [_magic_val] "r"(MAGIC), [_marker] "r"(&marker)
34-
: "r1", "r4", "memory");
27+
marker = MAGIC;
3528
}
3629

37-
bool __attribute__((naked)) pm_s2ram_mark_check_and_clear(void)
30+
bool pm_s2ram_mark_check_and_clear(void)
3831
{
39-
__asm__ volatile(
40-
/* Set return value to 0 */
41-
"mov r0, #0\n"
42-
43-
/* Check the marker */
44-
"ldr r3, [%[_marker]]\n"
45-
"cmp r3, %[_magic_val]\n"
46-
"bne exit\n"
47-
48-
/*
49-
* Reset the marker
50-
*/
51-
"str r0, [%[_marker]]\n"
32+
if (marker == MAGIC) {
33+
marker = 0;
5234

53-
/*
54-
* Set return value to 1
55-
*/
56-
"mov r0, #1\n"
35+
return true;
36+
}
5737

58-
"exit:\n"
59-
"bx lr\n"
60-
:
61-
: [_magic_val] "r"(MAGIC), [_marker] "r"(&marker)
62-
: "r0", "r1", "r3", "r4", "memory");
38+
return false;
6339
}
6440

6541
#endif /* CONFIG_PM_S2RAM_CUSTOM_MARKING */

arch/arm/core/cortex_m/reset.S

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ _ASM_FILE_PROLOGUE
2121
GTEXT(z_arm_reset)
2222
GTEXT(z_early_memset)
2323
GDATA(z_interrupt_stacks)
24+
GDATA(z_main_stack)
2425
#if defined(CONFIG_DEBUG_THREAD_INFO)
2526
GDATA(z_sys_post_kernel)
2627
#endif
@@ -29,7 +30,6 @@ GTEXT(soc_reset_hook)
2930
#endif
3031
#if defined(CONFIG_INIT_ARCH_HW_AT_BOOT)
3132
GTEXT(z_arm_init_arch_hw_at_boot)
32-
GDATA(z_main_stack)
3333
#endif
3434
#if defined(CONFIG_PM_S2RAM)
3535
GTEXT(arch_pm_s2ram_resume)
@@ -68,13 +68,6 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,z_arm_reset)
6868
*/
6969
SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
7070

71-
#if defined(CONFIG_DEBUG_THREAD_INFO)
72-
/* Clear z_sys_post_kernel flag for RTOS aware debuggers */
73-
movs.n r0, #0
74-
ldr r1, =z_sys_post_kernel
75-
strb r0, [r1]
76-
#endif /* CONFIG_DEBUG_THREAD_INFO */
77-
7871
#if defined(CONFIG_INIT_ARCH_HW_AT_BOOT)
7972
/* Reset CONTROL register */
8073
movs.n r0, #0
@@ -90,9 +83,56 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
9083
#endif /* CONFIG_INIT_ARCH_HW_AT_BOOT */
9184

9285
#if defined(CONFIG_PM_S2RAM)
86+
/*
87+
* Temporarily set MSP to interrupt stack so that arch_pm_s2ram_resume can
88+
* use stack for calling pm_s2ram_mark_check_and_clear.
89+
* This is safe because suspend never being called from an ISR ensures that
90+
* interrupt stack was not live during suspend.
91+
* Note:
92+
* if resuming from suspend, MSP is restored from cpu context
93+
* if not resuming, MSP will be set back to z_main_stack for proper init
94+
* And, apart from arch_pm_s2ram_resume being able to use the stack for
95+
* a short while, there is no change in behavior in either of the paths.
96+
*/
97+
ldr r0, =z_interrupt_stacks + CONFIG_ISR_STACK_SIZE + MPU_GUARD_ALIGN_AND_SIZE
98+
msr msp, r0
99+
93100
bl arch_pm_s2ram_resume
94101
#endif /* CONFIG_PM_S2RAM */
95102

103+
/*
104+
* MSP needs to be set to main stack for following scenarios:
105+
* - If CONFIG_PM_S2RAM is enabled, MSP is set to z_interrupt_stacks
106+
* for resume functions to make use of a stack. However,
107+
* if the device was not suspended and if resume functions return,
108+
* MSP needs to be set back to z_main_stack to ensure proper
109+
* initialization.
110+
* - If CONFIG_PM_S2RAM is not enabled but CONFIG_INIT_ARCH_HW_AT_BOOT is,
111+
* MSP needs to be set to z_main_stack for proper initialization in case
112+
* device was loaded through chain loading or a debugger, as the initial
113+
* value of MSP would be anything that the previous image loaded.
114+
* - If CONFIG_INIT_STACKS is enabled, we need to ensure MSP is not set
115+
* to z_interrupt_stacks, so we set it to z_main_stack.
116+
*
117+
* Since these scenarios cover most of the cases, we set MSP to
118+
* z_main_stack here.
119+
*
120+
*/
121+
ldr r0, =z_main_stack + CONFIG_MAIN_STACK_SIZE
122+
msr msp, r0
123+
124+
/* Note: Make sure that variables like z_sys_post_kernel
125+
* are set after the call to arch_pm_s2ram_resume
126+
* to avoid any issues with suspend/resume path.
127+
* Refer issue #83660 for more details.
128+
*/
129+
#if defined(CONFIG_DEBUG_THREAD_INFO)
130+
/* Clear z_sys_post_kernel flag for RTOS aware debuggers */
131+
movs.n r0, #0
132+
ldr r1, =z_sys_post_kernel
133+
strb r0, [r1]
134+
#endif /* CONFIG_DEBUG_THREAD_INFO */
135+
96136
#if defined(CONFIG_SOC_RESET_HOOK)
97137
bl soc_reset_hook
98138
#endif
@@ -105,8 +145,6 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
105145
str r0, [r1]
106146
dsb
107147
#endif /* CONFIG_CPU_HAS_ARM_MPU */
108-
ldr r0, =z_main_stack + CONFIG_MAIN_STACK_SIZE
109-
msr msp, r0
110148

111149
/* Initialize core architecture registers and system blocks */
112150
bl z_arm_init_arch_hw_at_boot

arch/arm/core/cortex_m/swap_helper.S

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ SECTION_FUNC(TEXT, z_arm_pendsv)
9898
#ifdef CONFIG_FPU_SHARING
9999
/* Assess whether switched-out thread had been using the FP registers. */
100100
tst lr, #_EXC_RETURN_FTYPE_Msk
101-
bne out_fp_endif
101+
bne .L_out_fp_endif
102102

103103
/* FP context active: set FP state and store callee-saved registers.
104104
* Note: if Lazy FP stacking is enabled, storing the callee-saved
@@ -108,7 +108,7 @@ SECTION_FUNC(TEXT, z_arm_pendsv)
108108
add r0, r2, #_thread_offset_to_preempt_float
109109
vstmia r0, {s16-s31}
110110

111-
out_fp_endif:
111+
.L_out_fp_endif:
112112
/* At this point FPCCR.LSPACT is guaranteed to be cleared,
113113
* regardless of whether the thread has an active FP context.
114114
*/
@@ -204,9 +204,9 @@ out_fp_endif:
204204
* were enabled before irq_lock was called.
205205
*/
206206
cmp r0, #0
207-
bne _thread_irq_disabled
207+
bne .L_thread_irq_disabled
208208
cpsie i
209-
_thread_irq_disabled:
209+
.L_thread_irq_disabled:
210210

211211
#if defined(CONFIG_MPU_STACK_GUARD) || defined(CONFIG_USERSPACE)
212212
/* Re-program dynamic memory map */
@@ -259,25 +259,25 @@ _thread_irq_disabled:
259259
#ifdef CONFIG_FPU_SHARING
260260
/* Assess whether switched-in thread had been using the FP registers. */
261261
tst lr, #_EXC_RETURN_FTYPE_Msk
262-
beq in_fp_active
262+
beq .L_in_fp_active
263263
/* FP context inactive for swapped-in thread:
264264
* - reset FPSCR to 0
265265
* - set EXC_RETURN.F_Type (prevents FP frame un-stacking when returning
266266
* from pendSV)
267267
*/
268268
movs.n r3, #0
269269
vmsr fpscr, r3
270-
b in_fp_endif
270+
b .L_in_fp_endif
271271

272-
in_fp_active:
272+
.L_in_fp_active:
273273
/* FP context active:
274274
* - clear EXC_RETURN.F_Type
275275
* - FPSCR and caller-saved registers will be restored automatically
276276
* - restore callee-saved FP registers
277277
*/
278278
add r0, r2, #_thread_offset_to_preempt_float
279279
vldmia r0, {s16-s31}
280-
in_fp_endif:
280+
.L_in_fp_endif:
281281
/* Clear CONTROL.FPCA that may have been set by FP instructions */
282282
mrs r3, CONTROL
283283
bic r3, #_CONTROL_FPCA_Msk
@@ -361,12 +361,12 @@ SECTION_FUNC(TEXT, z_arm_svc)
361361
movs r0, #_EXC_RETURN_SPSEL_Msk
362362
mov r1, lr
363363
tst r1, r0
364-
beq _stack_frame_msp
364+
beq .L_stack_frame_msp
365365
mrs r0, PSP
366-
bne _stack_frame_endif
367-
_stack_frame_msp:
366+
bne .L_stack_frame_endif
367+
.L_stack_frame_msp:
368368
mrs r0, MSP
369-
_stack_frame_endif:
369+
.L_stack_frame_endif:
370370
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
371371
tst lr, #_EXC_RETURN_SPSEL_Msk /* did we come from thread mode ? */
372372
ite eq /* if zero (equal), came from handler mode */
@@ -399,7 +399,7 @@ _stack_frame_endif:
399399
mrs r2, CONTROL
400400

401401
cmp r1, #3
402-
beq _do_syscall
402+
beq .L_do_syscall
403403

404404
/*
405405
* check that we are privileged before invoking other SVCs
@@ -411,12 +411,12 @@ _stack_frame_endif:
411411
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
412412
tst r2, #0x1
413413
#endif
414-
bne _oops
414+
bne .L_oops
415415

416416
#endif /* CONFIG_USERSPACE */
417417

418418
cmp r1, #2
419-
beq _oops
419+
beq .L_oops
420420

421421
#if defined(CONFIG_IRQ_OFFLOAD)
422422
push {r0, lr}
@@ -434,7 +434,7 @@ _stack_frame_endif:
434434

435435
#endif
436436

437-
_oops:
437+
.L_oops:
438438
push {r0, lr}
439439
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
440440
#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
@@ -484,7 +484,7 @@ _oops:
484484
* r6 - call_id
485485
* r8 - saved link register
486486
*/
487-
_do_syscall:
487+
.L_do_syscall:
488488
#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
489489
movs r3, #24
490490
ldr r1, [r0, r3] /* grab address of PC from stack frame */
@@ -510,15 +510,15 @@ _do_syscall:
510510
/* The supplied syscall_id must be lower than the limit
511511
* (Requires unsigned integer comparison)
512512
*/
513-
blo valid_syscall_id
513+
blo .L_valid_syscall_id
514514

515515
/* bad syscall id. Set arg1 to bad id and set call_id to SYSCALL_BAD */
516516
str r6, [r0]
517517
ldr r6, =K_SYSCALL_BAD
518518

519519
/* Bad syscalls treated as valid syscalls with ID K_SYSCALL_BAD. */
520520

521-
valid_syscall_id:
521+
.L_valid_syscall_id:
522522
ldr r0, =_kernel
523523
ldr r0, [r0, #_kernel_offset_to_current]
524524
#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)

boards/nordic/nrf52840dk/board.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_SOC_NRF52840_QIAA)
4+
board_runner_args(nrfutil "--ext-mem-config-file=${BOARD_DIR}/support/nrf52840dk_qspi_nrfutil_config.json")
5+
endif()
6+
37
board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
48
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
59
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)

0 commit comments

Comments
 (0)