purduesigbots / pros

Source code for PROS kernel: open source C/C++ development for the VEX V5 microcontroller
https://pros.cs.purdue.edu
Other
259 stars 76 forks source link

RFC: Increase max stack size for tasks #523

Open Richard-Stump opened 1 year ago

Richard-Stump commented 1 year ago

Problem:

Currently tasks in PROS are limited to 64k words, or 256kb of stack space. Most applications do not appear to reach this limit, but the folks working on vex-rt have ran into issues due to rust's memory management. Currently, the limit appears to be due to the fact that the stack depth is a uint16_t:

task_t task_create(task_fn_t function, void* const parameters, uint32_t prio, const uint16_t stack_depth, const char* const name);

Proposed Solution:

Change the FreeRTOS function to take a uint32_t for the stack depth, and add extra code to perform checks for things like:

Additionally, other things need to be considered such as:

Richard-Stump commented 1 year ago

After talking with the folks porting Rust to PROS, they found that their issues were not due to the limited stack size. I am leaving this PR open as it could be a useful addition in the future though.