Hello,
I’m working on porting some boot-loader code from the QE32 microcontroller to the QE64 microcontroller. It looks like the FLASH memory map is a little more complex (with some paging needed). I’m struggling a bit with the “Project.prm” file and the actual code to copy over to FLASH. Can you help me how to write to the FLASH in a boot-loader scenario using the “doonstack.asm” file? I’m wondering if I’m going down the right path by setting the PAGE (0 – 3) and the writing to address 0x8000 – 0xBFFF? I’ve copied in a code snippet below from my boot-loader. Is there a specific example for the QE64 chip?
// only pages one and two
for(index=1; index<3; index++)
{
PPAGE_XA_14 = index;
//erase old program here
ProgramAddress = 0x8000;
while(ProgramAddress < 0xBFFF)
{
//reset watchdog for each erase cycle
__RESET_WATCHDOG();
FlashErase((unsigned char*)ProgramAddress);
ProgramAddress += 512;
}
}
// only pages one and two
for(index=1; index<3; index++)
{
PPAGE_XA_14 = index;
ProgramAddress = 0x8000;
while(ProgramAddress < 0xBFFF)
{
//reset watchdog for each erase cycle
__RESET_WATCHDOG();
FlashProg((unsigned char*)ProgramAddress, value);
ProgramAddress++;
}
value++;
}
Thanks
Madhu
Hi Madhu,
We have a Serial Bootloader AN2295 example for the S08QE128. This has Assembly commands to erase and program the flash, using the PPAGE register for the paged flash. This code uses our older Classic CodeWarrior, and the project is located at \an2295sw\src\S08QE128\hc08sprg-s08qe128.mcp, and the bootloader source file is at \an2295sw\src\S08QE128\sources\slfprg-s08qe128.asm. The Appnote AN2295 below has more details on using this bootloader. The S08QE64 device has the same memory map for the flash as the QE128, except PPAGE is limited to 0-3 since it has half the flash.
So that can be used as an example for loading the PPAGE register before issuing the flash command to erase or program paged flash. Otherwise, yes the understanding is correct. As documented in the Reference Manual, the address range 0x8000 - 0xBFFF is the Paging Window for accessing Paged Flash, and the PPAGE register specifies which page is being accessed. Thanks
Application Note Document Number: AN2295 ... Quick guide: How to prepare the user Kinetis application forAN2295 bootloader ... |
Associated File: AN2295SW |