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

"remainder of xdata"

I have a need for making a buffer, the size of which is as large as possible. I know how to do that in assembler; however, not in C. Two ways would work:

1) a pointer to the end of used xdata
2) an array my_array[MAX]

I much prefer method #1, but any method that will give me the desired result will be appreciated.

Thanks,

Erik

Parents
  • Norbert, I have experienced that the Keil will rearrange variables if you change the name of one. I had to sanitize a program where the names were totally meaningless and wanted to do that with a .hex compare to verify that I did not make mistakes. In many instances when I changed a name the sequence of the variables changed.

    If someone knew the algorithm by which this happens, I could probably find a way e. g. if they are just alphasorted I could mame it zzz. However I will not make something that may fall apart when Keil releases a new version.

Reply
  • Norbert, I have experienced that the Keil will rearrange variables if you change the name of one. I had to sanitize a program where the names were totally meaningless and wanted to do that with a .hex compare to verify that I did not make mistakes. In many instances when I changed a name the sequence of the variables changed.

    If someone knew the algorithm by which this happens, I could probably find a way e. g. if they are just alphasorted I could mame it zzz. However I will not make something that may fall apart when Keil releases a new version.

Children
  • Hi eric,

    as far as I know reordering only applies to
    modules, compiled by C51.

    The ORDER-directive turn off reordering:

    #pragma ORDER
    

    However I referred to the ordering of segments:
    the suggested modul only contains 1 symbol, so
    the ordering of this Symbol within it's segment can
    easily be predicted :)

    The Linker processes the OBJ-Files "in the order
    in which they are specified on tthe command-line"
    .
    So the symbol's segment will be processed last if it is
    specified last. The maual doesn't exactly state, that
    it will be allocated last if it is processed last, but I guess
    you can assume this.

    Norbert

  • "but I guess you can assume this"


    That's the problem, I will not make something that may fall apart when Keil releases a new version.

  • Voilà one Reason, why we still use C51 V5.10.
    We are afraid of surprises.

    By the way:
    The assumption is definitely true for the combintion
    of partial code-segments (i.e. constant data in code).
    This is a feature on which Keil itself relies with their
    variable initialization routine ?C_START: a trailing zero
    linked at the end of ?C_INITSEG stops the initialization.
    It is also documented, that the customized STARTUP.A51's
    object file must be the last object file to be specified in
    the command-line.

    By the way. I think I remember that you've said, you have
    an assebler-solution to your problem. But to me this seems to
    be a linker problem, rather than a translator problem.

    So: How do you do it with the assembler?

    Norbert.