Forum Discussion
Memory Conflicts in onchip ram
Hi,
There's some mistake in the previous code posted. Done modified as below:
int main() {
int i = 262144;
unsigned int addr;
unsigned int result;
for (addr = BASE_ADDRESS; addr <= 0x40019; addr+=4) {
IOWR_32DIRECT(addr, 0x4, i);
i++;
}
for (result = BASE_ADDRESS; result <= 0x40019; result++ ) {
printf("Address: 0x%x, Value: %d\n", result, IORD_32DIRECT(result, 0x4));
}
printf("Address: 0x40016, Value: %d\n", IORD_32DIRECT(0x40016, 0x4));
printf("Address: 0x40007, Value: %d\n", IORD_32DIRECT(0x40007, 0x4));
return 0;
}
Terminal screenshot below:
Address part is increasing correctly and can read value outside the loop correctly. Ya, you're right can pass directly the numerical value.
You can checkout this link https://fys4220.github.io/part-exercises/exercises_memory_mapped_sw.html on byte-oriented offset for IOWR_32DIRECT and IORD_32DIRECT
Thanks,
Best Regards,
Sheng
- ggxnd3 years ago
New Contributor
Hi,
Thanks.
My question is does the same works for 2MB address location of OCR. What if the end address is increased so that it writes 2MB location?