Short version: I have reason to believe that my RAM isn't clearing on startup. It seems to retain its old value even when I reset, reprogram, or power cycle my board. I'm also having trouble writing data to arrays.
I'm working on an HDMI processor with a Zybo Z7-10 board, and I'm trying to overlay some images on my HDMI output. The images are read from an sd card on startup, and stored in the following array, where IMG_SIZE_PIXELS is 74*86*4.
My block diagram has a video mixer core connected between the video dma and the video output. I can write images to the layers inside the video mixer, and then enable/disable the layers to show/hide the images. This configuration worked, I was able to load my images from the sd card, display them on the output screen (below), and even change it on the fly.
Spoiler
I then declared a new array and initialized it by looping through every element and setting it to 0. I then wrote it to one of my video layers.
static uint8_t asdf[IMG_SIZE_PIXELS] __attribute__((aligned(0x20)));
for (i = 0; i < IMG_SIZE_PIXELS; i += 4)
{
asdf[i + 0] = 0;
asdf[i + 1] = 0;
asdf[i + 2] = 0;
asdf[i + 3] = 0;
}
The resulting image (below) is a noisy version of the original image, loaded from the sd card. Even when i completely disabled the sd card code, physically removed the sd card, and even power cycled the board, I can still see the old image. I expect to see a black block, since I set all the elements of the array to 0. According to the debugger, every element of this array was indeed set to 0. It seems like the old image data was written to some form of non volatile memory.
When I try running the code what reads the images from the sd card and outputs it to the screen, it seems to work fine. If I disable that code and write my own array that I've initialized to all zeros, it still outputs the old image.
Spoiler
One thing I should mention is that I've greatly increased the size of my stack and heap to 0xFFFFF and 0xFFFF respectively. Although the stack and heap both live in RAM, and shouldn't write to any form of non volatile memory.
Question
aytli
Short version: I have reason to believe that my RAM isn't clearing on startup. It seems to retain its old value even when I reset, reprogram, or power cycle my board. I'm also having trouble writing data to arrays.
I'm working on an HDMI processor with a Zybo Z7-10 board, and I'm trying to overlay some images on my HDMI output. The images are read from an sd card on startup, and stored in the following array, where IMG_SIZE_PIXELS is 74*86*4.
static uint8_t digits[10][IMG_SIZE_PIXELS] __attribute__((aligned(0x20)));
My block diagram has a video mixer core connected between the video dma and the video output. I can write images to the layers inside the video mixer, and then enable/disable the layers to show/hide the images. This configuration worked, I was able to load my images from the sd card, display them on the output screen (below), and even change it on the fly.
I then declared a new array and initialized it by looping through every element and setting it to 0. I then wrote it to one of my video layers.
static uint8_t asdf[IMG_SIZE_PIXELS] __attribute__((aligned(0x20))); for (i = 0; i < IMG_SIZE_PIXELS; i += 4) { asdf[i + 0] = 0; asdf[i + 1] = 0; asdf[i + 2] = 0; asdf[i + 3] = 0; }
The resulting image (below) is a noisy version of the original image, loaded from the sd card. Even when i completely disabled the sd card code, physically removed the sd card, and even power cycled the board, I can still see the old image. I expect to see a black block, since I set all the elements of the array to 0. According to the debugger, every element of this array was indeed set to 0. It seems like the old image data was written to some form of non volatile memory.
When I try running the code what reads the images from the sd card and outputs it to the screen, it seems to work fine. If I disable that code and write my own array that I've initialized to all zeros, it still outputs the old image.
One thing I should mention is that I've greatly increased the size of my stack and heap to 0xFFFFF and 0xFFFF respectively. Although the stack and heap both live in RAM, and shouldn't write to any form of non volatile memory.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.