From 81c623212a8746c4b5ebc29891b91228591040cc Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:50:51 +0800 Subject: [PATCH] Update SMP branch readme for port migration (#999) --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 067f6a066..ef2c293d6 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,44 @@ The contents of this branch will remain available for certain period but we will Have more questions? Post them in the [FreeRTOS forum](https://forums.freertos.org/). +## Migrate port from SMP branch to FreeRTOS v11 + +The following changes should be applied to migrate a port from this branch to FreeRTOS v11: + +* Call `xTaskIncrementTick` in critical section in port + +RP2040 example: +```c +void xPortSysTickHandler( void ) +{ + portBASE_TYPE xPreviousMask; + + /* xTaskIncrementTick now must be called in critical section. */ + xPreviousMask = taskENTER_CRITICAL_FROM_ISR(); + { + /* Increment the RTOS tick. */ + if( xTaskIncrementTick() != pdFALSE ) + { + /* Pend a context switch. */ + portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; + } + } + taskEXIT_CRITICAL_FROM_ISR( xPreviousMask ); +} +``` + +* Rename `configNUM_CORES` to `configNUMBER_OF_CORES` + +* Define `portSET/CLEAR_INTERRUPT_MASK` in port + +* Define `portENTER/EXIT_CRITICAL_FROM_ISR` for SMP in port + * These macros should be implemented with `vTaskEnterCriticalFromISR`/`xTaskExitCriticalFromISR` + +* Update `portSET/CLEAR_INTERRUPT_MASK_FROM_ISR` implementation in port + * SMP-dev doesn’t use these macros to enter/exit critical section from ISR. Instead, + `portENTER/EXIT_CRITICAL_FROM_ISR` are used. These functions should be implemented as + the macro name suggested, set or clear interrupt mask from ISR if nested interrupt are supported. + ---