-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* yeet clean.sh and move downloading kmc to makefile * yeet build.sh * deps * more deps * woops * a * remove docker from the sh * arrg * e * i * wget * maybe? * idk what im doing * xzcv * yeet docker because I couldn't make it work * i'm a dumb dumb * fix yaml * Fix test_gen_expected.sh * fixes * Add instructions to run the tests
- Loading branch information
1 parent
46729c5
commit bf661e7
Showing
20 changed files
with
229 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM ubuntu:22.04 | ||
RUN apt-get update | ||
RUN apt install -y build-essential make binutils-mips-linux-gnu python3 python3-pip wget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Test instructions | ||
|
||
## basic_app | ||
|
||
### Building the ROM | ||
|
||
You are expected to have a mips cross compiler installed on your system | ||
(compatible with binutils). | ||
|
||
By default we use `mips-linux-gnu-`, but if you want to use a different | ||
toolchain you can provide your own to `make` by passing the `CROSS=` option. | ||
For example `make CROSS=mipsel-linux-gnu-`. | ||
|
||
To build the ROM: | ||
|
||
```bash | ||
make -C test/basic_app clean | ||
make -C test/basic_app download_kmc | ||
make -C test/basic_app all | ||
``` | ||
|
||
### Running the test | ||
|
||
Run `python3 test.py`. | ||
|
||
This script will check if the files were generated as expected or if anything | ||
changed. Files changing may be good or bad depending on the changes made to the | ||
repo. | ||
|
||
If changes are expected, then follow the instructions at | ||
[Regenerate the expected files](#regenerate-the-expected-files). | ||
|
||
### Regenerate the expected files | ||
|
||
You need to have built the rom first. | ||
|
||
Run `test/test_gen_expected.sh` from the root of the repository and commit the | ||
changes. | ||
|
||
## Docker | ||
|
||
There's a `Dockerfile`, but I don't know how to use Docker so I can't tell you | ||
how to use it, shorry. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
BUILD_FOLDER := build | ||
KMC_FOLDER := gcc-2.7.2 | ||
CROSS := mips-linux-gnu- | ||
|
||
|
||
ROM := $(BUILD_FOLDER)/basic_app.bin | ||
|
||
## Programs | ||
|
||
CC := COMPILER_PATH=$(KMC_FOLDER) $(KMC_FOLDER)/gcc | ||
LD := $(CROSS)ld | ||
OBJCOPY := $(CROSS)objcopy | ||
|
||
|
||
## Programs' flags | ||
|
||
CFLAGS := -G0 -mgp32 -mfp32 -mips3 | ||
|
||
|
||
# Targets | ||
|
||
all: $(ROM) | ||
|
||
download_kmc: $(KMC_FOLDER)/gcc | ||
|
||
clean: | ||
$(RM) -rf $(BUILD_FOLDER) | ||
$(RM) -rf split | ||
|
||
.PHONY: all download_kmc clean | ||
.DEFAULT_GOAL := all | ||
# Prevent removing intermediate files | ||
.SECONDARY: | ||
|
||
|
||
## Files | ||
|
||
O_FILES := $(BUILD_FOLDER)/main.o $(BUILD_FOLDER)/header.o $(BUILD_FOLDER)/handwritten.o $(BUILD_FOLDER)/dummy_ipl3.o | ||
|
||
o_files: $(O_FILES) | ||
.PHONY: o_files | ||
|
||
## Rules | ||
|
||
%.bin: %.elf | ||
$(OBJCOPY) $< -O binary $@ --pad-to=0x1140 --gap-fill=0x00 | ||
|
||
$(BUILD_FOLDER)/%.elf: $(O_FILES) %.ld | $(BUILD_FOLDER) | ||
$(LD) -Map $(@:.elf=.map) -T $*.ld -o $@ $(O_FILES) | ||
|
||
$(BUILD_FOLDER)/%.o: %.s | $(BUILD_FOLDER) | ||
$(CC) -EB -c $(CFLAGS) -o $@ $< | ||
|
||
$(BUILD_FOLDER)/%.o: %.c | $(BUILD_FOLDER) | ||
$(CC) -EB -c $(CFLAGS) -o $@ $< | ||
|
||
|
||
$(KMC_FOLDER)/gcc: | ||
$(RM) -rf $(KMC_FOLDER) | ||
wget https://github.com/decompals/mips-binutils-2.6/releases/latest/download/binutils-2.6-linux.tar.gz | ||
wget https://github.com/decompals/mips-gcc-2.7.2/releases/latest/download/gcc-2.7.2-linux.tar.gz | ||
mkdir -p $(KMC_FOLDER) | ||
tar -xvf binutils-2.6-linux.tar.gz -C $(KMC_FOLDER) | ||
tar -xvf gcc-2.7.2-linux.tar.gz -C $(KMC_FOLDER) | ||
$(RM) -rf binutils-2.6-linux.tar.gz | ||
$(RM) -rf gcc-2.7.2-linux.tar.gz | ||
|
||
|
||
## Folders to create | ||
|
||
$(BUILD_FOLDER): | ||
mkdir -p $(BUILD_FOLDER) | ||
|
||
|
||
# Print target for debugging | ||
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
.section .bss | ||
|
||
glabel D_80000540 | ||
/* 1110 80000540 */ .space 0x78 | ||
/* 1140 80000540 */ .space 0x80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.include "macro.inc" | ||
|
||
.section .rodata | ||
|
||
glabel D_80000510 | ||
/* 1110 80000510 00010203 */ .word 0x00010203 | ||
/* 1114 80000514 04050607 */ .word 0x04050607 | ||
.size D_80000510, . - D_80000510 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.