ylin,
You are correct that the likely culprit is the RAM cookie.
For a discussion about why this cookie is used, see
Figure 3.1 BoLo/LoLo Interaction and Boot Sequence in the LogicLoader user's manual.
The location of the cookie varies from release to release of the LogicLoader because it is assigned at link-time. Therefore, to erase it, you should be able to just erase the entire BoLo run-time execution section of RAM.
Using PN_70000085_Rev_C.pdf I can see that BoLo executes from 0xC0000000 to 0xC00C0000. So, to blow this entire thing away, I would do something like this:
my_app_main.c
main()
{
/* Erase Logic's BoLo bootloader. */
unsigned int *ptr;
ptr = (unsigned int *)0xC0000000;
while ( ptr < 0xC00C0000 )
{
*ptr = 0;
ptr++;
}
/* Now I can do whatever else my application does. */
}
Now, erasing the
entire BoLo space is a bit overkill, as the cookie will exist somewhere up in BoLo's heap space. So, you could play around and optimize that loop (say only erasing the top 1K) if you wanted to. However, you may want to reclaim that RAM space for your own application. If that is the case, zero-ing the entire area out is probably for the best anyway.
Regards,
--mikee