Ok, that got me a little further. I renamed main() to bootloader() and made a 
linker script that moves both HOME and CSEG. Then I made my own crtstart.asm 
that puts " ljmp     __sdcc_gsinit_startup" at the reset vector, and changes  
__sdcc_gsinit_startup to jump to _bootloader instead of __sdcc_program_startup. 

Compiling and linking all of that gives me output that seems to do what I want. 
However, I noticed that main.asm has what appears to be code for initializing 
global variables. And it seems that normally this code is run after a jump to 
__sdcc_init_data and then there's a jump to __sdcc_program_startup after the 
initialization is finished. When I changed main() to bootloader() that last 
jump to __sdcc_program_startup went away.

I'm trying to figure out how to get that initialization code to run. I can't 
jump to __sdcc_init_data because there's no jump after the initialization that 
will get me back to _bootloader. Any suggestions?

(No worries, happens all the time)

-----Original Message-----
From: Maarten Brock [mailto:sourceforge.br...@dse.nl] 
Sent: Thursday, February 11, 2010 10:39 PM
To: sdcc-user@lists.sourceforge.net
Subject: Re: [Sdcc-user] Default linker script for mcs51?

Brandon,

You could also rename your main() to mymain() and generate the necessary 
startup code yourself in assembly.

(Sorry for misspelling your name earlier.)

Maarten

> 
> On Feb 11, 2010, at 20:04 , Peter Van Epp wrote:
> 
> > On Thu, Feb 11, 2010 at 12:27:04PM +0100, Brandon Fosdick wrote:
> >> Well, it looks like I spoke too soon. 
> >> 
> >> SDCC is still dumping some non-vector stuff in the GSINIT and HOME 
> >> segments. I see how I could use the linker to relocate GSINIT* segments to 
> >> someplace else (or modify the mcs51 library). But I don't see how to 
> >> relocate __sdcc_program_startup from HOME to CSEG. It doesn't seem to be 
> >> defined anywhere in the lib directory that was installed with SDCC.
> > 
> >     It is defined in main (and thus will be in the code generator 
> > somewhere I expect), and called from 
> > sdcc/device/lib/mcs51/crtstart.asm. I expect you would meed to 
> > modify the code generator to do what you want (or modify main.asm by hand).
> 
> 
> I was afraid of that. I may take a stab at modifying the generator, just for 
> fun. Does anyone have a git mirror of the repository?
> ----------------------------------------------------------------------
> -------- SOLARIS 10 is the OS for Data Centers - provides features 
> such as DTrace, Predictive Self Healing and Award Winning ZFS. Get 
> Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
> 



------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, 
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW 
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to