make a DZ128 CAN Bootloader

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

make a DZ128 CAN Bootloader

Jump to solution
1,586 Views
jeremywang
Contributor II

Dear all:

       I'm making a CAN Bootloader for mcs08dz128.

       I have few questions about write flash in address:0xFF80~0xFFFF.

        1). About Vector redirection,the address:0xFFBF,it's NVOPT=0x02,I know it should be set the FNORED bit to 0,&0xFFBD,it's NVPROT = FD,I set 0xE000~0xFFFF is protected.

         Question:Should I set that in bootload progrom or in app progrom?or both.

                       When i need write those address from read .s19,how should I do?

        2).The 0xFFFE~0xFFFF,it's reset by system?.s19 file has message to rewrite this address, should I egnore this address opreation?

        3).0xFF80~0xFFFF,It's interrupt vectors.is there anyone who know How to operate those address clearly?Give me favour,please!

Labels (1)
0 Kudos
1 Solution
799 Views
weapon
Senior Contributor I

Hi Jeremy,

I attached one project for your reference. the vector table is in main.c. the adress of the table can be changed easily. you need to calculate the address according to FPS bits.

For example, if 8192 bytes of FLASH are protected, the protected address region is from 0x0_E000

through 0x0_FFFF. The interrupt vectors (0x0_FF80 through 0x0_FFFD) are redirected to the locations

0x0_DF80 through 0x0_DFFD. If vector redirection is enabled and an interrupt occurs, the values in the

locations 0x0_DFE0:0x0_DFE1 are used for the vector instead of the values in the locations

0x0_FFE0:0x0FFE1. This allows the user to reprogram the unprotected portion of the FLASH with new

program code including new interrupt vector values while leaving the protected area, which includes the

default vector locations, unchanged.

View solution in original post

0 Kudos
6 Replies
799 Views
weapon
Senior Contributor I

Hi Jeremy,

The responsibility of bootloader is to parse addresses and data from S19 file then program them into flash, it's none of bussiness with applicaiton. Generally speaking, S19 file will include those nonvolatile registers' content and interrupt vectors. The thing you do is to get those data followed by programing them to flash.

Regarding your questiones , let me clarify something for you.

1. vector redirection.

It's strongly recommended that in bootloader, don't use any interrupt, use polling to replace. and bootloader should be protected to prevent from rewriting by accident.   In this case, FNORED should be cleared to enable vector redirection, so that application can use vector table as common.

2. reset vector.(0xfffe-0xffff)

If bootloader is protected, the reset vector can't be modified any more. bootloader only updates those flash area for application but keep its own area no change.

In fact, it can't be changed if it is protected.

3. like point 2. the default vector will be protected too. bootloader needn't to write this area. vector table of applications is below protected area. bootloader should update that vector table.

hope these info can help you.  Any doubt let me know easily.

B.R

Weiping.

799 Views
jeremywang
Contributor II

Hi Dear Weiping Xu:

         Your reply is very helpful for me.

         But I still don't know the bootloader how to update that vector table?

         & how could make the vector table of applications is below protected area? I try to let the interrupt address - 0x2000 to redirection in my software,but it can't work.

         Should I change the .prm file?but the interrupt vector is not define in it.but in mc9s08dz128.h.

        Thanks again for your supply.

0 Kudos
800 Views
weapon
Senior Contributor I

Hi Jeremy,

I attached one project for your reference. the vector table is in main.c. the adress of the table can be changed easily. you need to calculate the address according to FPS bits.

For example, if 8192 bytes of FLASH are protected, the protected address region is from 0x0_E000

through 0x0_FFFF. The interrupt vectors (0x0_FF80 through 0x0_FFFD) are redirected to the locations

0x0_DF80 through 0x0_DFFD. If vector redirection is enabled and an interrupt occurs, the values in the

locations 0x0_DFE0:0x0_DFE1 are used for the vector instead of the values in the locations

0x0_FFE0:0x0FFE1. This allows the user to reprogram the unprotected portion of the FLASH with new

program code including new interrupt vector values while leaving the protected area, which includes the

default vector locations, unchanged.

0 Kudos
799 Views
jeremywang
Contributor II

Oh,Yeah!Solved,finally!

before App _Startup() should add  #pragma CODE_SEG 0x4000(your start address).

0 Kudos
799 Views
ralphwuppinger
Contributor I

Hi Jeremy,

 

posting my last question regarding the CAN Bootloader is now nearly three years ago. Not knowing whether you are still active in that forum, I would like to ask you once again whether your still working with the DZ128 and whether your experiences using your CAN-Bootloader - also in a commercial environment - are poitive. The CAN-Bootloader topic was retriggered caused by an enquiry of one of our customers. Due to the fact that I'm not a friend of reinvent the wheel, I would like to ask you, if you would like to share your DZ128 CAN-Booloader project or if it is a commercial solution, whether it's possible to buy a license?


 

Thanks a lot in advance for your time and your answer!

 

Best regards

Ralph

0 Kudos
799 Views
ralphwuppinger
Contributor I

Hi Jeremy,

I'm just faced with the same problem like you were. I have to port our serial bootloader function to a CAN-Bus bootloader.

We are now using the DZ128 and the porting of the serial bootloader from DZ60 to DZ128 which was also tricky, but works so far.

Actually I'm looking around for some Freescale support or App-Note according a DZ128 CAN-Bus Bootloader but unfortunately there is none, so I stumble over your case here. I'm wondering that there are not more guys who have the need of a CAN-Bus Bootloader? But as far as I can see you've got joyfully your bootloader run.

So my question to you: can you imagine or do you see any possibility to share your CAN-Bus bootloader code or part of the code, which may help to implement such an CAN Bootloader. I hopy my questions is not to unreasonable, if it did please excuse!

Thanks a lot in advance for your time and your support!

Best regards

Ralph

0 Kudos