Allocated vs Free ??

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

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

Tabulous
Posts: 509
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 17 times

Re: Allocated vs Free ??

Postby Tabulous » Tue Dec 14, 2021 12:10 pm

Still does not make sense this......See below

[ addr ] [ top ] [ base ] [free] [pr] [rf] [ name ] [ state ] [ time ] [ % ]
2000F618 2000F804 2000F680 376 3 1 alsd SLEEPING 0 0.00

addr = address of the thread (tp)
top = p_ctx.r13
base = p_stklimit

alsd thread is declared with 384 bytes of WA
static THD_WORKING_AREA(ALSWA, 384);

So below is the thread memory from 2000F618, so where in here would one count to find the total used WA ? i.e. out of 384 what is used ?

0x2000F618 : 0x2000F618 <Hex>
Address 0 - 3 4 - 7 8 - B C - F
2000F610 810C0208 00000000 C0110020 C0110020
2000F620 03000000 34F80020 30500120 80150120
2000F630 B40C0508 80F60020 080001FF EE000000
2000F640 00000000 44F60020 48F60020 48F60020
2000F650 FFFFFFFF 00000000 00000000 03000000
2000F660 FFFFFFFF FFFFFFFF EC040000 B1280000
2000F670 9C170000 05040000 78B43300 00000000
2000F680 55555555 55555555 55555555 55555555
2000F690 55555555 55555555 55555555 55555555
2000F6A0 55555555 55555555 55555555 55555555
2000F6B0 55555555 55555555 55555555 55555555
2000F6C0 55555555 55555555 55555555 55555555
2000F6D0 55555555 55555555 55555555 55555555
2000F6E0 55555555 55555555 55555555 55555555
2000F6F0 55555555 55555555 55555555 55555555
2000F700 55555555 55555555 55555555 55555555
2000F710 55555555 55555555 55555555 55555555
2000F720 55555555 55555555 55555555 55555555
2000F730 55555555 55555555 55555555 55555555
2000F740 55555555 55555555 55555555 55555555
2000F750 55555555 55555555 55555555 55555555
2000F760 C1C12126 78160020 34030000 55555555
2000F770 16030008 55555555 55555555 55555555
2000F780 55555555 55555555 55555555 55555555
2000F790 55555555 55555555 55555555 55555555
2000F7A0 16030008 55555555 55555555 55555555
2000F7B0 55555555 55555555 55555555 55555555
2000F7C0 55555555 55555555 55555555 55555555
2000F7D0 55555555 55555555 55555555 55555555
2000F7E0 55555555 08F80020 00000000 55555555
2000F7F0 55555555 55555555 55555555 55555555
2000F800 55555555 81220008 2CF80020 CB1F0008
2000F810 08F80020 2CF80020 011F0208 59230008
2000F820 E8030000 78160003 00000000 3CE90020
2000F830 C4290120 55555555 55555555 55555555
2000F840 55555555 55555555 55555555 55555555
2000F850 55555555 55555555 55555555 55555555
2000F860 55555555 55555555 55555555 55555555
2000F870 55555555 98F80020 00000000 55555555

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: Allocated vs Free ??

Postby Giovanni » Tue Dec 14, 2021 1:08 pm

In this old version the Thread structure is placed at the base of the working area, you need to skip sizeof(Thread) bytes from base.

It is where the 0x55555555 start.

Giovanni

Tabulous
Posts: 509
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 17 times

Re: Allocated vs Free ??

Postby Tabulous » Tue Dec 14, 2021 2:37 pm

Giovanni wrote:In this old version the Thread structure is placed at the base of the working area, you need to skip sizeof(Thread) bytes from base.

It is where the 0x55555555 start.

Giovanni


What address do you say that would be on the above, 2000F680 ?

Also there is 4 extra bytes coming from somewhere ( 2000F804 - 2000F680 == 388 ) ?? WA is 384

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: Allocated vs Free ??

Postby Giovanni » Tue Dec 14, 2021 4:02 pm

Stack are aligned to 64 bits on ARM, it is an alignment done by the working area partitioning code.

Giovanni

Tabulous
Posts: 509
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 17 times

Re: Allocated vs Free ??

Postby Tabulous » Wed Dec 15, 2021 12:29 pm

Is there any where i can find the calculation that is used for "StkUnused" in the chibios RT eclispe plugin ?

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: Allocated vs Free ??

Postby Giovanni » Wed Dec 15, 2021 3:35 pm

Follow the THD_WORKING_AREA macro, it is done in there, it ends up in the port layer. Then look into chThdCreateStatic().

Giovanni


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 21 guests