Have a non volatile memory with the HCS08GT60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Have a non volatile memory with the HCS08GT60

2,181 Views
Vianney
Contributor I
Good Morning everybody,

I am a beginner in programmation with the HCS08 family of micro-controller, I am working with the SMAC library of freescale and I need to set up a Non Volatile Memory.
Is that possibile do to such a thing ?
Thanks.

Vianney
Labels (1)
0 Kudos
4 Replies

487 Views
J2MEJediMaster
Specialist I
Try looking at application Note AN2295 and its companion file, AN2295SW. It provides the code for a serial bootloader that writes to Flash. It might not do exactly what you want, but it should be a good starting point for your project.
 
---Tom
0 Kudos

487 Views
shiloh
Contributor I
What a lot of us want is some C code that we can use in our C applications to write a few variables to the Flash in the HCS08GT60/GB60.  However, when we ask for help with this, I frequently get references to assembly code such as that from AN2295.  And many of the examples in C that have been posted to this forum simply do not work.  Does anybody have any working C code for writing to the flash on a GT60/GB60?
0 Kudos

487 Views
Alban
Senior Contributor II
Hello,
 
All these products have available standard Flash drivers.
Wanting to program in C does not mean you need Flash programming routines in C.
IDEs like CodeWarrior handle mixing both ASM, C and even C++.
 
Also, even if you didn't want to see a line of ASM for these Flash drivers, they are available as S-Record.
 
Here is a direct example I took from the Driver Zip file :
 
Code:
    ////////////////////////////////////////////////////////////////////////////    // Mass Erase Flash    ////////////////////////////////////////////////////////////////////////////    dest = FLASH_START1;    number = 1; // For mass erase, number should be as 1    returnCode = FlashErase (CMD_MASS_ERASE, dest, number, HighVoltage, CallBack);    if (SGF_OK != returnCode)        goto EXIT;    ////////////////////////////////////////////////////////////////////////////    // Verify Flash after Erasing    ////////////////////////////////////////////////////////////////////////////    size = FLASH_END1 - FLASH_START1 + 1;    source = (UINT16)buffer;    returnCode = DataVerify (TRUE, dest, size, source, &failAddress, CallBack);    if (SGF_OK != returnCode)        goto EXIT;    // Verify the second part    dest = FLASH_START2;    size = FLASH_END2 - FLASH_START2 + 1;    returnCode = DataVerify (TRUE, dest, size, source, &failAddress, CallBack);    if (SGF_OK != returnCode)        goto EXIT;

 
That code demonstrate how to call the routines in C.
 
The Flash driver package is always available from the product page.
For the S08, here is a link:
 
HCS08SGFNVMSSD (1.44MB)
Standard Software Driver for HCS08 SGF Flash
Program/erase software driver for SGF NVM (flash and EEPROM) in HCS08.  
 
If this package does not work, please report so someone in FSL fixes it.
 
Cheers,
Alban.
0 Kudos

487 Views
admin
Specialist II
Hello,

I'm trying to use one page (512 bytes) of the HCS0GT16A Flash as an EEPROM memory.

In order to do that, and I read the following document and studied the source code:

"Standard Software Driver for HCS08 SGF Flash Program/erase software driver
 for SGF NVM (flash and EEPROM) in HCS08"

 I noticed the following points:

1. The functions that write the flash memory are executed in RAM.
2. The functions that write the flash memory are copied from FLASH to RAM in the startup code.

The problem is that it's not easy to modify the startup code of my application in order to copy those functions in RAM.

I'm now trying to write an example where those functions are copied and executed in RAM, using:

 1. The malloc() function.
 2. The memcpy() function.
 3. Five function pointers.

If I succeed, I'll post the code.

Enrico




0 Kudos