New to Genesis Coding.. A few questions.

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
3vix_6
Newbie
Posts: 1
Joined: Thu May 20, 2010 12:26 am

New to Genesis Coding.. A few questions.

Post by 3vix_6 »

Hi,

I set up a compiler based on the suggestions of a user named jlf65 at Devster forums. The link is posted here..

http://devster.proboards.com/index.cgi? ... 581&page=1

I set the Genesis compiler as stated in the forum, but I"m running into a problem..

The operating system I'm using is Ubuntu Linux 10.04. After setting up the compiler and the I tried compiling a simple test file that looks like the following..


#include "stdio.h"

int main(){

printf("Test");

}


I entered in the following in my console,

gcc -I ~/Tools/gendev/m68k/include test.c

I got the following output..

/home/me/Tools/gendev/m68k/bin/ld.real: crt0.o: No such file: No such file or directory

Any ideas what might be causing this?
Charles MacDonald
Very interested
Posts: 292
Joined: Sat Apr 21, 2007 1:14 am

Re: New to Genesis Coding.. A few questions.

Post by Charles MacDonald »

3vix_6 wrote: Any ideas what might be causing this?
When you are using a cross compiler the two 'extra' things you usually have to do is link in the object "crt0.o" along with your own objects, and specify a linker script which states where the target system ROM and RAM areas are at.

If you look through the cross compiler package you have there is probably a crt0.s you can assemble (or a pre-built crt0.o object) and a linker script called 'genesis.ld' or something along those lines. If they aren't included you can always write your own.

crt0.s is the code that clears BSS and calls your main() function btw. It's just a little fragment of startup code; in the case of the 68000 it specifies the vector table which has to come first -- so specify the files in the order of 'crt0.o test.o <other objects>' when linking.

Good luck!
Chilly Willy
Very interested
Posts: 2993
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy »

You need to look at the source and makefiles for the example code I linked for you over there.

If you use libmd, you need to do like the musicdemo and use md.o in place of crt0.o, and use -nostdlib in the makefile. Again, look at the musicdemo example.

If you don't use libmd, you'll have to make your own startup like md.s from libmd. Examples of that are in other demos posted here and elsewhere.

If you are doing 32X software, you'll need a special startup like the one I use in the DMA audio example I linked to.

The point is, the Genesis is not a full blown OS like linux or Windows - you simply can't print from a program. You need special routines to display something on the screen, functions like in libmd. You need to learn how to initialize the Genesis and use the special functions to do things, and for that, look at existing code.
Post Reply