diff --git a/contrib/other/uarm/Makefile b/contrib/other/uarm/Makefile index 29abee91a8..3dbc69b060 100755 --- a/contrib/other/uarm/Makefile +++ b/contrib/other/uarm/Makefile @@ -9,8 +9,14 @@ LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base INCLUDES = -I $(SDK_DIR)/sources/newlib/libc/include LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib -SRC := $(notdir $(wildcard *.c)) -OBJECTS = $(patsubst %.c, %.o, $(SRC)) + +# Only selected +SRC = RAM.c icache.c MMU.c pxa255_PwrClk.c pxa255_IC.c pxa255_GPIO.c callout_RAM.c rt.c pxa255_RTC.c SoC.c pxa255_UART.c pxa255_TIMR.c mem.c dcache.c pxa255_LCD.c cp15.c pxa255_DMA.c math64.c CPU.c main_pc.c pxa255_DSP.c + +# All .c files +# SRC = $(notdir $(wildcard *.c)) + +OBJECTS = $(patsubst %.c, %.o, $(SRC)) default: $(patsubst %.c,%.o,$(SRC)) kos32-ld $(LDFLAGS) $(LIBPATH) --subsystem console -o uARMk $(OBJECTS) -lgcc -lc.dll @@ -18,3 +24,6 @@ default: $(patsubst %.c,%.o,$(SRC)) %.o : %.c Makefile $(SRC) $(CC) $(CFLAGS) $(INCLUDES) -o $@ $< + +clean: + rm *.o diff --git a/contrib/other/uarm/cpu.h b/contrib/other/uarm/cpu.h deleted file mode 100755 index 3ef677d517..0000000000 --- a/contrib/other/uarm/cpu.h +++ /dev/null @@ -1,173 +0,0 @@ -#ifndef _CPU_H_ -#define _CPU_H_ - - -//#define ARM_V6 //define to allow v6 instructions -//#define THUMB_2 //define to allow Thumb2 - -#include "types.h" - -struct ArmCpu; - -#define ARM_SR_N 0x80000000UL -#define ARM_SR_Z 0x40000000UL -#define ARM_SR_C 0x20000000UL -#define ARM_SR_V 0x10000000UL -#define ARM_SR_Q 0x08000000UL -#ifdef ARM_V6 //V6KT2, but without T2 to be exact (we implement things like MLS, but not Thumb2 or ThumbEE) - #define ARM_SR_J 0x01000000UL - #define ARM_SR_E 0x00000200UL - #define ARM_SR_A 0x00000100UL - #define ARM_SR_GE_0 0x00010000UL - #define ARM_SR_GE_1 0x00020000UL - #define ARM_SR_GE_2 0x00040000UL - #define ARM_SR_GE_3 0x00080000UL - #define ARM_SR_GE_MASK 0x000F0000UL - #define ARM_SR_GE_SHIFT 16 -#endif -#define ARM_SR_I 0x00000080UL -#define ARM_SR_F 0x00000040UL -#define ARM_SR_T 0x00000020UL -#define ARM_SR_M 0x0000001FUL - -#define ARM_SR_MODE_USR 0x00000010UL -#define ARM_SR_MODE_FIQ 0x00000011UL -#define ARM_SR_MODE_IRQ 0x00000012UL -#define ARM_SR_MODE_SVC 0x00000013UL -#define ARM_SR_MODE_ABT 0x00000017UL -#define ARM_SR_MODE_UND 0x0000001BUL -#define ARM_SR_MODE_SYS 0x0000001FUL - -#define ARV_VECTOR_OFFT_RST 0x00000000UL -#define ARM_VECTOR_OFFT_UND 0x00000004UL -#define ARM_VECTOR_OFFT_SWI 0x00000008UL -#define ARM_VECTOR_OFFT_P_ABT 0x0000000CUL -#define ARM_VECTOR_OFFT_D_ABT 0x00000010UL -#define ARM_VECTOR_OFFT_UNUSED 0x00000014UL -#define ARM_VECTOR_OFFT_IRQ 0x00000018UL -#define ARM_VECTOR_OFFT_FIQ 0x0000001CUL - -#define HYPERCALL_ARM 0xF7BBBBBBUL -#define HYPERCALL_THUMB 0xBBBBUL - -//the following are for cpuGetRegExternal() and are generally used for debugging purposes -#define ARM_REG_NUM_CPSR 16 -#define ARM_REG_NUM_SPSR 17 - -struct ArmCpu; - -typedef Boolean (*ArmCoprocRegXferF) (struct ArmCpu* cpu, void* userData, Boolean two/* MCR2/MRC2 ? */, Boolean MRC, UInt8 op1, UInt8 Rx, UInt8 CRn, UInt8 CRm, UInt8 op2); -typedef Boolean (*ArmCoprocDatProcF) (struct ArmCpu* cpu, void* userData, Boolean two/* CDP2 ? */, UInt8 op1, UInt8 CRd, UInt8 CRn, UInt8 CRm, UInt8 op2); -typedef Boolean (*ArmCoprocMemAccsF) (struct ArmCpu* cpu, void* userData, Boolean two /* LDC2/STC2 ? */, Boolean N, Boolean store, UInt8 CRd, UInt32 addr, UInt8* option /* NULL if none */); -typedef Boolean (*ArmCoprocTwoRegF) (struct ArmCpu* cpu, void* userData, Boolean MRRC, UInt8 op, UInt8 Rd, UInt8 Rn, UInt8 CRm); - -typedef Boolean (*ArmCpuMemF) (struct ArmCpu* cpu, void* buf, UInt32 vaddr, UInt8 size, Boolean write, Boolean priviledged, UInt8* fsr); //read/write -typedef Boolean (*ArmCpuHypercall) (struct ArmCpu* cpu); //return true if handled -typedef void (*ArmCpuEmulErr) (struct ArmCpu* cpu, const char* err_str); - -typedef void (*ArmSetFaultAdrF) (struct ArmCpu* cpu, UInt32 adr, UInt8 faultStatus); - -#include "icache.h" - - -/* - - coprocessors: - - 0 - DSP (pxa only) - 0, 1 - WMMX (pxa only) - 11 - VFP (arm standard) - 15 - system control (arm standard) -*/ - - -typedef struct{ - - ArmCoprocRegXferF regXfer; - ArmCoprocDatProcF dataProcessing; - ArmCoprocMemAccsF memAccess; - ArmCoprocTwoRegF twoRegF; - void* userData; - -}ArmCoprocessor; - -typedef struct{ - - UInt32 R13, R14; - UInt32 SPSR; //usr mode doesn't have an SPSR -}ArmBankedRegs; - - - - - - - - -typedef struct ArmCpu{ - - UInt32 regs[16]; //current active regs as per current mode - UInt32 CPSR, SPSR; - - ArmBankedRegs bank_usr; //usr regs when in another mode - ArmBankedRegs bank_svc; //svc regs when in another mode - ArmBankedRegs bank_abt; //abt regs when in another mode - ArmBankedRegs bank_und; //und regs when in another mode - ArmBankedRegs bank_irq; //irq regs when in another mode - ArmBankedRegs bank_fiq; //fiq regs when in another mode - UInt32 extra_regs[5]; //fiq regs when not in fiq mode, usr regs when in fiq mode. R8-12 - - UInt16 waitingIrqs; - UInt16 waitingFiqs; - UInt16 CPAR; - - ArmCoprocessor coproc[16]; //coprocessors - - // various other cpu config options - UInt32 vectorBase; //address of vector base - -#ifdef ARM_V6 - - Boolean EEE; //endianness one exception entry - Boolean impreciseAbtWaiting; -#endif - - ArmCpuMemF memF; - ArmCpuEmulErr emulErrF; - ArmCpuHypercall hypercallF; - ArmSetFaultAdrF setFaultAdrF; - - icache ic; - - void* userData; //shared by all callbacks -}ArmCpu; - - -Err cpuInit(ArmCpu* cpu, UInt32 pc, ArmCpuMemF memF, ArmCpuEmulErr emulErrF, ArmCpuHypercall hypercallF, ArmSetFaultAdrF setFaultAdrF); -Err cpuDeinit(ArmCpu* cp); -void cpuCycle(ArmCpu* cpu); -void cpuIrq(ArmCpu* cpu, Boolean fiq, Boolean raise); //unraise when acknowledged - -#ifdef ARM_V6 - - void cpuSignalImpreciseAbt(ArmCpu* cpu, Boolean raise); - -#endif - -UInt32 cpuGetRegExternal(ArmCpu* cpu, UInt8 reg); -void cpuSetReg(ArmCpu* cpu, UInt8 reg, UInt32 val); - -void cpuCoprocessorRegister(ArmCpu* cpu, UInt8 cpNum, ArmCoprocessor* coproc); -void cpuCoprocessorUnregister(ArmCpu* cpu, UInt8 cpNum); - -void cpuSetVectorAddr(ArmCpu* cpu, UInt32 adr); - -UInt16 cpuGetCPAR(ArmCpu* cpu); -void cpuSetCPAR(ArmCpu* cpu, UInt16 cpar); - -void cpuIcacheInval(ArmCpu* cpu); -void cpuIcacheInvalAddr(ArmCpu* cpu, UInt32 addr); - - -#endif - diff --git a/contrib/other/uarm/main_pc.c b/contrib/other/uarm/main_pc.c index bba68474ae..e4d16ea3da 100755 --- a/contrib/other/uarm/main_pc.c +++ b/contrib/other/uarm/main_pc.c @@ -176,8 +176,8 @@ int main(int argc, char** argv){ int gdbPort = 0; if(argc != 3 && argc != 2){ - fprintf(stderr,"usage: %s path_to_disk [gdbPort]\n", argv[0]); - return -1; + fprintf(stdout,"usage: %s path_to_disk [gdbPort]\n", argv[0]); + return 0; } //setup the terminal diff --git a/contrib/other/uarm/pxa255_DMA.h b/contrib/other/uarm/pxa255_DMA.h index 61aff185ea..915bfd7350 100755 --- a/contrib/other/uarm/pxa255_DMA.h +++ b/contrib/other/uarm/pxa255_DMA.h @@ -2,7 +2,7 @@ #define _PXA255_DMA_H_ #include "mem.h" -#include "cpu.h" +#include "CPU.h" #include "pxa255_IC.h" /* diff --git a/contrib/other/uarm/pxa255_DSP.h b/contrib/other/uarm/pxa255_DSP.h index 1351bc6056..1d62eb9ad1 100755 --- a/contrib/other/uarm/pxa255_DSP.h +++ b/contrib/other/uarm/pxa255_DSP.h @@ -2,7 +2,7 @@ #define _PXA255_DSP_H_ #include "mem.h" -#include "cpu.h" +#include "CPU.h" @@ -17,4 +17,4 @@ typedef struct{ Boolean pxa255dspInit(Pxa255dsp* dsp, ArmCpu* cpu); -#endif \ No newline at end of file +#endif diff --git a/contrib/other/uarm/pxa255_GPIO.h b/contrib/other/uarm/pxa255_GPIO.h index 3585e90b98..7c7d1d2720 100755 --- a/contrib/other/uarm/pxa255_GPIO.h +++ b/contrib/other/uarm/pxa255_GPIO.h @@ -2,7 +2,7 @@ #define _PXA255_GPIO_H_ #include "mem.h" -#include "cpu.h" +#include "CPU.h" #include "pxa255_IC.h" /* diff --git a/contrib/other/uarm/pxa255_LCD.h b/contrib/other/uarm/pxa255_LCD.h index c2f3f6b471..3345860545 100755 --- a/contrib/other/uarm/pxa255_LCD.h +++ b/contrib/other/uarm/pxa255_LCD.h @@ -2,7 +2,7 @@ #define _PXA255_LCD_H_ #include "mem.h" -#include "cpu.h" +#include "CPU.h" #include "pxa255_IC.h" #ifndef EMBEDDED diff --git a/contrib/other/uarm/pxa255_PwrClk.h b/contrib/other/uarm/pxa255_PwrClk.h index e8ba87ba69..30d217a8c0 100755 --- a/contrib/other/uarm/pxa255_PwrClk.h +++ b/contrib/other/uarm/pxa255_PwrClk.h @@ -2,7 +2,7 @@ #define _PXA255_PWR_CLK_H_ #include "mem.h" -#include "cpu.h" +#include "CPU.h" diff --git a/contrib/other/uarm/pxa255_RTC.h b/contrib/other/uarm/pxa255_RTC.h index 2729320dc9..a95e4bc961 100755 --- a/contrib/other/uarm/pxa255_RTC.h +++ b/contrib/other/uarm/pxa255_RTC.h @@ -2,7 +2,7 @@ #define _PXA255_RTC_H_ #include "mem.h" -#include "cpu.h" +#include "CPU.h" #include "pxa255_IC.h" diff --git a/contrib/other/uarm/pxa255_TIMR.h b/contrib/other/uarm/pxa255_TIMR.h index 8f200526db..d2ee2c9496 100755 --- a/contrib/other/uarm/pxa255_TIMR.h +++ b/contrib/other/uarm/pxa255_TIMR.h @@ -2,7 +2,7 @@ #define _PXA255_TIMR_H_ #include "mem.h" -#include "cpu.h" +#include "CPU.h" #include "pxa255_IC.h" diff --git a/contrib/other/uarm/pxa255_UART.h b/contrib/other/uarm/pxa255_UART.h index 8209d181ba..a32c83fe63 100755 --- a/contrib/other/uarm/pxa255_UART.h +++ b/contrib/other/uarm/pxa255_UART.h @@ -2,7 +2,7 @@ #define _PXA255_UART_H_ #include "mem.h" -#include "cpu.h" +#include "CPU.h" #include "pxa255_IC.h"