Writing to Flash

Questions about the BASICtools and MakeItC
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Writing to Flash

Post by YahooArchive »

I am using

DIM b(1024)

lots of stuff

WRITE ($5000,b,1024)

to copy data to Flash on an Armite.

The WRITE updates the Flash correctly for the 1st 255 values, then does not
change the rest of the previously stored values.

I have tried to duplicate the problem with a simple program and cannot.
Do you have any ideas on what might be the problem?



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

> WRITE ($5000,b,1024)
>

that 1024 is a byte count, to write 1024 words use 4096

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

In basic there are the FREAD and WRITE functions. Is there an equivalent in C
for those functions?

Thanks,
Marc

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

> In basic there are the FREAD and WRITE functions. Is there an equivalent in C
for those functions?

check the cor_wrflash.h file

for details on the Flash organization, check the User manual from NXP.

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

There is a WriteFlash function in there, but I don't see a read.

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

You can read anywhere with pointers.

There is also a memcpy() in mem.h / mem.o

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

Nice to see another Armite in an automotive application. I use one for my boost
controller and another for my transmission controller.

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

Feeling dumb... but what would be the line of code to read with pointers?

Thanks,
Marc

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

> Feeling dumb... but what would be the line of code to read with pointers?

void * memcpy (void * dst0,void * src0,unsigned int len0){
char *dst = (char *) dst0;
char *src = (char *) src0;

void * save = dst0;

while (len0--)
{
*dst++ = *src++;
}

return save;
}

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Writing to Flash

Post by YahooArchive »

Does anyone have some example code on how to save info and reteive info from the
flash.

Post Reply