Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

BlocksDS: Difference between revisions

From GameBrew
No edit summary
No edit summary
Line 19: Line 19:
|image_alt=BlocksDS
|image_alt=BlocksDS
}}
}}
BlocksDS SDK is an SDK for Nintendo DS! It's built on the hard work of many talented individuals. Here are its goals:
BlocksDS SDK is an SDK for Nintendo DS. It's built on the hard work of many talented individuals. Here are its goals:


# Create a user-friendly NDS software development kit based on GCC, with minimal dependencies.
* Create a user-friendly NDS software development kit based on GCC, with minimal dependencies.
# Encourage developers to tinker and enhance the SDK by providing them with its complete source code. It also demonstrates how straightforward it is to build the entire codebase. The only exception is the tolchain, which can be tricky to build. To simplify things, we use Wonderful Toolchains instead of asking users to build it themselves.
* Encourage developers to tinker and enhance the SDK by providing them with its complete source code. It also demonstrates how straightforward it is to build the entire codebase. The only exception is the tolchain, which can be tricky to build. To simplify things, we use Wonderful Toolchains instead of asking users to build it themselves.
# Strive to maintain compatibility with existing C projects. Ideally, replacing the makefile with one from BlocksDS should be sufficient to build any project that utilizes libnds.
* Strive to maintain compatibility with existing C projects. Ideally, replacing the makefile with one from BlocksDS should be sufficient to build any project that utilizes libnds.


