Użytkownik Heiko Panther napisał:
Followup. Here's a self-contained demo of the problem. Compiles with
msp430-gcc main.S -mmcu=msp430x133 -o main.elf
Watch it run and check that while 2(r1) contains the address of
correct(),
actually wrong() is called. Tried with an M430F133 as well an M430F147.
Best,
Heiko
------------------------------------------------------------------------
.file "main.c"
.arch msp430x133
.text
.p2align 1,0
correct:
push r14
pop r14
ret
.p2align 1,0
wrong:
push r15
pop r15
ret
.p2align 1,0
.global main
.type main,@function
main:
mov #0x300, r1
sub #4, r1
mov #correct, 2(r1)
mov #wrong, 0(r1)
call 2(r1)
add #4, r1
br #__stop_progExec__
Hmm, in simulator it's OK
(gdb) disass
Dump of assembler code for function main:
0x0000fc4c <main+0>: mov #768, r1 ;#0x0300
0x0000fc50 <main+4>: sub #4, r1 ;r2 As==10
0x0000fc52 <main+6>: mov #-960, 2(r1) ;#0xfc40
0x0000fc58 <main+12>: mov #-954, 0(r1) ;#0xfc46
0x0000fc5e <main+18>: call 2(r1) ;
0x0000fc62 <main+22>: add #4, r1 ;r2 As==10
0x0000fc64 <main+24>: br #0xfc68 ;
End of assembler dump.
(gdb) stepi
0x0000fc50 in main () at gcrt0.S:39
39 in gcrt0.S
(gdb)
0x0000fc52 in main () at gcrt0.S:39
39 in gcrt0.S
(gdb)
0x0000fc58 39 in gcrt0.S
(gdb)
0x0000fc5e 39 in gcrt0.S
(gdb)
0x0000fc40 in correct () at gcrt0.S:39
39 in gcrt0.S
Albert