bsp: k230: fix some cpp_check warnings

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
This commit is contained in:
Chen Wang 2025-04-23 16:29:54 +08:00 committed by Rbb666
parent 919adbce38
commit 283c2fb94f
2 changed files with 12 additions and 2 deletions

View File

@ -64,7 +64,7 @@ void init_bss(void)
unsigned int *dst;
dst = &__bss_start;
while (dst < &__bss_end)
while ((rt_ubase_t)dst < (rt_ubase_t)&__bss_end)
{
*dst++ = 0;
}

View File

@ -129,7 +129,17 @@ static void _uart_init(void *uart_base)
dlh = bdiv >> 12;
dll = (bdiv - (dlh << 12)) / 16;
dlf = bdiv - (dlh << 12) - dll * 16;
if(dlh == 0 && dll == 0)
// dlh can be 0 only if bdiv < 4096 (since we're shifting right by 12 bits)
// bdiv = UART_CLK / UART_DEFAULT_BAUDRATE
// = 50000000 / 115200
// = 434.027
// so when dlh is 0,
// dll = (bdiv - (dlh << 12)) / 16
// = (434.027 - 0) / 16
// = 27.626
// which means dll can not reach 0,
// so we use 1 as the minimum value for dll
if((dlh == 0) && (dll < 1))
{
dll = 1;
dlf = 0;