diff options
author | red031000 <rubenru09@aol.com> | 2021-07-23 01:11:15 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2021-07-23 01:12:27 +0100 |
commit | 5bf13c7f48fe91c7902ce50250bc1a5a2398a2ae (patch) | |
tree | 2e91e60bdb7a9174b16d8ca1b532809d4ae2e5b6 /arm9/lib/libc | |
parent | c2d91a2d997afd01fa4f40e1e16d5ee85557c9a8 (diff) |
separate out libs to libc, libnns and NitroSDK
Diffstat (limited to 'arm9/lib/libc')
-rw-r--r-- | arm9/lib/libc/Makefile | 80 | ||||
-rw-r--r-- | arm9/lib/libc/include/MSL.h | 8 | ||||
-rw-r--r-- | arm9/lib/libc/include/MSL_Common_arith.h | 8 | ||||
-rw-r--r-- | arm9/lib/libc/src/MSL_Common_arith.c | 7 |
4 files changed, 103 insertions, 0 deletions
diff --git a/arm9/lib/libc/Makefile b/arm9/lib/libc/Makefile new file mode 100644 index 00000000..5a993851 --- /dev/null +++ b/arm9/lib/libc/Makefile @@ -0,0 +1,80 @@ +# Try to include devkitarm if installed +TOOLCHAIN := $(DEVKITARM) + +ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) +include $(TOOLCHAIN)/base_tools +endif + +# If you are using WSL, it is recommended you build with NOWINE=1. +WSLENV ?= no +ifeq ($(WSLENV),) +NOWINE = 1 +else +NOWINE = 0 +endif + +ifeq ($(OS),Windows_NT) +EXE := .exe +WINE := +else +EXE := +WINE := wine +endif + +ifeq ($(NOWINE),1) +WINE := +endif + +# Compare result of arm9, arm7, and ROM to sha1 hash(s) +COMPARE ?= 1 + +##################### Compiler Options ####################### + +MWCCVERSION = 2.0/sp1 + +CROSS := arm-none-eabi- + +MWCCARM = ../../../tools/mwccarm/$(MWCCVERSION)/mwccarm.exe +# Argh... due to EABI version shenanigans, we can't use GNU LD to link together +# MWCC built objects and GNU built ones. mwldarm, however, doesn't care, so we +# have to use mwldarm for now. +# TODO: Is there a hack workaround to let us go back to GNU LD? Ideally, the +# only dependency should be MWCCARM. +MWLDARM = ../../../tools/mwccarm/$(MWCCVERSION)/mwldarm.exe +MWASMARM = ../../../tools/mwccarm/$(MWCCVERSION)/mwasmarm.exe +SCANINC = ../../../tools/scaninc/scaninc$(EXE) + +AS = $(WINE) $(MWASMARM) +CC = $(WINE) $(MWCCARM) +CPP := cpp -P +LD = $(WINE) $(MWLDARM) +AR := $(CROSS)ar +OBJDUMP := $(CROSS)objdump +OBJCOPY := $(CROSS)objcopy + +# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o +ASFLAGS = -proc arm5te -ir ../../.. +CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -i include -ir include-mw -ir arm9/lib/libc/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -W all +LDFLAGS = -library -nodead -w off -proc v5te -interworking -pic +ARFLAGS = rcS + +export MWCIncludes := include + +################ Targets ################# + +.PHONY: all clean + +all: + @: + +clean: + $(RM) $(%.a=%/*.o) + +%.a: + $(AR) $(ARFLAGS) -o $@ $^ + +%.o: %.c + $(CC) $(CFLAGS) -o $@ $< + +%.o: %.s + $(AS) $(ASFLAGS) -o $@ $< diff --git a/arm9/lib/libc/include/MSL.h b/arm9/lib/libc/include/MSL.h new file mode 100644 index 00000000..a1709bc4 --- /dev/null +++ b/arm9/lib/libc/include/MSL.h @@ -0,0 +1,8 @@ +#ifndef MSL_H +#define MSL_H + +//include all msl files here + +#include "MSL_Common_arith.h" + +#endif //MSL_H diff --git a/arm9/lib/libc/include/MSL_Common_arith.h b/arm9/lib/libc/include/MSL_Common_arith.h new file mode 100644 index 00000000..3ec6bdbc --- /dev/null +++ b/arm9/lib/libc/include/MSL_Common_arith.h @@ -0,0 +1,8 @@ +#ifndef MSL_COMMON_ARITH_H +#define MSL_COMMON_ARITH_H + +#include "nitro/types.h" + +s32 abs(s32 val); + +#endif //MSL_COMMON_ARITH_H diff --git a/arm9/lib/libc/src/MSL_Common_arith.c b/arm9/lib/libc/src/MSL_Common_arith.c new file mode 100644 index 00000000..d4a2e834 --- /dev/null +++ b/arm9/lib/libc/src/MSL_Common_arith.c @@ -0,0 +1,7 @@ +#include "MSL_Common_arith.h" +#include "function_target.h" + +ARM_FUNC s32 abs(s32 val) +{ + return val < 0 ? -val : val; +} |