This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Memory problems idata

Hi Ken,

I understand that the 8051 has 256 bytes of internal data. Well, after declaring variables and array's, I get the error

	*** ERROR 107: ADDRESS SPACE OVERFLOW
	    SPACE: DATA
	    SEGMENT: _DATA_GROUP_
	    LENGTH: 0062H
	Target not created

Ok. So, I declare the variables using idata,
Which clears up the Error and allows access to the entire 256 bytes.

Well, the program compiles just fine, but the program is buggy. I'm not sure what the exact problem is, but I know the problem
has to do with memory and not in the code. I know the problem
is in the Memory, because If I delete some of the idata, the
program works. I really don't want to do that. I would like to
be able to use the maximum amount of internal data, but not have
any problems. I just have no how I can.
I must be over-writing memory, but I really shouldn't be.
Do you know what the problem could be?

I don't think the problem lies in variable access time.
I have the following statements,
which doesn't print out the correct MAC adress.
	GetMACInput(strSrcDest);
	printf("MAC Address......... ");
	printf("%02X:", strSrcDest->SrcMAC1 >> 8);
	printf("%02X:", strSrcDest->SrcMAC1 & 0x00FF);
	printf("%02X:", strSrcDest->SrcMAC2 >> 8);
	printf("%02X:", strSrcDest->SrcMAC2 & 0x00FF);
	printf("%02X:", strSrcDest->SrcMAC3 >> 8);
	printf("%02X",  strSrcDest->SrcMAC3 & 0x00FF);
	printf("\r\n");

P.S. I have no xdata just yet.
I plan on upgrading to a PSD (Flash/Sram/Eeprom) chip soon.

Thanks for your help,

Christopher J. Holland
8444 Capricorn Way #2
San Diego, CA. 92126
http://home.san.rr.com/webmain
I listen to doors and look at windows
"Holland is so low, that it is only saved by being damned'

Parents
  • "I am programming in C. I've never looked at registers or Memory space."

    To program a microcontroller in any language, you MUST fully understand the hardware. You need to read the datasheet for your device.

    "Maybe I can somehow figure out how much ram space my code is actually taking without debugging and looking at memory space?"

    If you take a look at the .cod or .lst file assembler outputs in conjunction with the function call tree in the .map file I think you could figure out worst case stack usage by adding two bytes per function for the deepest level of nesting, than adding all the registers pushed in each ISR.

    Stefan

Reply
  • "I am programming in C. I've never looked at registers or Memory space."

    To program a microcontroller in any language, you MUST fully understand the hardware. You need to read the datasheet for your device.

    "Maybe I can somehow figure out how much ram space my code is actually taking without debugging and looking at memory space?"

    If you take a look at the .cod or .lst file assembler outputs in conjunction with the function call tree in the .map file I think you could figure out worst case stack usage by adding two bytes per function for the deepest level of nesting, than adding all the registers pushed in each ISR.

    Stefan

Children
No data