| Details | Message |
|---|
Read-Only Author Ingvar Kreft Posted 17-Jan-2005 15:02 GMT Toolset C51 |  Link Problem Ingvar Kreft Hi I need to put some function in the first 8k area of my program. The function that i will put there is. START_MXB.asm Interrupt and my bootloader. This area should not be optmized and i don't want any library function in this area.
My function main should start at 0x2000. And here I want to optimize.
How should i set up my linker to solve this? |
|
Read-Only Author Keil Reinhard Posted 17-Jan-2005 17:57 GMT Toolset C51 |  RE: Link Problem Keil Reinhard Take a look to the USERCLASS feature.
Example: http://www.keil.com/support/docs/2670.htm
Reinhard |
|
Read-Only Author Ingvar Kreft Posted 18-Jan-2005 14:26 GMT Toolset C51 |  RE: Link Problem Ingvar Kreft OK I now have done this in my code.
pragma userclass (code = IAP) // Generates CODE_IAP class
And under Project - Options for Target - LX51 Locate - User Class i put
CODE_IAP (C:0x2000 - C:0xFFFF)
but when i take a look i my .map file i can see that the linker puts a lot of code in the area 0-0x1FFF. Like this.
800FC9H 800FD1H 000009H BYTE UNIT CODE ?L?COM023F
How can I tell the linker that i don't want any code except start_mx and my interrupt routines? |
|
Read-Only Author Keil Reinhard Posted 18-Jan-2005 14:32 GMT Toolset C51 |  RE: Link Problem Keil Reinhard Specify in addition the CODE class and use a memory region that excludes 0x800000 - 0x801FFF.
Reinhard |
|
Read-Only Author Ingvar Kreft Posted 18-Jan-2005 15:24 GMT Toolset C51 |  RE: Link Problem Ingvar Kreft If I do this, then i also will move start_mx from this area.
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
What i want is start_mx CODE at 0x0000 IntFunc CODE Main CODE GAP to 0x1FFF TheRestFunc CODE_IAP at 0x2000
Ingvar |
|
Read-Only Author Keil Reinhard Posted 19-Jan-2005 06:54 GMT Toolset C51 |  RE: Link Problem Keil Reinhard Then change the segment directive in the startup code to:
?C_C51STARTUP SEGMENT 'CODE_IAP'
More information: Assembler/Utilities User's Guide (A51.PDF), page 107, User-defined Class Names. |
|
Read-Only Author Ingvar Kreft Posted 19-Jan-2005 09:19 GMT Toolset C51 |  RE: Link Problem Ingvar Kreft Hi I try'd to do that, and get this Error.
*** ERROR L115: PARTIAL SEGMENT BELONGS TO DIFFERENT MEMORY CLASS SEGMENT: ?C_C51STARTUP MODULE: E:\KEIL\C51\LIB\CX51L.LIB (?C_INIT)
And if i want to read more about "ERROR L115" I get this answer.
*** Error L115 INPAGE SEGMENT IS GREATER THAN 256 BYTES SEGMENT: segment-name
I'm a little bit confused!
Ingvar |
|
Read-Only Author Ingvar Kreft Posted 19-Jan-2005 15:58 GMT Toolset C51 |  RE: Link Problem Ingvar Kreft Hi I solved my problem by writing 2 program. One starting at 0x800000 and the second starting at 0x802000. Is there some way to link the two programs to one program?
Ingvar |
|
Read-Only Author Hans-Bernhard Broeker Posted 19-Jan-2005 17:06 GMT Toolset C51 |  RE: Link Problem Hans-Bernhard Broeker Is there some way to link the two programs to one program?
Probably no. The best you can likely achieve is to merge the two HEX files. Just concatenating them may be enough, but in case of doubt you'ld better use real tools. |
|
Read-Only Author Keil Reinhard Posted 20-Jan-2005 07:20 GMT Toolset C51 |  RE: Link Problem Keil Reinhard Yes, there is a way. See: http://www.keil.com/support/docs/2385.htm
Reinhard |
|