mcugotchi-setup/readme.md
2024-12-08 14:34:20 +01:00

88 lines
2.2 KiB
Markdown

# 1. Setting Up the Project Directory
```
mkdir gothci
cd gotchi/
```
# 2. Installing Basic Development Tools
```
sudo apt update && sudo apt upgrade -y
sudo apt install build-essential git make gcc-mingw-w64 g++-mingw-w64 zip -y
```
__Note: gcc-mingw-w64 and g++-mingw-w64 may not be necessary if you're only targeting Linux builds.__
# 3. Cloning and setting up the tamatool Repository
```
git clone --recursive https://github.com/jcrona/tamatool.git
```
# 4. Installing SDL2 Dependencies
```
sudo apt install libsdl2-dev libsdl2-image-dev libpng-dev -y
```
# 5. Building tamatool for Windows/Linux (I used Linux)
```make linux ``` or ```make windows```
I used `make linux` because I am using WSL. WSL2 should work since it's using openocd.
# 7. Updating System and Installing Cross-Compilation Tools
`sudo apt install build-essential git cmake gcc-arm-none-eabi openocd dfu-util`
# 8. Cloning the mcugotchi Repository
`cd ..`
`git clone --recursive https://github.com/jcrona/mcugotchi.git`
__Note: If you don't use recursive you won't get the necessary includes.__
# 9. Generating rom.h from a ROM File
__Note: These steps are already done in the provided folder__
Place the `tama.b` file from the [zip file](https://www.planetemu.net/rom/mame-roms/tama) into mcugotchi/src/ and rename it to `tama.bin`
`nano mcugotchi/src/rom.c`
Remove '//' from //#define ROM_BUILT_IN at line 30.
cd tamatool/linux/dist
./tamatool -r ../mcugotchi/src/tama.bin -H > ../mcugotchi/src/rom_data.h
__Note: The command in the GitHub repo for Tamatool is wrong, the output file is "rom.h" in the provided command, which literally overrides the header file used for loading the ROM.__
# 10. Compiling mcugotchi
`cd ../../../mcugotchi`
`nano Makefile`
Edit the makefile, remove the text after `TOOLCHAIN =` and `OPENOCD_BIN =`.
```
# GNU ARM Embedded Toolchain location
TOOLCHAIN =
# OpenOCD location
OPENOCD_BIN =
```
Then remove `$(TOOLCHAIN)/bin/` from all other lines.
```
CC = arm-none-eabi-gcc
AS = arm-none-eabi-as
LN = arm-none-eabi-gcc
STRIP = arm-none-eabi-strip
HEX = arm-none-eabi-objcopy -O ihex
BIN = arm-none-eabi-objcopy -O binary
```
Now we should be able to compile mcugotchi.
`make`
# 11. Flashing mcugotchi
Inside of mcugotchi folder:
`make flash`