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

configuring the xdata in the startup.a51

I have assigned 0x0000 to 0xF7FF space to the external RAM and the rest space i.e. 0xF800 to 0xFFFF to the I/O devices. Please advice me on the following:
1) The xdata defination in the target files should be 0-F7FF or 0-FFFF?
2) In the startup.a51 file, what should be the configuration of the XDATA
3) I donot want the compiler to allocate any variable or stack in 0xF800 to 0xFFFF space.
4)Does the _at_ defination makes sure that the data being defined there is not initialized to 0 by the startup.a51 and the init.51 files.

Regards
Mohit

  • I have assigned 0x0000 to 0xF7FF space to the external RAM and the rest space i.e. 0xF800 to 0xFFFF to the I/O devices. Please advice me on the following:

    1) The xdata defination in the target files should be 0-F7FF or 0-FFFF?

    The memory area you specify in the target tab of the project options is the memory area that the linker can use to locate program code and variables. Therefore, the area you specify for XDATA should be 0x0000-0xF7FF.

    2) In the startup.a51 file, what should be the configuration of the XDATA

    The startup code clears the XDATA ram for the range that you specify. If you don't want the startup code to clear ANY of the XDATA, you must specify a 0 for the XDATA size. If you want it to clear your RAM and your memory-mapped devices, specify a size of 0x10000.

    3) I donot want the compiler to allocate any variable or stack in 0xF800 to 0xFFFF space.

    OK. See #1.

    4)Does the _at_ defination makes sure that the data being defined there is not initialized to 0 by the startup.a51 and the init.51 files.

    No. That is done in the startup code.

    Jon

  • Dear Jon,

    Thank you for your valuable suggestions.

    Please clarify the following:

    1) What is the drawback if we donot initialise the XDATA Space to 0 using the startup.a51 file.

    2) If I XRAM is from 0 - 0xF7ff and I want my battery backup variables to reside from 0x8000 - 0xF7FF then should I should specify the XDATALEN as 0x8000 in the startup.a51 file to make sure that this area is not initialized?

    Mohit

  • 1) What is the drawback if we donot initialise the XDATA Space to 0 using the startup.a51 file.

    In C, by default all global uninitialized variables are set to a value of 0. That's what clearing the memory to 0 does. If this is not important, you can leave this out.

    2) If I XRAM is from 0 - 0xF7ff and I want my battery backup variables to reside from 0x8000 - 0xF7FF then should I should specify the XDATALEN as 0x8000 in the startup.a51 file to make sure that this area is not initialized?

    Yep. That's it exactly.

    Jon