ILLEGAL_BP in CAN Bootloader MC9S12P64

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

ILLEGAL_BP in CAN Bootloader MC9S12P64

1,301 Views
nada_amani123
Contributor I

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 :

pastedImage_1.png

The .Prm file :

pastedImage_2.png

The issue :

pastedImage_3.png

NB : I didn't used any interrupt and disabled the watchdog 

Any help would be great, thanks in advance !

Labels (1)
4 Replies

1,088 Views
carleslloret
Contributor II

Hi Nada

I amb also very interested in your CAN bootloader development. Where do you learn to program a CAN bootloader?  

0 Kudos
Reply

1,088 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply

1,088 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi Nada,

Could you please share your Srecord?

Thank you.

Best Regards,

Diana

0 Kudos
Reply

1,088 Views
kef2
Senior Contributor V

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

0 Kudos
Reply