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):
u8 reg8, spd_data;
reg8 = pci_read_config8(PCI_DEV(0, 0, 3), 0x62); spd_data = smbus_read_byte(0x50, 30); spd_data = spd_data / 10; if(spd_data < 5) spd_data = 5; else if(spd_data > 20) spd_data = 20;
if(spd_data > (reg8 >> 4)) { reg8 &= 0xf; reg8 |= (spd_data << 4); }
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:
dst type: auto unsigned char dst: %edx:%eax auto.c:35.1: raminit.c:436.33: raminit.c:615.36: auto.c:218.32: 0x83cbe70 convert Internal compiler error: failed to trunc value: mask ff make[1]: *** [auto.inc] Aborted (core dumped)
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:
reg8 = pci_read_config8(ctrl->d0f3, 0x63); j = spd_read_byte(ctrl->channel0[i], SPD_tRRD);//ctrl->channel0[0] = 0x50 spd_data = ((j >> 2) * 100); spd_data |= ((j & 0x3) * 25); spd_data = spd_data / (ram_cycle * 100); //ram_cycle in this case = 10 if(spd_data < 2) spd_data = 2; else if(spd_data > 5) spd_data = 5;
if((spd_data - 2) > (reg8 >> 6)) { reg8 &= 0x3f; reg8 |= (spd_data - 2) << 6; }
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?
Cory, I don't know what the error means. Others might know more but I can make some recommendations for you to try. 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.
Marc
Corey Osgood wrote:
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):
u8 reg8, spd_data;
reg8 = pci_read_config8(PCI_DEV(0, 0, 3), 0x62); spd_data = smbus_read_byte(0x50, 30); spd_data = spd_data / 10; if(spd_data < 5) spd_data = 5; else if(spd_data > 20) spd_data = 20;
if(spd_data > (reg8 >> 4)) { reg8 &= 0xf; reg8 |= (spd_data << 4); }
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:
dst type: auto unsigned char dst: %edx:%eax auto.c:35.1: raminit.c:436.33: raminit.c:615.36: auto.c:218.32: 0x83cbe70 convert Internal compiler error: failed to trunc value: mask ff make[1]: *** [auto.inc] Aborted (core dumped)
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:
reg8 = pci_read_config8(ctrl->d0f3, 0x63); j = spd_read_byte(ctrl->channel0[i], SPD_tRRD);//ctrl->channel0[0]
= 0x50 spd_data = ((j >> 2) * 100); spd_data |= ((j & 0x3) * 25); spd_data = spd_data / (ram_cycle * 100); //ram_cycle in this case = 10 if(spd_data < 2) spd_data = 2; else if(spd_data > 5) spd_data = 5;
if((spd_data - 2) > (reg8 >> 6)) { reg8 &= 0x3f; reg8 |= (spd_data - 2) << 6; }
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?
In addition, you could try using "unsigned" instead of "u8"... I think romcc is kind of bad at handling different data types and it handles all sizes equally (ie. using u8 does not gain you the rest of the register you are using)
Marc Jones wrote:
Cory, I don't know what the error means. Others might know more but I can make some recommendations for you to try. 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.
Marc
Corey Osgood wrote:
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):
u8 reg8, spd_data;
reg8 = pci_read_config8(PCI_DEV(0, 0, 3), 0x62); spd_data = smbus_read_byte(0x50, 30); spd_data = spd_data / 10; if(spd_data < 5) spd_data = 5; else if(spd_data > 20) spd_data = 20;
if(spd_data > (reg8 >> 4)) { reg8 &= 0xf; reg8 |= (spd_data << 4); }
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:
dst type: auto unsigned char dst: %edx:%eax auto.c:35.1: raminit.c:436.33: raminit.c:615.36: auto.c:218.32: 0x83cbe70 convert Internal compiler error: failed to trunc value: mask ff make[1]: *** [auto.inc] Aborted (core dumped)
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:
reg8 = pci_read_config8(ctrl->d0f3, 0x63); j = spd_read_byte(ctrl->channel0[i], SPD_tRRD);//ctrl->channel0[0]
= 0x50 spd_data = ((j >> 2) * 100); spd_data |= ((j & 0x3) * 25); spd_data = spd_data / (ram_cycle * 100); //ram_cycle in this case = 10 if(spd_data < 2) spd_data = 2; else if(spd_data > 5) spd_data = 5;
if((spd_data - 2) > (reg8 >> 6)) { reg8 &= 0x3f; reg8 |= (spd_data - 2) << 6; }
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?
On Wed, Apr 2, 2008 at 5:12 PM, Stefan Reinauer stepan@coresystems.de wrote:
In addition, you could try using "unsigned" instead of "u8"... I think romcc is kind of bad at handling different data types and it handles all sizes equally (ie. using u8 does not gain you the rest of the register you are using)
Thanks, unsigned int/long, u16/u32, and int/long all still produce the same error (including the auto unsigned char part).
-Corey
Marc Jones wrote:
Cory, I don't know what the error means. Others might know more but I can make some recommendations for you to try. 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.
Marc
Corey Osgood wrote:
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):
u8 reg8, spd_data;
reg8 = pci_read_config8(PCI_DEV(0, 0, 3), 0x62); spd_data = smbus_read_byte(0x50, 30); spd_data = spd_data / 10; if(spd_data < 5) spd_data = 5; else if(spd_data > 20) spd_data = 20;
if(spd_data > (reg8 >> 4)) { reg8 &= 0xf; reg8 |= (spd_data << 4); }
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:
dst type: auto unsigned char dst: %edx:%eax auto.c:35.1: raminit.c:436.33: raminit.c:615.36: auto.c:218.32: 0x83cbe70 convert Internal compiler error: failed to trunc value: mask ff make[1]: *** [auto.inc] Aborted (core dumped)
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:
reg8 = pci_read_config8(ctrl->d0f3, 0x63); j = spd_read_byte(ctrl->channel0[i], SPD_tRRD);//ctrl->channel0[0] = 0x50 spd_data = ((j >> 2) * 100); spd_data |= ((j & 0x3) * 25); spd_data = spd_data / (ram_cycle * 100); //ram_cycle in this case = 10 if(spd_data < 2) spd_data = 2; else if(spd_data > 5) spd_data = 5;
if((spd_data - 2) > (reg8 >> 6)) { reg8 &= 0x3f; reg8 |= (spd_data - 2) << 6; }
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?
-- coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br. Tel.: +49 761 7668825 • Fax: +49 761 7664613 Email: info@coresystems.de • http://www.coresystems.de/ Registergericht: Amtsgericht Freiburg • HRB 7656 Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
On Wed, Apr 02, 2008 at 05:59:16PM -0400, Corey Osgood wrote:
On Wed, Apr 2, 2008 at 5:12 PM, Stefan Reinauer stepan@coresystems.de wrote:
In addition, you could try using "unsigned" instead of "u8"... I think romcc is kind of bad at handling different data types and it handles all sizes equally (ie. using u8 does not gain you the rest of the register you are using)
Thanks, unsigned int/long, u16/u32, and int/long all still produce the same error (including the auto unsigned char part).
Try -mcpu=p2 (or other values) in romcc, e.g.
action "./romcc -mcpu=p2 -E -O -I$(TOP)/src -I. $(CPPFLAGS) $(MAINBOARD)/auto.c -o $@"
That helped last time I had the same problem. Depends on which CPU/chipset you use, of course.
Uwe.
On Wed, Apr 2, 2008 at 6:10 PM, Uwe Hermann uwe@hermann-uwe.de wrote:
On Wed, Apr 02, 2008 at 05:59:16PM -0400, Corey Osgood wrote:
On Wed, Apr 2, 2008 at 5:12 PM, Stefan Reinauer stepan@coresystems.de wrote:
In addition, you could try using "unsigned" instead of "u8"... I think romcc is kind of bad at handling different data types and it handles
all
sizes equally (ie. using u8 does not gain you the rest of the register
you
are using)
Thanks, unsigned int/long, u16/u32, and int/long all still produce the
same
error (including the auto unsigned char part).
Try -mcpu=p2 (or other values) in romcc, e.g.
action "./romcc -mcpu=p2 -E -O -I$(TOP)/src -I. $(CPPFLAGS) $(MAINBOARD)/auto.c -o $@"
That helped last time I had the same problem. Depends on which CPU/chipset you use, of course.
Uwe.
c3, c3-2, p2, p3, and p4 all give the same error. Same applies when -mmmx and/or -msse are added. -fdebug-all gives the same error too, no more info
Thanks, Corey
On undefined, Corey Osgood corey.osgood@gmail.com wrote:
On Wed, Apr 2, 2008 at 6:10 PM, Uwe Hermann uwe@hermann-uwe.de wrote:
On Wed, Apr 02, 2008 at 05:59:16PM -0400, Corey Osgood wrote:
On Wed, Apr 2, 2008 at 5:12 PM, Stefan Reinauer <stepan@coresystems.de
wrote:
In addition, you could try using "unsigned" instead of "u8"... I
think
romcc is kind of bad at handling different data types and it handles
all
sizes equally (ie. using u8 does not gain you the rest of the
register you
are using)
Thanks, unsigned int/long, u16/u32, and int/long all still produce the
same
error (including the auto unsigned char part).
Try -mcpu=p2 (or other values) in romcc, e.g.
action "./romcc -mcpu=p2 -E -O -I$(TOP)/src -I. $(CPPFLAGS) $(MAINBOARD)/auto.c -o $@"
That helped last time I had the same problem. Depends on which CPU/chipset you use, of course.
Uwe.
c3, c3-2, p2, p3, and p4 all give the same error. Same applies when -mmmx and/or -msse are added. -fdebug-all gives the same error too, no more info
Thanks, Corey
Huh, well, the problem's gone now. I have no idea why it worked, but I changed the smbus functions along with the spd_read_byte wrapper from returning a u8 to an int. Makes no sense, but it works.
-Corey
On Wed, Apr 2, 2008 at 5:07 PM, Marc Jones Marc.Jones@amd.com wrote:
Cory, I don't know what the error means. Others might know more but I can make some recommendations for you to try. 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.
Marc
Thanks, tried all 3, still exactly the same error.
-Corey
Corey Osgood wrote:
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):
u8 reg8, spd_data;
reg8 = pci_read_config8(PCI_DEV(0, 0, 3), 0x62); spd_data = smbus_read_byte(0x50, 30); spd_data = spd_data / 10; if(spd_data < 5) spd_data = 5; else if(spd_data > 20) spd_data = 20;
if(spd_data > (reg8 >> 4)) { reg8 &= 0xf; reg8 |= (spd_data << 4); }
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:
dst type: auto unsigned char dst: %edx:%eax auto.c:35.1: raminit.c:436.33: raminit.c:615.36: auto.c:218.32: 0x83cbe70 convert Internal compiler error: failed to trunc value: mask ff make[1]: *** [auto.inc] Aborted (core dumped)
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:
reg8 = pci_read_config8(ctrl->d0f3, 0x63); j = spd_read_byte(ctrl->channel0[i], SPD_tRRD);//ctrl->channel0[0] = 0x50 spd_data = ((j >> 2) * 100); spd_data |= ((j & 0x3) * 25); spd_data = spd_data / (ram_cycle * 100); //ram_cycle in this case = 10 if(spd_data < 2) spd_data = 2; else if(spd_data > 5) spd_data = 5;
if((spd_data - 2) > (reg8 >> 6)) { reg8 &= 0x3f; reg8 |= (spd_data - 2) << 6; }
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?
-- Marc Jones Senior Firmware Engineer (970) 226-9684 Office mailto:Marc.Jones@amd.com http://www.amd.com/embeddedprocessors
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:
dst type: auto unsigned char dst: %edx:%eax auto.c:35.1: raminit.c:436.33: raminit.c:615.36: auto.c:218.32: 0x83cbe70 convert Internal compiler error: failed to trunc value: mask ff make[1]: *** [auto.inc] Aborted (core dumped)
Please try with FSF GCC 4.3.0, and report any failures at http://gcc.gnu.org/bugzilla . If 4.3.0 works, try 4.2.3 and maybe 4.1.2. Thanks!
Segher