Hi,
I use RTOS Chibios / RT on the Arduino platform. I developed my project using 3 threads of size 100 bytes for the working area parameter. But I think I'm wasting my memory. I tried to run some tests and I got a strange result.
When defining the working area in 0 bytes, the program works in the same way as for 10, 20 ... 50 or 100 bytes (each thread has operations to flash LEDs, start motors, read digital and analog pins among other functions). I've even used a code to determine the ram memory consumption and in fact each thread uses a portion of the memory. I wonder if anyone knows why this occurred and if there is any way to determine the size of the threads since on the arduino platform the debug is difficult to perform.
Thanks!
Managing the working area of a thread
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: Managing the working area of a thread
Hi,
Without debug capability there is no way to assess the stack usage. You may try to measure it at runtime by counting the filler in stacks (you need to enable the option for stack filling in chconf.h).
The effect of stack overflows can also not be immediately evident, you may think it is OK but it is overflowing and bite you afterward.
An API to measure stack usage is in the to-do list but results could be unreliable.
Unless you really need it to be an Arduino I would suggest to get a cheap Nucleo board a solve a lot of problems in one go.
Giovanni
Without debug capability there is no way to assess the stack usage. You may try to measure it at runtime by counting the filler in stacks (you need to enable the option for stack filling in chconf.h).
The effect of stack overflows can also not be immediately evident, you may think it is OK but it is overflowing and bite you afterward.
An API to measure stack usage is in the to-do list but results could be unreliable.
Unless you really need it to be an Arduino I would suggest to get a cheap Nucleo board a solve a lot of problems in one go.
Giovanni
Who is online
Users browsing this forum: No registered users and 6 guests