Skip to main content
Associate
September 28, 2023
Solved

error: function 'ALIGN_32BYTES' is initialized like a variable

  • September 28, 2023
  • 1 reply
  • 1769 views

Hello everyone!
I'm trying to debug a project based on the following video:
https://www.youtube.com/watch?v=PXfCyE-LnR4
As one of the steps, after adding the following text:

#define CCRValue_BufferSize 37

ALIGN_32BYTES (uint32_t DiscontinuousSineCCRValue_Buffer[CCRValue_BufferSize]) =
{
14999, 17603, 20128, 22498, 24640, 26488, 27988, 29093, 29770,
29998, 29770, 29093, 27988, 26488, 24640, 22498, 20128, 17603,
14999, 12394, 9869, 7499, 5357, 3509, 2009, 904, 227, 1, 227,
904, 2009, 3509, 5357, 7499, 9869, 12394, 14999
};

I get the error:

error: function 'ALIGN_32BYTES' is initialized like a variable

I would like to know how to solve the problem.
Thanks!

This topic has been closed for replies.
Best answer by TDK

Unclear how ALIGN_32BYTES is defined. Perhaps it is missing or wrong.

In any case, you can use __attribute__((aligned(32))) to declare the array instead.

__attribute__((aligned(32))) uint32_t DiscontinuousSineCCRValue_Buffer[CCRValue_BufferSize] =
{
14999, 17603, 20128, 22498, 24640, 26488, 27988, 29093, 29770,
29998, 29770, 29093, 27988, 26488, 24640, 22498, 20128, 17603,
14999, 12394, 9869, 7499, 5357, 3509, 2009, 904, 227, 1, 227,
904, 2009, 3509, 5357, 7499, 9869, 12394, 14999
};

 

1 reply

TDK
TDKBest answer
Super User
September 28, 2023

Unclear how ALIGN_32BYTES is defined. Perhaps it is missing or wrong.

In any case, you can use __attribute__((aligned(32))) to declare the array instead.

__attribute__((aligned(32))) uint32_t DiscontinuousSineCCRValue_Buffer[CCRValue_BufferSize] =
{
14999, 17603, 20128, 22498, 24640, 26488, 27988, 29093, 29770,
29998, 29770, 29093, 27988, 26488, 24640, 22498, 20128, 17603,
14999, 12394, 9869, 7499, 5357, 3509, 2009, 904, 227, 1, 227,
904, 2009, 3509, 5357, 7499, 9869, 12394, 14999
};

 

"If you feel a post has answered your question, please click ""Accept as Solution""."