

; Assembler Code Here
1.在C函数中定义一段汇编代码;
2.在C文件中定义一个汇编函数;
__ASM uint32_t __get_PSP(void){mrs r0, pspbx lr}
uint32_t __get_PSP(void){__ASM("mrs r0, psp");__ASM("bx lr");}
static portFORCE_INLINE void vPortRaiseBASEPRI( void ){uint32_t ulNewBASEPRI = configMAX_SYSCALL_INTERRUPT_PRIORITY;__asm{/* Set BASEPRI to the max syscall priority to effect a critical section. */msr basepri, ulNewBASEPRIdsbisb}}
__asm void xPortPendSVHandler( void ){extern uxCriticalNesting;extern pxCurrentTCB;extern vTaskSwitchContext;PRESERVE8mrs r0, pspisbldr r3, =pxCurrentTCB /* Get the location of the current TCB. */ldr r2, [r3]stmdb r0!, {r4-r11} /* Save the remaining registers. */str r0, [r2] /* Save the new top of stack into the first member of the TCB. */stmdb sp!, {r3, r14}mov r0,msr basepri, r0dsbisbbl vTaskSwitchContextmov r0,msr basepri, r0ldmia sp!, {r3, r14}ldr r1, [r3]ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */ldmia r0!, {r4-r11} /* Pop the registers and the critical nesting count. */msr psp, r0isbbx r14nop}
__asm void NVIC_CoreReset_a(void){LDR R0, =0xE000ED0CLDR R1, =0x05FA0001STR R1, [R0]deadloop_CoreB deadloop_Core}
关注微信公众号『strongerHuang』,后台回复“1024”,查看更多精彩内容。

长按识别图中二维码关注