Dana Echtner <dana@ece.concordia.ca> wrote:
wendy wrote:
I’ve discussed this with Dana via email. If you can’t reload with RTP, one
way to restore the flash and eliminate any hardware problems is to use the
FlashFX utilities for QNX or DOS and reformat the flash. When she tried
this, she said it formatted fine. Take care that the total image you
create isn’t too large to fit onto the flash (ie. boot image < 512K, total
image < 8M).
Well, it sort of worked.
Under DOS it formats fine, looks file, works fine, but as soon as I boot
into QNX and use flashctl over qnet to erase the flash I get the “erase
protect error” again. I’ve tried
FXFMT 80 /p64k
and
FXRECLM and both worked fine, but it doesn’t fix my problem.
(the problem being that doing an erase with flashctl fails with “erase
protect error” and a cp of an image freezes at 70-some percent. (I assume
at the same place as the erase protect error))
I’m still futzing with it but not really getting anywhere.
Dana
–
Dana Echtner \ Real-Time Systems Administrator
dana@ece.concordia.ca > / ECE, Concordia University, Montreal, Canada
What type of flash is on the Elan 104 board? If it’s Intel, I’ve seen other
situations where Intel flash somehow gets certain sectors locked, such that
they can’t be erased.
If it’s Intel, the following program will unlock the flash. It assumes
a single 16 bit, 8MB flash part, mapped to address 0xff000000.
You’ll need to change your defines accordingly.
Also, if your flash is interleaved, or a different bus width, you’ll need to
change the pointer size, etc.
#include <stdlib.h>
#include <stdio.h>
#include <sys/neutrino.h>
#include <sys/mman.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <x86/inout.h>
#define REGION1 0xff000000
#define FLASHSIZE 0x800000
// function prototypes
void* Map_Physical(unsigned long, unsigned long);
void unlock_flash(void*);
int main(void)
{
void *addr;
ThreadCtl(_NTO_TCTL_IO, 0);
addr=Map_Physical(REGION1,FLASHSIZE);
unlock_flash(addr);
return(0);
}
void* Map_Physical(unsigned long region, unsigned long size)
{
int fd;
char *addr;
// Open physical memory
fd = shm_open(“Physical”, O_RDWR | O_CREAT, 0777);
if (fd == -1)
{
fprintf(stderr, “Open failed:%s\n”, strerror(errno));
exit(1);
}
// Map specified region
addr = mmap_device_memory(0, (size_t)size, PROT_READ | PROT_WRITE | PROT_NOCACHE,
MAP_SHARED, region);
if (addr == (void *) -1)
{
fprintf(stderr, “mmap failed : %s\n”,strerror(errno));
exit(1);
}
return(addr);
}
void unlock_flash(void *addr)
{
unsigned short *s = (unsigned short *)addr;
s[0] = 0x0060; // send unlock_device command to flash
s[0] = 0x00d0;
}
Dave Green (dgreen@qnx.com)
QNX Software Systems Ltd.
http://www.qnx.com