History of the SDK before version 0.4
  • C 72.7%
  • Makefile 23.9%
  • Shell 1.9%
  • Dockerfile 1.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2023-03-24 00:12:24 +00:00
docker docker: Update docker build script 2023-03-14 00:41:11 +01:00
docs docs: Fix line break 2023-03-22 18:25:31 +00:00
examples examples: tests: Move comutex test to examples 2023-03-23 00:30:44 +00:00
libs submodules: Update libnds and crts 2023-03-23 23:11:38 +00:00
licenses templates: Add ROM and library templates 2023-02-21 01:39:14 +00:00
sys build: submodules: Silence linker warning about RWX segments 2023-03-24 00:12:24 +00:00
templates build: submodules: Silence linker warning about RWX segments 2023-03-24 00:12:24 +00:00
tests build: submodules: Silence linker warning about RWX segments 2023-03-24 00:12:24 +00:00
tools submodules: Update references 2023-03-20 01:19:15 +00:00
.gitmodules submodules: Point avr-libstdcpp to a fork 2023-03-20 01:39:01 +00:00
changelog.rst docs: Update changelog 2023-03-20 22:56:58 +00:00
Makefile build: Save commit hash when installing the SDK 2023-03-13 18:42:49 +01:00
readme.rst docs: Change credits 2023-03-15 22:18:49 +00:00

############
BlocksDS SDK
############

1. Introduction
***************

This is an SDK for Nintendo DS. It builds on the work of several people, and it
has the following goals:

- To create an easy-to-use NDS software development kit based on GCC with as few
  dependencies as possible.

- To encourage developers to hack and improve the SDK by letting them have all
  the source code of the SDK. This also shows how easy it is to build the whole
  codebase.

- To try to keep compatibility with pre-existing C projects. In theory, it
  should be enough to replace the makefile by one of BlocksDS to build any
  project that uses ``libnds``.

This project is currently in beta stage, and most features are working. Please,
check the `libc port documentation <docs/libc.rst>`_ for more information about
the supported libc functions.

You may keep multiple versions of this SDK in your PC. The location of the
active SDK is stored in the environment variable ``BLOCKSDS``, so all you need
to do is to change its value and point to the right version.

If you want to port a project built with devkitPro, follow `this guide
<docs/porting-guide.rst>`_ for instructions.

For detailed information about the design of BlocksDS, check `this other document
<docs/design-guide.rst>`_.

For licensing information, check `this <docs/licenses.rst>`_.

C++ standard library support is limited. It is provided by `avr-libcpp
<https://github.com/modm-io/avr-libstdcpp>`_. If you don't use GCC as a
compiler, check the licensing notes of this library.

2. Setup
********

If you are using Linux, MinGW, WSL, or any similar environment, you can install
the SDK using the native installation instructions.

If you are on Windows, you need to install MinGW, WSL or similar.

However, there are Docker images of BlocksDS that can be used in any OS. They
require more disk space than the native installation, but they may be needed if
a native installation isn't possible.

Docker
======

Follow the instructions in `this file <docker/readme.rst>`_ to use the Docker
images.

Native installation
===================

You need to install a cross compiler to build applications for NDS. You also
need to build a few host tools, so you need a compiler for the host, the
FreeImage library, and some build tools (Meson and Ninja):

If you're on Ubuntu, for example, run the following command:

.. code:: bash

    sudo apt-get install -y --no-install-recommends \
        build-essential gcc-arm-none-eabi libfreeimage-dev meson ninja-build \
        dosfstools mtools

Clone this repository:

.. code:: bash

    git clone --recurse-submodules https://github.com/blocksds/sdk.git
    cd sdk

To build the SDK, run this from the root of this repository:

.. code:: bash

    export BLOCKSDS=/path/to/sdk/
    make

You can avoid exporting ``BLOCKSDS`` every time by adding it to your
``.bashrc``, ``.zshenv`` or similar.

Test
****

To test that everything is working, you can try building one of the templates.

There is a template that lets the programmer write the code for both CPUs of the
NDS (``templates/rom_combined``) and a template that uses the default ARM7 core
that comes with Blocks DS and lets the programmer focus on the ARM9 core. There
are also two templates to create static libraries.

For example, go to the combined template folder and run:

.. code:: bash

    cd templates/rom_combined
    make

This should have generated a NDS ROM that you can run on any emulator or
flashcart.

To do a verbose build, run ``make`` like this (this also works for the Makefile
of the SDK):

.. code:: bash

    VERBOSE=1 make

**NOTE**: The paths in the Makefile that refer to source code, includes,
graphics, data, etc, must be inside the folder of the project. That means you
can't use ``..`` in a path to go one level up from the Makefile. If you really
need to use folders outside of the folder of the project, create a symlink to
the destination, or build the other code as a static library and link it with
the project.

Credits
*******

This project wouldn't have been possible without:

- `asie <https://asie.pl>`_ for his help and advice.
- `devkitPro <https://devkitpro.org/>`_
- `picolibc <https://github.com/picolibc/picolibc>`_
- `libnds <https://github.com/devkitPro/libnds>`_
- `dswifi <http://akkit.org/dswifi/>`_
- `maxmod <https://maxmod.devkitpro.org/>`_ (and `mmutil`)
- `grit <https://www.coranac.com/projects/grit/>`_
- `GCC <https://gcc.gnu.org/>`_
- `make <https://www.gnu.org/software/make/>`_
- And many others!