This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hey. Get your hardware developer to make hardware that can read the software's mind as it should. :-)
Oh, and I left the "volatile" keyword out of all of the above, but you absolutely, positively need it as well when you're touching hardware.
Linus Torvalds said somewhere he didn't like volatile because it never did what people expected. Linux people usually use a macro as follows:
#define barrier() __asm__ __volatile__("": : :"memory")
*reg = val1; barrier(); *reg = val2; barrier(); *reg = val3; barrier();
*reg = val1; *reg = val2; *reg = val3;
hwio32u reg = (unsigned int*)0xfe; *reg = 1; *reg = 2;
$ arm-elf-gcc -g -O3 -S test.c && less test.s
foo:
/* load register address */
mov r0, #254 /* 0xfe */
mov r1, #1
mov r2, #2
/* load write a '1' to it */
str r1, [r0, #0]
/* load write a '2' to it */
str r2, [r0, #0]
mov pc, lrfoo:
mov r1, #2
mov r0, #254
str r1, [r0, #0]
mov pc, lr-- Bill Gatliff Embedded Linux development and training services. bgat@billgatliff.com
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |