Vector address Area in .prm file

cancel
Showing results for 
Search instead for 
Did you mean: 

Vector address Area in .prm file

185 Views
Contributor V

Hi All,

Query is regarding area defined for vector table in the .prm file.

I am referring "MC9S12ZVML128_BLDC_Sensorless" sample code as reference.

I will attach the sample code too.

From the S12zvm.prm file it can be observed that vector are defined from 0xFFFE10 TO   0xFFFFFF

Query is why arent they defined from 0xFFFE00 TO   0xFFFFFF.

In RM (Rev 2.13 for MagniV S12) , chapter 4.5.1 Initialization, says software should Initialize the interrupt vector base register if the interrupt vector table is not located at the default location (0xFFFE00–0xFFFFFB).

Thanking in advacne.

Labels (1)
0 Kudos
5 Replies

36 Views
Contributor V

Hi Ladislav,

Thank you for your answer.

Still i have some question and is relevant to the below line in the sample code.

 

# 1 )  /* VECTORS       = READ_ONLY     0xFFFE00 TO   0xFFFFFF; intentionally not defined: used for VECTOR commands below */

# 2)  OSVECTORS     = READ_ONLY     0xFFFE10 TO   0xFFFFFF;   /* OSEK interrupt vectors (use your vector.o) */

Q1 - Why # 1 is commented and is defined from  0xFFFE00 TO   0xFFFFFF ? 

Q2 - Why # 2 is defined from 0xFFFE10 TO   0xFFFFFF ? why it is not defined from 0xFFFE00 TO   0xFFFFFF?

 

0 Kudos

36 Views
NXP TechSupport
NXP TechSupport

Hi,

everything depends on the fact whether you understand the function of the prm file and organization of the memory map of the real MCU. Finally you can create your own to be satisfied with everything. But back to your question and again in other words.

The vectors are defined from highest address to lower addresses. The datasheet shows, please check:

0xFFFFFC

Vector base + 0x1F8

Vector base + 0x1F4

...

...

...

Vector base + 0x88 to Vector base + 0x10              Reserved

The question is. What does happen if I allocate memory for vectors down to address Vector base + 0x10  or Vector base + 0x00 ?

Answer is NOTHING. I only allocate the larger part of the memory in the second case which will not be used for anything because real vectors addresses are considered stop at address Vector base + 0x10. It will happen nothing even if you create this space from the bottom address Vector base + 0x89 because the last real and existing vector table finishes at this address  (S12ZVM reference manual) - I suppose the reserved space is used for nothing. However, only to be sure, reserved space is better to leave untouched.

Moreover, from programmer point of view and sector size it is better to lose the lowest part of the flash assigned for vector table because it can cause some issues if you use it for your application purpose and you need to E/W them during application run. So you can either allocate entire sector or do not use the remaining part of the sector and do not mention it in the prm file...then it does not exists for linker and will not be even accidentally by user used for any purpose during program compiling and linking. (I do not write about E/W by SW....here you can do anything you want)

I hope it is clearer.

Best regards,

Ladislav

0 Kudos

36 Views
NXP TechSupport
NXP TechSupport

Hi,

if you mean the line:

  

  vector    INTO  OSVECTORS; /* OSEK */

then it has no meaning for standard project.

It is related for OSEK operating system. You can ignore it.

Best regards,

Ladislav

0 Kudos

36 Views
Contributor V

Hi Ladislav,

Thank you for your answer.

What my question is relevant to the below line in the sample code

# 1 )  /* VECTORS       = READ_ONLY     0xFFFE00 TO   0xFFFFFF; intentionally not defined: used for VECTOR commands below */

# 2)  OSVECTORS     = READ_ONLY     0xFFFE10 TO   0xFFFFFF;   /* OSEK interrupt vectors (use your vector.o) */

#1 is commented, while # 2 is used 

vector    INTO  OSVECTORS; /* OSEK */

so instead if : vector    INTO  VECTORS ; is used , is it correct?

0 Kudos

36 Views
NXP TechSupport
NXP TechSupport

I am sorry I have provided confusing info (now I had a closer look at project) and I am sorry I’ll confuse you a little bit more.It is hard to join all info into short essay.

 

Please ignore everything related to OSEK. Not necessary to think about if you do not use it. However as I see these command lines are used even they have different meaning and in this case there is no problem to use them. The SW engineer only used the command line for his purpose. So let’s start.

 

There are more ways how to define interrupt vector table/interrupt_function_vector

 

/*   VECTORS       = READ_ONLY     0xFFFE00 TO   0xFFFFFF; intentionally not defined: used for VECTOR commands below */

 

This can be uncommented when you want to use this space to place there own vector array defined in your SW. The size is selected to cover all possible vectors size. In this case you do not use VECTOR commands (the first one is presented only) placed on the bottom of the prm file.

Vector 0    _Startup

But you create your own array of the vector with the placement in the space which should be presented in the PLACEMENT section if you do not use direct placement of the array at iven address “@” as an alternative.

 

If you want to use VECTOR commands to define vectors then for example define vector 25:

 

Vector 0    _Startup

Vector 25  My_vector_25_function

 

The result is that the interrupt function is then defined:

Interrupt void My_vector_25_function(void) {}

 

Another approach is to ignore above mentioned and easily use. (Neither additional VECTOR command nor Vectors uncommented):

Interrupt 25 void My_vector_function(void) {}

 

 

So back to your question. The organization you presented does:

/* VECTORS       = READ_ONLY     0xFFFE00 TO   0xFFFFFF; intentionally not defined: used for VECTOR commands below */ 

Is commented so the space is not allocated and you can use commands VECTOR or interrupt xx int function() or to define array of interrupt functions at given address “@”.

 

In this project there is vectors.c file created where interrupt vectors are created as an array of vectors placed at PR_CONST_SECTION(vector):

 

PR_CONST_SECTION(vector)

const typeVect _vectab[] = {….

 

 

 

There is a definition of section placement in the file S12ZVM_devconfig.h

            #define PR_CONST_SECTION(sec_name) \#pragma section const {## sec_name}

 

Of course, the SW engineer used “vector”definition from prm file:

    vector    INTO  OSVECTORS; /* OSEK */

 

It is confusing because the project has nothing with OSEK but the space covers entire space. Everything is correct because the vectors are from upper address toward lower addresses and OSEK here is only confusing word.

It would nothing happen if you change the prm file to following content:

 

/*   VECTORS       = READ_ONLY     0xFFFE00 TO   0xFFFFFF; intentionally not defined: used for VECTOR commands below */

/*      OSVECTORS     = READ_ONLY     0xFFFE10 TO   0xFFFFFF;  */ /* OSEK interrupt vectors (use your vector.o) */

 

MY_INTERRUPT_VECTORS       = READ_ONLY     0xFFFE00 TO   0xFFFFFF

 

 

 

Andin the section placement:

    /*vector    INTO  OSVECTORS; *//* OSEK */

    vector    INTO  MY_INTERRUPT_VECTORS

 

 

I am sorry I think you are now confused more than before.

Best regards,

Ladislav

0 Kudos