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 class question

Is it possible to place some critical variables, as near memory type, in the on-chip 1K memory, yet other non-critical variables, still declared as near memory type, in the external memory? In other words, how do you explicitly place two variables, both declared as near, into two seperate memory spaces - on-chip 1k and external memory?

  • You have 2 groups of XDATA:
    INT: 0x0000-0x3FFF
    EXT: 0x0400-0xFFFF

    Here is one way. Declare all the xdata variables that you want to be located in memory space EXT in one file, say "ExtDecl.c".

    Then in the "BL51 Locate" options tab of the project options add "?XD?EXTDECL(0x0400)", with no quotes, to the XDATA line. This tells the linker to take all xdata variables found in ExtDecl and to start placing them at location 0x400.

  • Sorry I forgot to mention this is 251 part.
    Access to XDATA is much slower than access to "near" memory. It is accessed indirectly through the data pointer(DPTR) while access to near is using direct addressing.
    I could use SEGMENTS directive to place particular segment in the memory space I wanted, but with quite few files in the project, this way is very painful.