In the examples, the following code is used for stack alignment:
asm( " .align 4 " );
DWORD MyTaskStk[USER_TASK_STK_SIZE] __attribute__( ( aligned( 4 ) ) );
Are both directives needed? I would think the .asm one isn't needed since the aligned attribute does the same thing. I saw some notes about older versions of GCC not working correctly so is that the reason?
-Bob
Stack declaration attribute aligned vs. .align
-
- Posts: 22
- Joined: Mon Jan 27, 2014 7:19 pm
Re: Stack declaration attribute aligned vs. .align
I cannot find any examples that use
but you are right that you should not need both forms of alignment.
You can always use the macros defined in ucos.h and documented in uCOSLibrary.pdf:
OSSimpleTaskCreate( function, priority );
OSSimpleTaskCreatewName( function, priority, name );
these macros should force the stack alignment to be correct. Examining the macro definitons in ucos.h, there is no asm(" .align 4") line
ps I am referring to the latest release 2.6.8, but I don't think this has changed for a while.
Code: Select all
asm( " .align 4 " );
DWORD MyTaskStk[USER_TASK_STK_SIZE] __attribute__( ( aligned( 4 ) ) );
but you are right that you should not need both forms of alignment.
You can always use the macros defined in ucos.h and documented in uCOSLibrary.pdf:
OSSimpleTaskCreate( function, priority );
OSSimpleTaskCreatewName( function, priority, name );
these macros should force the stack alignment to be correct. Examining the macro definitons in ucos.h, there is no asm(" .align 4") line
ps I am referring to the latest release 2.6.8, but I don't think this has changed for a while.
-
- Posts: 22
- Joined: Mon Jan 27, 2014 7:19 pm
Re: Stack declaration attribute aligned vs. .align
I guess it wasn't in the shipping examples but in the Example for OSTaskCreate in the uC/OS manual. Thanks for the info.
-Bob
-Bob