bugAVR C Runtime Library - Bugs: bug #28108, bug with winavr20090313

 
 

bug #28108: bug with winavr20090313

Submitted by:  Brn Gomes <unknwn>
Submitted on:  Fri 27 Nov 2009 06:40:01 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: InvalidPercent Complete: 0%
Assigned to: NoneOpen/Closed: Closed
Release: 1.6.6Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 09 Jun 2010 09:31:35 AM UTC, comment #5:

The resulting code snippet when compiling the code from the
attachment here using GCC 4.3.4 is:

So closing this as being fixed in GCC now (it's "invalid"
with respect to the scope of avr-libc anyway, as this has been
a compiler issue).

Joerg Wunsch <joerg_wunsch>
Project Administrator
Wed 13 Jan 2010 08:10:29 AM UTC, comment #4:

This bug has been discussed extensively in the avrfreaks.net thread to which the link is given in the original bugreport.

It has been confirmed that while the given code DOES result in erratic binary, reducing the given code results in correct code.

It has also been noted that this might be the same error than http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37466 , which is said to be fixed in gcc 4.3.3

So, some of the principal developers could perhaps try and confirm that gcc 4.3.3 fixes this bug, too. Then there's no point to submit a duplicate bugreport to an already fixed bug into the gcc bugtracker.

JW

Jan Waclawek <wek>
Wed 13 Jan 2010 05:06:27 AM UTC, comment #3:

Please be succinct in describing the problem, and why you think this is a bug in avr-libc. If you think the problem is in the compiler then you need to submit a bug to the GCC project here:
http://gcc.gnu.org/

If you think it is a problem with avr-libc, then please provide a small compilable test case that shows the problem, with instructions on how to reproduce the problem.

Eric Weddington <arcanum>
Project Administrator
Mon 30 Nov 2009 11:23:57 AM UTC, comment #2:

brief problem summary:

I'm having a sort of a "bug" after compiling with winavr 2009-03-13 because i noticed that i wasn't receiving one specific CAN message for some reason. The reason was the msg_id on the transmitter was not correct so the receiver didn't "caught" any because the ID were diferent. But the main problem was that in code C was everything perfect but when I saw the assembly, there was some wrong stuff there (see below please).
The ID is a #define and for some reason r16 is wrongly changed into the last ID byte... making an erroneous ID.

Brn Gomes <unknwn>
Mon 30 Nov 2009 11:17:46 AM UTC, comment #1:

If I want a CAN msg with ID=0xFDFFFFF0 on msg2

it sends

ID=0xFDFDFFF0....

#define TEST_CAN_MSG1_ID 0xFDFFFFE0L
#define TEST_CAN_MSG2_ID 0xFDFFFFD0L
#define TEST_CAN_MSG3_ID 0xFDFFFFC0L

#define TEST_CAN_TX_MSG0_ID TEST_CAN_MSG3_ID
#define TEST_CAN_TX_MSG1_ID TEST_CAN_MSG1_ID
#define TEST_CAN_TX_MSG2_ID TEST_CAN_MSG2_ID

typedef struct
{
uint32_t id;
uint32_t id_msk;
uint8_t *data_ptr;
uint8_t status;
uint8_t proc;
void *action_ptr;
uint8_t max_size;
uint8_t size;
uint8_t mob_num;
uint8_t wdlc;
uint8_t mob_assign;
} can_msg_t;

static volatile can_msg_t can_tx_msg0;
static volatile can_msg_t can_tx_msg1;
static volatile can_msg_t can_tx_msg2;

static volatile uint8_t can_buf_out_msg0[10];
static volatile uint8_t can_buf_out_msg1[10];
static volatile uint8_t can_buf_out_msg2[10];

funtion called in C code:

