#define portRESTORE_CONTEXT_OS_INT()
{
extern volatile unsigned portLONG ulCriticalNesting;
extern volatile void *volatile pxCurrentTCB;
/* Check if AVR32_INTC_INT0 or higher were being handled (case where the OS tick interrupted another */
/* interrupt handler (which was of a higher priority level but decided to lower its priority */
/* level and allow other lower interrupt level to occur). */
/* In this case we don't want to do a task switch because we don't know what the stack */
/* currently looks like (we don't know what the interrupted interrupt handler was doing). */
/* Saving SP in pxCurrentTCB and then later restoring it (thinking restoring the task) */
/* will just be restoring the interrupt handler, no way!!! */
__asm__ __volatile__ (
"ld.w r0, sp[9*4]nt" /* Read SR in stack */
"bfextu r0, r0, 22, 3nt" /* Extract the mode bits to R0. */
"cp.w r0, 1nt" /* Compare the mode bits with supervisor mode(b'001) */
"brhi LABEL_INT_SKIP_RESTORE_CONTEXT_"ASTRINGZ(__LINE__)
);
/* Else */
/* because it is here safe, always call vTaskSwitchContext() since an OS tick occurred. */
/* A critical section has to be used here because vTaskSwitchContext handles FreeRTOS linked lists. */
portENTER_CRITICAL();
vTaskSwitchContext();
portEXIT_CRITICAL();
/* Restore all registers */
__asm__ __volatile__ (
/* Set SP to point to new stack */
"mov r8, LWRD("ASTRINGZ(pxCurrentTCB)")nt"
"orh r8, HWRD("ASTRINGZ(pxCurrentTCB)")nt"
"ld.w r0, r8[0]nt"
"ld.w sp, r0[0]n"
"LABEL_INT_SKIP_RESTORE_CONTEXT_"ASTRINGZ(__LINE__)":nt"
/* Restore ulCriticalNesting variable */
"ld.w r0, sp++nt"
"mov r8, LWRD("ASTRINGZ(ulCriticalNesting)")nt"
"orh r8, HWRD("ASTRINGZ(ulCriticalNesting)")nt"
"st.w r8[0], r0nt"
/* Restore R0..R7 */
"ldm sp++, r0-r7nt"
/* Now, the stack should be R8..R12, LR, PC and SR */
"rete"
);
/* Force import of global symbols from assembly */
ulCriticalNesting;
pxCurrentTCB;
}
#endif
The compiler reports the following error:
Error: Undefined symbol: LABEL_INT_SKIP_RESTORE_CONTEXT_215Error: Undefined symbol: LABEL_INT_SKIP_RESTORE_CONTEXT_215 I’ve been thinking to try to call switch the context inside the asm statement but I’m not sure if this is the best option and if it really would work. So, it would be great to get some advice here, how to restore the context in another way and avoid the compiling error. Thank you so much