Build from source

Build from source

This is the option you should use if you want to help develop BlocksDS, or if you want to always use the cutting edge version of BlocksDS.

Install host tools

You need to install a cross compiler to build applications for NDS. You also need to build a few host tools, including a C/C++ compiler.

If you’re on Ubuntu run the following command:

sudo apt-get install -y --no-install-recommends build-essential

Install Wonderful Toolchain

Follow the instructions in this link:

https://wonderful.asie.pl/wiki/doku.php?id=getting_started:linux

Install the ARM toolchain

Install the ARM toolchain of Wonderful Toolchain:

export PATH=/opt/wonderful/bin:$PATH
wf-pacman -Syu
wf-pacman -S toolchain-gcc-arm-none-eabi

You can also install the Teak toolchain if you want to develop binaries for the DSP of the DSi. This isn’t available in all platforms (like in Windows).

wf-pacman -S toolchain-llvm-teak-llvm

Clone the main repository of BlocksDS

Now, clone this repository:

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

Build the SDK

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

BLOCKSDS=$PWD make -j`nproc`

Setup environment variables

Now, you have some options. The first one is recommended, the others are for users that may have advanced needs.

  1. Recommended. Install it in your system in the default path. You won’t need to set BLOCKSDS or BLOCKSDSEXT manually to use the SDK. Run:

    sudo mkdir /opt/blocksds/ && sudo chown $USER:$USER /opt/blocksds
    mkdir /opt/blocksds/external
    make install

    This will install the libraries and tools to /opt/blocksds/core. Third party libraries and tools are expected to be installed to /opt/blocksds/external.

    BLOCKDS defaults to /opt/blocksds/core in all Makefiles, and BLOCKDSEXT defaults to /opt/blocksds/external.

  2. Install it in your system in a custom path. You will need to set BLOCKSDS or BLOCKSDSEXT manually to use the SDK. Run:

    BLOCKSDS=$PWD make INSTALLDIR=my/path -j`nproc`

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

  3. Use the libraries from this path. Make sure that the environment variable BLOCKSDS is always set to the right location when you want to use the SDK. The build system of the templates and examples will use this variable to locate the components of BlocksDS it and use them. Any other external library will need to be managed by you.

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

How to build projects

Now you can try to build one of the BlocksDS examples. They are available in folder examples in the root of the repository. From there, for example, go to graphics_3d/volumetric_shadow and type make. This will generate a NDS ROM that you can try with an emulator or a flashcart.

You can also try one of the open source projects made with BlocksDS that are listed here.