public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Porting gcc
@ 2006-06-13 18:48 Piotr Pałka
  2006-06-20 14:20 ` kernel coder
  0 siblings, 1 reply; 7+ messages in thread
From: Piotr Pałka @ 2006-06-13 18:48 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

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

[-- Attachment #2: mu0core.c --]
[-- Type: text/plain, Size: 4300 bytes --]

#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;
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Porting gcc
  2006-06-13 18:48 Porting gcc Piotr Pałka
@ 2006-06-20 14:20 ` kernel coder
  0 siblings, 0 replies; 7+ messages in thread
From: kernel coder @ 2006-06-20 14:20 UTC (permalink / raw)
  To: Piotr Pałka; +Cc: gcc-help

> 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."

you need to give path of binutils for cris architecture.First compile
binutils for cris architecture and then set the PATH variable to the
directory containing compiled binutils for cris architecture.

shahzad

On 6/13/06, Piotr Pałka <piopalka@interia.pl> wrote:
> 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
>
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Porting GCC
@ 2003-08-13 11:26 Petar Penchev
  0 siblings, 0 replies; 7+ messages in thread
From: Petar Penchev @ 2003-08-13 11:26 UTC (permalink / raw)
  To: gcc-help

Hello All,
I started porting GCC for new target. I read the documentation I have found
and I have couple questions I can't find answers.

Target.c target.h and target.md files are complementary to one another. I
mean they have common purpose (to define target machine). I am wondering are
there any tools which could help me to create /or better to generate / these
files or I have to write them from scratch ?

And second question in Amazon.com I found some books on porting GCC, does
anybody know something about on-line version of these books ?

Regards Petar

^ permalink raw reply	[flat|nested] 7+ messages in thread

* porting gcc
@ 2000-09-13 23:42 Kiran Kumar K
  0 siblings, 0 replies; 7+ messages in thread
From: Kiran Kumar K @ 2000-09-13 23:42 UTC (permalink / raw)
  To: gcc-help

Hello,

I am a newbie into this compiler world.
I would like to develop a cross compiler for zilog 180 processor on
winnt,
Where is the startup info i could find to start with gcc as the front
end.
I guess I need to write the machine description of z180 processor
in RTL.

Best Regards,
Kiran




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: porting gcc
  2000-09-13  2:59 brahmaiah vallabhaneni
@ 2000-09-13 19:38 ` Alexandre Oliva
  0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2000-09-13 19:38 UTC (permalink / raw)
  To: brahmaiah vallabhaneni; +Cc: help-gcc

On Sep 13, 2000, brahmaiah vallabhaneni <vbrahmaiah@yahoo.com> wrote:

> Is there any stadard method to change my md file ???

Using the text editor of your preference? :-)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 7+ messages in thread

* porting gcc
@ 2000-09-13  2:59 brahmaiah vallabhaneni
  2000-09-13 19:38 ` Alexandre Oliva
  0 siblings, 1 reply; 7+ messages in thread
From: brahmaiah vallabhaneni @ 2000-09-13  2:59 UTC (permalink / raw)
  To: help-gcc

Hi all,
  I am porting gcc to a new processor.
Is there any stadard method to change my
md file ???


Please reply.


Thanks and regards

V.Brahmaiah

 

__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* porting gcc
@ 2000-09-13  2:56 brahmaiah vallabhaneni
  0 siblings, 0 replies; 7+ messages in thread
From: brahmaiah vallabhaneni @ 2000-09-13  2:56 UTC (permalink / raw)
  To: help-gcc

Hi ,
 I am working to port gcc for a new processor.
I have a few doubts, If some body could clarify them I
am really thankful to them.

  See in my processor integer is 3 bytes.
Can I use PSI mode in standard names im
 my md file ??

  What are the additional issues I have
to concerned about??

Please reply.

Thanks and regards

V.Brahmaiah






__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-06-20 14:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-13 18:48 Porting gcc Piotr Pałka
2006-06-20 14:20 ` kernel coder
  -- strict thread matches above, loose matches on Subject: below --
2003-08-13 11:26 Porting GCC Petar Penchev
2000-09-13 23:42 porting gcc Kiran Kumar K
2000-09-13  2:59 brahmaiah vallabhaneni
2000-09-13 19:38 ` Alexandre Oliva
2000-09-13  2:56 brahmaiah vallabhaneni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).