Hi Peter & JM thanks for the help. I can confirm that the version below, with a single inline asm instruction works as expected/hoped for. I guess that adding a "nop" after the Clear GIE won't hurt.
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. 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? Best Matthias On 18.04.2011, at 16:51, Peter Bigot wrote: > Doesn't there need to be a nop between the clear of GIE and the > following move? The DINT instruction description in the manual > implies that without it the interrupt could still occur during the > first movx. > > Peter > > On Mon, Apr 18, 2011 at 9:27 AM, JMGross <msp...@grossibaer.de> wrote: >> extern inline __attribute__((always_inline)) unsigned char FlashReadByte >> (unsigned long addr){ >> unsigned char result; >> unsigned int register sr, flash; >> __asm__ __volatile__ ("mov r2 , %1 \n" >> "bic %3 , r2 \n" >> "movx.a %4 , %2 \n" >> "movx.b @%2, %0 \n" >> "mov %1 , r2 \n" >> :"=X"(result),"=r"(sr),"=r"(flash) >> :"i"(GIE),"m"(addr)); >> return result; >> } ------------------------------------------------------------------------------ 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