Re: [Sdcc-user] How do I get _GSINIT into code section? (z80)
I figured out what I was doing wrong! I was putting my example.o file (with main() in it) first in my link command. When I put crt0.o first, and example.o second, _GSINIT landed in the code section!!! :-) The sdcc manual, in section 3.1.3 says: The file containing the main() function MUST be the FIRST file specified Apparently, this is not always true. I assume the linker must be putting the sections in the order it first encounters them, and with example.o linked first, it uses the order they appear in that file, which is not the right order. (why not? Couldn't the compiler put the dummy .area's in main, or in all the object files, for that matter???) With crt0.o first, it works fine (except that the linked file is now crt0.ihx). If I use -o example to name the file, for some strange reason I don't get a .map file. Another odd thing is that when example.o is linked first, I can use -o example.hex, but with crt0.o first, it ignores the .hex and names the output file example.ihx. What is the recommended way to link in a custom crt0.o? Should I explicitly list it as an object file to be linked? Should I put it in my own library? Or should I overwrite the standard crt0.o in SDCC\lib\z80??? I tried making my own library with my crt0.o in it, but when I use it, _GSINIT goes back into data section! Is there any reason to keep the standard crt0.o??? Also, I made a custom putchar.o in my library, but I got an error regarding two definitions of _putchar. I had to delete the putchar function from the standard lib. I thought that the manual said it would use the first one it found. Perhaps I am needlessly making trouble for myself by trying to put these into a library, since it *does* all work if I link them in explicitly. I just wonder how others are doing this. Thanks!!! Randy - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user
Re: [Sdcc-user] How do I get _GSINIT into code section? (z80)
.area GSINIT (CODE) On 9/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Philipp Klaus Krause wrote: Place another .area _CODE before the .area _GSINIT? OK, I tried that, but it didn't make any difference, _GSINIT is still in RAM. But thanks for trying! Randy - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user -- http://www.pkuhar.com/ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user
Re: [Sdcc-user] How do I get _GSINIT into code section? (z80)
[EMAIL PROTECTED] schrieb: Philipp Klaus Krause wrote: Place another .area _CODE before the .area _GSINIT? OK, I tried that, but it didn't make any difference, _GSINIT is still in RAM. But thanks for trying! Randy Umm, sorry, works fine here though. Looking at crt0.map I see that gsinit is placed after all the code. I meant to add the additional .area _CODE before the last .area _GSINIT in your crt0.s, not the first one. The end of my crt0.s (I just removed the header stuff for readability): ;; Ordering of segments for the linker - copied from sdcc crt0.s .area _HOME .area _CODE .area _GSINIT .area _GSFINAL .area _DATA .area _BSS .area _HEAP .area _CODE nmi:push af push bc push de push hl ;push ix ; saved by callee push iy call _cv_vint pop iy ;pop ix pop hl pop de pop bc pop af retn .area _GSINIT gsinit:: .area _GSFINAL ret From crt0.map: l__CABS l__HEAP l__HOME l__OVERLAY s__HEADER 0001l__GSFINAL 0003l__BSS 003Al__GSINIT 02C8l__DATA 7000s__DATA 72C8s__BSS 72CBs__CABS 72CBs__HEAP 72CBs__OVERLAY 7CBBl__CODE 803Al__HEADER 8100s__CODE FDBBs__GSINIT FDBBs__HOME FDF5s__GSFINAL - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user
Re: [Sdcc-user] How do I get _GSINIT into code section? (z80)
Place another .area _CODE before the .area _GSINIT? Philipp - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user