开始是这样的,在移植eCos时遇到一个编译错误,代码如下
//=========================================================================
// State switch VSR
//
// This is called from the init code to switch execution from the main
// stack to the process stack. We also take the opportunity to do some
// other things that are best done in asm code such as disabling interrupts
// and setting the control register.
//
// The adjustment to MSP by 1/2 interrupt stack size allows code to
// throw exceptions without corrupting the execution stack. This is
// only necessary for non-kernel configurations (e.g. RedBoot, Stubs)
// since kernel configurations will switch to a thread stack before
// they should throw an exception.
.global hal_switch_state_vsr
.thumb
.thumb_func
.type hal_switch_state_vsr, %function
hal_switch_state_vsr:
mov r0,#CYGNUM_HAL_CORTEXM_PRIORITY_MAX
msr basepri,r0
mov r0,#2 // Set CONTROL register to 2
msr control,r0
isb // Insert a barrier
msr psp,sp // Copy SP to PSP
#if !defined(CYGPKG_KERNEL)
sub sp,#(CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE/2)
#endif
orr lr,#0xD // Adjust return link
bx lr // Return to init code on PSP now
#endif |