[U-Boot-Users] combined C/ARM assembly example

Shakthi Kannan shakthimaan at yahoo.com
Wed Mar 22 20:05:05 CET 2006


Greetings!

I am trying to test the mrs ARM instruction from
hello_world.c example using 2.95.3 toolchain,
u-boot-1.1.1 (will update). SDRAM is at 0x30000000.

The C/assembly code is as follows:

#include <common.h> 
#include <exports.h> 

int main (int argc, char *argv[])
{
 unsigned long *ptr1, *ptr2;

 ptr1 = (unsigned long *) (0x30800000);
 ptr2 = (unsigned long *) (0x30800004);

 asm volatile ("ldr r0,= 0x30800000");
 asm volatile ("ldr r3,= 0x30800004");
 asm volatile ("ldr r1,= 0xff000000");
 asm volatile ("movs r2, r1, lsl #1");
 asm volatile ("mrs r1, cpsr");
 asm volatile ("str r1, [r0, #0]");
 asm volatile ("str r2, [r3, #0]");

 printf ("*ptr1 = %8lx\n", *ptr1);
 printf ("*ptr2 = %8lx\n", *ptr2);

 return (0);
}

I am expecting:

*ptr1 (0x30800000) = cpsr value
*ptr2 (0x30800004) = 0xfe000000

I get the following output:

*ptr1 (0x30800000) = 0xfe000000
*ptr2 (0x30800004) = 0xfe000000

But, when I use md to get the memory dump, the values
are correct though:
     0x30800000 contains a00000d3
     0x30800004 contains fe000000

a00000d3 = NzCvjIFt_svc

svc because I am using -D__KERNEL__ ?

Checking the disassembly using objdump reveals no
instance of 0x30800004.

The Makefile, code, output is at:
http://shakthimaan.com/616514.txt

I'd appreciate any inputs regarding this or am I
missing something here.

Thanks,

SK


--
Shakthi Kannan, MS
Software Engineer, Hexaware Technologies
[E]: shakthimaan at yahoo dot com           [M]: (91) 98407-87007
[W]: http://www.shakthimaan.com      [L]: Chennai, India

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the U-Boot mailing list