Flash Update Routine

I am working with a Sandpoint development system with a PPC8245 chip. I know
that when the system goes into reset the reset vector is 0xFFF00100. The
flash chip (AMD AM29F040) is mapped at 0xFFF00000. What I would like to do
is write a routine that would allow me to reprogram the flash chip in my
circuit. That way I don’t have to remove it, put it in a burner and then put
it back into the circuit every time I have to reprogram.

Being that I am rather new to embedded development I am having difficulties
achieving this. I know the command sequences that are needed to talk to the
flash chip I just can’t seem to address the chip. I think the real question
is how do you address the chip?

I have tried something to the effect of:

volatile unsigned int *PCIFlash;
volatile unsigned int *PCIFlash_001;
volatile unsigned int *PCIFlash_2AA;
volatile unsigned int *PCIFlash_555;
unsigned char manu;

//the following addresses are needed for communications with the flash chip:
PCIFlash = (unsigned char *) 0xFFF00000;
PCIFlash_001 = PCIFlash + 0x001;
PCIFlash_2AA = PCIFlash + 0x2AA;
PCIFlash_555 = PCIFlash + 0x555;

//get the manufacturers id from the chip
//set the following addresses = to:
*PCIFlash_555 = 0xAA;
*PCIFlash_2AA = 0x55;
*PCIFlash_555 = 0x90;
//read the id
manu = *PCIFlash;

However on the *PCIFlash_555 command my program crashes hard with a SIGSEGV.
I seem to be stuck here, not know where to go on the next step.

It has also been suggested to me that the OS once loaded may unmap the flash
device from memory. Is this true? How can I find out?

If anyone has any ideas to kick me in the right direction I would be very
grateful!

Thanks in advance,
Mike

“Mike Toreno” <no.spam@address.com> wrote in message
news:a7fod1$91u$1@nntp.qnx.com

I am working with a Sandpoint development system with a PPC8245 chip. I
know
that when the system goes into reset the reset vector is 0xFFF00100. The
flash chip (AMD AM29F040) is mapped at 0xFFF00000. What I would like to do
is write a routine that would allow me to reprogram the flash chip in my
circuit. That way I don’t have to remove it, put it in a burner and then
put
it back into the circuit every time I have to reprogram.

Being that I am rather new to embedded development I am having
difficulties
achieving this. I know the command sequences that are needed to talk to
the
flash chip I just can’t seem to address the chip. I think the real
question
is how do you address the chip?

I have tried something to the effect of:

volatile unsigned int *PCIFlash;
volatile unsigned int *PCIFlash_001;
volatile unsigned int *PCIFlash_2AA;
volatile unsigned int *PCIFlash_555;
unsigned char manu;

//the following addresses are needed for communications with the flash
chip:
PCIFlash = (unsigned char *) 0xFFF00000;
PCIFlash_001 = PCIFlash + 0x001;
PCIFlash_2AA = PCIFlash + 0x2AA;
PCIFlash_555 = PCIFlash + 0x555;

Can’t do that, your program is running in a virtual address mode. To access

physical memory have a look at mmap_device_memory().

//get the manufacturers id from the chip
//set the following addresses = to:
*PCIFlash_555 = 0xAA;
*PCIFlash_2AA = 0x55;
*PCIFlash_555 = 0x90;
//read the id
manu = *PCIFlash;

However on the *PCIFlash_555 command my program crashes hard with a
SIGSEGV.

Normal, the program is accessing memory not map into the program memory
space.

I seem to be stuck here, not know where to go on the next step.

It has also been suggested to me that the OS once loaded may unmap the
flash
device from memory. Is this true? How can I find out?

It doesn’t unmap it from memory, it doesn’t map it into your program memory
space :wink:

That’s why QNX is robust. A program can’t write into memory it doesn’t
“own”.

If anyone has any ideas to kick me in the right direction I would be very
grateful!

Thanks in advance,
Mike
\

Mike Toreno <no.spam@address.com> wrote:

I am working with a Sandpoint development system with a PPC8245 chip. I know
that when the system goes into reset the reset vector is 0xFFF00100. The
flash chip (AMD AM29F040) is mapped at 0xFFF00000. What I would like to do
is write a routine that would allow me to reprogram the flash chip in my
circuit. That way I don’t have to remove it, put it in a burner and then put
it back into the circuit every time I have to reprogram.

You wish to do this once the OS is up and running, correct? The easiest way
is to use a flash filesystem driver, which will allow you to write your new
IPL and OS image. I don’t know if there’s a specific flash driver for the
sandpoint, but devf-generic should work fine; you just need to pass the
physical address and size to the driver:

devf-generic -s0xfff00000,0x80000

