I am working to port older code to an Atmel AT89C51AC3, I have the system basically running but have run out of data space while tweaking the code to handle timing constraints. The AT89C51AC3 has 2048 bytes of ERAM that I was expecting to be able to use, but I have not found the correct compiler and/or linker configuration to get it working. I have seen comments in other threads that state BOTH:
- PDATA and XDATA can be used together
- PDATA and XDATA can NOT be used together
The code as I received it had EXTRAM set, thereby disabling the internal ERAM (I believe) and expecting those addresses to be supported by external XRAM. The hardware does not have external RAM, but it does use pdata variables to access other peripherals via the address and data busses.
If I just add the xdata directive to the new variables that put me over the available data space, the compiler/linker is happy. The memory map shows my new variables in the X: segment with addresses just following the previously existing pdata variables. However, the code does not work as there is no actual memory there to access.
If I clear EXTRAM, then my code does not run at all.
The STARTUP.A51 (as received) includes:
XDATASTART EQU 0H XDATALEN EQU 0H PDATASTART EQU 0H PDATALEN EQU 6H IBPSTACK EQU 1 IPBSTACKTOP EQU 0FFH+1 PPAGEENABLE EQU 1 PPAGE EQU 0
My attempts to enable the internal ERAM and set XDATASTART & XDATALEN have not yielded a workable solution.
Can anyone tell me what I have missed? Where should XDATASTART if I want to maintain the existing PDATA location? Should XDATALEN match the value I set in XRS2-0 as the amount of internal ERAM to actually use?
Thank you for any thoughts. .Tim