[ion/3ds] Got it to build.

This commit is contained in:
M4x1m3
2020-04-18 12:08:38 +02:00
parent 13874cd2e0
commit 2f01603c4d
6 changed files with 113 additions and 5 deletions

View File

@@ -0,0 +1,2 @@
TOOLCHAIN = devkitarm
EXE = elf

View File

@@ -0,0 +1,70 @@
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif
DEVKITPATH=$(shell echo "$(DEVKITPRO)" | sed -e 's/^\([a-zA-Z]\):/\/\1/')
PREFIX = $(DEVKITPATH)/devkitARM/bin/arm-none-eabi-
CC = $(PREFIX)gcc
CXX = $(PREFIX)g++
LD = $(CXX)
GDB = $(PREFIX)gdb
OBJCOPY = $(PREFIX)objcopy
SIZE = $(PREFIX)size
ARCH = -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS = -g -Wall -O2 -mword-relocations \
-ffunction-sections \
$(ARCH)
LIBDIRS := $(DEVKITPRO)/libctru
INCLUDE = $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS = -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS = -lctru -lm
# Always generate debug information
SFLAGS += -ggdb3
# Put data/code symbols in their own subsection
# This allows the linker script to precisely place a given symbol
SFLAGS += -fdata-sections -ffunction-sections
ifeq ($(DEBUG),1)
LTO ?= 0
else
LTO ?= 1
endif
ifeq ($(LTO),1)
# Use link-time optimization if LTO=1
SFLAGS += -flto
endif
# Get rid of unused symbols. This is also useful even if LTO=1.
LDFLAGS += -Wl,--gc-sections
LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
LDFLAGS += $(SFLAGS) $(LIBPATHS) $(LIBS) -lgcc
# To debug linker scripts, add the following line
# LDFLAGS += -Wl,-M

View File

@@ -0,0 +1,4 @@
ion_src += $(addprefix ion/src/simulator/3ds/, \
main.cpp \
)

View File

@@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <3ds.h>
int main(int argc, char * argv[]) {
gfxInitDefault();
consoleInit(GFX_TOP, NULL);
printf("Hello, world!\n");
// Main loop
while (aptMainLoop())
{
gspWaitForVBlank();
gfxSwapBuffers();
hidScanInput();
// Your code goes here
u32 kDown = hidKeysDown();
if (kDown & KEY_START)
break; // break in order to return to hbmenu
}
gfxExit();
return 0;
}

View File

@@ -0,0 +1,4 @@
undefine sdl_src
undefine ion_simulator_sdl_src

View File

@@ -13,11 +13,11 @@ class LayoutNode;
class Integer;
struct IntegerDivision;
typedef uint16_t half_native_uint_t;
typedef int32_t native_int_t;
typedef int64_t double_native_int_t;
typedef uint32_t native_uint_t;
typedef uint64_t double_native_uint_t;
typedef unsigned short half_native_uint_t;
typedef int native_int_t;
typedef long long int double_native_int_t;
typedef unsigned int native_uint_t;
typedef unsigned long long int double_native_uint_t;
static_assert(sizeof(double_native_int_t) <= sizeof(double_native_uint_t), "double_native_int_t type has not the right size compared to double_native_uint_t");
static_assert(sizeof(native_int_t) == sizeof(native_uint_t), "native_int_t type has not the right size compared to native_uint_t");