a bootloader for freescale 12xep100 microcontroller

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

a bootloader for freescale 12xep100 microcontroller

1,266 Views
daxuefenfei
Contributor II

I m new in writing a bootloader for freescale 12xep100 microcontroller.I  get from the newer application note AN4258 Serial Bootloader for S12(X) Microcontrollers Based on 180 nm Technology.I hace tried the demo application,it was successful.My own program can not work when i try it.I do not know how to modify it .please help me,thank you!

Labels (1)
0 Kudos
6 Replies

708 Views
RadekS
NXP Employee
NXP Employee

There is chapter for AN4258:

6 How to write a user application

You must ensure that the user application does not interfere with bootloader area 0xF000-0xFFFF.

  1. Create a new project in CodeWarrior Development Studio for Freescale HCS12(X) Microcontrollers.
  2. Open the .prm file
  3. Trim the segment ROM_C000 from the origianl size 0xC000–0xFEFF to 0xC000–0xEFDF. This is because the area 0xF000–0xFFFF is occupied by the bootloader and the area at address 0xEFE0–0xEFFF will be used for the user application reset vector.

If interrupts are used:

  1. Trim the segment ROM_4000 from the original size 0x4000–0x7FFF to 0x4000–0x7F0F. The area 0x7F10–0x7FFF will be used for the relocated interrupt vector table.
  2. Create a vector table as shown in the attached demo applications and set the IVBR register accordingly. The IVBR sets the interrupt vector table base address and in this case must be set to 0x7F.

Could you please confirm that you create your application according this procedure?

In default prm file is defined reset vector VECTOR 0 _Startup.

This will generate record in output s19 file like S105FFFEC0003D.

Since address 0xFFFE is already occupied by bootloader reset vector, please erase this line from your application s19 file.

Note: S105FFFEC0003D decoding:

S1 is type of record (16bit address),

05 is size of record in bytes,

FFFE is address of reset vector,

C000 is content of reset vector (start address of your applicaction).

3D is CRC checksum.

When we use ROM_4000 segment (0x4000–0x7FFF) in user application we have to disabling the optimization that changes JSR's into BSR's = the project settings will include the following compiler option: -Onb=b (Go to standard setings (Alt+F7), compiler for HC12, add command line argument -Onb=b (if missing)).

708 Views
daxuefenfei
Contributor II

thank you ! I have createdmyapplication according the procedure,at the same time, my prm file  defined reset vector VECTOR 0 _Startup too. The s19 file of the demo application also has record like S105FFFEC0003D,Even if  i erase this line from my application s19 file,it does not work.Is there other place also needing to configure?

0 Kudos

708 Views
RadekS
NXP Employee
NXP Employee

Did you convert your s19 file by SRecCvt tool (according chapter 7)?

708 Views
daxuefenfei
Contributor II

I have solved the questions,thank you!

0 Kudos

708 Views
daxuefenfei
Contributor II

I tried unsecuring using Unsecure12.  I changed the OSC Frequency field to 16000000, since I have a 16MHz crystal on my board. Then, I click the "Unsecure" button, and I get the following response.

Searching for Interface Speed .......

(after several seconds)

ERROR - Communicating with target

Appropriate interface speed not found.

0 Kudos

708 Views
daxuefenfei
Contributor II

yes,I do.now i have a new problem,i merge the user application and bootloader together as "8 How to merge the user application and bootloader ",I can't download the new program via BDM device.I confirm that I Add the  command ' FLASH NOUNSECURE' into the file 'P&E_Multilink_CyclonePro_Preload.cmd',Why such a situation would happen,What should I do now?

0 Kudos