From: Fabio G. <fab...@au...> - 2007-04-19 10:04:08
|
Hi all, I have found the following problem. I'm using gcc 3.2.3 hms for sh target; in particular I'm using the c compiler (gcc without g++) and Icompiled 3.2.3 - hms version without any patch. On sh2 7145 and 7044 I had no problem; now I'm porting a software on sh2 7085 (7080 family; http://eu.renesas.com/fmwk.jsp?cnt=sh7080_series_landing.jsp&fp=/products/mpumcu/superh_family/sh7080_series/) and I discovered such a problem: I have this struct describing the AD converter registers: struct st_ad0 { /* struct A/D0 */ unsigned short ADDR0; /* ADDR0 */ unsigned short ADDR1; /* ADDR1 */ unsigned short ADDR2; /* ADDR2 */ unsigned short ADDR3; /* ADDR3 */ char wk1[8]; /* */ union { /* ADCSR */ unsigned short WORD; /* Word Access */ struct { /* Bit Access */ unsigned short ADF :1; /* ADF */ unsigned short ADIE :1; /* ADIE */ unsigned short :2; /* */ unsigned short TRGE :1; /* TRGE */ unsigned short :1; /* */ unsigned short CONADF:1; /* CONADF */ unsigned short STC :1; /* STC */ unsigned short CKSL :2; /* CKSL */ unsigned short ADM :2; /* ADM */ unsigned short ADCS :1; /* ADCS */ unsigned short CH :3; /* CH */ } BIT; /* */ } ADCSR; /* */ union { /* ADCR */ unsigned short WORD; /* Word Access */ struct { /* Bit Access */ unsigned short :2; /* */ unsigned short ADST:1; /* ADST */ } BIT; /* */ } ADCR; /* */ char wk2[8060]; /* */ union { /* ADTSR */ unsigned short WORD; /* Word Access */ struct { /* Bit Access */ unsigned short :4; /* */ unsigned short TRG01S:4; /* TRG01S */ unsigned short :4; /* */ unsigned short TRG0S :4; /* TRG0S */ } BIT; /* */ } ADTSR; /* */ }; /* */ Reading the hw manual you can see ADCSR is a register accessible only as word (16 bit) so the only assembler allowed istruction to access the register is MOV.W; Obviusly if I write AD0.ADCSR.WORD |= BIT14 or AD0.ADCSR.WORD &= ~BIT14 what I read in assembler is correct; if I write AD0.ADCSR.BIT.ADIE = 1 or AD0.ADCSR.BIT.ADIE = 0 in assembler is used a MOV.B instruction being not allowed by the architecture. Is this a complier bug? How could I approach the problem? Obviusly I can avoid the bit field manupulation in the 16 bit access register but I'd like to have a full featured compiler. Thanks -- Fabio Giovagnini Aurion s.r.l. via degli orti 11, 40050 Funo di Argelato (BO) Tel. +39.335.8350919 Fax +39.051.8659009 www.aurion-tech.com account telefono VoIP skype (www.skype.com): aurion.giovagnini |