Skip to content

Commit 216285a

Browse files
committed
[bluetrum] fix context switch error
1 parent 9a59737 commit 216285a

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

bsp/bluetrum/ab32vg1-ab-prougen/.config

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ CONFIG_RT_USING_LIBC=y
288288
# CONFIG_PKG_USING_PDULIB is not set
289289
# CONFIG_PKG_USING_BTSTACK is not set
290290
# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
291+
# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
291292

292293
#
293294
# security packages
@@ -437,6 +438,8 @@ CONFIG_RT_USING_LIBC=y
437438
# CONFIG_PKG_USING_QKEY is not set
438439
# CONFIG_PKG_USING_RS485 is not set
439440
# CONFIG_PKG_USING_NES is not set
441+
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
442+
# CONFIG_PKG_USING_VDEVICE is not set
440443

441444
#
442445
# miscellaneous packages
@@ -495,13 +498,13 @@ CONFIG_RT_USING_LIBC=y
495498
# Onboard Peripheral Drivers
496499
#
497500
CONFIG_BSP_USING_USB_TO_USART=y
501+
CONFIG_BSP_USING_AUDIO=y
502+
CONFIG_BSP_USING_AUDIO_PLAY=y
498503

499504
#
500505
# On-chip Peripheral Drivers
501506
#
502507
CONFIG_BSP_USING_UART0=y
503-
CONFIG_BSP_USING_AUDIO=y
504-
CONFIG_BSP_USING_AUDIO_PLAY=y
505508

506509
#
507510
# Board extended module Drivers

bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@
169169
/* Onboard Peripheral Drivers */
170170

171171
#define BSP_USING_USB_TO_USART
172+
#define BSP_USING_AUDIO
173+
#define BSP_USING_AUDIO_PLAY
172174

173175
/* On-chip Peripheral Drivers */
174176

175177
#define BSP_USING_UART0
176-
#define BSP_USING_AUDIO
177-
#define BSP_USING_AUDIO_PLAY
178178

179179
/* Board extended module Drivers */
180180

bsp/bluetrum/libcpu/cpu/context_gcc.S

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ enable_int_ret:
4444

4545
/* Macro for saving task context */
4646
.macro save_context
47-
addi sp, sp, -120
47+
addi sp, sp, -124
4848

4949
/* Save Context */
5050
sw x1, 0(sp)
@@ -79,6 +79,8 @@ enable_int_ret:
7979

8080
lw a5, EPC(zero) //Saves current program counter (EPC) as task program counter
8181
sw a5, 116(sp)
82+
lw a5, EPICCON(zero)
83+
sw a5, 120(sp)
8284

8385
sw sp, rt_cur_thread_sp, a4 //store sp in preempted tasks tcb
8486
.endm
@@ -93,6 +95,8 @@ enable_int_ret:
9395
/* Load task program counter EPC*/
9496
lw a5, 116(sp)
9597
sw a5, EPC(zero)
98+
lw a5, 120(sp)
99+
sw a5, EPICCON(zero)
96100

97101
/* Restore registers,
98102
Skip global pointer because that does not change */
@@ -126,7 +130,7 @@ enable_int_ret:
126130
lw x30, 108(sp)
127131
lw x31, 112(sp)
128132

129-
addi sp, sp, 120
133+
addi sp, sp, 124
130134
mret
131135
.endm
132136

bsp/bluetrum/libcpu/cpu/cpuport.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
3939
stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
4040
stk = (rt_uint32_t *)stack_addr;
4141

42+
stk--;
43+
*stk = (rt_uint32_t)0x10003; /* Start address */
4244
stk--;
4345
*stk = (rt_uint32_t)tentry; /* Start address */
4446
stk -= 22;

0 commit comments

Comments
 (0)