GithubHelp home page GithubHelp logo

laqieer / build-your-own-gba-toolchain Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 29 KB

๐Ÿค“ Build your own toolchain for gba dev

License: GNU General Public License v3.0

Assembly 46.24% C 53.76%
gba-dev gba-toolchain crosstool-ng gba gba-development game-boy-advance

build-your-own-gba-toolchain's Introduction

build-your-own-gba-toolchain

๐Ÿค“ Build your own toolchain for gba dev

Inspired by build-your-own-x.

Artifacts are released here.

Only for education purpose. Don't use it for non-trivial development.

Build toolchain

Read crosstool-NG's doc. The version I use is 1.24.0.

You can load .config file in its config menu. Don't forget to change Toolchain ID string and Toolchain bug URL in Toolchain options pls. Feel free to tweak other options for your own toolchain. You can also load your own patches in CT_TOP_DIR if you have.

Here are problems I met and solutions I found:

  1. My OS is CentOS 7. Accoding to crosstool-NG 1.24.0's release note, its g++ version cannot build gdb. Solution: Follow this doc to update it.

  2. OS's setting up. According to crosstool-NG's doc, you should read its dockerfile to figure out its dependencies. Solution: Read dockerfile as it says. For CentOS 7, yum install -y autoconf gperf bison file flex texinfo help2man gcc-c++ libtool make patch ncurses-devel python36-devel perl-Thread-Queue bzip2 git wget which xz unzip.

  3. [ERROR] You must NOT be root to run crosstool-NG. Solution: Run it as another user or CT_ALLOW_BUILD_AS_ROOT=y according to this.

  4. [ERROR] Don't set LD_LIBRARY_PATH. It screws up the build. Solution: unset LD_LIBRARY_PATH accoding to this doc.

To sum up, Google Is Your Best Friend.

Test toochain

Now we have our own toolchain, let's test it.

All files in test directory are borrowed from somewhere else (first.c from tonc and others from here with a little modifications). I know the code is ugly, but it is only for test.

arm-gba-eabi-gcc -nostartfiles -Xlinker -T gba.ld first.c crt0.s gba-syscalls.c
arm-gba-eabi-objcopy -O binary a.out first.gba

Then we get first.gba and test it. It works fine. Don't forget to gbafix it for release.

Here are some notes:

  1. This is only to test toolchain. For non-trivial development, use build automation.

  2. gba.ld here is linker script for gba cartridge. Use this for multiboot.

  3. crt0 and syscalls can also be merged into libc which is a part of our toolchain. Here are docs for porting newlib (Google Is Your Best Friend again).

build-your-own-gba-toolchain's People

Contributors

laqieer avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.