[bluetrum] fix context switch error

This commit is contained in:
greedyhao 2020-12-25 17:19:58 +08:00
parent 9a59737b5f
commit 216285a2c3
4 changed files with 15 additions and 6 deletions

View File

@ -288,6 +288,7 @@ CONFIG_RT_USING_LIBC=y
# CONFIG_PKG_USING_PDULIB is not set
# CONFIG_PKG_USING_BTSTACK is not set
# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
#
# security packages
@ -437,6 +438,8 @@ CONFIG_RT_USING_LIBC=y
# CONFIG_PKG_USING_QKEY is not set
# CONFIG_PKG_USING_RS485 is not set
# CONFIG_PKG_USING_NES is not set
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
# CONFIG_PKG_USING_VDEVICE is not set
#
# miscellaneous packages
@ -495,13 +498,13 @@ CONFIG_RT_USING_LIBC=y
# Onboard Peripheral Drivers
#
CONFIG_BSP_USING_USB_TO_USART=y
CONFIG_BSP_USING_AUDIO=y
CONFIG_BSP_USING_AUDIO_PLAY=y
#
# On-chip Peripheral Drivers
#
CONFIG_BSP_USING_UART0=y
CONFIG_BSP_USING_AUDIO=y
CONFIG_BSP_USING_AUDIO_PLAY=y
#
# Board extended module Drivers

View File

@ -169,12 +169,12 @@
/* Onboard Peripheral Drivers */
#define BSP_USING_USB_TO_USART
#define BSP_USING_AUDIO
#define BSP_USING_AUDIO_PLAY
/* On-chip Peripheral Drivers */
#define BSP_USING_UART0
#define BSP_USING_AUDIO
#define BSP_USING_AUDIO_PLAY
/* Board extended module Drivers */

View File

@ -44,7 +44,7 @@ enable_int_ret:
/* Macro for saving task context */
.macro save_context
addi sp, sp, -120
addi sp, sp, -124
/* Save Context */
sw x1, 0(sp)
@ -79,6 +79,8 @@ enable_int_ret:
lw a5, EPC(zero) //Saves current program counter (EPC) as task program counter
sw a5, 116(sp)
lw a5, EPICCON(zero)
sw a5, 120(sp)
sw sp, rt_cur_thread_sp, a4 //store sp in preempted tasks tcb
.endm
@ -93,6 +95,8 @@ enable_int_ret:
/* Load task program counter EPC*/
lw a5, 116(sp)
sw a5, EPC(zero)
lw a5, 120(sp)
sw a5, EPICCON(zero)
/* Restore registers,
Skip global pointer because that does not change */
@ -126,7 +130,7 @@ enable_int_ret:
lw x30, 108(sp)
lw x31, 112(sp)
addi sp, sp, 120
addi sp, sp, 124
mret
.endm

View File

@ -39,6 +39,8 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
stk--;
*stk = (rt_uint32_t)0x10003; /* Start address */
stk--;
*stk = (rt_uint32_t)tentry; /* Start address */
stk -= 22;