Size stack in static threads

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

Peterx
Posts: 3
Joined: Thu Apr 07, 2016 8:18 pm

Size stack in static threads

Postby Peterx » Thu Apr 07, 2016 9:32 pm

Hi!

How I can determine the stack size of a static thread?

For example in THD_WORKING_AREA:
/*
* Working area for the LED flashing thread.
*/
static THD_WORKING_AREA(myThreadWorkingArea, 128);

/*
* LED flashing thread.
*/
static THD_FUNCTION(myThread, arg) {

while (true) {
LED_ON();
chThdSleepMilliseconds(500);
LED_OFF();
chThdSleepMilliseconds(500);
}
}

Thanks!

User avatar
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: Size stack in static threads

Postby Giovanni » Thu Apr 07, 2016 9:42 pm

Hi,

There is an option in chconf.h that enables a stack filler, you can use a debugger to see how much memory is left. In ChibiStudio there is a debug plugin that does that automatically, it shows all threads and their attributes.

Giovanni

phoenix2000
Posts: 2
Joined: Sat Mar 03, 2018 12:27 pm
Has thanked: 4 times

Re: Size stack in static threads

Postby phoenix2000 » Sat Mar 03, 2018 2:45 pm

Giovanni wrote:Hi,

There is an option in chconf.h that enables a stack filler, you can use a debugger to see how much memory is left. In ChibiStudio there is a debug plugin that does that automatically, it shows all threads and their attributes.

Giovanni

Hi
I changed CH_DBG_FILL_THREADS in chconf.h to TRUE. after clean and rebuild and run the application via debugger I couldn't find a place to watch the amount of stack the is used.
I guess it should be in ChibiOS/RT 4.x.x Debug View tab. but it is totally empty. Should I do anything further?

User avatar
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: Size stack in static threads

Postby Giovanni » Sat Mar 03, 2018 3:09 pm

Hi,

You need to press the refresh button on the ChibiOS view (top right), you also need to do this AFTER chSysInit() has been called and while the application is stopped.

Giovanni

gujoseleite
Posts: 4
Joined: Mon Apr 16, 2018 10:37 pm

Re: Size stack in static threads

Postby gujoseleite » Mon Apr 16, 2018 10:44 pm

Hi, everyone

How do I use and configure the chibios plugin? Do you have any tutorials? I downloaded and rode some demos but I did not understand how to check the memory for each thread..

Thanks for help me!

gujoseleite
Posts: 4
Joined: Mon Apr 16, 2018 10:37 pm

Re: Size stack in static threads

Postby gujoseleite » Tue Apr 17, 2018 9:01 pm

gujoseleite wrote:Hi, everyone

How do I use and configure the chibios plugin? Do you have any tutorials? I downloaded and rode some demos but I did not understand how to check the memory for each thread..

Thanks for help me!


Complementing..
I work with an arduino board and would like to debug via Chibios Studio, but I can not configure some debugger settings. I do not know how to define in debbuger the "targets" that should be observed ...

User avatar
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: Size stack in static threads

Postby Giovanni » Tue Apr 17, 2018 9:08 pm

Hi,

The ChibiOS plugin does not require any configuration, stop execution and refresh the view using the small yellow-ish button in the view toolbar.

Have you tried the video guides on Play Embedded? there are several tutorial you could try.

http://www.playembedded.org

Giovanni

gujoseleite
Posts: 4
Joined: Mon Apr 16, 2018 10:37 pm

Re: Size stack in static threads

Postby gujoseleite » Tue Apr 17, 2018 11:20 pm

Giovanni wrote:Hi,

The ChibiOS plugin does not require any configuration, stop execution and refresh the view using the small yellow-ish button in the view toolbar.

Have you tried the video guides on Play Embedded? there are several tutorial you could try.

http://www.playembedded.org

Giovanni


Hi,

I used a demo for arduino uno that is in chibios studio and created a new project following the tutorial: http://www.chibios.org/dokuwiki/doku.ph ... s:eclipse2.
But in the debugger configuration in "startup tab", I do not know which "targets" to put in the case of the arduino platform. The soft_reset_halt monitor and soft_reset_halt monitor commands among others in the tutorial are used for another platform. When executing the debug the project apparently works however the commands that you indicated are not available and in some the message: "Target Request Failed: Do not know how to run."

Thanks for answering!

User avatar
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: Size stack in static threads

Postby Giovanni » Wed Apr 18, 2018 7:43 am

Hi,

Those are OpenOCD commands, if you are using an ST-Link then the launch configuration is always the same, you can copy from another project. If you are using a different debugger then you should refer to the OpenOCD documentation, it could be different.

Giovanni


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 14 guests