Is there and alignment directive to align data on a 16-byte boundary?

Status
Not open for further replies.

Burly

Member
Hey guys...

Is there and alignment directive to align data on a 16-byte boundary?

I'm working with a Teensy LC.
I've successfully used PROGMEM to store a 16-byte array in program flash memory.
Here is the code snippet of static global variable;

Code:
static const uint8_t PROGMEM SYNC_Table[16] = {0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F};
I can open the .hex file in a text editor and see the data.
I can also access the data in program.
So everything is working just fine.
My question is...is there some way to have the compiler start this array on a 16-byte border in the Flash Memory.

The reason is...I want to hold a GUID Type ID...like a MAC address...or IP address.
I also want the user to be able to go into the .hex file and modify the bytes.
Having the array on a single line of the .hex file makes it easier to deal with.
Of course the checksum at the end of the line has to be adjusted.

To make things more foolproof, I can even write a program that gives the user a 16-byte field to enter a random number.
The program would then open the .hex file and scan for the 16 occurrences of 0x3F in the proper columns...plug in the new number...and fix up the checksum.

But if I can't get 16-byte alignment...that makes the task more difficult...but not impossible.
I'd just have to deal with plugging the proper fragments in two lines.

Any thoughts?

Thanks!!!
 
Try:
Code:
static const uint8_t PROGMEM SYNC_Table[16] __attribute__ ((aligned (16))) =

Pete
Paul beat me to it.
 
YEAH!!!!
WORK'S LIKE A CHAMP!!!!!
Code:
static const uint8_t PROGMEM SYNC_Table[16]__attribute__((aligned(16))) = 
{0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F};
When I look at the .HEX file it's aligned on the 16-byte boundry...

THANKS GUYS!!!!!
 
Status
Not open for further replies.
Back
Top