OSDev.org

The Place to Start for Operating System Developers
It is currently Sun May 31, 2020 4:55 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Linker help
PostPosted: Sun Feb 23, 2020 1:37 pm 
Offline

Joined: Tue Jun 05, 2018 4:43 pm
Posts: 13
Hello,

I'm working on a custom single-board computer based around the Motorola 68000. While I wait for the PCB to come in the mail, I've written some basic debugging scripts in M68k Assembler. I'd like to get my environment set up for writing C code now.

The system has 256K of ROM starting at 0x0, and 256K of RAM starting at 0x120000. What I need to produce is an executable that fits in ROM, and starts out with a few kB of assembler code followed by a bunch of C code.

Here is what my linker script looks like right now:

Code:
STARTUP(start.o)
INPUT(main.o)
OUTPUT(os.bin)
OUTPUT_FORMAT("binary")
ENTRY(_start)

MEMORY
{
   ROM(rx): ORIGIN = 0, LENGTH = 256k
   RAM(rwx): ORIGIN = 0x120000, LENGTH = 256k
}

SECTIONS
{
   .text :
   {
      *(.text)
      *(.rodata*)
   } > ROM

   .data :
   {
      *(.data*)
   } > RAM AT > ROM

   .bss :
   {
      *(.bss*)
   } > RAM
}



Anything bad/wrong I'm doing there? The output binary looks like what I'd expect, but I want to make sure I'm doing everything correctly so I don't run into issues down the line. I can't test the binary until I get the PCB anyway.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


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 © 2000, 2002, 2005, 2007 phpBB Group