Hi,
The cinit_t structure members are read from the program memory, they are never written. I still think that __code qualifier is ok.
Yep, we just need the symbol to find the cinit-structure in ROM.
Has anybody investigated in which svn revision the bug appeared? If it was really in rev. 7080, then it is an ugly side effect of optralloc branch merge :-(
Nope, I did not (yet) search for the first bad revision.
I think this should be fixed ASAP, before the RC2 release, so any help is welcome. Raphael, can you please take a look to this problem?
Done. Please find a patch against r7955 attached.
; .line 76; "../idata.c" cptr = &cinit.entry[0]; MOVLW high (_cinit + 2) MOVWF r0x1002 MOVLW (_cinit + 2) MOVWF r0x1003 MOVLW 0x80 MOVWF r0x1004
Similar code is generated once the above patch is applied.The code gerenator is/was confusing address calculations and data manipulations: Do we want to read the byte at _cinit and add 2 to the value found there *xor* do we want to read the byte at address (_cinit + 2)?
If anyone with a sufficiently large PIC14 program could confirm that this (a) actually does fix the problem and (b) does not break other stuff, that would be great. I can confirm that the fix is executed only twice in the PIC14 library code: only in libsdcc/{regular,enhanced}/idata.c. But due to the limited code base, this does not tell us too much.
You can compile your projects with --debug-xtra to see messages like idata.c:76: CHECK: using address of '_cinit' instead of contents whenever the fix is used during code generation. Raphael
cinit-fix.patch
Description: Binary data
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user