More labels; add WIP build script

This commit is contained in:
scnorton
2017-12-14 19:38:05 -05:00
parent 1461f78982
commit bd3e8ec8d7
4 changed files with 405 additions and 289 deletions

File diff suppressed because it is too large Load Diff

88
build_newlib.sh Normal file
View File

@@ -0,0 +1,88 @@
#!/bin/sh
# Put this in newlib-1.8.2/newlib/libc (version not final)
AGBCC=${HOME}/pmd-red/tools/agbcc # change this to wherever you keep your agbcc source
# Make sure DEVKITARM is defined in your environment, otherwise this will fail
CPP=cpp
CPPFLAGS="-undef -nostdinc -I${AGBCC}/include -Ilibc/include -iquote libm/common -D__thumb__ -D__GNUC__"
CC1=${AGBCC}/bin/old_agbcc
CCFLAGS="-O2 -fhex-asm"
AS=${DEVKITARM}/bin/arm-none-eabi-as
ASFLAGS="-mcpu=arm7tdmi"
AR=ar
ARFLAGS="-rc"
dummy=
names="
libc/string/memcpy
libc/string/memset
libc/stdio/sprintf
libc/string/strcat
libc/string/strcmp
libc/string/strcpy
libc/string/strlen
libc/string/strncpy
libc/stdio/vfprintf
libc/stdio/vsprintf
libc/stdio/wsetup
libc/stdlib/dtoa
libc/stdio/fflush
libc/stdio/findfp
${dummy# libc/stdlib/mallocr:FREE}
libc/stdio/fvwrite
libc/stdio/fwalk
libc/locale/locale
libc/stdio/makebuf
${dummy# libc/stdlib/mallocr:MALLOC}
libc/stdlib/mbtowc
libc/string/memchr
libc/string/memmove
libc/stdlib/mlock
libc/stdlib/mprec
libm/math/s_isinf
libm/math/s_isnan
libc/reent/sbrkr
libc/stdio/stdio
libc/sys/arm/syscalls
libc/reent/writer
${dummy# libc/stdlib/mallocr:CALLOC}
"
compile () {
lib=$1
name=$2
outp=$3
ADDCPPFLAGS="$4"
${CPP} ${CPPFLAGS} ${ADDCPPFLAGS} -o ${outp}.i ${name}.c && \
${CC1} ${CCFLAGS} ${outp}.i && \
rm -f ${outp}.i && \
bash -c 'echo -e ".text\n\t.align\t2, 0\n"' >> ${outp}.s && \
${AS} ${ASFLAGS} -o ${outp}.o ${outp}.s && \
# rm -f ${outp}.s && \
${AR} ${ARFLAGS} tmp${lib}.a ${outp}.o && \
rm -f ${outp}.o || echo error in ${name}
}
rm -f tmplibc.a tmplibm.a
set -e
for name in $(echo ${names})
do
echo ${name}
lib=$(echo ${name} | cut -d'/' -f1)
compile ${lib} ${name} ${name} ""
done
# For some reason the two halves of mallocr are assembled separately
for comp in MALLOC FREE CALLOC
do
echo stdlib/mallocr with ${comp}
compile libc libc/stdlib/mallocr libc/stdlib/mallocr_${comp} "-DINTERNAL_NEWLIB -DDEFINE_${comp}"
done
mv tmplibc.a libc.a
mv tmplibm.a libm.a

View File

@@ -98,8 +98,8 @@ gUnknown_826FEB4: @ 826FEB4
.4byte 125
.align 2, 0
.global gUnknown_826FEC0
gUnknown_826FEC0: @ 826FEC0
.global __mprec_tens
__mprec_tens: @ 826FEC0
.8byte 0x000000003ff00000 @ 1e0
.8byte 0x0000000040240000 @ 1e1
.8byte 0x0000000040590000 @ 1e2
@@ -127,15 +127,17 @@ gUnknown_826FEC0: @ 826FEC0
.8byte 0x79d99db444ea7843 @ 1e24
.align 2, 0
.global gUnknown_826FF88
gUnknown_826FF88: @ 826FF88
@ big tens
.global __mprec_bigtens
__mprec_bigtens: @ 826FF88
.8byte 0x37e080004341c379 @ 1e16
.8byte 0xb5056e174693b8b5 @ 1e32
.8byte 0xe93ff9f54d384f03 @ 1e64
.8byte 0xf9301d325a827748 @ 1e128
.8byte 0x7f73bf3c75154fdd @ 1e256
@ tiny tenths
.align 2, 0
.global __mprec_tinytens
__mprec_tinytens:
.8byte 0x97d889bc3c9cd2b2 @ 1e-16
.8byte 0xd5a8a7333949f623 @ 1e-32
.8byte 0x44f4a73d32a50ffd @ 1e-64

View File

@@ -1,17 +1,17 @@
.align 2
gUnknown_2039E18: @ 2039E18
heap_end: @ 2039E18
.space 0x4
gUnknown_2039E1C: @ 2039E1C
monitor_stdin: @ 2039E1C
.space 0x4
gUnknown_2039E20: @ 2039E20
monitor_stdout: @ 2039E20
.space 0x4
gUnknown_2039E24: @ 2039E24
monitor_stderr: @ 2039E24
.space 0x4
gUnknown_2039E28: @ 2039E28
openfiles: @ 2039E28
.space 0xA8
gUnknown_2039ED0: @ 2039ED0
@@ -59,7 +59,7 @@ EraseFlashSector: @ 203B02C
gFlashMaxTime: @ 203B030
.space 0x4
gUnknown_203B034: @ 203B034
errno: @ 203B034
.space 0x4
alt_203B038: