diff --git a/build/platform.simulator.3ds.mak b/build/platform.simulator.3ds.mak new file mode 100644 index 000000000..d8d158a7d --- /dev/null +++ b/build/platform.simulator.3ds.mak @@ -0,0 +1,2 @@ +TOOLCHAIN = devkitarm +EXE = elf diff --git a/build/toolchain.devkitarm.mak b/build/toolchain.devkitarm.mak new file mode 100644 index 000000000..7c03f3a4f --- /dev/null +++ b/build/toolchain.devkitarm.mak @@ -0,0 +1,70 @@ + +ifeq ($(strip $(DEVKITARM)),) +$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") +endif + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=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 diff --git a/ion/src/simulator/3ds/Makefile b/ion/src/simulator/3ds/Makefile new file mode 100644 index 000000000..7a87a2857 --- /dev/null +++ b/ion/src/simulator/3ds/Makefile @@ -0,0 +1,4 @@ + +ion_src += $(addprefix ion/src/simulator/3ds/, \ + main.cpp \ +) diff --git a/ion/src/simulator/3ds/main.cpp b/ion/src/simulator/3ds/main.cpp new file mode 100644 index 000000000..bfcb5c65e --- /dev/null +++ b/ion/src/simulator/3ds/main.cpp @@ -0,0 +1,28 @@ +#include +#include +#include +#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; +} + diff --git a/ion/src/simulator/external/config.3ds.mak b/ion/src/simulator/external/config.3ds.mak new file mode 100644 index 000000000..3feb8e7ed --- /dev/null +++ b/ion/src/simulator/external/config.3ds.mak @@ -0,0 +1,4 @@ + +undefine sdl_src +undefine ion_simulator_sdl_src + diff --git a/poincare/include/poincare/integer.h b/poincare/include/poincare/integer.h index 181193a75..63577e369 100644 --- a/poincare/include/poincare/integer.h +++ b/poincare/include/poincare/integer.h @@ -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");