Rappid bootloader for s12zvm

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

Rappid bootloader for s12zvm

Jump to solution
2,109 Views
jasminrouleau
Contributor II

Hello community !

 

I'm trying to use the Rappid Boot Loader utility (v1.6.7.26) with the s12zvm without much success.

 

The target board is the S12ZVML-MINIBRD.

 

I have programmed the S12ZVM.rbf file into the cpu. I downloaded my application code with the RappidBL software without problems but my application doesn't run.

 

I dumped the cpu flash to file and I find out that my application is where is should be in flash but the interrupt vectors (0xfffe10 +) are not the same as my application.

 

Is there any limitations for the application code to use this bootloader ? I added the required data at specific addresses in my application but is there more to do ?

 

Regards,

 

Jasmin

Labels (1)
0 Kudos
1 Solution
907 Views
RadekS
NXP Employee
NXP Employee

Hi Jasmin,

Unfortunately I do not have experience with Rappid Boot Loader utility.

However problem with interrupt vectors is quite clear.

By default, interrupt vectors are located from address 0xfffe10.

Typically we want that bootloader starts at every MCU reset and check whether it will continue in bootloader code or application code (it doesn’t have sense to have such routine as part of main application). Bootloader will occupy part for flash (it should be protected part of flash) and default interrupt/reset vectors location.

On other side, application code should have their own vector table somewhere in flash/RAM (must be aligned to 512 byte block) and IVBR register have to be modified at begin of application code (it points to application vector table).

Note: As reference could be used also our application note AN4723 S12Z MagniV Bootloader

http://www.freescale.com/files/microcontrollers/doc/app_note/AN4723.pdf

http://www.freescale.com/files/microcontrollers/doc/app_note/AN4723_SW.zip


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
908 Views
RadekS
NXP Employee
NXP Employee

Hi Jasmin,

Unfortunately I do not have experience with Rappid Boot Loader utility.

However problem with interrupt vectors is quite clear.

By default, interrupt vectors are located from address 0xfffe10.

Typically we want that bootloader starts at every MCU reset and check whether it will continue in bootloader code or application code (it doesn’t have sense to have such routine as part of main application). Bootloader will occupy part for flash (it should be protected part of flash) and default interrupt/reset vectors location.

On other side, application code should have their own vector table somewhere in flash/RAM (must be aligned to 512 byte block) and IVBR register have to be modified at begin of application code (it points to application vector table).

Note: As reference could be used also our application note AN4723 S12Z MagniV Bootloader

http://www.freescale.com/files/microcontrollers/doc/app_note/AN4723.pdf

http://www.freescale.com/files/microcontrollers/doc/app_note/AN4723_SW.zip


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
907 Views
jasminrouleau
Contributor II

Thank Radek,

I gave up on the Rappid Bootloader, I'm using the AN4723. I had a problem with the SCI baudrate, I believe that there a divide by 16 that should not be there in the computation of the baudrate "prescaler".

Regarding the bootloader, I don't have to relocate the vector table of my application if I don't protect the p-flash section of the bootloader. If I wish to protect the bootloader code section, I must relocate the vector table, right ?

I have not tried yet but I would change the vector section (OSVECTORS) location to just before the bootloader (0xFFF600 TO   0xFFF7FF) and change the IVBR to 0xFFF6 in my app. Then how the startup vector will be "programmed" to trigger the end of the bootloading phase ? Do I have to split the OSVECTOR section to ensure that the startup vector address will be "programmed" ?

Thanks again,

Jasmin

0 Kudos
907 Views
RadekS
NXP Employee
NXP Employee

Hi Jasmin,

About SCI baudrate)

Please be careful, early S12ZVM masksets (N06E) contained SCIv5 instead SCIv6. The main difference is in divider by 16 on input clock (SCIv6 don’t have divider) and appropriate changes in registers.

Please look at "..\AN4723_SW\Software\Sources\Comms\" and select appropriate SCI code. Unfortunately example code use SCIv5 be default (Application note was tested and released prior official S12ZVM release)

Early S12ZVM masksets (N06E) have also GDU registers on different place in memory map.

So, please be sure that you use correct header file for your MCU.

I would like to really recommend use separate vector tables for application and bootloader. Typically we want that bootloader could be used more than once. Rewriting default vector location isn’t best idea, because bootloader functionality may be affected.

There is also high risk during reprogramming last sector. If we want update default vector location, we have to erase last sector and unexpected reset (like power supply lost) may cause loosing of information in reset vector – only way how to fix it is trough special mode and BDM interface!

You could create your own vector table in application. For example (based on code generated be PE):

//==============================================================================

// API_ISR

//==============================================================================

interrupt void API_ISR(void)

{

  CPMUAPICTL_APIF = 1;  //clear flag

}

//==============================================================================

// Unimplemented_ISR

//==============================================================================

interrupt void Unimplemented_ISR(void)

{

  asm NOP;  //place breakpoint here

}

/* ISR prototype */

typedef void (*const tIsrFunc)(void);

/* Pack 3 byte pointers as 4 byte Interrupt Vector Table entries */

typedef struct

{

  byte padding;

  tIsrFunc address;

} InterruptTableEntry;

#define _VECTOR(v) {0xFFU, &v}

const InterruptTableEntry _InterruptVectorTable[123] @0x00FFF610U = { /* Interrupt vector table */

                                _VECTOR(Unimplemented_ISR),

                                //...

                                _VECTOR(API_ISR),

                                //...

                                _VECTOR(Unimplemented_ISR),

};


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos