CXX = aarch64-linux-gnu-g++
AS = aarch64-linux-gnu-as
STRIP = aarch64-linux-gnu-strip
-CFLAGS += -I/usr/include/SDL
-CFLAGS += -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -fno-stack-protector
+CFLAGS += -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result
ASFLAGS +=
-LDFLAGS +=
-LDLIBS += -lSDL -lasound -lpng -lz -lm -lstdc++ -ldl
+LDFLAGS += # --sysroot ${HOME}/opt/aarch64/debian-arm64
+LDLIBS += -lSDL -lasound -lpng -lz -lm -ldl
ARCH = aarch64
PLATFORM = generic
-SOUND_DRIVERS = alsa
+SOUND_DRIVERS = oss alsa sdl
CXX = arm-gph-linux-gnueabi-g++
AS = arm-gph-linux-gnueabi-as
STRIP = arm-gph-linux-gnueabi-strip
-CFLAGS += -mfloat-abi=soft -mcpu=arm920t -mtune=arm920t -fno-stack-protector -D__GP2X__
-CFLAGS += -fno-gcse -funswitch-loops -fweb -ftree-loop-im #-fpredictive-commoning -ftree-loop-distribution -frename-registers
-CFLAGS += -I${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/include -I${HOME}/src/gp2x/armroot-eabi/include
+CFLAGS += -I${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/include -I${HOME}/src/gp2x/armroot-eabi/include -D__GP2X__ -Wno-unused-result
+CFLAGS += -mfloat-abi=soft -mcpu=arm920t -mtune=arm920t -mno-thumb-interwork -fno-stack-protector -fno-common
+CFLAGS += -finline-limit=42 -fipa-pta -fno-ipa-pure-const
ASFLAGS += -mfloat-abi=soft -mcpu=arm920t
-LDFLAGS += -B${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/lib/gcc/arm-gph-linux-gnueabi/4.2.4 -B${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/lib -L${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/lib -L${HOME}/src/gp2x/armroot-eabi/lib -static
+LDFLAGS += --sysroot ${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root -L${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/lib -L${HOME}/src/gp2x/armroot-eabi/lib -static
LDLIBS += -lpng -lm -ldl
ARCH = arm
CXX = arm-linux-gnueabi-g++
AS = arm-linux-gnueabi-as
STRIP = arm-linux-gnueabi-strip
-CFLAGS += -mfloat-abi=soft -mcpu=arm920t -mtune=arm920t -Wno-unused-result -fno-stack-protector -D__GP2X__
-CFLAGS += -fno-gcse -funswitch-loops -fweb -ftree-loop-im #-fpredictive-commoning -ftree-loop-distribution -frename-registers
-CFLAGS += -I${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/include -I${HOME}/src/gp2x/armroot-eabi/include
+CFLAGS += -I${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/include -I${HOME}/src/gp2x/armroot-eabi/include -D__GP2X__ -Wno-unused-result
+CFLAGS += -mfloat-abi=soft -mcpu=arm920t -mtune=arm920t -mno-thumb-interwork -fno-stack-protector -fno-common
+CFLAGS += -finline-limit=42 -fipa-pta -fno-ipa-sra -fno-ipa-pure-const
ASFLAGS += -mfloat-abi=soft -mcpu=arm920t
-LDFLAGS += -B${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/lib/gcc/arm-gph-linux-gnueabi/4.2.4 -B${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/lib -L${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/lib -static
+LDFLAGS += -B${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/lib/gcc/arm-gph-linux-gnueabi/4.2.4 -B${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/lib -L${HOME}/opt/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/arm-gph-linux-gnueabi/sys-root/usr/lib -L${HOME}/src/gp2x/armroot-eabi/lib -static
LDLIBS += -lpng -lm -ldl
ARCH = arm
CXX = mipsel-linux-g++
AS = mipsel-linux-as
STRIP = mipsel-linux-strip
-CFLAGS += -I${HOME}/opt/opendingux-toolchain/usr/include/
-CFLAGS += -I${HOME}/opt/opendingux-toolchain/usr/include/SDL
+CFLAGS += -I${HOME}/opt/opendingux-toolchain/usr/include/ -I${HOME}/opt/opendingux-toolchain/usr/include/SDL
CFLAGS += -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -fno-stack-protector
ASFLAGS +=
-LDFLAGS +=
-LDLIBS += -B${HOME}/opt/opendingux-toolchain/usr/lib -Wl,-rpath-link=${HOME}/opt/opendingux-toolchain/usr/lib -Wl,-rpath-link=${HOME}/opt/opendingux-toolchain/lib -lSDL -lasound -lpng -lm -lstdc++ -ldl
+LDFLAGS += --sysroot ${HOME}/opt/opendingux-toolchain -L${HOME}/opt/opendingux-toolchain/lib
+LDLIBS += -lSDL -lasound -lpng -lz -lm -ldl
ARCH = mipsel
PLATFORM = opendingux
CXX = mipsel-linux-gnu-g++
AS = mipsel-linux-gnu-as
STRIP = mipsel-linux-gnu-strip
-CFLAGS += -I${HOME}/opt/opendingux-toolchain/usr/include/
-CFLAGS += -I${HOME}/opt/opendingux-toolchain/usr/include/SDL
+CFLAGS += -I${HOME}/opt/opendingux-toolchain/usr/include/ -I${HOME}/opt/opendingux-toolchain/usr/include/SDL
CFLAGS += -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -fno-stack-protector
ASFLAGS +=
-LDFLAGS +=
-LDLIBS += -B${HOME}/opt/opendingux-toolchain/usr/lib -B${HOME}/opt/opendingux-toolchain/lib -Wl,-rpath-link=${HOME}/opt/opendingux-toolchain/usr/lib -Wl,-rpath-link=${HOME}/opt/opendingux-toolchain/lib -lSDL -lasound -lpng -lz -lm -lstdc++ -ldl
+LDFLAGS += -B${HOME}/opt/opendingux-toolchain/usr/lib -B${HOME}/opt/opendingux-toolchain/lib -Wl,-rpath-link=${HOME}/opt/opendingux-toolchain/usr/lib -Wl,-rpath-link=${HOME}/opt/opendingux-toolchain/lib
+LDLIBS += -lSDL -lasound -lpng -lz -lm -ldl
ARCH = mipsel
PLATFORM = opendingux
CXX = mipsel-gcw0-linux-uclibc-g++
AS = mipsel-gcw0-linux-uclibc-as
STRIP = mipsel-gcw0-linux-uclibc-strip
-CFLAGS += -I${HOME}/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/
-CFLAGS += -I${HOME}/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL
+CFLAGS += -I${HOME}/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/ -I${HOME}/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL
CFLAGS += -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -fno-stack-protector
ASFLAGS +=
-LDFLAGS +=
-LDLIBS += -B${HOME}/opt/gcw0-toolchain/usr/lib -Wl,-rpath-link=${HOME}/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib -Wl,-rpath-link=${HOME}/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/lib -lSDL -lasound -lpng -lz -lm -lstdc++ -ldl
+LDFLAGS += --sysroot ${HOME}/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot
+LDLIBS += -lSDL -lasound -lpng -lz -lm -ldl
ARCH = mipsel
PLATFORM = opendingux
CXX = arm-open2x-linux-g++
AS = arm-open2x-linux-as
STRIP = arm-open2x-linux-strip
-CFLAGS += -msoft-float -mcpu=arm920t -mtune=arm920t -D__GP2X__
-CFLAGS += -I${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include -I${HOME}/src/gp2x/armroot/include
-CFLAGS += -fno-gcse -funswitch-loops -fweb -ftree-loop-im #-fpredictive-commoning -ftree-loop-distribution -frename-registers
+CFLAGS += -I${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include -I${HOME}/src/gp2x/armroot/include -D__GP2X__ -Wno-unused-result
+CFLAGS += -msoft-float -mcpu=arm920t -mtune=arm920t
+CFLAGS += -finline-limit=42 -fipa-cp -fno-ipa-pure-const
ASFLAGS += -mcpu=arm920t -mfloat-abi=soft
LDFLAGS += --sysroot ${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux -L${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib -L${HOME}/src/gp2x/armroot/lib -static
LDLIBS += -lpng -lm -ldl
CXX = arm-linux-gnueabi-g++
AS = arm-linux-gnueabi-as
STRIP = arm-linux-gnueabi-strip
+CFLAGS += -I${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include -I${HOME}/src/gp2x/armroot/include -D__GP2X__ -Wno-unused-result
CFLAGS += -mabi=apcs-gnu -mfloat-abi=soft -mfpu=fpa -mcpu=arm920t -mtune=arm920t
-CFLAGS += -Wno-unused-result -D__GP2X__ -mno-thumb-interwork -fno-stack-protector -fno-common
-CFLAGS += -I${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include -I${HOME}/src/gp2x/armroot/include
+CFLAGS += -mno-thumb-interwork -fno-stack-protector -fno-common
CFLAGS += -finline-limit=42 -fipa-pta -fno-ipa-sra -fno-ipa-pure-const
ASFLAGS += -mabi=apcs-gnu -mfloat-abi=soft -mfpu=fpa -mcpu=arm920t
-LDFLAGS += -mabi=apcs-gnu -mfpu=fpa -B${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1 -B${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib -L${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib -L${HOME}/src/gp2x/armroot/lib -static
+LDFLAGS += -mabi=apcs-gnu -mfpu=fpa -B${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1 -B${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib -L${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/usr/lib -L${HOME}/src/gp2x/armroot/lib -static
LDLIBS += -lpng -lm -ldl
ARCH = arm
CXX = g++
AS = as
STRIP = strip
-CFLAGS += -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -m32 # -pg
+CFLAGS += -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -m32
ASFLAGS +=
-LDFLAGS += -m32 #-pg
-LDLIBS += -L/usr/lib/i386-linux-gnu -L${HOME}/opt/lib32 -lSDL-1.2 -lasound -lpng -lz -lm -ldl
+LDFLAGS += -m32 -L/usr/lib/i386-linux-gnu -L${HOME}/opt/lib32
+LDLIBS += -lSDL-1.2 -lasound -lpng -lz -lm -ldl
ARCH = i386
PLATFORM = generic
-SOUND_DRIVERS = oss alsa sdl
+SOUND_DRIVERS = oss alsa sdl
CXX = g++
AS = as
STRIP = strip
-CFLAGS += -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result # -pg
+CFLAGS += -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result
ASFLAGS +=
-LDFLAGS += #-pg
-LDLIBS += -L/usr/lib/x86_64-linux-gnu -lSDL-1.2 -lasound -lpng -lz -lm -ldl
+LDFLAGS += -L/usr/lib/x86_64-linux-gnu
+LDLIBS += -lSDL-1.2 -lasound -lpng -lz -lm -ldl
ARCH = x86_64
PLATFORM = generic
-SOUND_DRIVERS = oss alsa sdl
+SOUND_DRIVERS = oss alsa sdl
@*
@* PicoDrive
@* (C) notaz, 2010
+@* (C) kub, 2019
@*
@* This work is licensed under the terms of MAME license.
@* See COPYING file in the top-level directory.
/*
* PicoDrive
* (C) notaz, 2009,2010,2013
+ * (C) kub, 2019
*
* This work is licensed under the terms of MAME license.
* See COPYING file in the top-level directory.
/*\r
* PicoDrive\r
* (C) notaz, 2006-2009\r
+ * (C) kub, 2019\r
*\r
* This work is licensed under the terms of MAME license.\r
* See COPYING file in the top-level directory.\r
# compile with target C compiler and extract value from .rodata section
compile_rodata ()
{
- $CC $CFLAGS -I .. -shared /tmp/getoffs.c -o /tmp/getoffs.o || exit 1
+ # $CC $CFLAGS -I .. -shared /tmp/getoffs.c -o /tmp/getoffs.o || exit 1
+ echo 'void dummy(void) { asm(""::"r" (&val)); }' >> /tmp/getoffs.c
+ $CC $CFLAGS -I .. -nostdlib -Wl,-edummy /tmp/getoffs.c \
+ -o /tmp/getoffs.o || exit 1
# find the name of the .rodata section (in case -fdata-sections is used)
rosect=$(readelf -S /tmp/getoffs.o | grep '\.rodata' |
sed 's/^[^.]*././;s/ .*//')
name=$(echo $* | sed 's/ /_/g')
echo '#include "pico/pico_int.h"' > /tmp/getoffs.c
echo "static const struct $struct p;" >> /tmp/getoffs.c
- echo "const int offs = (char *)&p.$field - (char*)&p;" >>/tmp/getoffs.c
+ echo "const int val = (char *)&p.$field - (char*)&p;" >>/tmp/getoffs.c
compile_rodata
line=$(printf "#define %-20s 0x%04x" $prefix$name $rodata)
}
# determine endianess
-echo "const int one = 1;" >/tmp/getoffs.c
+echo "const int val = 1;" >/tmp/getoffs.c
compile_rodata
ENDIAN=$(if [ "$rodata" -eq 1 ]; then echo be; else echo le; fi)
# output header