From owner-freebsd-small Sun Feb 25 23:58:16 2001 Delivered-To: freebsd-small@freebsd.org Received: from leka.almamedia.fi (leka.yhteys.mtv3.fi [62.236.224.129]) by hub.freebsd.org (Postfix) with SMTP id CDA7E37B401 for ; Sun, 25 Feb 2001 23:58:11 -0800 (PST) (envelope-from jml@cubical.fi) Received: (qmail 17501 invoked from network); 26 Feb 2001 07:58:09 -0000 Received: from dyn-e-025.yhteys.mtv3.fi (HELO snafu.intra.net) (@62.236.229.25) by leka.yhteys.mtv3.fi with SMTP; 26 Feb 2001 07:58:09 -0000 Received: from cubical.fi (dhcp-32.intra.net [192.168.2.32]) by snafu.intra.net (8.11.1/8.11.1) with ESMTP id f1Q7w1199706; Mon, 26 Feb 2001 09:58:05 +0200 (EET) (envelope-from jml@cubical.fi) Message-ID: <3A9A0CCE.B6748C@cubical.fi> Date: Mon, 26 Feb 2001 09:59:10 +0200 From: Juha-Matti Liukkonen Organization: Cubical Solutions Ltd X-Mailer: Mozilla 4.74 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Don Wilde Cc: freebsd-small@FreeBSD.ORG Subject: Re: asm interface References: <3A999FAA.D1675624@Silver-Lynx.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-small@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, your program needs to access physical memory. That cannot be done from a user level program. You need to write a device driver for your flash chip -- it will run in kernel mode and have access to physical memory and I/O ports. Check /usr/share/examples/driver, and assuming you have kernel sources installed, /usr/src/dev directory for lots of sample code. Also I think that the nandread/nandwrite routines would be easier to write in C. Most of the hassle they do is to build pointers out of 16-bit segment/offset pairs, and you don't need (want!) this when running 32-bit. Once you have the address of the Flash memory, the actual operation is to first write the opcodes to the control and address ports (16-bit memory writes to fixed offsets in the memory), followed by data read/write to the data port (which is another 16-bit memory location). I can give you some more pointers if needed, just email me directly. (BTW, we use ATA Flashes, as they are trivial to set up as normal disks -- of course assuming you have the physical space for a cable-conneted device.) - Juha Don Wilde wrote: > > I'm trying to link some asm routines I've converted from DOS/intel > format. Machine is running 4.2-S, compiler gcc.2.95, and the routines > are for accessing an MCSI PromDisk 32M flash. My problem is in my lack > of knowledge of gnu tools, I'm sure. > > I have it successfully linking into a binary, and when I run it in gdb, > I can see the disassembled c code calling the location, and I see the > proper assembled code at that called location, but I get a SIGBUS > immediately upon stepping to that call. > > I've HTMLified my code on http://www.silver-lynx.com/flash/flash.html > and derivatives. I know it's probably a really simple oh-sh*t, but can > anybody tell me what's wrong? > > Thanks! > -- > Don Wilde Don@Silver-Lynx.com > Silver Lynx Embedded Microsystems Architects > 2218 Southern Bl. Ste. 12 Rio Rancho, NM 87124 > 505-891-4175 FAX 891-4185 > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-small" in the body of the message -- Juha-Matti Liukkonen, Cubical Solutions Ltd Phone: +358(0)405280142 Email: jml@cubical.fi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-small" in the body of the message