Hello,
I am currently working on bootloader developpement with MSCAN module using target mc9s12p64.
When I try to program the flash, ILLEGAL_BP occurs
Here's the PFlash_Program () function I used :
The .Prm file :
The issue :
NB : I didn't used any interrupt and disabled the watchdog
Any help would be great, thanks in advance !
Hi Nada
I amb also very interested in your CAN bootloader development. Where do you learn to program a CAN bootloader?
Hello Carles,
I would like to recommend you to start with the link below:
Useful documents for building own CAN bootloader
I hope it helps.
Best Regards,
Diana
Hi Nada,
Could you please share your Srecord?
Thank you.
Best Regards,
Diana
Hi Nada
RELOCATE_TO in your PRM relocates address of your functions in RAM_CODE from flash to RAM, but nothing copies code from flash to RAM. You need to memcpy((void*)0x3D00, (void*)0xFD00, 0x200) or something.
There's simpler way to have functions in RAM without RELOCATE_TO and memcpy:
1) in project wizard choose ansi startup instead of minimal. If you had minimal, you need to remove from compiler settings -D__ONLY_INIT_SP
2) PRM modification, just one additional line for RAM_CODE
PLACEMENT
..
RAM_CODE INTO RAM;
..
END
3) In you code for any function to be placed in RAM:
#pragma CODE_SEG RAM_CODE
void your_function(void)
{
}
#pragma CODE_SEG DEFAULT
This doesn't do any linker relocation, it directly compiles to RAM. Since RAM is READ_WRITE, linker will treat you code as initialized variables, fill copydown structure and startup routine will initialize RAM with proper code for your routines in RAM_CODE placement.
Edward