Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

aligned attribute in XC compiler

Status
Not open for further replies.
I have seen this code

#define PM_ROW __attribute__((space(prog), aligned(128)))
const PM_ROW MyRowData1InFlash[] =
{ 0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111
};
const PM_ROW MyRowData2InFlash[] =
{ 0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222
};

If i do not give align(128) will the compiler not put in multiples of 128 addresses. When it is mandatory that i give this align parameter? Please advise.
 
If you omit the align attribute the compiler will put it wherever it likes. It's only mandatory when you need it aligned.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top