Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Feb 2001 09:59:10 +0200
From:      Juha-Matti Liukkonen <jml@cubical.fi>
To:        Don Wilde <Don@Silver-Lynx.com>
Cc:        freebsd-small@FreeBSD.ORG
Subject:   Re: asm interface
Message-ID:  <3A9A0CCE.B6748C@cubical.fi>
References:  <3A999FAA.D1675624@Silver-Lynx.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A9A0CCE.B6748C>