This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sharing data and overlayable segments

I'm using the Keil C51 Tools and have successfully written 8051 programs only in assembly language. Now I need add C code to my assembly program.
After the i add C code to my assembly code Keil C51 has grasped a part of space DATA memory. Now i can not use DATA space for some assembly variables. My C code running in the start programm and i can sharing DATA space _DATA_GROUP_ with my assebly variables. How can i make DATA segments for sharing DATA space between _DATA_GROUP_ and my assembly variables?

Parents
  • Yes, Andy. I studied it. I use C and Assembler successful in my Code. But now i have some problem. I made a C code for some task used long long integer values. I use C8051F344 chip. It has 80 DATA space. My assembler code use about 64 bytes DATA space already. When Keil compiles my assembler code with C code it gives a 60 bytes DATA space for _DATA_GROUP_ and the stayed DATA space is insufficiently for my assembler variables.
    I used XDATA space for all C variables. I use stdlib.lib, stdio.lib and string.lib in my C code. After the compiling C code a size of _DATA_GROUP_ has 42 bytes but it is insufficiently for my assembler code. I could not reduce the size of _DATA_GROUP.
    Now i ask how can i use the same of DATA space as _DATA_GROUP_ because i know the C code will work at the start my program and then will work assembler code only.
    Or second way how can i make that C code use XDATA space only.
    Thank, Andy.

Reply
  • Yes, Andy. I studied it. I use C and Assembler successful in my Code. But now i have some problem. I made a C code for some task used long long integer values. I use C8051F344 chip. It has 80 DATA space. My assembler code use about 64 bytes DATA space already. When Keil compiles my assembler code with C code it gives a 60 bytes DATA space for _DATA_GROUP_ and the stayed DATA space is insufficiently for my assembler variables.
    I used XDATA space for all C variables. I use stdlib.lib, stdio.lib and string.lib in my C code. After the compiling C code a size of _DATA_GROUP_ has 42 bytes but it is insufficiently for my assembler code. I could not reduce the size of _DATA_GROUP.
    Now i ask how can i use the same of DATA space as _DATA_GROUP_ because i know the C code will work at the start my program and then will work assembler code only.
    Or second way how can i make that C code use XDATA space only.
    Thank, Andy.

Children
  • I Use for my XPOWYMODN.C
    i assebler code:
    myDATA_DATA SEGMENT DATA OVERLABLE;
    ?XD?XPOWYMODN_MAIN SEGMENT XDATA

    in C code i use XDATA for my C variables.
    Memory map of linker are: DATA 0028H 002AH UNIT _DATA_GROUP_ DATA 0052H 0020H UNIT MYSTACK

    and error
    *** ERROR L107: ADDRESS SPACE OVERFLOW SPACE: DATA SEGMENT: MYDATA_DATA LENGTH: 001FH
    How can i force the linker to place MYDATA_DATA in address 0028H with length 001FH without error L107?

  • Some correcting:

    myDATA_BIT SEGMENT BIT;
    myDATA_DATA SEGMENT DATA OVERLAYABLE;
    mySTACK SEGMENT DATA;
    myDATA_IDATA SEGMENT IDATA;
    myData_XDATA SEGMENT XDATA;

    in C code i use XDATA for my C variables.
    Memory map of linker are:

    DATA 0028H 002AH UNIT _DATA_GROUP_
    DATA 0052H 0020H UNIT MYSTACK

    and error

    *** ERROR L107: ADDRESS SPACE OVERFLOW SPACE:
    DATA SEGMENT: MYDATA_
    DATA LENGTH: 001FH

    How can i force the linker to place MYDATA_DATA in address 0028H with length 001FH without error L107?