Memory Region Lock

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i started my project with at32uc3 and interfacing with external SRAM capacity of 1mb. In sram i want to allocate half 512kb for storing input values and another 512kb for storing output values. While storing these values memory overlapping can happen, so i need to overcome overlapping the values. How to divide memory region and lock them? is there any built-in function? tell me to lock it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

so i need to overcome overlapping the values

Surely this technique works on any CPU?:

uint8_t *p, *q;
p = (uint8_t *) 0x123;
q = (uint8_t *) 0x124;
for (int i=0; i<10; i++) {
  *p = *q;
}

The regions overlap! What you can't obviously do is:

uint8_t p[10] @ 0x123;
uint8_t q[10] @ 0x124;
for (int i=0; i<10; i++) {
  p[i] = q[i];
}

because any attempt to place p[] and q[] at overlapping addresses would cause a linker error. But surely with freely assigned pointers you can do it?