* Writing a small test program - a bit off topic
@ 2005-05-09 9:58 Peter Asemann
2005-05-09 20:04 ` McMullan, Jason
0 siblings, 1 reply; 2+ messages in thread
From: Peter Asemann @ 2005-05-09 9:58 UTC (permalink / raw)
To: linuxppc-embedded
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Writing a small test program - a bit off topic
2005-05-09 9:58 Writing a small test program - a bit off topic Peter Asemann
@ 2005-05-09 20:04 ` McMullan, Jason
0 siblings, 0 replies; 2+ messages in thread
From: McMullan, Jason @ 2005-05-09 20:04 UTC (permalink / raw)
To: Peter Asemann; +Cc: PPC_LINUX
[-- Attachment #1: Type: text/plain, Size: 670 bytes --]
On Mon, 2005-05-09 at 11:58 +0200, Peter Asemann wrote:
> 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.
assuming 'foo.c' is your program, and you want to run it at origin 0.
Step 1) ppc8xx-linux-gcc -Dmain=_start -nostdlib foo.c -o foo
Step 2) ppc8xx-linux-objcopy foo -O binary foo.bin
Done!
--
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-09 20:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-09 9:58 Writing a small test program - a bit off topic Peter Asemann
2005-05-09 20:04 ` McMullan, Jason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).