add mcu flash size detect and auto config usart

This commit is contained in:
2025-08-25 17:26:19 +08:00
parent 2d752eed5e
commit d651ff73c9
7 changed files with 136 additions and 19 deletions

View File

@@ -16,6 +16,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include "gd32e23x_usart.h"
#include "board_config.h"
#undef errno
extern int errno;
@@ -164,7 +165,7 @@ int _execve(char *name, char **argv, char **env)
// USART0 printf重定向实现
int __io_putchar(int ch) {
// 等待发送缓冲区空
while (usart_flag_get(USART0, USART_FLAG_TBE) == RESET) {}
usart_data_transmit(USART0, (uint8_t)ch);
while (usart_flag_get(RS485_PHY, USART_FLAG_TBE) == RESET) {}
usart_data_transmit(RS485_PHY, (uint8_t)ch);
return ch;
}