From a80ae4a0353fce94df700ec84222d3c56c3d813a Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 23 Sep 2011 19:29:03 +0300 Subject: [PATCH] support armv5 build --- Makefile | 49 +++++++++++++++++-------- frontend/cspace.c | 7 ++++ frontend/{arm_utils.h => cspace.h} | 0 frontend/{arm_utils.s => cspace_neon.s} | 0 frontend/menu.c | 2 +- frontend/plat_dummy.c | 12 ------ libpcsxcore/new_dynarec/emu_if.c | 4 +- libpcsxcore/new_dynarec/emu_if.h | 4 ++ libpcsxcore/new_dynarec/linkage_arm.s | 9 +---- plugins/dfsound/spu.c | 4 +- plugins/dfxvideo/draw_fb.c | 2 +- plugins/dfxvideo/soft.c | 2 +- plugins/gpu_neon/Makefile | 2 +- plugins/gpu_neon/vout_fb.c | 2 +- plugins/gpu_unai/Makefile | 2 +- plugins/gpu_unai/gpu.cpp | 2 +- 16 files changed, 57 insertions(+), 46 deletions(-) create mode 100644 frontend/cspace.c rename frontend/{arm_utils.h => cspace.h} (100%) rename frontend/{arm_utils.s => cspace_neon.s} (100%) diff --git a/Makefile b/Makefile index 2b570538..5a7b278e 100644 --- a/Makefile +++ b/Makefile @@ -3,26 +3,39 @@ AS = $(CROSS_COMPILE)as CC = $(CROSS_COMPILE)gcc LD = $(CROSS_COMPILE)ld +ARM926 ?= 0 +ARM_CORTEXA8 ?= 1 +USE_OSS ?= 1 +#USE_ALSA = 1 +#DRC_DBG = 1 +#PCNT = 1 +TARGET = pcsx + +-include Makefile.local + ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') -CFLAGS += -Wall -ggdb -Ifrontend +CFLAGS += -Wall -ggdb -Ifrontend -ffast-math LDFLAGS += -lz -lpthread -ldl -lpng -lbz2 -ifeq "$(ARCH)" "arm" -CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math -ASFLAGS += -mcpu=cortex-a8 -mfpu=neon -endif ifndef DEBUG CFLAGS += -O2 -DNDEBUG endif CFLAGS += $(EXTRA_CFLAGS) -USE_OSS ?= 1 -#USE_ALSA = 1 -#DRC_DBG = 1 -#PCNT = 1 -TARGET = pcsx +ifeq "$(ARCH)" "arm" +ifeq "$(ARM_CORTEXA8)" "1" +CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp +ASFLAGS += -mcpu=cortex-a8 -mfpu=neon +endif +ifeq "$(ARM926)" "1" +CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s +ASFLAGS += -mcpu=arm926ej-s +endif +endif --include Makefile.local +# detect armv7 and NEON from the specified CPU +HAVE_NEON = $(shell $(CC) -E -dD $(CFLAGS) frontend/config.h | grep -q '__ARM_NEON__ 1' && echo 1) +HAVE_ARMV7 = $(shell $(CC) -E -dD $(CFLAGS) frontend/config.h | grep -q '__ARM_ARCH_7A__ 1' && echo 1) all: $(TARGET) @@ -33,7 +46,7 @@ OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \ libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \ libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o -ifeq "$(ARCH)" "arm" +ifeq "$(HAVE_NEON)" "1" OBJS += libpcsxcore/gte_neon.o endif libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign @@ -41,6 +54,7 @@ libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull # dynarec ifndef NO_NEW_DRC +libpcsxcore/new_dynarec/linkage_arm.o: ASFLAGS += --defsym HAVE_ARMV7=$(HAVE_ARMV7) OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o OBJS += libpcsxcore/new_dynarec/pcsxmem.o endif @@ -58,7 +72,7 @@ OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \ plugins/dfsound/registers.o plugins/dfsound/spu.o plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \ plugins/dfsound/xa.c -ifeq "$(ARCH)" "arm" +ifeq "$(HAVE_NEON)" "1" OBJS += plugins/dfsound/arm_utils.o endif ifeq "$(USE_OSS)" "1" @@ -109,8 +123,11 @@ else OBJS += frontend/plat_dummy.o endif endif # !USE_GTK -ifeq "$(ARCH)" "arm" -OBJS += frontend/arm_utils.o + +ifeq "$(HAVE_NEON)" "1" +OBJS += frontend/cspace_neon.o +else +OBJS += frontend/cspace.o endif ifdef X11 frontend/%.o: CFLAGS += -DX11 @@ -136,7 +153,7 @@ frontend/revision.h: FORCE $(TARGET): $(OBJS) $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map -PLUGINS = plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \ +PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \ plugins/gpu-gles/gpuGLES.so plugins/gpu_neon/gpu_neon.so $(PLUGINS): diff --git a/frontend/cspace.c b/frontend/cspace.c new file mode 100644 index 00000000..f5f8d35b --- /dev/null +++ b/frontend/cspace.c @@ -0,0 +1,7 @@ +#include "cspace.h" + +// TODO? +void bgr555_to_rgb565(void *dst, const void *src, int bytes) {} +void bgr888_to_rgb888(void *dst, const void *src, int bytes) {} +void bgr888_to_rgb565(void *dst, const void *src, int bytes) {} + diff --git a/frontend/arm_utils.h b/frontend/cspace.h similarity index 100% rename from frontend/arm_utils.h rename to frontend/cspace.h diff --git a/frontend/arm_utils.s b/frontend/cspace_neon.s similarity index 100% rename from frontend/arm_utils.s rename to frontend/cspace_neon.s diff --git a/frontend/menu.c b/frontend/menu.c index cdba3adf..01b568e4 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -22,7 +22,7 @@ #include "omap.h" #include "pandora.h" #include "pcnt.h" -#include "arm_utils.h" +#include "cspace.h" #include "common/plat.h" #include "common/input.h" #include "linux/in_evdev.h" diff --git a/frontend/plat_dummy.c b/frontend/plat_dummy.c index 44ba4a81..bafb1847 100644 --- a/frontend/plat_dummy.c +++ b/frontend/plat_dummy.c @@ -43,18 +43,6 @@ void plat_finish(void) { } -void bgr555_to_rgb565(void *d, void *s, int len) -{ -} - -void bgr888_to_rgb888(void *d, void *s, int len) -{ -} - -void bgr888_to_rgb565(void *d, void *s, int len) -{ -} - void in_update_analogs(void) { } diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index 58216507..8a068ea0 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -161,11 +161,13 @@ static int ari64_init() for (i = 0; i < ARRAY_SIZE(gte_handlers); i++) if (psxCP2[i] != psxNULL) gte_handlers[i] = psxCP2[i]; -#if defined(__arm__) && !defined(DRC_DBG) +#ifndef DRC_DBG +#ifdef __ARM_NEON__ gte_handlers[0x01] = gteRTPS_neon; gte_handlers[0x30] = gteRTPT_neon; gte_handlers[0x12] = gteMVMVA_neon; gte_handlers[0x06] = gteNCLIP_neon; +#endif #endif psxH_ptr = psxH; diff --git a/libpcsxcore/new_dynarec/emu_if.h b/libpcsxcore/new_dynarec/emu_if.h index 128d4317..8acd1f5a 100644 --- a/libpcsxcore/new_dynarec/emu_if.h +++ b/libpcsxcore/new_dynarec/emu_if.h @@ -1,6 +1,10 @@ #include "new_dynarec.h" #include "../r3000a.h" +#ifndef __ARM_ARCH_7A__ +#define ARMv5_ONLY +#endif + extern char invalid_code[0x100000]; /* weird stuff */ diff --git a/libpcsxcore/new_dynarec/linkage_arm.s b/libpcsxcore/new_dynarec/linkage_arm.s index c545ed35..f5af0f59 100644 --- a/libpcsxcore/new_dynarec/linkage_arm.s +++ b/libpcsxcore/new_dynarec/linkage_arm.s @@ -19,15 +19,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -.equiv HAVE_ARMV7, 1 +/* .equiv HAVE_ARMV7, 1 */ -.if HAVE_ARMV7 - .cpu cortex-a8 - .fpu vfp -.else - .cpu arm9tdmi - .fpu softvfp -.endif .global rdram rdram = 0x80000000 .global dynarec_local diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 06cc4761..f84ef77c 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -37,7 +37,7 @@ #define N_(x) (x) #endif -#ifdef __arm__ +#ifdef __ARM_ARCH_7A__ #define ssat32_to_16(v) \ asm("ssat %0,#16,%1" : "=r" (v) : "r" (v)) #else @@ -620,7 +620,7 @@ static int do_samples_noise(int ch, int ns, int ns_to) return -1; } -#ifdef __arm__ +#ifdef __ARM_ARCH_7A__ // asm code extern void mix_chan(int start, int count, int lv, int rv); extern void mix_chan_rvb(int start, int count, int lv, int rv); diff --git a/plugins/dfxvideo/draw_fb.c b/plugins/dfxvideo/draw_fb.c index f40063e6..7f807244 100644 --- a/plugins/dfxvideo/draw_fb.c +++ b/plugins/dfxvideo/draw_fb.c @@ -10,7 +10,7 @@ #include "gpu.h" #include "../../frontend/plugin_lib.h" -#include "../../frontend/arm_utils.h" +#include "../../frontend/cspace.h" #include "../../frontend/pcnt.h" // misc globals diff --git a/plugins/dfxvideo/soft.c b/plugins/dfxvideo/soft.c index 1b246248..160b0c47 100644 --- a/plugins/dfxvideo/soft.c +++ b/plugins/dfxvideo/soft.c @@ -1077,7 +1077,7 @@ static int left_B, delta_left_B, right_B, delta_right_B; // USE_NASM static inline int shl10idiv(int x, int y) { -#ifdef __arm__ +#ifdef __ARM_ARCH_7A__ // rearmed: let's use VFP divider instead float r = 1024.0f * (float)x / (float)y; return (int)r; diff --git a/plugins/gpu_neon/Makefile b/plugins/gpu_neon/Makefile index 09c47d34..adb50970 100644 --- a/plugins/gpu_neon/Makefile +++ b/plugins/gpu_neon/Makefile @@ -10,7 +10,7 @@ SRC += gpu.c ifeq "$(ARCH)" "arm" TARGET = gpu_neon.so CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -SRC += vout_fb.c ../../frontend/arm_utils.s +SRC += vout_fb.c ../../frontend/cspace_neon.s else TARGET = gpu_neon.so.x86 CFLAGS += `sdl-config --cflags` -m32 diff --git a/plugins/gpu_neon/vout_fb.c b/plugins/gpu_neon/vout_fb.c index 6b687b30..bda8d4a6 100644 --- a/plugins/gpu_neon/vout_fb.c +++ b/plugins/gpu_neon/vout_fb.c @@ -10,7 +10,7 @@ #include "gpu.h" #include "../../frontend/plugin_lib.h" -#include "../../frontend/arm_utils.h" +#include "../../frontend/cspace.h" static const struct rearmed_cbs *cbs; static void *screen_buf; diff --git a/plugins/gpu_unai/Makefile b/plugins/gpu_unai/Makefile index 026d9503..80f82aef 100644 --- a/plugins/gpu_unai/Makefile +++ b/plugins/gpu_unai/Makefile @@ -16,7 +16,7 @@ LDFLAGS += -shared -Wl,-soname,$(TARGET) all: $(TARGET) -$(TARGET): gpu.cpp ../../frontend/arm_utils.s +$(TARGET): gpu.cpp ../../frontend/cspace_neon.s $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) # $(TARGET): *.h diff --git a/plugins/gpu_unai/gpu.cpp b/plugins/gpu_unai/gpu.cpp index 3342d1ee..fa176d53 100644 --- a/plugins/gpu_unai/gpu.cpp +++ b/plugins/gpu_unai/gpu.cpp @@ -820,7 +820,7 @@ void GPU_updateLace(void) #else #include "../../frontend/plugin_lib.h" -#include "../../frontend/arm_utils.h" +#include "../../frontend/cspace.h" extern "C" { -- 2.39.2