URL
https://opencores.org/ocsvn/eco32/eco32/trunk
Subversion Repositories eco32
Compare Revisions
- This comparison shows the changes necessary to convert path
/eco32/tags/eco32-0.26/stdalone/hello2
- from Rev 245 to Rev 270
- ↔ Reverse comparison
Rev 245 → Rev 270
/Makefile
0,0 → 1,33
# |
# Makefile for "hello2", a program for testing the boot loader |
# |
|
BUILD = ../../build |
|
SRC = start.s main.c end.s |
BIN = hello2.bin |
MAP = hello2.map |
EXO = hello2.exo |
|
.PHONY: all install run clean |
|
all: $(BIN) $(EXO) |
|
install: $(BIN) $(EXO) |
mkdir -p $(BUILD)/stdalone |
cp $(BIN) $(BUILD)/stdalone |
cp $(MAP) $(BUILD)/stdalone |
cp $(EXO) $(BUILD)/stdalone |
|
run: $(BIN) |
$(BUILD)/bin/sim -i -s 1 -t 0 -l $(BIN) -a 0x10000 |
|
$(EXO): $(BIN) |
$(BUILD)/bin/bin2exo -S2 0x10000 $(BIN) $(EXO) |
|
$(BIN): $(SRC) |
$(BUILD)/bin/lcc -A -Wo-kernel \ |
-Wl-m -Wl$(MAP) -o $(BIN) $(SRC) |
|
clean: |
rm -f *~ $(BIN) $(MAP) $(EXO) |
/start.s
0,0 → 1,58
; |
; start.s -- startup code |
; |
|
.import main |
.import _ecode |
.import _edata |
.import _ebss |
|
.export _bcode |
.export _bdata |
.export _bbss |
|
.code |
_bcode: |
|
.data |
_bdata: |
|
.bss |
_bbss: |
|
.code |
|
start: |
mvfs $8,0 |
or $8,$8,1 << 27 ; let vector point to RAM |
mvts $8,0 |
add $29,$0,stack ; set sp |
add $10,$0,_bdata ; copy data segment |
add $8,$0,_edata |
sub $9,$8,$10 |
add $9,$9,_ecode |
j cpytest |
cpyloop: |
ldw $11,$9,0 |
stw $11,$8,0 |
cpytest: |
sub $8,$8,4 |
sub $9,$9,4 |
bgeu $8,$10,cpyloop |
add $8,$0,_bbss ; clear bss |
add $9,$0,_ebss |
j clrtest |
clrloop: |
stw $0,$8,0 |
add $8,$8,4 |
clrtest: |
bltu $8,$9,clrloop |
jal main ; call 'main' |
start1: |
j start1 ; loop |
|
.bss |
|
.align 4 |
.space 0x800 |
stack: |
/main.c
0,0 → 1,29
/* |
* main.c -- main program |
*/ |
|
|
void putchar(char c) { |
unsigned int *base; |
|
if (c == '\n') { |
putchar('\r'); |
} |
base = (unsigned int *) 0xF0300000; |
while ((*(base + 2) & 1) == 0) ; |
*(base + 3) = c; |
} |
|
|
void puts(char *s) { |
char c; |
|
while ((c = *s++) != '\0') { |
putchar(c); |
} |
} |
|
|
void main(void) { |
puts("\nHello, world!\n\n"); |
} |
/end.s
0,0 → 1,19
; |
; end.s -- end-of-segment labels |
; |
|
.export _ecode |
.export _edata |
.export _ebss |
|
.code |
.align 4 |
_ecode: |
|
.data |
.align 4 |
_edata: |
|
.bss |
.align 4 |
_ebss: |