This website works better with JavaScript.
Home
Help
Register
Sign In
stephen
/
68000-sbc-software
Watch
1
Star
0
Fork
0
Code
Issues
1
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
Basic C linker
master
Stephen
1 year ago
parent
9ce64441cf
commit
e151ce5e54
4 changed files
with
60 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+30
-0
os/Linker.ld
+8
-0
os/Makefile
+13
-0
os/main.c
+9
-0
os/start.s
+ 30
- 0
os/Linker.ld
View File
@ -0,0 +1,30 @@
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
}
+ 8
- 0
os/Makefile
View File
@ -0,0 +1,8 @@
os.bin
:
start
.
o
main
.
o
Linker
.
ld
m68k-elf-ld -T Linker.ld -o os.bin -O2 -nostdlib
start.o
:
start
.
s
m68k-elf-as -mcpu
=
68000
-o start.o start.s
main.o
:
main
.
c
m68k-elf-gcc -c main.c -o main.o -ffreestanding -O2 -Wall -Wextra
+ 13
- 0
os/main.c
View File
@ -0,0 +1,13 @@
void
kmain
(
)
{
char
*
s
=
"
Hello world!
"
;
char
*
o
=
(
char
*
)
0x50500
;
while
(
1
)
{
*
s
=
*
o
+
1
;
*
o
=
*
s
;
o
+
+
;
s
+
+
;
}
}
+ 9
- 0
os/start.s
View File
@ -0,0 +1,9 @@
.global
_start
.long
_start
.org
0x400
_start:
.long
0xDEADBEEF
.long
0xDEADBEEF
.long
0xDEADBEEF
JSR
kmain
Write
Preview
Loading…
Cancel
Save