you should now see /dev/fs0, which is the raw device, and /dev/fs0p0, which
is a partition which covers the entire raw device. If you happened to have
a flash filesystem (unlikely on a 512k device), you would also see /dev/fs0p1.

The online documentation describes the flash filesystem in greater detail:

http://support.qnx.com/support/docs/embedding_sdk_en/building/flashfsys.html

You didn’t indicate how you are booting the board, but presuming you are booting
serially, by sending an OS image via the IPL or DINK32, you’ll need to include the
following in the boot image, unless you have access to them over a network
connection;

devf-generic
flashctl
cp
the image you wish to place in the flash

So:

  • start devf-generic

-erase the flash:
flashctl -p/dev/fs0 -e

-copy the new image to flash (from /proc/boot, for example)

cp -V /proc/boot/my_512k_image /dev/fs0

-re-boot the board

Because this is the boot ROM, there may be a mechanism in place to write-protect
the flash by default, in which case devf-generic will still work, but you won’t
be able to erase the flash until you have disabled the write protect (by hitting
a particular register, etc.).


Being that I am rather new to embedded development I am having difficulties
achieving this. I know the command sequences that are needed to talk to the
flash chip I just can’t seem to address the chip. I think the real question
is how do you address the chip?

I have tried something to the effect of:

volatile unsigned int *PCIFlash;
volatile unsigned int *PCIFlash_001;
volatile unsigned int *PCIFlash_2AA;
volatile unsigned int *PCIFlash_555;
unsigned char manu;

//the following addresses are needed for communications with the flash chip:
PCIFlash = (unsigned char *) 0xFFF00000;
PCIFlash_001 = PCIFlash + 0x001;
PCIFlash_2AA = PCIFlash + 0x2AA;
PCIFlash_555 = PCIFlash + 0x555;

//get the manufacturers id from the chip
//set the following addresses = to:
*PCIFlash_555 = 0xAA;
*PCIFlash_2AA = 0x55;
*PCIFlash_555 = 0x90;
//read the id
manu = *PCIFlash;

However on the *PCIFlash_555 command my program crashes hard with a SIGSEGV.
I seem to be stuck here, not know where to go on the next step.

It has also been suggested to me that the OS once loaded may unmap the flash
device from memory. Is this true? How can I find out?

If anyone has any ideas to kick me in the right direction I would be very
grateful!

Thanks in advance,
Mike


Dave Green (dgreen@qnx.com)

QNX Software Systems Ltd.
http://www.qnx.com

Thanks guys! Just got around from being side tracked… Unfortunately the
devf-generic returns:
#devf-generic -s0xfff00000,0x80000
#devf: Unable to properly identify any flash devices
Process 4184 (devf-generic) exited status=1.
(The flash chip is definately there, 0xfff0000)

However mmap_device_memory() works and can read the flash chip (yeah!). But
writing to it is a different story, no luck :frowning:. It is most likely operator
error…

Thanks again!
Mike

“Mike Toreno” <no.spam@address.com> wrote in message
news:a7fod1$91u$1@nntp.qnx.com

I am working with a Sandpoint development system with a PPC8245 chip. I
know
that when the system goes into reset the reset vector is 0xFFF00100. The
flash chip (AMD AM29F040) is mapped at 0xFFF00000. What I would like to do
is write a routine that would allow me to reprogram the flash chip in my
circuit. That way I don’t have to remove it, put it in a burner and then
put
it back into the circuit every time I have to reprogram.

Being that I am rather new to embedded development I am having
difficulties
achieving this. I know the command sequences that are needed to talk to
the
flash chip I just can’t seem to address the chip. I think the real
question
is how do you address the chip?

I have tried something to the effect of:

volatile unsigned int *PCIFlash;
volatile unsigned int *PCIFlash_001;
volatile unsigned int *PCIFlash_2AA;
volatile unsigned int *PCIFlash_555;
unsigned char manu;

//the following addresses are needed for communications with the flash
chip:
PCIFlash = (unsigned char *) 0xFFF00000;
PCIFlash_001 = PCIFlash + 0x001;
PCIFlash_2AA = PCIFlash + 0x2AA;
PCIFlash_555 = PCIFlash + 0x555;

//get the manufacturers id from the chip
//set the following addresses = to:
*PCIFlash_555 = 0xAA;
*PCIFlash_2AA = 0x55;
*PCIFlash_555 = 0x90;
//read the id
manu = *PCIFlash;

However on the *PCIFlash_555 command my program crashes hard with a
SIGSEGV.
I seem to be stuck here, not know where to go on the next step.

It has also been suggested to me that the OS once loaded may unmap the
flash
device from memory. Is this true? How can I find out?

If anyone has any ideas to kick me in the right direction I would be very
grateful!

Thanks in advance,
Mike
\