Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

SDCC overlaps external and internal RAM spaces


I came across a problem where, if you use too much external RAM, it will start to overlap with internal RAM. Just wanted to bring this to everyone’s attention. SDCC does not give any warnings and will just allocate external RAM space past address 0xFF00, which is where internal RAM begins. However, if I use more RAM than the max size, then it will give an error. Here’s a snippet of my “.mem” file.

Other memory:
   Name             Start    End      Size     Max     
   ---------------- -------- -------- -------- --------
   PAGED EXT. RAM   0xf000   0xf0f8     249      256   
   EXTERNAL RAM     0xf000   0xff5d    3685     3840   
   ROM/EPROM/FLASH  0x0000   0x44fe   17663    32768   

To be fair, I am using an old version of SDCC, version 3.2.0, so this may have been fixed in a newer version.


Hello. Thank you for reporting this. I was able to confirm that the bug is still happening in the latest snapshot version of SDCC, and I have reported it to the SDCC team here:


In the meantime, if you want to be sure that your program does not put XDATA variables in invalid locations, I think you could edit the Wixel SDK’s Makefile and change the “–xram-size 0xF00” option to “–xram-size 0xE00”. However, this is not optimal because you would have to fill up the PDATA section if you want to fill up the entire external RAM.