This project is currently in beta stage, and most features are working. Please, check the [https://github.com/blocksds/sdk/blob/master/docs/libc.rst libc port documentation] for more information about the supported libc functions.
This project is currently in beta stage, and most features are working. Please, check the [https://github.com/blocksds/sdk/blob/master/docs/libc.rst libc port documentation] for more information about the supported libc functions.
Line 32: Line 32:


For licensing information, check [https://github.com/blocksds/sdk/blob/master/docs/licenses.rst this].
For licensing information, check [https://github.com/blocksds/sdk/blob/master/docs/licenses.rst this].
==Setup==
=== Setup on Windows ===
'''Important note''': Native Windows support is experimental.
The following instructions describe how to install BlocksDS on Windows natively. If you want to use it in WSL, follow the instructions for Linux instead.
<ol>
<li><p>You will need to install the ARM toolchain of Wonderful Toolchains. Follow the instructions in this link: https://wonderful.asie.pl/docs/getting-started/#windows-via-msys2</p></li>
<li><p>Now, install the ARM toolchain of Wonderful Toolchains, as well as the BlocksDS packages.</p>
<pre>wf-pacman -Syu
wf-pacman -S toolchain-gcc-arm-none-eabi</pre>
<p>For the latest stable version of BlocksDS, run:</p>
<pre>wf-pacman -S thirdparty-blocksds-toolchain</pre>
<p>For the latest unstable version, run:</p>
<pre>wf-pacman -S thirdparty-blocksds-git-toolchain</pre>
</li>
<li><p>(Optional step) You can also install some third party libraries like [https://github.com/knightfox75/nds_nflib NightFox’s Lib] and [https://github.com/AntonioND/nitro-engine Nitro Engine] using <code>wf-pacman</code>:</p>
<pre>wf-pacman -S thirdparty-blocksds-nflib \
            thirdparty-blocksds-nitroengine</pre>
</li>
<li><p>Whenever you need to update the SDK, run:</p>
<pre>wf-pacman -Syu</pre>
=== Setup on Linux ===
If you are using Linux, MinGW, WSL, or any similar environment, you can install the SDK using <code>wf-pacman</code>, Docker, or the native installation instructions.
If you are on Windows, you need to install WSL and follow the Linux instructions, or to use the Docker instructions.
The Docker images of BlocksDS 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.
=== Option 1: <code>wf-pacman</code> ===
This is the easiest option, but you may not get the latest version of the SDK right away.
<ol>
<li><p>You will also need to install the ARM toolchain of Wonderful Toolchains. Follow the instructions in this link: https://wonderful.asie.pl/docs/getting-started/#linux</p></li>
<li><p>Now, install the ARM toolchain of Wonderful Toolchains, as well as the BlocksDS packages.</p>
<pre>export PATH=/opt/wonderful/bin:$PATH
wf-pacman -Syu
wf-pacman -S toolchain-gcc-arm-none-eabi</pre>
<p>For the latest stable version of BlocksDS, run:</p>
<pre>wf-pacman -S thirdparty-blocksds-toolchain</pre>
<p>For the latest unstable version, run:</p>
<pre>wf-pacman -S thirdparty-blocksds-git-toolchain</pre>
</li>
<li><p>(Optional step) You can also install some third party libraries like [https://github.com/knightfox75/nds_nflib NightFox’s Lib] and [https://github.com/AntonioND/nitro-engine Nitro Engine] using <code>wf-pacman</code>:</p>
<pre>wf-pacman -S thirdparty-blocksds-nflib \
            thirdparty-blocksds-nitroengine</pre>
<li><p>Add the cross compiler to your <code>PATH</code>:</p>
<pre>export PATH=/opt/wonderful/toolchain/gcc-arm-none-eabi/bin/:$PATH</pre>
<p>You can avoid exporting <code>PATH</code> every time by adding it to your <code>.bashrc</code>, <code>.zshenv</code> or similar.</p></li>
<li><p><code>wf-pacman</code> installs BlocksDS in <code>/opt/wonderful/thirdparty/blocksds/</code>. This isn't the standard location (<code>wf-pacman</code> can only write files to <code>/opt/wonderful/</code>) so you need to do one of the two following options:</p>
<p>5.1 Create a symlink:</p>
<pre>ln -s /opt/wonderful/thirdparty/blocksds /opt/blocksds</pre>
<p>5.2 Set your environment variables correctly:</p>
<pre>export BLOCKSDS=/opt/wonderful/thirdparty/blocksds/core
export BLOCKSDSEXT=/opt/wonderful/thirdparty/blocksds/external</pre>
</li>
<li><p>Whenever you need to update the SDK, run:</p>
<pre>wf-pacman -Syu</pre>
=== Option 2: Docker ===
Follow the instructions in [https://github.com/blocksds/sdk/blob/master/docker/readme.rst this file] to use the Docker images.
=== Option 3: Build the SDK yourself ===
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.
Follow the instructions in [https://github.com/blocksds/sdk/blob/master/docs/build-from-code.rst this file] to use the Docker images.
== 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 (<code>templates/rom_combined</code>) 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:
<pre>cd templates/rom_combined
make</pre>
This should have generated a NDS ROM that you can run on any emulator or flashcart.
To do a verbose build, run <code>make</code> like this (this also works for the Makefile of the SDK):
<pre>VERBOSE=1 make</pre>
'''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 <code>..</code> 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.
==Additional libraries ==
This is a list of libraries that support BlocksDS and can be installed in <code>/opt/blocksds/external</code>:
<ul>
<li><p>[[NFlib|NightFox’s Lib]]</p>
<p>Library designed to make development of 2D games easy, with support for sprites, backgrounds (even &quot;infinite&quot; maps), and it also has limited 2D graphics support using the 3D engine.</p></li>
<li><p>[[Nitro Engine]]</p>
<p>Library to create 3D applications. It supports dual screen 3D, static and animated models, supports all texture types, and has basic 2D support using the 3D hardware. It's compatible with NightFox's Lib.</p></li></ul>
<span id="user-content-keeping-multiple-versions-of-blocksds"></span>
<span id="user-content-6-keeping-multiple-versions-of-blocksds"></span>
== Keeping multiple versions of BlocksDS ==
You may keep multiple versions of this SDK in your PC. The location of the active SDK is stored in the environment variables <code>BLOCKSDS</code> and <code>BLOCKSDSEXT</code>, so all you need to do is to change their values and point to the version of the SDK you want to use.
By default, the paths are assumed to be <code>/opt/blocksds/core/</code> and <code>/opt/blocksds/external/</code>. The first one is used for core BlocksDS libraries and tools, and it is managed by BlocksDS. The second one is left for users to freely install third party libraries and tools.


==Changelog==
==Changelog==
'''v0.8.1'''
'''v0.8.1'''
*libnds:
*libnds:
Line 282: Line 155:


== External links ==
== External links ==
* Github - https://github.com/blocksds/sdk
* GitHub - https://github.com/blocksds/sdk

Revision as of 06:21, 8 October 2023

BlocksDS
Ndspc2.png
General
AuthorAntonioND
TypeDevelopment Tools
Version0.8.1
LicenseMixed
Last Updated2023/08/01
Links
Download
Website
Source

BlocksDS SDK is an SDK for Nintendo DS. It's built on the hard work of many talented individuals. Here are its goals:

  • Create a user-friendly NDS software development kit based on GCC, with minimal dependencies.
  • Encourage developers to tinker and enhance the SDK by providing them with its complete source code. It also demonstrates how straightforward it is to build the entire codebase. The only exception is the tolchain, which can be tricky to build. To simplify things, we use Wonderful Toolchains instead of asking users to build it themselves.
  • Strive to maintain compatibility with existing C projects. Ideally, replacing the makefile with one from BlocksDS should be sufficient to build any project that utilizes libnds.

This project is currently in beta stage, and most features are working. Please, check the libc port documentation for more information about the supported libc functions.

If you want to port a project built with devkitPro, follow this guide for instructions.

For detailed information about the design of BlocksDS, check this other document.

For licensing information, check this.

Changelog

v0.8.1

  • libnds:
    • Fix NitroFAT in emulators. It only worked when DLDI was initialized correctly, which isn't the case in emulators like no$gba.
    • Set the right CPU as owner of the Slot-1 bus in NitroFAT handling functions.
  • SDK:
    • Update build systems to generate Maxmod soundbanks in the NitroFAT filesystem if the filesystem is used. This isn't supported by ARM9 + ARM7 makefiles for now, only by ARM9 makefiles.
    • Fix segmentation fault in mkfatimg when not enough arguments are provided.
    • Stop relying on make -j in Makefiles. It is passed by make to any sub-make, so it isn't required.
    • Add basic Maxmod and Maxmod + NitroFAT examples.

v0.8

  • libnds:
    • Document MPU setup code properly.
    • Cleanup exception handling code.
    • Add asynchronous math functions to complement the previous synchronous ones.
    • Support redirecting stdout and stderr to user functions.
    • Fix code that selects the default filesystem (DSi SD or DLDI).
    • Fix leaking file handlers in truncate().
    • Fix memory leaks in image and pcx modules.
    • Support more rumble packs.
  • ndstool:
    • Fix warnings.
    • Remove non-homebrew-related functionality.
  • SDK:
    • Automatically link with libc and libstdc++ rather than forcing users to do it explicitly.
    • Support *.arm.c and *.arm.cpp filenames for compatibility with devkitARM.
    • Correctly initialize TLS in the ARM7.
    • Improve bin2c.
    • Update libc documentation.
    • Improve and cleanup some examples.

v0.7

  • libnds:
    • Unify all coding and documentation style of the codebase.
    • Change license of GL2D to Zlib (with the author's permission).
    • Improve sassert() so that it can exit to the loader instead of locking the application.
    • Keyboard:
      • Fix initialization glitch where it would blink for a frame.
      • Fix backspace handling.
      • Make it use cothread functions so that it never blocks the application.
    • cothread:
      • Fixed stack alignment
      • Fixed stack size of the scheduler thread.
    • libc:
      • Fix no$gba debug messages on the ARM9.
      • Add support of no$gba debug messages to the ARM7.
  • mmutil:
    • Fix segfault with samples with implied zero loop.
  • SDK:
    • Improve some old examples. Fix memory leaks in all examples that used
    • getcwd().
    • Fix ARM9 linkerscript to place ITCM sections in ITCM correctly.
    • Add new examples: Exception handling, assertions, no$gba debug console.
    • Prevent mkfatimg from generating FAT images that are so small that FatFs
    • can't mount them.
    • Improve installation instructions.

v0.6

  • libnds:
    • Document MPU setup steps and CP15 registers.
    • Enable more warnings in the Makefile and fix them.
    • FIFO subsystem:
      • The FIFO subsystem has been cleaned up and documented.
      • Some bugs in the FIFO subsystem have been fixed (the stress test still fails, though).
      • Prevent using cothread_yield() in the ARM7.
    • libc:
      • Alignment of thread local storage sections has been fixed.
      • Support stat() in the root directory of a filesystem.
      • Support statvfs() and fstatvfs().
    • Avoid including the default keyboard data if it isn't used.
    • Allow setting the duration of the lid sleep check, and to disable it completely.
    • Build release versions of the library as well as debug.
  • ndstool:
    • Support multiple languages in the banner.
    • Support more file formats for icons (GIF, PNG).
    • Support animated icons (from GIF files).
  • SDK:
    • Refactor install targets of the SDK components. Now, all components can
    • be installed on their own, and they copy the licenses of the components to
    • the installation directory.
    • Emulate behaviour of bin2s of devkitPro more closely with bin2c.
    • Use SPDX license identifiers in all libraries and components that end up in
    • the NDS application binary.
    • Some cleanup of code formatting.
    • Added a DLDI driver template.

v0.5

  • Define a default location for BlocksDS: /opt/blocksds/
  • Use mkfatimg (distributed with FatFs) instead of imgbuild.sh to reduce
  • the number of dependencies.
  • Fix mmutil target in Makefiles in parallel builds.
  • Cleanup of GBA slot peripherals drivers.
  • Integrate libxm7 as a core library.
  • Fix exit to loader code from the ARM7. It has been simplified a bit.
  • Document exit to loader code.

v0.4

  • Use Wonderful Toolchains to get full C++ standard library support.
  • Remove picolibc and avr-libstdcpp as submodules (all previous history has been condensed to one commit).
  • Multithreading:
    • Add cooperative multithreading scheduler.
    • Enable scheduler in the ARM9 by default.
    • Add examples of having multiple threads, mutexes, and asynchronous file
    • loading.
    • Support thread local storage.
  • Added mutexes to problematic parts of libnds and FatFs.
  • Add initial support and example of DSi camera (thanks, asie!).
  • Support malloc() in the ARM7.
  • Simplify build system of tests and examples.
  • Bugfixes.

Credits

This project wouldn't have been possible without:

External links

Advertising: