9S12DT512 bootloader AN3275 questions

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

9S12DT512 bootloader AN3275 questions

2,127 Views
Lewing
Contributor I
Hello,
 
I have to programm a bootloader which should send a defined String through the serial interface and wait a certain time for a character to start the bootloader.
 
I want to take the AN3275 as a basis, but got several problems.
First i don't know how to config my user programm to start after the bootloader.
besides there are other Parameters in S12Derivative then in MC9S12XDT512 so i can't make use of the Flash routines.
 
Does someone have some hints for me? I am new to this controller and to the CodeWarrior.
 
thx
Matthias
 
Labels (1)
0 Kudos
Reply
3 Replies

674 Views
ang
Contributor I
Hi
I think you can do it like this.
 
1) Press a key and power on the unit shall go to bootloader software . For that, you can wait some msec for the particular character in the startup.
2) Normal powerON shall go to the application program. For this, after the wait time is expired without receiving the particular character, you can jump to application start address.
 
Or if you don't want to wait in the startup, you can configure a portpin as a switch to select bootloader software and application software.
 
Regrards,
Ang.
 
0 Kudos
Reply

674 Views
DI
Contributor I

Hi!!

I try to use AN3275 for building a serial bootloader for MCU ->MC9S12GC64.

The application note is ok, and i can download firmware inside MCU by rs232!

If i set the PP0 pin user program start and if PP0 isn't set bootloader program start!

 

Now,

i try to change AN3275 code for jump to user code if i don't get serial character after approximately 3s.

Istruction for jump to user program is (after PP0 was checked..):

 

asm JMP    [0xFFFE-BootBlkSize,pcr] /* Run user Program */

where:

BootBlkSize=0x1000; and:

0xFFFE-BootBlkSize=0xEFFE

 

Application note guide say:

"All the interrupt vectors except the
reset vector will be written in their normal locations. The reset vector will be written into address 0xEFFE
because the bootloader must own the reset vector to be able to determine if the user’s code or the
bootloader code is the one to be called."

 

But if i try to do jump:

asm JMP    [0xFFFE-BootBlkSize,pcr] /* Run user Program */

 

after the istruction:
   /* initialize the stack pointer */
   INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro definition in hidef.h */

 

the jump isn't ok and the user program don't start!!

What do you think about this?

Thanks!

 

 

 

 

 

 

0 Kudos
Reply

674 Views
JimDon
Senior Contributor III
The bootloader notes what you attempted to write to the reset vector and saves it elsewhere, as the the only vectors it owns is the reset vector.

When the switch is set, then it will go to your code.

If the flashing is that different, then you may have to tweak the flash routines, but you have the source code.

0 Kudos
Reply