void InitCan(void){

/*

  • Msg 0

*/
can_tx_msg0.id = TEST_CAN_TX_MSG0_ID;
can_tx_msg0.data_ptr = (uint8_t *) can_buf_out_msg0;
can_tx_msg0.max_size = 8;
can_tx_msg0.size = 8;
can_tx_msg0.status = NOT_SENT;
can_tx_msg0.mob_num = 0;
can_tx_msg0.mob_assign = FIXED_MOB;

/* send dummy data... */
can_buf_out_msg0[0] = 0;
can_buf_out_msg0[1] = 0;
can_buf_out_msg0[2] = 0;
can_buf_out_msg0[3] = 0;
can_buf_out_msg0[4] = 0xDE;
can_buf_out_msg0[5] = 0xAD;
can_buf_out_msg0[6] = 0xFA;
can_buf_out_msg0[7] = 0xCE;

/*

  • Msg 1

*/
can_tx_msg1.id = TEST_CAN_TX_MSG1_ID;
can_tx_msg1.data_ptr = (uint8_t *) can_buf_out_msg1;
can_tx_msg1.max_size = 8;
can_tx_msg1.size = 8;
can_tx_msg1.status = NOT_SENT;
can_tx_msg1.mob_assign = FLOATING_MOB;

/* send dummy data... */
can_buf_out_msg1[0] = 0xDE;
can_buf_out_msg1[1] = 0xAD;
can_buf_out_msg1[2] = 0xFA;
can_buf_out_msg1[3] = 0xCE;
can_buf_out_msg1[4] = 0;
can_buf_out_msg1[5] = 0;
can_buf_out_msg1[6] = 0;
can_buf_out_msg1[7] = 0;

/*

  • Msg 2

*/
can_tx_msg2.id = TEST_CAN_TX_MSG2_ID;
can_tx_msg2.data_ptr = (uint8_t *) can_buf_out_msg2;
can_tx_msg2.max_size = 8;
can_tx_msg2.size = 8;
can_tx_msg2.status = NOT_SENT;
can_tx_msg2.mob_assign = FLOATING_MOB;

/* send dummy data... */
can_buf_out_msg2[0] = 0xDE;
can_buf_out_msg2[1] = 0xAD;
can_buf_out_msg2[2] = 0xFA;
can_buf_out_msg2[3] = 0xCE;
can_buf_out_msg2[4] = 0;
can_buf_out_msg2[5] = 0;
can_buf_out_msg2[6] = 0;
can_buf_out_msg2[7] = 0;

......-----------......

the .lss file generated with the error at line 724:

can_tx_msg2.id = TEST_CAN_TX_MSG2_ID;
71a: 00 ed ldi r16, 0xD0 ; 208
71c: e0 2e mov r14, r16
71e: 0f ef ldi r16, 0xFF ; 255
720: f0 2e mov r15, r16
722: 0f ef ldi r16, 0xFF ; 255
724: 00 2f mov r16, r16
726: 0d ef ldi r16, 0xFD ; 253
728: 10 2f mov r17, r16
72a: e0 92 0f 02 sts 0x020F, r14
72e: f0 92 10 02 sts 0x0210, r15
732: 00 93 11 02 sts 0x0211, r16
736: 10 93 12 02 sts 0x0212, r17
can_tx_msg2.data_ptr = (uint8_t *) can_buf_out_msg2;
73a: 86 e3 ldi r24, 0x36 ; 54
73c: 92 e0 ldi r25, 0x02 ; 2
73e: 90 93 18 02 sts 0x0218, r25
742: 80 93 17 02 sts 0x0217, r24
can_tx_msg2.max_size = 8;
746: 60 93 1d 02 sts 0x021D, r22
can_tx_msg2.size = 8;
74a: 60 93 1e 02 sts 0x021E, r22
can_tx_msg2.status = NOT_SENT;
74e: 70 93 19 02 sts 0x0219, r23

Brn Gomes <unknwn>
Fri 27 Nov 2009 06:40:01 PM UTC, original submission:

greetings,

I'm using winavr20090313 which has gcc 4.3.2 and i'm getting the bug that I reported at:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=86733

In attachment there's a .rar that shows the error.

Give me a help on this one please.

Thanks ;)

Brn Gomes <unknwn>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #19155:  can_bug.zip added by unknwn (8KiB - application/zip)
file #19140:  can_bug.rar added by unknwn (8KiB - application/x-rar-compressed)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by joerg_wunsch (Posted a comment)
  • -unavailable- added by wek (Posted a comment)
  • -unavailable- added by arcanum (Posted a comment)
  • -unavailable- added by unknwn (Submitted the item)
  • -unavailable- added by unknwn
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 09 Jun 2010 09:31:35 AM UTCjoerg_wunschStatusNone=>Invalid
      Open/ClosedOpen=>Closed
    Mon 30 Nov 2009 10:57:24 AM UTCunknwnAttached File-=>Added can_bug.zip, #19155
    Fri 27 Nov 2009 06:40:01 PM UTCunknwnAttached File-=>Added can_bug.rar, #19140
      Carbon-Copy-=>Added unknwn

    Back to the top


    Powered by Savane 3.1-cleanup1