How to utilize PowerPC pre-existing flash resident code ???
Jon Miller
jmiller@silcom.com
Mon Feb 11 12:40:00 GMT 2002
Hello,
I am trying to make the world's simplest example of a c program
utilizing pre-existing PowerPC flash resident code.
I hope someone there can look at this and at least point me to a
reference;
BACKGROUND :
I am using the gnu tools for powerpc with cygwin.dll.
The pre-existing function resides at 0x00010ff8 in physical memory.
<main.c> calls <jon.s> in order to jump to the phy address but it
doesn't work?
Here is the resulting disassembly of the jump statement
4: 48 01 0f fa ba 10ff8 <wc_lbl+0x10ff8> <--- ????
QUESTIONS:
1) Where can I read how to do this?
2) Could I do this directly from c with no s file?
3) How can I fix my existing setup?
Thanks, Jon Miller 805-564-3119
www.jrmconsultants.com
====================================
(c code)
int main(void)
{
*(int *)PBDIR |= 0x2000; /* PB 18 = Out */
asm volatile (
".extern wc_lbl;"
"bl wc_lbl;" // use a stepping stone
);
return 0;
}
====================================
(asm code)
#include "ppc-asm.h"
.file "jon.S"
.text
.Lptr:
.globl wc_lbl
.type wc_lbl,@function
wc_lbl:
mfspr r30,LR /* Save the Link Register value. */
ba 0x00010ff8 /* jump to abs adr in low memory ??? */ ,
mtspr LR,r30 /* restore original Link Register value */
bclr 20,0 /*return */
====================================
(binary dump)
powerpc-elf-objdump --disassemble jon.o
jon.o: file format elf32-powerpc
Disassembly of section .text:
00000000 <wc_lbl>:
0: 7f c8 02 a6 mflr r30
4: 48 01 0f fa ba 10ff8 <wc_lbl+0x10ff8> <--- ????
8: 7f c8 03 a6 mtlr r30
c: 4e 80 00 20 blr
====================================
(loader script)
SECTIONS
{
. = 0x00800000;
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss) }
__bss_start = .;
/* . += 0x100; */
__bss_end = .;
__sbss_start = .;
/* . += 0x100; */
__sbss_end = .;
. += 0x100;
PROVIDE (__stack = .);
_end = .;
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
}
====================================
(cygwin makefile script)
# POWER PC EXAMPLE MAKEFILE
PROC=powerpc
#TYPE=srec
TYPE=elf
TARGETBOARD=jon
# OTHER PRECONFIGURED TARGET BOARD LINK SCRIPTS:
#TARGETBOARD=SBC403
#TARGETBOARD=8260ADS
#TARGETBOARD=823FADS
PATH=/usr/local/bin:/usr/bin:$PATH
LIBPATH=/usr/local/$(PROC)-$(TYPE)/lib
INCPATH=/usr/local/$(PROC)-$(TYPE)/include
CC=$(PROC)-$(TYPE)-gcc
AS=$(PROC)-$(TYPE)-as
AR=$(PROC)-$(TYPE)-ar
LD=$(PROC)-$(TYPE)-ld
NM=$(PROC)-$(TYPE)-nm
OBJDUMP=$(PROC)-$(TYPE)-objdump
test:
$(CC) -g -c --gstabs -o jon.o jon.S
$(CC) -g -c test.c
$(LD) -g -v -t -Tldscript_$(TARGETBOARD) -o test test.o jon.o
$(NM) test
objcopy test test.s2 -O srec
====================================
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list