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

variable pattern in sram

I've one global pointer to a register in one c-file. This variable is stored in the sram at the position (shown in the symbol window) - e.g. 0x00100000. But when I take a look into the memory window I can see this variable at 0x00100000, 0x00110000, 0x00120000, 0x00130000 and so on. What's the reason for this?

The header file is included in this c-file and in another c-file calling one function.

When I commend out this variable I don't see this pattern in the sram - but I can see a few other pattern where's the same problem (with maybe librarys). In both c-files I include the same librarys.

thanks in advance
JChris

Parents
  • The variable is stored in the internal RAM.

    The result is that you will get aliasing, where you will see multiple full copies of the RAM directly following each other.

    But I won't get in trouble if I store more variables in the internal RAM, so that the multiple copies will be overlayed themselves?

    JChris

Reply
  • The variable is stored in the internal RAM.

    The result is that you will get aliasing, where you will see multiple full copies of the RAM directly following each other.

    But I won't get in trouble if I store more variables in the internal RAM, so that the multiple copies will be overlayed themselves?

    JChris

Children
  • In a situation where you have aliasing (such as a 2kB RAM showing up 4 times after each other in a 8kB memory area) you will not get into any problems if you only use 2kB variables. As soon as you try to use more than 2kB, writes past the 2kB limit will roll ower and destroy other variables.

    The datasheet for your chip will tell you how much internal RAM it has. If you have RAM aliasing, then the aliasing distance should be a multiple of the RAM size.

  • thanks for your explanation - now I understand what you mean. The size for the SRAM is much bigger than the SRAM really is, so the values of the SRAM will be shown several times.

    JChris

  • Yes, it is quite common (at least for "bigger" processors) that the allocated space is a lot larger than the actual amount of RAM.

    The ARM has 4GB of address space. Because of this, they may allocate a huge memory range for RAM. Then they release a number of specific models with varying amount of RAM and/or FLASH.