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
"2) an array my_array[MAX]" Or, how about just my_array[], and make sure that the linker locates it last - is that possible?
an array my_array[MAX] would allow locating it anywhere. Erik
Maybe if it is at the end of the last object-File to be linked: eofiles.c
unsigned char last_xdata_byte[1];
extenr unsigned char last_xdata_byte[];
L51.EXE [all the obj-files to be linked],EOFILES.OBJ
#define MAX_GAP_SIZE 0 unsigned char last_xdata_byte[MAX_GAP_SIZE+1];
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.
Hi eric, as far as I know reordering only applies to modules, compiled by C51. The ORDER-directive turn off reordering:
#pragma ORDER
"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.