-
Notifications
You must be signed in to change notification settings - Fork 0
2.1. Getting started with devkitPro in Code::Blocks
Source article here. The following article shows step by step how to arrange the setup to use the devkitARM compiler inside Code::Blocks IDE. It is assumed that you have already installed Code::Blocks on your Windows device. The following instructions were tested on Code::Blocks 20.03.
1. First, identify your devkitPro installation path. If you run into problems while following these steps, make sure devkitPro isn't installed in a system directory (like C:\Program Files
), which could be the reason of some failures in running the compiler. In the following, it is assumed that devkitPro is installed in C:\
directory.
2. Check devkitPro and devkitARM are declared in the System Variables list. This is crucial because your programs will not run if %PATH%
is not set up correctly. To check your %PATH%
, do the following:
a. Open File Explorer. Right click on the PC icon and in the context menu choose Properties.
A window containing information about your PC will appear.
b. Click Advanced system settings in the left column of the window.
c. Click Environment variables
in the System Properties menu.
d. Look for DEVKITPRO
and DEVKITARM
in the System Properties menu.
Note: If you cannot find DEVKITARM and DEVKITPRO among the system variables, try uninstalling and reinstalling devkitPro.
3. Launch Code::Blocks, go to Settings menu, then click Compiler...
4. In the Compiler Settings window, make sure GNU GCC Compiler
is the selected compiler, then click the Copy
button below
5. A popup window will show requesting you to enter a new name for our compiler. Enter "devkitARM NDS Compiler" or any name you want to give to your compiler.
6. Now click Ok. A dialog will be shown saying The new compiler has been added! Don't forget to update the "Toolchain executables" page...
. Click Ok once more.
7. Now in the compiler settings, make sure your selected compiler is now devkitARM NDS Compiler
(or your custom compiler name). Click the Toolchain executables
tab below. Now update the fields with the following information:
Field | Value |
---|---|
Compiler's installation directory |
C:\devkitPro\devkitARM\bin * |
C Compiler | arm-none-eabi-gcc.exe |
C++ Compiler | arm-none-eabi-c++.exe |
Linker for dynamic libs | arm-none-eabi-c++.exe |
Linker for static libs | arm-none-eabi-ar.exe |
Make program | make.exe |
* In the source page, the compiler's installation directory is
c:\devkitPro\msys
. However, my setup worked with the path specified in the table. If you are experimenting issues with one of the following settings, it's worth trying the other one.
Now go to the Additional Paths
tab and add C:\devkitPro\devkitARM\bin
8. Finally, in the compiler settings window, click the Ok button from the bottom right.
Now you have set your NDS compiler. Let's see how we can put it to work.
1. Create a new Code::Blocks blank project (File -> New -> Project -> Empty project). Click Next to skip the welcome page if it appears. 2. Choose a project title and a project path of your choice. Then, click Next.
Make sure the project title does not contain any white spaces, otherwise you could run into compiling errors later
3. Choose devkitARM NDS Compiler
as your project's compiler. You can uncheck the Create "Debug" configuration
option as we don't have a compiler set up. Then, click Finish
4. Now go to C:\devkitPro\examples\nds\hello_world
and copy the source/
folder and the Makefile
. Paste them in your template project directory. Your project's folder structure should be as follows:
devkitARM_NDS_Template
╠═ source
║ ╚═ main.cpp
╠═ devkitARM_NDS_Template.cbp
╚═ Makefile
5. Return to Code::Blocks window. An empty project appeared in your Code::Blocks workspace. Right-Click -> Add Files Recursively, then go to your project directory and click Select Folder
. From the Multiple Selection window, click Select All
. Click Ok.
Now all you have to do is define the build directives.
6. In the Code::Blocks menu, go to Project -> Properties. Check "This is a custom Makefile". Set the Execution Directory to ${PROJECT_DIR}
. Then click Ok.
7. In the Code::Blocks menu, go to Project -> Build options. Make sure the selected compiler is set to devkitARM NDS Compiler
.
8. Go to "Make" commands
tab and type in the following:
Field | Value |
---|---|
Build project/target | $make -f $makefile |
Compile single file | $make -f $makefile |
Clean project/target | $make -f $makefile clean |
Ask if rebuild is needed | $make -q -f $makefile clean |
Click Ok.
9. And now, the moment of truth! You'll test your project to see if it compiles before saving it as template. Make sure devkitARM_NDS_Template
is selected in your Workspace and hit F9
(or [Fn]+F9
depending on your keyboard settings).
You shouldn't get any errors at this point. A dialog may appear saying "It seems that this project has not been built yet". Just click Cancel.
If everything went well so far, you can go to step 10.
10. In order to save the template, go to menu File -> Save project as template... . Enter a name to your template (you could leave it as it is) and click Ok. A dialog could appear saying that the template was saved successfully.
Now you can create NDS project from template by following the steps: File -> New -> From Template -> debkitARM_NDS_Template -> Go. You will be asked to choose your project directory (Be careful, choose an empty directory, because Code::Blocks would not make a special directory for projects created from template!). You can give a name to your project. Click Ok, and you are good to go.
11. Let's analyze the consequences of step 9. In the project directory you will find some new files:
Name | Description |
---|---|
build/ | Object files and other building process redundancies |
devkitARM_NDS_Template.elf | ARM9 binary image. |
devkitARM_NDS_Template.nds | Final NDS executable ROM, obtained by linking the ARM9 binary image to the ARM7 binary image implicitely provided by devkitARM |
Now you can run the .nds
file in your favorite emulator to finally see the result.
libnds Practical Wiki - This is an independent work of learning and exposing the facts about NDS programming. I am not affiliated in any way with Nintendo, devkitPro organization or libnds developers.