Commit da0d3389 authored by Matěj Kopecký's avatar Matěj Kopecký
Browse files

Add crt0local.S

parent 5695b79d
ARCH=mips-elf
#ARCH=mips-linux-gnu
SOURCES = main.c my_terminal.c my_lcd_text.c font_prop14x16.c
SOURCES = main.c my_terminal.c my_lcd_text.c font_prop14x16.c crt0local.S
TARGET_EXE = main
CC=$(ARCH)-gcc
......@@ -21,6 +21,7 @@ LDFLAGS += -ggdb
LDFLAGS += -nostartfiles
LDFLAGS += -static
#LDFLAGS += -specs=/opt/musl/mips-linux-gnu/lib/musl-gcc.specs
LDLIBS += -lc
CFLAGS += $(ARCHFLAGS)
CXXFLAGS+= $(ARCHFLAGS)
......@@ -50,7 +51,7 @@ all : default
default : $(TARGET_EXE)
$(TARGET_EXE) : $(OBJECTS)
$(CC) $(LDFLAGS) $^ -o $@
$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)
dep: depend
......
/* minimal replacement of crt0.o which is else provided by C library */
.globl main
.globl _start
.globl __start
.globl _heap_stack_start
.globl _heap_stack_end
.set noat
.set noreorder
.ent _start
.text
__start:
_start:
#if defined(__PIC__) || defined(__pic__)
bal next
nop
next:
.set noreorder
.cpload $31
.set reorder
#else
la $gp, _gp
#endif
la $sp, _heap_stack_end
addi $a0, $zero, 0
addi $a1, $zero, 0
jal main
nop
quit:
addi $a0, $zero, 0
addi $v0, $zero, 4001 /* SYS_exit */
syscall
loop: break
beq $zero, $zero, loop
nop
.end _start
.bss
_heap_stack_start:
.skip 0x800000
_heap_stack_end:
......@@ -109,7 +109,6 @@ int main(void) {
}
++print_c;
}
while(1) {} // Infinite loop
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment