Hello,
I met a very strange problems:
Problem Background:
0. Compiler: GreenHills 7.1.6d for S32R274 (Demo Board)
1. Below code is in .link file:
__DATA_SIZE = SIZEOF(.data);
2.Below code is in .s file (startup file):
DATACOPY:
e_lis r9, __DATA_SIZE@ha # Load upper SRAM load size (# of bytes) into R9
e_or2i r9, __DATA_SIZE@l # Load lower SRAM load size into R9
3. Below code is in main function, I use LAUTERBACH and I can see the value of Evaluation_DataSize is 0xBA19 (I open map file ,is the same 0xBA19):
extern char __DATA_SIZE[];
int main(void)
{
Evaluation_DataSize = (UL)__DATA_SIZE;
4. But, in LAUTERBACH, I can see the list is as below:
e_lis r9, 0x10000 ;r9,65536
e_or2i r9, 0xBA19 ;r947641
My Problem:
Why the value is 0x10000? It should be 0x0. It puzzled me, hope your help.
Thanks in advance!
Solved! Go to Solution.
Hi,
got it, I didn't catch that first time. This is the problem:
e_lis r9, __DATA_SIZE@ha # Load upper SRAM load size (# of bytes) into R9
e_or2i r9, __DATA_SIZE@l # Load lower SRAM load size into R9
Two options to load 32bit value to a register are possible:
lis rn, VALUE@ha
addi rn, rn, VALUE@l
Second option:
lis rn, VALUE@h
ori rn, rn, VALUE@l
To solve this problem, you simply need to change @ha to @h.
Regards,
Lukas
Hi,
what is the opcode of this e_lis instruction?
Regards,
Lukas
Hi,
got it, I didn't catch that first time. This is the problem:
e_lis r9, __DATA_SIZE@ha # Load upper SRAM load size (# of bytes) into R9
e_or2i r9, __DATA_SIZE@l # Load lower SRAM load size into R9
Two options to load 32bit value to a register are possible:
lis rn, VALUE@ha
addi rn, rn, VALUE@l
Second option:
lis rn, VALUE@h
ori rn, rn, VALUE@l
To solve this problem, you simply need to change @ha to @h.
Regards,
Lukas
Thanks very much!
Can you send me a link to download the document of the S32R274 assemble instruction?
Perfect!
Thanks very much!