I am trying to use Hifive unleashed as bare metal platform. Using the openocd gdb server, I can connect to it, load the executable using gdb and run it. It seems to work fine. But I observed that if my executable exceeds 128K, the load seems to zero out the memory in the start. I was able to produce the same issue on openocd console. Please see the example below. I write a word on 0x80000000 and it goes ok. But when I write something on 0x80020000, it seems to zero out the contents on 0x80000000.
mww 0x80000000 0x10101010
mww 0x80020000 0xff
I thought that it may be some issue with openocd. Then I wrote a C program which repeats this pattern and observed that memory zeroed out there too. Anybody else observed a similar issue. Am I missing some memory initialization? Any help is greatly appreciated.