Hi Johannes & Jukka,

Thank you for looking into this, I just wanted to mention something, so it
does not get over looked, if it is still appropriate:

In the past (9 or so years ago) there was an issue with floating point that
required the stack to be 8 byte aligned. It was too long ago, so I do not
remember the details, j
(There is a note in the release notes, "ARM EABI: Fix stack alignment
required for passing floating point values.") But I do remember that printf
printed garbage until the STACK_ALIGN_xxxx stuff was done.

Regards,

David


-----Original Message-----
From: Schock, Johannes - NIVUS GmbH [mailto:johannes.sch...@nivus.com]
Sent: Friday, September 25, 2020 5:49 AM
To: dev@nuttx.apache.org
Subject: RE: Stack size alignment on arm

> 1. Set the stack size as aligned already in
> arch/arm/src/common/arm_createstack.c:
>
> -      tcb->adj_stack_size = stack_size;
> +      tcb->adj_stack_size = STACK_ALIGN_DOWN(stack_size);
>
> 2. fix the do_stackcheck in a way that it doesn't start at (unaligned)
> top, but at the first aligned stack address?
>
> 3. just leave nuttx as is, and go fix all the stack sizes in px4?
>
>
> Initally I did the (1.) which seems to fix my problem.

I had a look, and you're right. I've missed that arm_stack_color and
do_check are now working differently concerning calculation of top
(stackbase) address.
If you don't mind (and since it is my mistake) I will provide a fix that
weekend.
Perhaps 32bit downalign instead of 32bit upalign the arm_stack_color
stackbase would also be a solution as well, since TLS size is also 32bit
aligned. This would keep the requested size in tcb->adj_stack_size.
But I have to verify with arm_usestack.c

Johannes

Reply via email to