We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am using philips MC2 controller. Following are the memory classes defined: ACTIVE MEMORY CLASSES OF MODULE: BASE START END USED MEMORY CLASS ========================================================== 000000H 700000H 77FFFFH 00A2B6H HDATA 7F0000H 7F0000H 7F04FFH 000100H EDATA 000000H 000000H 0006FFH 000440H XDATA 910000H 910000H 91FFFFH 01000BH CODE 900000H 900000H 90FFFFH 0000FCH CONST 000000H 910000H FFFFFFH 01975FH ECODE 000000H 910000H FFFFFFH 000002H HCONST 000000H 900000H 90FFFFH 000EFDH ECODE_CFI LX51 LINKER/LOCATER V3.60 10/09/2003 14:59:56 PAGE 4 7F0020H.0 7F0020H.0 7F002FH.7 000007H.3 BIT 7F0000H 7F0000H 7F007FH 000068H DATA 000000H 000000H 0000FFH 000005H PDATA 7F0000H 7F0000H 7F00FFH 000002H IDATA I am getting address overflow error for code memory. If i remove some portion of code then it fits in the CODE memory Class. otherwise it overflows. The expectation is that the linker should be using ECODE instead. What can be reason ? I can only use memory in the range 0x900000-0xFFFFFF for code.
Are you using ROM(HUGE)? Jon
Yes i am using HUGE model
Hmmmm, When you use ROM(HUGE) the compiler automatically places C functions in ECODE. Maybe you can take a look at the module memory map from the linker map file and see what's getting located in CODE spce. Maybe you have a lot of tables that are declared as CODE or maybe you have a lot of initialized data. The following memory map is generated by the C_LINEAR_ROM Philips MX example program.
MEMORY MAP OF MODULE: loadapp (MAIN_B) START STOP LENGTH ALIGN RELOC MEMORY CLASS SEGMENT NAME ========================================================================= 000000H 000001H 000002H BYTE UNIT XDATA ?XD?MAIN_B 000002H 7EFFFFH 7EFFFEH --- --- **GAP** 7F0000H 7F0007H 000008H --- AT.. DATA "REG BANK 0" 7F0008H 7F000FH 000008H --- AT.. DATA "REG BANK 1" 7F0010H 7F0010H 000001H BYTE UNIT IDATA ?STACK 7F0011H 7FFFFFH 00FFEFH --- --- **GAP** 800000H 800002H 000003H --- OFFS.. CODE ?CO?START_MX?3 800003H 80000BH 000009H BYTE UNIT CODE ?C_INITSEG 80000CH 800024H 000019H BYTE INSEG ECODE ?PR?T2_INI_LOAD?MAIN_B 800025H 800028H 000004H BYTE INSEG ECODE ?PR?INT_ON?MAIN_B 800029H 80002AH 000002H --- --- **GAP** 80002BH 80002FH 000005H BYTE OFFS.. CODE ?INT?0002B 800030H 800070H 000041H BYTE INSEG ECODE ?PR?MAIN?MAIN_B 800071H 800074H 000004H BYTE INSEG ECODE ?PR?INT_OFF?MAIN_B 800075H 80007AH 000006H --- --- **GAP** 80007BH 800081H 000007H --- OFFS.. CODE ?CO?START_MX?4 800082H 800130H 0000AFH BYTE UNIT CODE ?C_C51STARTUP 800131H 80015CH 00002CH BYTE INSEG ECODE ?PR?TIMER2?INT 80015DH 800169H 00000DH BYTE INSEG ECODE ?PR?T2_ISR_LOAD?MAIN_B 80016AH 86FFFFH 06FE96H --- --- **GAP** 870000H 870034H 000035H BYTE INSEG ECODE_APPL ?PR?MAIN_APP?MAIN_A 870035H 87004DH 000019H BYTE INSEG ECODE_APPL ?PR?T2_INI_APP?MAIN_A 87004EH 87005AH 00000DH BYTE INSEG ECODE_APPL ?PR?T2_ISR_APP?MAIN_A
When i look at the memory map, I am finding things are not right. What i am not able to figure out is by the linker placing parts of the program in Code memory, even after it finds it has crossed 64k. I have explicity tried to place modules in ECODE memory Class by using directives #pragma USERCLASS (ECODE=OTHER) #pragma USERCLASS (ECODE=CFI) The(Mr.) linker still tries to put it in Code memory. Following are the memory setting which i am using HDATA(0x700000-0x77FFFF), EDATA(0x7F0000-0x7F04FF), XDATA(0x0000-0x06FF), CODE(0x900000-0x90FFFF), CONST(0x900000-0x900FFF),ECODE (0x910000-0xFFFFFF), HCONST(0x910000-0xFFFFFF), ECODE_CFI(0x910000-0x91FFFF),ECODE_OTHER(0x910000-0xFFFFFF). And below is the Memory Class section of the .map file. ACTIVE MEMORY CLASSES OF MODULE BASE START END USED MEMORY CLASS ========================================================== 000000H 700000H 77FFFFH 00A2B6H HDATA 7F0000H 7F0000H 7F04FFH 000100H EDATA 000000H 000000H 0006FFH 000440H XDATA 900000H 900000H 90FFFFH 01000BH CODE 900000H 900000H 900FFFH 0000FCH CONST 000000H 910000H FFFFFFH 003B8BH ECODE 000000H 910000H FFFFFFH 000002H HCONST 000000H 910000H 91FFFFH 000EFDH ECODE_CFI LX51 LINKER/LOCATER V3.60 10/10/2003 14:32:43 PAGE 4 000000H 910000H FFFFFFH 015ACCH ECODE_OTHER 7F0020H.0 7F0020H.0 7F002FH.7 000007H.3 BIT 7F0000H 7F0000H 7F007FH 000068H DATA 000000H 000000H 0000FFH 000005H PDATA 7F0000H 7F0000H 7F00FFH 000002H IDATA In the project i have used lot of enums. Code variables are used but not many. Thanks in advance. sharad.
The linker does not move segments from one memory space to another. It merges segments that are located in same memory class but it does not move them to a different memory class. The memory class (code, ecode, xdata, ...) of a segment is determined when that segment is created (in the assembler or in the compiler). When you looked at the Memory Map Of Module did you notice which of your program segments were located in CODE memory? Jon