Kirk Humphries

bootloader for 9s12c128

Discussion created by Kirk Humphries Employee on Jan 31, 2006

This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.

 

Posted: Wed Jul 13, 2005  11:38 am

 

I adadpted the bootloader described in AN2153.

I didn't copy it into the RAM but put it into ROM at Adress C000 to D000.

Then I wanted to write into the PAGED Area of the RAM (e.g. 388000)

 

If I debug the Code with my BDM Debugger step by step everything works fine, but if I let it run, the Program Counter crashes after setting the CBEIF Flag.

 

Is it necessary to copy the bootloader into the RAM?

 


 

Posted: Wed Jul 13, 2005  1:57 pm

 

I don't know that bootloader, but I think your problem is in Flash programming theory.

 

The problem is that you can't write to the same block that you are writing. My first thought was that there is two 64K blocks and you were reading from Block 0 while writing Block 1, but that was in such as DG128. The manual for C128 says it is only 1 block of 128K, so you will have to be in RAM for this one.

 


 

Posted: Wed Jul 13, 2005  3:36 pm

 

Depends what you are doing with it. The Flash writing routine at least has to be copied into RAM.

 

On another note I had a similar problem with step by step vs free run mode. More often than not the cause was poor assembly level programming such as x and y registers not saved onto the stack before being modifed within a function.

 


 

Posted: Thu Jul 14, 2005  6:48 am

 

> I adapted the bootloader described in AN2153.

> I didn't copy it into the RAM but put it into ROM at Adress C000 to D000.

> Then I wanted to write into the PAGED Area of the RAM (e.g. 388000)

 

As David Wild and Jefferson Smith already stated, you can't execute a bootloader from the same Flash block being written.

 

> If I debug the Code with my BDM Debugger step by step everything works

> fine, but if I let it run, the Program Conunter crashes after setting

> the CBEIF Flag.

 

Because the CPU was in BDM memory during the flash write.

 


 

Posted: Sat Jul 16, 2005  8:07 am

 

The bootloader works really good for the paged addresses but I have problems, to delete the Address Range from C000 - FFFF. In the Application Note Bootloader there are also only S2 Records supported. How am I able to write on this Address Range?

 


 

Posted: Tue Jul 19, 2005  8:38 am

 

The bootloader works really good for the paged addresses (eg. 3A8000 - 3ABFFF)

 

But I have problems, to write to the Address Range from C000 - FFFF. Because I have mapped my RAM to this position.

 

What can I do. Do I have to map the RAM to another position to write to this Address Range?

Outcomes