Skip to content

Commit 730ae6b

Browse files
authored
Merge branch 'main' into update-pxcurrentTCB
2 parents cd0d09c + 6dab25a commit 730ae6b

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

portable/GCC/ARM_CM0/portasm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att
472472
" ldr r3, =%1 \n"
473473
" cmp r2, r3 \n"
474474
" beq system_call_exit \n"
475-
" b vPortSVCHandler_C \n"
475+
" ldr r3, =vPortSVCHandler_C \n"
476+
" bx r3 \n"
476477
" \n"
477478
" system_call_enter: \n"
478479
" push {lr} \n"
@@ -508,11 +509,13 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att
508509
" \n"
509510
" stacking_used_psp: \n"
510511
" mrs r0, psp \n"
511-
" b vPortSVCHandler_C \n"
512+
" ldr r3, =vPortSVCHandler_C \n"
513+
" bx r3 \n"
512514
" \n"
513515
" stacking_used_msp: \n"
514516
" mrs r0, msp \n"
515-
" b vPortSVCHandler_C \n"
517+
" ldr r3, =vPortSVCHandler_C \n"
518+
" bx r3 \n"
516519
" \n"
517520
" .align 4 \n"
518521
);

portable/MSVC-MingW/port.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,20 @@ void vPortCloseRunningThread( void * pvTaskToDelete,
547547
/* This is called from a critical section, which must be exited before the
548548
* thread stops. */
549549
taskEXIT_CRITICAL();
550+
551+
/* Record that a yield is pending so that the next tick interrupt switches
552+
* out this thread regardless of the value of configUSE_PREEMPTION. This is
553+
* needed when a task deletes itself - the taskYIELD_WITHIN_API within
554+
* vTaskDelete does not get called because this function never returns. If
555+
* we do not pend portINTERRUPT_YIELD here, the next task is not scheduled
556+
* when configUSE_PREEMPTION is set to 0. */
557+
if( pvInterruptEventMutex != NULL )
558+
{
559+
WaitForSingleObject( pvInterruptEventMutex, INFINITE );
560+
ulPendingInterrupts |= ( 1 << portINTERRUPT_YIELD );
561+
ReleaseMutex( pvInterruptEventMutex );
562+
}
563+
550564
CloseHandle( pxThreadState->pvYieldEvent );
551565
ExitThread( 0 );
552566
}

0 commit comments

Comments
 (0)