forked from nesbox/TIC-80
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Baremetal Raspberry PI build support (nesbox#918)
* Raspberry PI baremetal support * boot utils for baremetal RPI * Building instructions * fix surf continuously accessing disk
- Loading branch information
Showing
25 changed files
with
3,054 additions
and
1 deletion.
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 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,47 @@ | ||
# | ||
# Makefile | ||
# | ||
TIC80HOME = ../.. | ||
TIC803RD = $(TIC80HOME)/3rd-party | ||
CIRCLESTDLIB = $(TIC803RD)/circle-stdlib/ | ||
CIRCLEHOME = $(CIRCLESTDLIB)/libs/circle | ||
NEWLIBDIR = $(CIRCLESTDLIB)/install/arm-none-circle | ||
TIC80LIB = $(TIC80HOME)/build/lib | ||
TIC80SRC = $(TIC80HOME)/src | ||
BAREMETALSYSTEM = $(TIC80SRC)/system/baremetalpi | ||
|
||
OBJS = \ | ||
$(BAREMETALSYSTEM)/main.o $(BAREMETALSYSTEM)/kernel.o $(BAREMETALSYSTEM)/customchargenerator.o \ | ||
$(BAREMETALSYSTEM)/customscreen.o $(BAREMETALSYSTEM)/utils.o $(BAREMETALSYSTEM)/gamepads.o | ||
|
||
include $(CIRCLEHOME)/Rules.mk | ||
|
||
CFLAGS += -I "$(NEWLIBDIR)/include" -I $(STDDEF_INCPATH) -I $(CIRCLESTDLIB)/include -I $(TIC80HOME)/include -I $(TIC80SRC) \ | ||
-D BAREMETALPI | ||
|
||
|
||
LIBS := \ | ||
$(TIC80LIB)/libtic80lib.a \ | ||
$(TIC80LIB)/libtic80core.a \ | ||
$(TIC80LIB)/libgiflib.a \ | ||
$(TIC80LIB)/liblpeg.a \ | ||
$(TIC80LIB)/liblua.a \ | ||
$(TIC80LIB)/libwren.a \ | ||
$(TIC80LIB)/libzlib.a \ | ||
$(NEWLIBDIR)/lib/libc.a \ | ||
$(NEWLIBDIR)/lib/libcirclenewlib.a \ | ||
$(CIRCLEHOME)/addon/vc4/sound/libvchiqsound.a \ | ||
$(CIRCLEHOME)/addon/vc4/vchiq/libvchiq.a \ | ||
$(CIRCLEHOME)/addon/linux/liblinuxemu.a \ | ||
$(CIRCLEHOME)/addon/SDCard/libsdcard.a \ | ||
$(CIRCLEHOME)/addon/fatfs/libfatfs.a \ | ||
$(CIRCLEHOME)/lib/usb/libusb.a \ | ||
$(CIRCLEHOME)/lib/input/libinput.a \ | ||
$(CIRCLEHOME)/lib/fs/fat/libfatfs.a \ | ||
$(CIRCLEHOME)/lib/fs/libfs.a \ | ||
$(CIRCLEHOME)/lib/net/libnet.a \ | ||
$(CIRCLEHOME)/lib/sched/libsched.a \ | ||
$(CIRCLEHOME)/lib/libcircle.a \ | ||
$(NEWLIBDIR)/lib/libm.a | ||
|
||
# $(TIC80LIB)/libsquirrel.a \ |
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,93 @@ | ||
|
||
# Raspberry PI Baremetal build | ||
|
||
The following explains how to build TIC-80 for the Raspberry PI boards in baremetal mode, that is, without an operating system (the board boots directly in TIC-80) | ||
|
||
# Requirements | ||
|
||
You need: | ||
|
||
- A Linux machine | ||
- gcc ARM toolchain. You can get it [here](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads). Successfully tested with version: gcc-arm-none-eabi-8-2018-q4-major | ||
- A standard building environment (make, cmake, gcc, wget, etc) | ||
|
||
# Building instructions | ||
|
||
Following are all the building steps for building the system. | ||
|
||
First, set the path to include the arm toolkit (fix the command with your path): | ||
|
||
``` | ||
PATH=/home/you/gcc-arm-none-eabi-8-2018-q4-major/bin/:$PATH | ||
``` | ||
|
||
Get a fresh copy of TIC-80 repository and build demo carts: | ||
|
||
``` | ||
git clone --recursive https://github.com/nesbox/TIC-80 | ||
cd TIC-80 | ||
sh build_demos.sh | ||
``` | ||
|
||
Clone and build circle/circle-stdlib: | ||
|
||
``` | ||
cd 3rd-party | ||
git clone --recursive https://github.com/smuehlst/circle-stdlib.git | ||
cd circle-stdlib | ||
./configure -r 2 | ||
make | ||
``` | ||
|
||
Make some addon that are not compiled automatically: | ||
|
||
``` | ||
cd libs/circle/addon/vc4/sound/ | ||
make | ||
cd ../vchiq | ||
make | ||
cd ../../linux | ||
make | ||
cd ../fatfs | ||
make | ||
cd ../../../../../.. | ||
``` | ||
|
||
Build `tic80lib` for arm with baremetal customizations: | ||
|
||
``` | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBAREMETALPI=1 .. | ||
make tic80lib | ||
``` | ||
|
||
Build the kernel: | ||
|
||
``` | ||
cd baremetalpi | ||
make | ||
``` | ||
|
||
This generates the final `kernel7.img` file. Copy it into your SD card root. | ||
|
||
Now you have to prepare some bootup files that need to be copied to the SD card root together with your kernel7.img. This only need to be done once: | ||
|
||
``` | ||
cd boot | ||
make | ||
``` | ||
|
||
Now copy the following files to your SD card | ||
|
||
- `config.txt` | ||
- `LICENCE.broadcom` | ||
- `bootcode.bin` | ||
- `fixup.dat` | ||
- `start.elf` | ||
|
||
You need to create a `tic80` folder into your SD card. Your carts go in there. | ||
|
||
# Thanks | ||
|
||
This project is built on two awesome projects, [circle](https://github.com/rsta2/circle) and [circle-stdlib](https://github.com/smuehlst/circle-stdlib). Without them, this version of TIC-80 would not exists. | ||
|
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,14 @@ | ||
# | ||
# Download the firmware files to be required for boot (requires wget) | ||
# | ||
# These files must be copied along with the generated kernel.img | ||
# onto a SD(HC) card with FAT file system. | ||
# | ||
|
||
firmware: | ||
wget -q -O LICENCE.broadcom https://github.com/raspberrypi/firmware/blob/master/boot/LICENCE.broadcom?raw=true | ||
wget -q -O bootcode.bin https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin?raw=true | ||
wget -q -O fixup.dat https://github.com/raspberrypi/firmware/blob/master/boot/fixup.dat?raw=true | ||
wget -q -O start.elf https://github.com/raspberrypi/firmware/blob/master/boot/start.elf?raw=true | ||
|
||
all: firmware |
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 @@ | ||
hdmi_group=1 | ||
hdmi_mode=16 | ||
scaling_kernel=8 |
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.