EASy68K  
It is currently Mon Feb 24, 2020 8:53 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Example C Code?
PostPosted: Mon Nov 25, 2019 4:32 pm 
Offline

Joined: Fri Oct 25, 2019 8:15 pm
Posts: 18
So I have been googling until my eyes pop out, and because of how obscure the 68K is these days I am having a tough time finding a good "hello world" style example C program targeting the 68000/68010 Bare Metal.

I sorta found something but its heavily 68328 dependent, and I still dont know enough about C Bare Metal to do anything with it, as its highly confusing. I know Arduino C, but it abstracts alot of things away, that is necessary for 68K bare metal C compiling to work, like Standard Library, (newlib), etc... Not to mention the printf drivers, etc.

Not to mention being able to setup the interrupt vector table, And adding interrupt subroutines.

The hardware that I am working with is custom, and thats fine, I know it intimately. I have 4MB of RAM as well as ROM, so plenty of stuff to use. And an RTC IC attached to the first interrupt vector. the UART is on a separate IO card that I wrote firmware for and I know how to communicate with that as well (In assembler, I wrote a super simple BIOS in assembly that uses the UART, among other things as well as load a program into RAM over my data card, and it all works great).

So bare metal C, I know I am going to have to figure out how to add the relevant "driver" code to make my UART work, my RTC chip work, etc. but Honestly, I have no idea and its hard to find examples. I saw the crt0.s code in newlibc, but its as confusing as anything else.

Basically, I need a "Bare metal C programming for 68000 with GCC for dummies" :-)

I found a few things online, but they target consoles, or other things and each and every single one of the toolchain setups, etc are different. So it makes it hard to nail down anything.

Any thoughts or ideas? thanks!


Top
 Profile  
 
 Post subject: Re: Example C Code?
PostPosted: Sat Dec 07, 2019 12:22 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1118
This page might help. I did not have time to try any of the code.
http://www.doc.ic.ac.uk/~phjk/Compilers/SampleCode/68000/HowToCompileTo68k.html

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject: Re: Example C Code?
PostPosted: Sat Dec 07, 2019 1:55 am 
Offline

Joined: Fri Oct 25, 2019 8:15 pm
Posts: 18
I found something already. Its not ideal, but it works.

However, I am running into an issue with the hello world skeleton/linker script. if I have the -O0 flag set, its all cool.

soon as I set -O1, or higher optimization flags, I am getting an "overlap" error in the linker script. Why, I have no idea. I am a newb at non-abstracted C.


Top
 Profile  
 
 Post subject: Re: Example C Code?
PostPosted: Sat Dec 07, 2019 12:53 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1118
Which C compiler?
What does the help say about "overlap" error?

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject: Re: Example C Code?
PostPosted: Sat Dec 07, 2019 1:21 pm 
Offline

Joined: Fri Oct 25, 2019 8:15 pm
Posts: 18
GCC, and what help?


Top
 Profile  
 
 Post subject: Re: Example C Code?
PostPosted: Mon Dec 09, 2019 1:57 pm 
Offline

Joined: Fri Oct 25, 2019 8:15 pm
Posts: 18
Been doing alot of research and reading over the weekend. I figured some things out, so I think I have a grasp on it.

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group