i trying load , store data 2 different arm registers.
int testing[64*1024] __attribute__ ((aligned (8192))); __asm__("mov r0, %0" :: "r" (testing) : "r0"); __asm__("str r5,[r0];"); in initial attempt tried store data pointed register r0 register r5. there absolutely no compilation problems data in register cannot accessed.
it same case load well.
ldr r1,[r0] (gdb) info registers r0 0xb6000 745472 r1 0x1 1 r2 0x0 0 r3 0xb6000 745472 r4 0x8961 35169 r5 0x0 0 r6 0x0 0 r7 0xbeba9664 3199899236 r8 0x0 0 r9 0xefb9 61369 r10 0xf02d 61485 r11 0x0 0 r12 0x0 0 sp 0xbeba9664 0xbeba9664 lr 0x89cb 35275 pc 0xeace 0xeace <test48+14> cpsr 0x60000030 1610612784 (gdb) bt #0 0x0000eace in test48 () #1 0x000089ca in main () (gdb) x/x $r5 0x0: cannot access memory @ address 0x0 (gdb) x/x $r0 0xb6000 <testing>: 0x00000000 essentially trying achieve memory inline addressing using ldr , str.
i took of this guide while building example
any idea going wrong
your comment , code not match:
in initial attempt tried store data pointed register r0 register r5 [...]
__asm__("str r5,[r0];");
the instruction wrote stores value of r5 memory location r0 points to. register r5 not point memory location - value 0x00 in example.
the __asm__ statements not declare r5 register used in way, compiler free put temporary value or variable in it. explains:
(gdb) x/x $r5 0x0: cannot access memory @ address 0x0 your gdb command tries access memory location r5 points - not point @ any.
Comments
Post a Comment