Hello, I want to "learn" gcc to work with mu0core microprocessor (see attachment). I would be appreciated for any useful advice how to accomplish that. I haven't much time to do that, so if you can, please provide the fastest solution. I read something about porting gcc, on cris example. Is that the right way I should go? Should I define md file? And the second think is the problem with compiling gcc source. I want to compile it for cris, so I do that: - configure --target=cris - make And I get the following error: "No rules to make object '/usr/local/bin/crx-as', needed by 'stamp-as'. Stop." If I cannot compile gcc for some target machine(eg. Mu0core) how could I test what I write? Best regards, Piotr Pałka ---------------------------------------------------------------------- INTERIA.PL dla kobiet... >>> http://link.interia.pl/f193b
#include "../../headers/deviceplugin.h" //prototypes void PinInput(int nPinNo, BYTE bPinState); //contants definitions #define CODE_MEM_SIZE 4096 //size of code memory #define DATA_MEM_SIZE 0 //size of data memory #define IO_SPACE_SIZE 0 //size of I/O space (or external RAM) #define REG_BANK_COUNT 1 //number of register banks (if not banked, leave it 1) #define SFR_COUNT 1 //number of special function registers #define REG_COUNT 1 //number of general purpose registers #define CPU_BIT_WIDTH 16 //register bit-width #define ADDR_BIT_WIDTH 16 //address bit-width #define MEM_BIT_WIDTH 16 //memory unit bit-width #define PIN_COUNT 10 //number of pins //macros to access registers #define PC internal.PC.w.lo #define ACC REG[0] #define PSW internal.Flag.w.lo #define IR SFR[0] #define NEXTCODE CodeMem[PC++] #define MEM CodeMem[IR&0xFFF] //chip storage WORD CodeMem[CODE_MEM_SIZE]; // code memory space WORD SFR[SFR_COUNT]; // special function register file WORD REG[REG_COUNT]; // register file PINDATA Pin[PIN_COUNT]; // pins //string resources DISPLAY display={ "Rst P0 P1 P2 P3 P4 P5 P6 P7 Nc", // names of pins "", // names of register banks (seperated by white space) "ACC", // names of general purpose registers "PC SP PSW IR", // names of special function registers (first must be PC register and second must be flag register) "C A - - - - - -", // names of flag bits }; //processor specification SPEC spec={ CODE_MEM_SIZE, DATA_MEM_SIZE, IO_SPACE_SIZE, ADDR_BIT_WIDTH, CPU_BIT_WIDTH, MEM_BIT_WIDTH, PIN_COUNT, REG_BANK_COUNT, REG_COUNT, SFR_COUNT }; //processor internals INTERNAL internal={ CodeMem, // pointer to code memory array NULL, // pointer to data memory array NULL, // pointer to I/O space / external RAM array REG, // pointer to register array SFR, // pointer to SFR arrary }; //processor externals EXTERNAL external={ Pin, // pointer to pin arrary PinInput // pointer to pin input function }; //plugin container struct DEVICEMODULE cpu={ "MU0 Core", // name of the processor {0x10,0,0,HW_CPU,NULL}, // device info NULL, MessageProc, // message processing routine SingleStep, // single step emulation routine NULL, // full-speed run routine &spec, &display, &internal, &external, NULL }; __declspec(dllexport) BOOL WINAPI LibMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved) { return TRUE;} //This is the only outputed function by which ProEmulator gets the main struct of the plugin __declspec(dllexport) DEVICEMODULE* GetDeviceModule () { return &cpu;} void reset () { PC=0; ACC=0; PSW=0; cpu.fnSingleStep=SingleStep; } DWORD WINAPI CPUStopped() { return 1;} //emulate a single step of the processor DWORD WINAPI SingleStep () { IR=NEXTCODE; //load into IR switch (IR>>12) { case 0x0: ACC=MEM; //LDA break; case 0x1: MEM=ACC; //STO break; case 0x2: ACC+=MEM; //ADD break; case 0x3: ACC-=MEM; //SUB break; case 0x4: PC=IR&0xFFF; //JMP break; case 0x5: if (ACC>=0) PC=IR&0xFFF; //JGE break; case 0x6: if (ACC!=0) PC=IR&0xFFF; //JNE break; case 0x7: cpu.fnSingleStep=CPUStopped; break; } return 1; } void PinInput(int nPinNo, BYTE bPinState) { //Pin[nPinNo].bPinBuffer is the previous state of the pin //bPinState is the new state of the pin char buf[128]; if (!Pin[nPinNo].bPinBuffer && bPinState) wsprintf(buf,"Signal of pin %d is rising",nPinNo+1); else if (Pin[nPinNo].bPinBuffer && !bPinState) wsprintf(buf,"Signal of pin %d is falling",nPinNo+1); else return; ShowInfo(buf); Pin[nPinNo].bPinBuffer=bPinState; } void Init() { memset(CodeMem,0,CODE_MEM_SIZE); memset(Pin,0,sizeof(Pin)); } DWORD WINAPI MessageProc(DWORD msg,WPARAM wParam,LPARAM lParam) { switch (msg){ case PM_RESET: // when processor is to be reset reset(); break; case PM_LOAD: // when the plugin is to be loaded Init(); break; case PM_UNLOAD: // when the plugin is to be unloaded break; default: return 0; } return 1; }