On Wed, Apr 2, 2008 at 5:07 PM, Marc Jones <<a href="mailto:Marc.Jones@amd.com">Marc.Jones@amd.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Cory,<br>
I don't know what the error means. Others might know more but I can make some recommendations for you to try.<br>
ROMCC problems are usually a stack depth problem. ROMCC is using registers for stack space so every function call uses up registers. The code around this code will have a big effect if this code will work. First try to inline the code (ROMCC might already be doing this). Next, try moving the pci read to after the math so the value doesn't need to be stored before it is used.<br>

<br>
Marc<br><div><div class="Wj3C7c"></div></div></blockquote><div><br>Thanks, tried all 3, still exactly the same error.<br><br>-Corey<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div class="Wj3C7c"><br>
Corey Osgood wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Working with romcc here, you can drop this block of code into the auto.c/raminit portion of any board using romcc and reproduce the error (it compiles fine with CAR, but that's not an option with the c7 cpu, at least not yet):<br>

<br>
u8 reg8, spd_data;<br>
<br>
reg8 = pci_read_config8(PCI_DEV(0, 0, 3), 0x62);<br>
spd_data = smbus_read_byte(0x50, 30);<br>
spd_data = spd_data / 10;<br>
if(spd_data < 5)<br>
    spd_data = 5;<br>
else if(spd_data > 20)<br>
    spd_data = 20;<br>
<br>
if(spd_data > (reg8 >> 4))<br>
{<br>
   reg8 &= 0xf;<br>
   reg8 |= (spd_data << 4);<br>
}<br>
<br>
The error is confirmed on ubuntu 8.04 alpha/beta/? and debian unstable, both with gcc 4.2.3, and also gentoo with gcc 4.1.2:<br>
<br>
dst type: auto unsigned char<br>
dst: %edx:%eax<br>
auto.c:35.1: raminit.c:436.33: raminit.c:615.36: auto.c:218.32:<br>
0x83cbe70 convert    Internal compiler error: failed to trunc value: mask ff<br>
make[1]: *** [auto.inc] Aborted (core dumped)<br>
<br>
Commenting out either spd_data/10 or the if/else portion gets rid of the error, it only happens when all of these statements are in. I also have half a dozen blocks like this which compile fine:<br>
<br>
    reg8 = pci_read_config8(ctrl->d0f3, 0x63);<br>
    j = spd_read_byte(ctrl->channel0[i], SPD_tRRD);//ctrl->channel0[0] = 0x50<br>
    spd_data = ((j >> 2) * 100);<br>
    spd_data |= ((j & 0x3) * 25);<br>
    spd_data = spd_data / (ram_cycle * 100); //ram_cycle in this case = 10<br>
    if(spd_data < 2)<br>
        spd_data = 2;<br>
    else if(spd_data > 5)<br>
        spd_data = 5;<br>
<br>
    if((spd_data - 2) > (reg8 >> 6)) {<br>
        reg8 &= 0x3f;<br>
        reg8 |= (spd_data - 2) << 6;<br>
    }<br>
<br>
It's just that one instance that fails to compile. I've tried moving it around, changing the variables, changing the types, modifying the math, etc, etc, and nothing seems to help. Any suggestions?<br>
</blockquote>
<br></div></div><font color="#888888">
-- <br>
Marc Jones<br>
Senior Firmware Engineer<br>
(970) 226-9684 Office<br>
mailto:<a href="mailto:Marc.Jones@amd.com" target="_blank">Marc.Jones@amd.com</a><br>
<a href="http://www.amd.com/embeddedprocessors" target="_blank">http://www.amd.com/embeddedprocessors</a><br>
<br>
<br>
</font></blockquote></div><br>