maybe the compiler bug for the following test code:# test.S# define ALT_CPU_FREQ 90000000# define BAUD_RATE 2400 //1200# define C_DIVISOR ((ALT_CPU_FREQ+BAUD_RATE/2)/BAUD_RATE)
.equ A_DIVISOR , ((ALT_CPU_FREQ+BAUD_RATE/2)/BAUD_RATE)
.macro MOVUIK32 _reg,_val
.if (\_val >>16) == 0
MOVUI \_reg,%lo(\_val)
.elseif (\_val <<16) == 0
MOVHI \_reg,%hi(\_val)
.else
MOVIA \_reg,\_val
.endif
.endm
.section .text
.align 2
.set noat
_start:
MOVUIK32 r2,C_DIVISOR
MOVUIK32 r3,A_DIVISOR
.end
You may change the valu of ALT_CPU_FREQ and BAUD_RATE macros, and then check the compiling result!