overlap detected by using FILL in PRM file and vector relocation

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

overlap detected by using FILL in PRM file and vector relocation

Jump to solution
1,204 Views
Seppel
Contributor I

Hi @all,

 

i get this error: Code loading overlap detected in range 0x0000D5C0..0x0000D5F in debugger, when i use FILL  instruction in PRM file (to fill unused FLASH areas with 0xFF) and vector relocation of the interrupt vector table (in MCUinit.c). My application code is at the beginning of the address area 0x7F00 TO 0xD5FF and the relocated vector table at the end of it. When i burn this code anyway in the controller, the vector table became overwritten by 0xFF... and without interrupt vector table the controller crashes.

 

Is there a way to tell the linker that he don't fill / overwrite the vector table?

 

//in MCUinit.c:
/* NVPROT: FPS=56 */const unsigned char NVPROT_INIT @0x0000FFBD = 248;/* NVOPT: KEYEN=0,FNORED=0,SEC1=1,SEC0=0 */const unsigned char NVOPT_INIT @0x0000FFBF = 62;extern near void _Startup(void);/* Interrupt vector table */#ifndef UNASSIGNED_ISR  #define UNASSIGNED_ISR ((void(*near const)(void)) 0xFFFF) /* unassigned interrupt service routine */#endifvoid (* near const _vect[])(void) @0xD5C0 = { /* Interrupt vector table */         UNASSIGNED_ISR,               /* Int.no. 31 Vacmp2 (at D5C0)                Unassigned */         UNASSIGNED_ISR,               /* Int.no. 30 Vacmp1 (at D5C2)                Unassigned */         isrVcantx,                    /* Int.no. 29 Vcantx (at D5C4)                Used */         isrVcanrx, ... //etc. -> Standard code!                //PRM File://1) thats ok:FUNKTIONEN_DELETE =  READ_ONLY    0x7F00 TO 0xD5FF;//2) that don't work:FUNKTIONEN_DELETE =  READ_ONLY    0x7F00 TO 0xD5FF FILL 0xFF;
Labels (1)
0 Kudos
1 Solution
653 Views
CompilerGuru
NXP Employee
NXP Employee

Not sure where the confusion is from. Basically areas used with the @ operator like

>void (* near const _vect[])(void) @0xD5C0...

must be excluded in the prm. Either the flash memory is used by content assigned by the compiler or by the linker, but not by both.

Note that this has nothing to do with the separation from an app and a loader or with what else is in FUNCTIONEN_DELETE prior to 0xD5C0. So I'm not saying to remove this segement, just to make the segment FUNCTIONEN_DELETE exclude the area used otherwise. This will also avoid that the linker fills in data colliding with the @ allocated table which is the main topic in this thread in my understanding :smileyhappy:.

 

About the warning, I was refering to the linker command line options.

I see "-WmsgSd1100 -WmsgSd1912" in a newly created CW 10.0 project.

Without those options, a stationary project with

 

>const int whatever @ 0xFF00 = 23;

 

added to main and " FILL 0xdf" added in the ROM segment,

 

I get 

 

> WARNING L1912: Object whatever overlaps with another (last addr: 0xFFAE, object addr: 0xFF00)

 

Note that the warning L1912 was disabled in the stationary, I guess this is the case in your setup as well. If you remove

the "-WmsgSd1100 -WmsgSd1912" linker command line options, you get a warning at link time, not just as now at download time.

 

Daniel

 

 


View solution in original post

0 Kudos
4 Replies
653 Views
CompilerGuru
NXP Employee
NXP Employee

Both setups are incorrect. When using absolutely allocated variables, exclude those areas from the prm file.

 

 FUNKTIONEN_DELETE =  READ_ONLY    0x7F00 TO 0xD5BF FILL 0xFF;

 

or 

 

 FUNKTIONEN_DELETE =  READ_ONLY    0x7F00 TO 0xD5BF;

 

Also check if you have any linker warnings disabled, check the linker command line. I would hope that the linker warns you for such a setup. But those warnings can be suppressed.

 

Daniel

0 Kudos
653 Views
Seppel
Contributor I

Both setups are incorrect. When using absolutely allocated variables, exclude those areas from the prm file.

  FUNKTIONEN_DELETE =  READ_ONLY    0x7F00 TO 0xD5BF FILL 0xFF;

 or 

  FUNKTIONEN_DELETE =  READ_ONLY    0x7F00 TO 0xD5BF;

 

This is my seperated ROM Segment, where the application code is located. Although this segment being named as "FUNKTIONEN_DELETE" there are also variables inside. Better name would be "APPLICATION_SEGMENT". I can't exclude this segment, because i also use bootloader code in other segment and i want a isolation between them.

 

Also check if you have any linker warnings disabled, check the linker command line. I would hope that the linker warns you for such a setup.

 

I get this warning: Code loading overlap detected in range 0x0000D5C0..0x0000D5F in debuggers command window, when i use FILL instruction in PRM file. When i burn this code anyway in the controller, the vector table (located in the error range) became overwritten by 0xFF (-> from FILL) and without interrupt vector table the controller crashes.

0 Kudos
654 Views
CompilerGuru
NXP Employee
NXP Employee

Not sure where the confusion is from. Basically areas used with the @ operator like

>void (* near const _vect[])(void) @0xD5C0...

must be excluded in the prm. Either the flash memory is used by content assigned by the compiler or by the linker, but not by both.

Note that this has nothing to do with the separation from an app and a loader or with what else is in FUNCTIONEN_DELETE prior to 0xD5C0. So I'm not saying to remove this segement, just to make the segment FUNCTIONEN_DELETE exclude the area used otherwise. This will also avoid that the linker fills in data colliding with the @ allocated table which is the main topic in this thread in my understanding :smileyhappy:.

 

About the warning, I was refering to the linker command line options.

I see "-WmsgSd1100 -WmsgSd1912" in a newly created CW 10.0 project.

Without those options, a stationary project with

 

>const int whatever @ 0xFF00 = 23;

 

added to main and " FILL 0xdf" added in the ROM segment,

 

I get 

 

> WARNING L1912: Object whatever overlaps with another (last addr: 0xFFAE, object addr: 0xFF00)

 

Note that the warning L1912 was disabled in the stationary, I guess this is the case in your setup as well. If you remove

the "-WmsgSd1100 -WmsgSd1912" linker command line options, you get a warning at link time, not just as now at download time.

 

Daniel

 

 


0 Kudos
653 Views
Seppel
Contributor I

Basically areas used with the @ operator like "void (* near const _vect[])(void) @0xD5C0..." must be excluded in the prm. Either the flash memory is used by content assigned by the compiler or by the linker, but not by both.

 

Ahh, ok :smileyhappy: I didn't know that compiler "@"s and Linker "prm-commands" don't get along with each other. Now i do!

I also recognize this, by trying to bring in a "const var @ " at the beginnining of my copydown ROM area... that don't work, Linker copydown vars always overwrite the var placed with "@".

 

Thank you for your explanation! I will fix up my PRM file and i also have to change some bootloader-areas, because i use "HEXFILE bootloader.s19" in prm and there are also some areas that overlap (but they are mirrored, so equal in both). You are also right with your suggestion about the disabled Linker Warnings "-WmsgSd1100 -WmsgSd1912". 

 

Thanks,

Seppel

0 Kudos