From: Russel W. <ru...@ru...> - 2001-08-25 10:56:21
|
By way of Bug Report 454266, Toni R=E4s=E4nen and myself have been having a short discussion about the way in which SDCC deals with array data initialization. I had thought that was the wrong forum for the debate and Toni stated this explicitly, so I am writing this email. Discussion started from the following program: char xdata x [] =3D=20 { 'a', 'b', 'c' }; =20 int main(){ } =20 which generates the code: 000D 90s00r00 79 mov dptr,#_x 0010 74 61 80 mov a,#0x61 0012 F0 81 movx @dptr,a 0013 90s00r01 82 mov dptr,#(_x + 0x0001) 0016 74 62 83 mov a,#0x62 0018 F0 84 movx @dptr,a 0019 90s00r02 85 mov dptr,#(_x + 0x0002) 001C 74 63 86 mov a,#0x63 001E F0 87 movx @dptr,a I was making the point that to use assignment to initialize xdata seems unreasonable since the data values and the code have to be stored in code memory and then transferred to xdata whereas using the Intel Hex Dowload file (or S-Record dowload file) the values could be initialized without recourse to code. If the array is put into the code segment, or made const, then the compiler uses initialization rather than assignment but puts the information in the code segment rather than xdata. The problem I have is that the 8051 based system I am involved with has RAM, EEPROM and ROM in the xdata space. Clearly I cannot use assignemnt for the ROM which is where most of the xdata is. ROM here is not real ROM but flash silicon so it is actually OTP memory. This means it is entirely appropriate for the code to hold the initialization data (as opposed to doing separate creation as would be done for ROM) but it seems SDCC has no mechanisms for dealing with the fact that xdata is not of homogeneous form, i.e. not all RAM. I hope Toni sees this as a fair restatement of the problem. Now it is really open for debate. Is this a problem unique to me or is it something others are having problems with? Have others found techniques? (I was wodnering whether some form of linker script mechanism =E0 la GCC would be appropriate.) --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder +44 20 7585 2200 41 Buckmaster Road +44 7770 465 077 London SW11 1EN, UK ru...@ru... |