FreeRTOS module improvements
enhancementgood first issuehelp wanted
#871 introduced FreeRTOS integration for RP2040 and RP2350 ARM targets but there is still more things to do.
### More Zig wrapping functions
At this moment only few FreeRTOS API functions are wrapped in [zig module](https://github.com/ZigEmbeddedGroup/microzig/blob/main/modules/freertos/src/root.zig), would be nice to add all of them.
### More config options in build
Right now all FreeRTOS configs are set in [FreeRTOSConfig.h](https://github.com/ZigEmbeddedGroup/microzig/blob/main/modules/freertos/config/RP2040/FreeRTOSConfig.h) file, would be nice to extract some of this option to zig build file. For example:
configTOTAL_HEAP_SIZE
configSUPPORT_STATIC_ALLOCATION
configNUMBER_OF_CORES
### Allocator selection
Current implementation support just on default FreeRTOS heap [allocator / strategy](https://www.freertos.org/Documentation/02-Kernel/02-Kernel-features/09-Memory-management/01-Memory-management): heap_1.c We should allow in build config to select this by configuration option and expose all 5 standard allocators + add extra option where custom zig allocator could be provided.
### Multicore support
Current ports for RP2xxx do not support multicore operation because the following functions remain unimplemented: `multicore_launch_core1`, `multicore_reset_core1`, and `multicore_doorbell_claim_unused`.
The main question is where these functions should be implemented: in Zig itself, or in C glue code that utilizes the Pico SDK implementation, similar to how IRQ handling is currently done. This confusion arose because the current Zig HAL already has an implementation of `multicore_launch_core1`, but its quality and correctness are unclear.
### RP2350 RISC-V port
I tried to add this port but finally get stuck with 2 missing symbols: `__StackOneTop` and `__StackTop`. In PicoSDK those are defined in [liner script](https://github.com/raspberrypi/pico-sdk/blob/a1438dff1d38bd9c65dbd693f0e5db4b9ae91779/src/rp2_common/pico_crt0/rp2350/memmap_default.ld) so microzig target would have to introduce something similar.
### ESP32 C3 port
First, the base version used there is an older FreeRTOS release (V10.5.1) with custom [patches](https://github.com/espressif/esp-idf/blob/master/components/freertos/FreeRTOS-Kernel/idf_changes.md). The current FreeRTOS version (V11.2.0) used by the MicroZig module already includes these patches and changes, so the only relevant parts are likely located [here](https://github.com/espressif/esp-idf/tree/master/components/freertos/FreeRTOS-Kernel/portable).
This code can either be reused directly or copied and slightly modified as needed. Don't know if generic RISC-V [target ](https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/main/portable/GCC/RISC-V)from FreeRTOS repository can be used in this case directly.
0 条评论