Hi Matthias, ----- Ursprüngliche Nachricht ----- Von: Matthias Ringwald An: Peter Bigot; JMGross Gesendet am: 18 Apr 2011 22:28:41
> I guess that adding a "nop" after the Clear GIE won't hurt. I'd be surprised, if. :) > Another question: Is there a way to get the address of data stored above 64kB? > For now, I'm fine just assuming that my table starts at 0x10000, but if there > would be multiple tables I would need to > calculate other addresses by a series of sizeof() operations. There is, with a trick: First, you need to place the array in the uppe rmemory. On mspgcc3.2.3, I did it by placinf the dat ainto the .fartext segment manually: const char __attribute__ ((section(".fartext"))) fardata[128]={9,8,7,6,5,4,3,2,1,0}; Then you can use the asm instruction to 'fetch' it into a long variable: unsigned long int longvar; __asm__ __volatile__ ( "movx.a %1,%0":"=m"(longvar):"i"(fardata)); While the 'i' fails for constants, it works fine for everything that is resolved at link stage. The linker inserts the 20 bit value properly into the instruction and the compiler (not knowing that there could be a 20 bit reference) doesn't put an #llo() around it. Here the 'lazyness' of the programmer finally produces something good :) but be careful: the linker does not complain when the assembly instruction does not take 20 bit operands. It will silently cut off the upper 4 bits then. > Finally, a maybe related one: I got an error trying to declare an array with > over 32k bytes/items. In my code, I can also split it into two arrays and > access them one after another, or, even assume that > there's no padding bytes in the middle, directly use FlashReadByte function. > What's the reason for the limitation? Is this a consequence of the 16-bit > architecture? As Peter already explained, this is because of the internal usage of signed ints for the index. (yes, an index into an array can be negative, even if nobody ever uses it). So the maximum index value is 32767, which means 32768 elements. Without 20 bit poitners, you could never reach element #32769. JMGross ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users