File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ void init_bss(void)
6464 unsigned int * dst ;
6565
6666 dst = & __bss_start ;
67- while (dst < & __bss_end )
67+ while (( rt_ubase_t ) dst < ( rt_ubase_t ) & __bss_end )
6868 {
6969 * dst ++ = 0 ;
7070 }
Original file line number Diff line number Diff line change @@ -129,7 +129,17 @@ static void _uart_init(void *uart_base)
129129 dlh = bdiv >> 12 ;
130130 dll = (bdiv - (dlh << 12 )) / 16 ;
131131 dlf = bdiv - (dlh << 12 ) - dll * 16 ;
132- if (dlh == 0 && dll == 0 )
132+ // dlh can be 0 only if bdiv < 4096 (since we're shifting right by 12 bits)
133+ // bdiv = UART_CLK / UART_DEFAULT_BAUDRATE
134+ // = 50000000 / 115200
135+ // = 434.027
136+ // so when dlh is 0,
137+ // dll = (bdiv - (dlh << 12)) / 16
138+ // = (434.027 - 0) / 16
139+ // = 27.626
140+ // which means dll can not reach 0,
141+ // so we use 1 as the minimum value for dll
142+ if ((dlh == 0 ) && (dll < 1 ))
133143 {
134144 dll = 1 ;
135145 dlf = 0 ;
You can’t perform that action at this time.
0 commit comments