Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

pl330 Buffer Overrun in U-Boot with ECC

For anyone who has issues with ECC memory and scrubbing in the U-Boot preloader:

There are some issues with the sdram.c file that ships with the u-boot that comes with Quartus. In general, the buffer sizes for the pl330 DMA initialization are too small for RAM sizes >1 GiB. We are running a Cyclone V with 2 GiB of RAM with ECC, leading to a 40-bit wide interface with two chip selects.

In order to fix the buffer error, it is necessary to choose a buffer size that is dynamically calculated using preloader parameters, or by hard-coding the size in to the preloader. After some testing (see attached), I was able to work out that pl330_buf1 needed to be 2208 words deep. It is also necessary to change the variable used in sdram_scrub_boot_region by removing the "buf" variable and implementing this change on line 1534 in sdram.c:

- pl330.buf_size = sizeof(buf);

- pl330.buf = buf;

+ pl330.buf_size = sizeof(pl330_buf1);

+ pl330.buf = pl330_buf1;

If anyone has any questions about this, just post or send me a note.
No RepliesBe the first to reply