Writing a small test program - a bit off topic
Peter Asemann
peter.asemann at web.de
Mon May 9 19:58:25 EST 2005
Hi there!
I *hope* this mail isn't very off topic. In principle it probably is,
but I don't know a mailing list which is about writing test programs to
test processors in order to debug a hardware to get linux running. Plus,
I suppose there are people out there who could help me. So I hope you
won't stone me for this post.
Whatever:
I have to write some test program for a mpc875 processor. It should run
in the processor cache as the memory of the hardware doesn't work for
hardware-problem-reasons.
I set up the memory mapping of the IMMR of the processor with the
debugger (BDM4GDB) so the IMMR is at 0xff000000.
Then I want to change the state of two leds. This can be done by writing
some values into some memory-mapped MPC registers (PEDAT / PEDIR) which
reside at IMMR + 0xac8 / 0xad8.
I wrote a C program to do that; As there is no OS I think I can just try
to write to memory locations directly:
#define CONFIG_8xx
int main(void){
long* a;
long* b;
a = (long*)0xff000ac8;
*a = 0x00001800;
b = (long*)0xff000ad8;
*b = 0x00001800;
}
Actually, if I compile it (using Denx ELDK 3.1) with
ppc-linux-gcc -static led.c -o led
the resulting program is 477K big.
On the other hand, if I do
ppc-linux-as -mcom led.s
and
ppc-linux-as -mcom led.s -o led.bin
the resulting program is 439 byte big.
Now, my questions are: Will the 439 byte program faciliated this way do
what I want? Did I make some fatal newbie mistakes? Does somebody know
how to upload code to the mpc instruction cache and execute it?
Thanks for reading,
Peter Asemann
More information about the Linuxppc-embedded
mailing list