From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 757 invoked by alias); 17 Nov 2010 14:16:45 -0000 Received: (qmail 748 invoked by uid 22791); 17 Nov 2010 14:16:45 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from claranetfr-outbound-smtp00.mail.eu.clara.net (HELO claranetfr-outbound-smtp00.mail.eu.clara.net) (195.8.64.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Nov 2010 14:16:39 +0000 Received: from 140.140.74-86.rev.gaoland.net ([86.74.140.140]:50260 helo=[192.168.0.100]) by relay00.mail.eu.clara.net (smtp-vh.fr.clara.net [213.253.3.40]:1725) with esmtpa (authdaemon_plain:jean-marc.saffroy@joguin.com) id 1PIioO-00017t-09 (return-path ); Wed, 17 Nov 2010 14:16:36 +0000 Message-ID: <4CE3E3C3.6040302@joguin.com> Date: Wed, 17 Nov 2010 14:16:00 -0000 From: Jean-Marc Saffroy User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10 MIME-Version: 1.0 To: Dalibor Kovacevic CC: cgen@sourceware.org Subject: Re: porting to a new architecture References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2010-q4/txt/msg00007.txt.bz2 Hi Dalibor, > My client wants me to port GDB to his CPU but he does not have any > kind of simulator yet on which I could try out my port. No simulator? This sounds really surprising! > Reading about > the quickest way to generate a simulator and came across CGEN. It seems a good idea, CGEN can save you a lot of time in writing a simulator, though it is still a fair bit of work, possibly much more than a simple gdb port. > So I`m wondering can I do that but not in the order like on > http://sourceware.org/cgen/docs-1.0/cgen_5.html Indeed, if all you want is a simulator, then you don't need to follow all the steps described in the CGEN documentation. What you really want is a working simulator, so the steps needed are: - modify configure etc. stuff for your arch - .cpu and .opc files to feed to CEN; you should look at other ports for ideas, but it seems you will need to start from scratch - simple modifications for opcodes support; CGEN generates almost everything here - simulator code: . some boiler plate code to start the simulator; most can be stolen from other simple ports . mloop.in: a template for the main loop, which can very generic code, with little (if any) knowledge of the simulated arch; again, there are good examples in other ports . support code for specific aspects of your target: traps, interruptions, and the like; this is of course much more specific to your target > for that I need a .cpu > file which I don`t have and before I start making one just wanted to > check is there a way to get that file out of already ported gcc or > binutils. I have searched them for all .cpu files but my architecture > is not there. The binutils CVS repo on sourceware.org has .cpu files under two directories: cpu/ and cgen/cpu/. Though it looks like the latter contains some unfinished stuff. There is no .cpu file in gcc; CGEN's RTL and gcc's RTL are meant to look familiar, but they really are different things. Maybe you could use an existing gcc port for hints, if the CPU documentation isn't clear enough, but then you have other serious problems! Cheers, Jean-Marc