Skip to contentSkip to conversation

combined C/ARM assembly example

U-Boot-Users Shakthi Kannan 1 participant 1 message Mar 28, 2006

lore
Share & tools
lore
#0 lore raw

Hi again,

Got this working. Repositioned, ptr1, ptr2 assignment after the assembly usage:

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

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

/* not here */

  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]");

/* placed here */

  ptr1 = (unsigned long *) (0x30800000);
  ptr2 = (unsigned long *) (0x30800004);
  
  printf ("*ptr1 = %8lx\n", *ptr1);
  printf ("*ptr2 = %8lx\n", *ptr2);

return (0);
}

Regards,

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