Hi Soltras,

What do you think is wrong with the generated code? The line

usart0_tx_buffer[usart0_tx_extract_idx] == '\n';

is perfectly valid C, so it produces no error message. However, it does nothing 
useful so it produces no code.

Regards,
Steve


soltras wrote:

The below code is generating wrong asm instruction. All is because
the statment ("c") is x == y; instead of x=y;
I think, that if compiler doesn't notice above statement as a correct one should throw syntax error.
Compilation to the final output is misleading, and  doesn't help debuging


robert
455 if(usart0_tx_buffer[usart0_tx_extract_idx] == '~'){ - 0x864e <usart0XmtIsr+16>: mov &0x024e,r15 ;0x024e -> usart0_tx_extract_idx - 0x8652 <usart0XmtIsr+20>: add #572, r15 ;#572 -> #0x023c ->usart0_tx_buffer - 0x8656 <usart0XmtIsr+24>: cmp.b #126, 0(r15) ;#126 -> #0x007e ->'~' = compare instr 455 - 0x865c <usart0XmtIsr+30>: jnz $+8 ;jump to 0x8664 which out of consideration 456 usart0_tx_buffer[usart0_tx_extract_idx] == '\n';this line is not noticed by compiler 457 AppStatus = WAITING_USART0_RREPORT; 0x865e <usart0XmtIsr+32>: mov.b #2, &0x0204 ;0x0204 = AppStatus , #2 = WAITING_USART0_RREPORT - 0x8662 <usart0XmtIsr+36>: jmp $+22 ;abs dst addr 0x8678 458 459 }else if(usart0_tx_buffer[usart0_tx_extract_idx] == '\x7D'){ 0x8664 <usart0XmtIsr+38>: mov &0x024e,r15 ;src addr 0x024e - 0x8668 <usart0XmtIsr+42>: add #572, r15 ;#0x023c - 0x866c <usart0XmtIsr+46>: cmp.b #125, 0(r15) ;#0x007d - 0x8672 <usart0XmtIsr+52>: jnz $+6 ;abs dst addr 0x8678 460 usart0_tx_buffer[usart0_tx_extract_idx] == '\n'; 461 AppStatus = INIT_PRODRP; - 0x8674 <usart0XmtIsr+54>: mov.b #4, &0x0204 ;subst r2 with As==10 462 } 463 StartQTimer(usart0_tx_buffer[usart0_tx_extract_idx++]); - 0x8678 <usart0XmtIsr+58>: mov &0x024e,r15 ;src addr 0x024e -



Reply via email to