minor clean up. ch32v307 has issue with uart LOG=2 (skipping characters)

This commit is contained in:
hathach 2023-01-12 15:34:29 +07:00
parent 3cf21c66b6
commit 160d64b00a
3 changed files with 35 additions and 35 deletions

View File

@ -101,7 +101,7 @@ void usart_printf_init(uint32_t baudrate)
USART_ITConfig(USART1, USART_IT_TC, ENABLE);
USART_Cmd(USART1, ENABLE);
NVIC_InitTypeDef NVIC_InitStructure = {0};
NVIC_InitTypeDef NVIC_InitStructure = { 0 };
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;

View File

@ -106,17 +106,22 @@ void board_init(void) {
volatile uint32_t system_ticks = 0;
/* Small workaround to support HW stack save/restore */
void SysTick_Handler(void) __attribute__((naked));
void SysTick_Handler(void) {
void SysTick_Handler (void) __attribute__((naked));
void SysTick_Handler (void)
{
__asm volatile ("call SysTick_Handler_impl; mret");
}
__attribute__((used)) void SysTick_Handler_impl(void) {
SysTick->SR=0;
__attribute__((used)) void SysTick_Handler_impl (void)
{
SysTick->SR = 0;
system_ticks++;
}
uint32_t board_millis(void) { return system_ticks; }
uint32_t board_millis (void)
{
return system_ticks;
}
#endif

View File

@ -13,8 +13,6 @@ CH32V307_SDK_SRC = $(CH32V307_SDK)/EVT/EXAM/SRC
include $(TOP)/$(BOARD_PATH)/board.mk
SKIP_NANOLIB = 1
CFLAGS += \
-flto \
-march=rv32imac \
@ -30,9 +28,6 @@ CFLAGS += \
-Xlinker --gc-sections \
-DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
LDFLAGS += \
-Xlinker --gc-sections --specs=nano.specs --specs=nosys.specs
SRC_C += \
src/portable/wch/ch32v307/dcd_usbhs.c \
$(CH32V307_SDK_SRC)/Core/core_riscv.c \