Atmel's flash api is almost ported from keil to SDCC, but I need some help with this last function. Keil has a support for DPTR and I'm not quite sure what would be the best way to replace lines that are using DPTR?
Uchar __api_wr_eeprom_page (Uint16 add_eeprom, Uint16 add_xram, Uchar nb_data) small
ea_save = EA;
// write column latch
DPTR = add_xram;
AUXR1++; /* DPTR=DPTR1 */
DPTR = add_eeprom;
EECON |= 0x02;
*((Uchar xdata*)DPTR) = ACC;
EECON = 0x50; // write 5x, clear 2nd LSb
EECON^= 0x50; // write Ax
EA=ea_save; // restore interrupt state
I see 2 options:
1) forget about the dual dptr and rewrite for normal pointers (e.g. Uchar xdata* ptr1; Uchar xdata* ptr2)
2) rewrite in inline assembly.
There's no automatic solution I think
Thanks again Maarten. I got it work with normal pointers. So, now atmel's flash api is compiled with sdcc and it seems to work also. I can share it if somebody is interested.
I guess if someone is interested it will be Thorsten Godau. He runs the SDCC Open Knowledge Base at http://sdccokr.dl9sec.de/ with lots of sample code.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.