| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- /*
- * Copyright (c) 2006-2023, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2023-05-26 RT-Thread first version
- */
- #include <rtthread.h>
- #include "stm32g0xx_hal.h"
- #include "usart/usart.h"
- #include "boot/boot.h"
- //#include <rtthread.h>
- //#include "ymodem.h"
- UART_HandleTypeDef UartHandle;
- extern char rt_hw_console_getchar(void);
- void MX_USART1_UART_Init(void);
- static void MX_GPIO_Init(void)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- __HAL_RCC_GPIOA_CLK_ENABLE();
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET);
- /*Configure GPIO pin : PA12 */
- GPIO_InitStruct.Pin = GPIO_PIN_12;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
- }
- int main(void)
- {
- char ad_val[4]={"BOOT"};
- HAL_Init(); //HAL库初始化
- MX_USART1_UART_Init();
- MX_GPIO_Init();
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, SET);
- HAL_UART_Transmit(&UartHandle,(unsigned char*)ad_val,4,1000);
- n_boot_memu(); //bootloader菜单
- thread_boot();//bootloader功能
- return RT_EOK;
- }
|