is there a way to force constant strings to be aligned on 4 byte boundary?
For example: createTask("Taskname");
I tried the linker option "OVERALIGN", but it just generates a warning.
Do you just need to use __attribute__((aligned(4))) when you declare the string?
(better documented in later versions)https://developer.arm.com/docs/101754/0614/armclang-reference/compiler-specific-function-variable-and-type-attributes/__attribute__aligned-variable-attributeRegardsRonan
But does this work with constant string like in the example? I tried, but it did not work in the first attempt:
create("name" __attribute__((aligned(4))) );
Edit:I tried: __attribute__((align(4))) "default" and "default" __attribute__((align(4)))
Hi BastianDeclaring like this worked for me.
char __attribute__((aligned(4))) string1 = "abcde";
Could you share a larger snippet of your code?
Yes this works for me as well. This is actually my workaround:
/* Workaround */
char name; /* automatic aligned to 4 bytes as it is on stack*/
create("process"); /* constant string might be placed on any boundary */
func2() would show the original code.
create() (assembly function) would read the name 32bit wise. This works fine on architecture > Armv6-M, but not for Armv6-M.
The workaround is ok and I can live with it, but it is a pity there is no way to force alignment.
View all questions in Arm Compilers forum