cancel
Showing results for 
Search instead for 
Did you mean: 

Rom Table Alignment Problems

rlongdon
Associate II
Posted on November 14, 2008 at 15:58

Rom Table Alignment Problems

3 REPLIES 3
rlongdon
Associate II
Posted on May 17, 2011 at 12:52

I am trying to place a constant table in flash. When I execute the code and point to the table using the LDR R0, =Table_Start command, the start address of the table is returned offset by +1, which of course, screws up all my data. (Example, Table_Start is 0x080003F4. After execution of the LDR command, R0 contains 0x080003F5).

I'm sure I've screwed up something in the alignment! Here's how I set up the section. I'm using IAR EWARM 5.2. Code is pure assembler.

Table_Start:

DCW 0,62,124,185,247,309,371,432,494,555,616,677,738,799

DCW 859,920,980,1040,1100,1159,1218,1277,1336,1394,1452,1510,1567,1624

I've tried various alignment schemes, and even defined a separate .rodata section, but none seem to work (admittedly I'm still kinda fuzzy on the alignment issues, but I'm starting to make a bit of sense out of them!)

If anyone has any thoughts or experiences, help would be appreciated!

Regards,

tibo
Associate II
Posted on May 17, 2011 at 12:52

LDR is a pseudo instruction. If you load a program address, it switches the LSB to 1

to indicate the Thumb-State of the processor. If you load a data address the LSB is

not changed.

A second way is to use ADR, then the LSB is not changed too.

rlongdon
Associate II
Posted on May 17, 2011 at 12:52

Tibo,

Thanks so much! That solved the problem. I'm new to ARM processors and was aware of the interworking instructions, but obviously don't completely understand them.

Not only have you helped me solve my immediate issue, but you've pointed me in the direction toward studying and understanding the details.

Thanks again.

Regards,

Russ