We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I've port C source from C51 to CARM but CARM compiler seem has bug in comparison.
#include <lpc210x.h> //DKARM 1.3h //---------- //AA MACRO ASSEMBLER V0.10a //CA ARM COMPILER V0.10a //LA ARM LINKER/LOCATER V0.10c unsigned char test(void) { return(0xEE); } void main(void) { unsigned char K; K=test(); if ((K&0x0F)!=0x0F) { //0xEE&0x0F=>0x0E //0x0E!=0x0F //but this block don't enter while (1); } else { while (1); } }
"I've port C source from C51 to CARM" On a general note, beware that the 8051 is an 8-bit processor, and ARM is 32-bit. You need to pay very careful attention to issues like data type sizes, byte ordering, and anywhere that your code has relied upon the specific details of the 8051 and/or C51.
while (1) is just simple code to show where block are entered to executed. Ithe above case, if you see the disassembly windows while debugging. You will see comparison of R0 (0xEE) with R1 (0x0F), thats seem the CARM don't mask significant bits (3:0) before compare. Thanks.
This case don't related with optimization.
This looks like a compiler problem. I've already reported it to engineering. Jon