Hello,
In my project,I want to create an interrupt vector array in a vector.c like this:
PR_CONST_SECTION(my_vector)
const typeVect _vectab[]={
{0x00,dummy,} /*0xFFFE00+10*/
{0x00,dummy,} /*0xFFFE00+14*/
...
{0x00,STARTUP_FCN} /*0xFFFE00+1FC*/
}
I have already defined the _Startup as STARTUP_FCN like this:
#define STARTUP_FCN _Startup
I want to locate the vector array into the 0xFFFE10 where is the default vector table address.
So,in the prm file :
SEGMENTS
RAM = READ_WRITE 0x001000 TO 0x002FFF;
EEPROM = READ_ONLY 0x100000 TO 0x1001FF;
ROM = READ_ONLY 0xFE0200 TO 0xFFDFF7;
VECTORS = READ_ONLY 0xFFFE10 TO 0xFFFFFF;
//OSVECTORS = READ_ONLY 0xFFFE10 TO 0xFFFFFF;
END
PLACEMENT
_PRESTART, /* Used in HIWARE format: jump to _Startup at the code start */
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
//.ostext, /* OSEK */
NON_BANKED, /* runtime routines which must not be banked */
DEFAULT_ROM,
COPY INTO ROM;
//.stackstart, /* eventually used for OSEK kernel awareness: Main-Stack Start */
SSTACK, /* allocate stack first to avoid overwriting variables on overflow */
//.stackend, /* eventually used for OSEK kernel awareness: Main-Stack End */
ptuTrigE,
adcLists,
DEFAULT_RAM INTO RAM;
my_vector INTO VECTORS;
END
ENTRIES /* keep the following unreferenced variables */
/* OSEK: always allocate the vector table and all dependent objects */
//_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
//_vectab
END
STACKSIZE 0x500
//VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
//VECTOR 0 Entry /* reset vector: this is the default entry point for an Assembly application. */
//INIT Entry /* for assembly applications: that this is as well the initialization entry point */
Then I successfully compile the program and download it into the S19ZVML128.
When I dubug the progam,by the Memory Monitors Window,I find that there is no data about the vector array between the 0xFFFE10 and 0xFFFFFF.
I think that means the CPU can not get the _Startup adrress,but the program successfully step into the _Startup and report an error jumping into the main function.
Now,I want to ask Why the CPU can get the _Startup adrress,there is obviously no data between the 0xFFFE10 and 0xFFFFFF
And why the program can not jump into the main function?
And how to locate the data of vevtor array into the 0xFFFE10?
Hi,
1) Please check vectors.c file in the attached example
2) Also changes were made in the prm file:
PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
…
…
…
DEFAULT_RAM INTO RAM;
my_vector INTO VECTORS;
//.vectors INTO OSVECTORS; /* OSEK */
END
ENTRIES
InterruptVectorTable
END
STACKSIZE 0x100
//VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
//VECTOR 0 Entry /* reset vector: this is the default entry point for an Assembly application. */
//INIT Entry /* for assembly applications: that this is as well the initialization entry point */
3) #include "starts12z.h" added into Vectors.c because it contains a declaration of the _Startup function.
Best regards,
Ladislav
Thank you very much !
I have solved the problem.