STM32G030移植RT-Thread

移植流程

移植前需要安装Keil.STM32G0xx_DFP.1.2.0.pack组件,大致的移植过程:

  1. CubeMX配置
  2. RT-Thread组件配置
  3. 工程模板配置

参考例程配置:拷贝仓库原有的stm32g070-st-nucleo工程,然后另起一个名字,目录结构如下

在这里插入图片描述

完整的RT-Thread BSP需要考虑的改动点:

  1. 文档:把两个README文档改一下,改成stm32g030相关的说明
  2. 芯片:board目录下是跟stm32g030相关的CubeMX配置、链接脚本、板级初始化文件
  3. MDK5:template工程是命令scons --target=mdk5生成工程的模板
  4. 系统:.config文件保存RT-Thread系统的基本组件配置,rtconfig.h与之关联

CubeMX配置

时钟配置

Caegories栏点击System Core一栏,然后选择RCC,实际上HSELSE也可以不用配置,因为stm32已经集成了晶振,在GPIO资源紧张时可以不配置

在这里插入图片描述

这里选择不配置时钟,Clock Configuration配置如下:

在这里插入图片描述

系统滴答

点击SYS项,配置如下图所示

在这里插入图片描述

串口配置

Connectivity栏点击USART1项,配置PB6、PB7两个GPIO,设置波特率等串口参数

在这里插入图片描述

工程配置

Project Manager配置项参考

在这里插入图片描述

Code Generator配置,最后点击右上角GENERATE CODE

在这里插入图片描述

组件配置

先说结论,一个成功移植了GPIO和USART的系统工程大致是这样的:

在这里插入图片描述

Kconfig

mainmenu "RT-Thread Configuration"BSP_DIR := .RTT_DIR := ../../..PKGS_DIR := packagesconfig SOC_STM32G030RBboolselect SOC_SERIES_STM32G0select RT_USING_COMPONENTS_INITselect RT_USING_USER_MAINdefault yconfig BOARD_STM32G030_TINY_BOARDboolselect BOARD_SERIES_STM32_NUCLEO_64default ysource "$(RTT_DIR)/Kconfig"
osource "$PKGS_DIR/Kconfig"
rsource "../libraries/Kconfig"if !RT_USING_NANO
rsource "board/Kconfig"
endif

board/Kconfig

menu "Hardware Drivers Config"menu "Onboard Peripheral Drivers"endmenumenu "On-chip Peripheral Drivers"config BSP_USING_GPIObool "Enable GPIO"select RT_USING_PINdefault ymenuconfig BSP_USING_UARTbool "Enable UART1"default yselect RT_USING_SERIALif BSP_USING_UARTconfig BSP_STM32_UART_V1_TX_TIMEOUTint "UART TX timeout"default 2000depends on RT_USING_SERIAL_V1config BSP_USING_UART1bool "Enable UART1"default yendifsource "$(BSP_DIR)/../libraries/HAL_Drivers/drivers/Kconfig"endmenumenu "Board extended module Drivers"endmenuendmenu

board/SConscript

import os
import rtconfig
from building import *Import('SDK_LIB')cwd = GetCurrentDir()# add general drivers
src = Split('''
board.c
CubeMX_Config/Src/stm32g0xx_hal_msp.c
''')path =  [cwd]
path += [cwd + '/CubeMX_Config/Inc']startup_path_prefix = SDK_LIBif rtconfig.PLATFORM in ['gcc']:src += [startup_path_prefix + '/STM32G0xx_HAL/CMSIS/Device/ST/STM32G0xx/Source/Templates/gcc/startup_stm32g030xx.s']
elif rtconfig.PLATFORM in ['armcc', 'armclang']:src += [startup_path_prefix + '/STM32G0xx_HAL/CMSIS/Device/ST/STM32G0xx/Source/Templates/arm/startup_stm32g030xx.s']
elif rtconfig.PLATFORM in ['iccarm']:src += [startup_path_prefix + '/STM32G0xx_HAL/CMSIS/Device/ST/STM32G0xx/Source/Templates/iar/startup_stm32g030xx.s']CPPDEFINES = ['STM32G030xx']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
Return('group')

board/board.h

/** Copyright (c) 2006-2025 RT-Thread Development Team** SPDX-License-Identifier: Apache-2.0** Change Logs:* Date           Author       Notes* 2018-11-5      SummerGift   first version*/#ifndef __BOARD_H__
#define __BOARD_H__#include <rtthread.h>
#include <stm32g0xx.h>
#include "drv_common.h"
#include "drv_gpio.h"#ifdef __cplusplus
extern "C" {
#endif#define STM32_FLASH_START_ADRESS     ((uint32_t)0x08000000)
#define STM32_FLASH_SIZE             (64 * 1024)
#define STM32_FLASH_END_ADDRESS      ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE))/* Internal SRAM memory size[Kbytes] <8-64>, Default: 64*/
#define STM32_SRAM_SIZE      8
#define STM32_SRAM_END       (0x20000000 + STM32_SRAM_SIZE * 1024)#if defined(__ARMCC_VERSION)
extern int Image$$RW_IRAM1$$ZI$$Limit;
#define HEAP_BEGIN      ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
#elif __ICCARM__
#pragma section="CSTACK"
#define HEAP_BEGIN      (__segment_end("CSTACK"))
#else
extern int __bss_end;
#define HEAP_BEGIN      ((void *)&__bss_end)
#endif#define HEAP_END        STM32_SRAM_ENDvoid SystemClock_Config(void);#ifdef __cplusplus
}
#endif#endif /* __BOARD_H__ */

board/board.c

/** Copyright (c) 2006-2025 RT-Thread Development Team** SPDX-License-Identifier: Apache-2.0** Change Logs:* Date           Author       Notes* 2018-12-21     zylx         first version*/#include "board.h"void SystemClock_Config(void)
{RCC_OscInitTypeDef RCC_OscInitStruct = {0};RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};/** Configure the main internal regulator output voltage*/HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);/** Initializes the RCC Oscillators according to the specified parameters* in the RCC_OscInitTypeDef structure.*/RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;RCC_OscInitStruct.HSIState = RCC_HSI_ON;RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK){Error_Handler();}/** Initializes the CPU, AHB and APB buses clocks*/RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1;RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK){Error_Handler();}
}

board/linker_scipts/link.icf

/** linker script for STM32F10x with GNU ld*//* Program Entry, set to mark it as "used" and avoid gc */
MEMORY
{ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64k /* 64KB flash */RAM (rw) : ORIGIN = 0x20000000, LENGTH =  8k /* 8K sram */
}
ENTRY(Reset_Handler)
_system_stack_size = 0x400;SECTIONS
{.text :{. = ALIGN(4);_stext = .;KEEP(*(.isr_vector))            /* Startup code */. = ALIGN(4);*(.text)                        /* remaining code */*(.text.*)                      /* remaining code */*(.rodata)                      /* read-only data (constants) */*(.rodata*)*(.glue_7)*(.glue_7t)*(.gnu.linkonce.t*)/* section information for finsh shell */. = ALIGN(4);__fsymtab_start = .;KEEP(*(FSymTab))__fsymtab_end = .;. = ALIGN(4);__vsymtab_start = .;KEEP(*(VSymTab))__vsymtab_end = .;/* section information for initial. */. = ALIGN(4);__rt_init_start = .;KEEP(*(SORT(.rti_fn*)))__rt_init_end = .;. = ALIGN(4);PROVIDE(__ctors_start__ = .);KEEP (*(SORT(.init_array.*)))KEEP (*(.init_array))PROVIDE(__ctors_end__ = .);. = ALIGN(4);_etext = .;} > ROM = 0/* .ARM.exidx is sorted, so has to go in its own output section.  */__exidx_start = .;.ARM.exidx :{*(.ARM.exidx* .gnu.linkonce.armexidx.*)/* This is used by the startup in order to initialize the .data secion */_sidata = .;} > ROM__exidx_end = .;/* .data section which is used for initialized data */.data : AT (_sidata){. = ALIGN(4);/* This is used by the startup in order to initialize the .data secion */_sdata = . ;*(.data)*(.data.*)*(.gnu.linkonce.d*)PROVIDE(__dtors_start__ = .);KEEP(*(SORT(.dtors.*)))KEEP(*(.dtors))PROVIDE(__dtors_end__ = .);. = ALIGN(4);/* This is used by the startup in order to initialize the .data secion */_edata = . ;} >RAM.stack :{. = ALIGN(4);_sstack = .;. = . + _system_stack_size;. = ALIGN(4);_estack = .;} >RAM__bss_start = .;.bss :{. = ALIGN(4);/* This is used by the startup in order to initialize the .bss secion */_sbss = .;*(.bss)*(.bss.*)*(COMMON). = ALIGN(4);/* This is used by the startup in order to initialize the .bss secion */_ebss = . ;*(.bss.init)} > RAM__bss_end = .;_end = .;/* Stabs debugging sections.  */.stab          0 : { *(.stab) }.stabstr       0 : { *(.stabstr) }.stab.excl     0 : { *(.stab.excl) }.stab.exclstr  0 : { *(.stab.exclstr) }.stab.index    0 : { *(.stab.index) }.stab.indexstr 0 : { *(.stab.indexstr) }.comment       0 : { *(.comment) }/* DWARF debug sections.* Symbols in the DWARF debugging sections are relative to the beginning* of the section so we begin them at 0.  *//* DWARF 1 */.debug          0 : { *(.debug) }.line           0 : { *(.line) }/* GNU DWARF 1 extensions */.debug_srcinfo  0 : { *(.debug_srcinfo) }.debug_sfnames  0 : { *(.debug_sfnames) }/* DWARF 1.1 and DWARF 2 */.debug_aranges  0 : { *(.debug_aranges) }.debug_pubnames 0 : { *(.debug_pubnames) }/* DWARF 2 */.debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }.debug_abbrev   0 : { *(.debug_abbrev) }.debug_line     0 : { *(.debug_line) }.debug_frame    0 : { *(.debug_frame) }.debug_str      0 : { *(.debug_str) }.debug_loc      0 : { *(.debug_loc) }.debug_macinfo  0 : { *(.debug_macinfo) }/* SGI/MIPS DWARF 2 extensions */.debug_weaknames 0 : { *(.debug_weaknames) }.debug_funcnames 0 : { *(.debug_funcnames) }.debug_typenames 0 : { *(.debug_typenames) }.debug_varnames  0 : { *(.debug_varnames) }
}

board/linker_scipts/link.sct,这个是MDK的链接脚本文件,需要加上rti_fn保证RT-Thread组件的初始化

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************LR_IROM1 0x08000000 0x00010000  {    ; load region size_regionER_IROM1 0x08000000 0x00010000  {  ; load address = execution address*.o (RESET, +First)*(InRoot$$Sections).ANY (+RO)}RW_IRAM1 0x20000000 0x00002000  {  ; RW data.ANY (+RW +ZI)}
}

board/linker_scripts/link.lds,这个是arm gcc的链接脚本

/** linker script for STM32F10x with GNU ld*//* Program Entry, set to mark it as "used" and avoid gc */
MEMORY
{ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64k /* 128KB flash */RAM (rw) : ORIGIN = 0x20000000, LENGTH =  8k /* 8K sram */
}
ENTRY(Reset_Handler)
_system_stack_size = 0x400;SECTIONS
{.text :{. = ALIGN(4);_stext = .;KEEP(*(.isr_vector))            /* Startup code */. = ALIGN(4);*(.text)                        /* remaining code */*(.text.*)                      /* remaining code */*(.rodata)                      /* read-only data (constants) */*(.rodata*)*(.glue_7)*(.glue_7t)*(.gnu.linkonce.t*)/* section information for finsh shell */. = ALIGN(4);__fsymtab_start = .;KEEP(*(FSymTab))__fsymtab_end = .;. = ALIGN(4);__vsymtab_start = .;KEEP(*(VSymTab))__vsymtab_end = .;/* section information for initial. */. = ALIGN(4);__rt_init_start = .;KEEP(*(SORT(.rti_fn*)))__rt_init_end = .;. = ALIGN(4);PROVIDE(__ctors_start__ = .);KEEP (*(SORT(.init_array.*)))KEEP (*(.init_array))PROVIDE(__ctors_end__ = .);. = ALIGN(4);_etext = .;} > ROM = 0/* .ARM.exidx is sorted, so has to go in its own output section.  */__exidx_start = .;.ARM.exidx :{*(.ARM.exidx* .gnu.linkonce.armexidx.*)/* This is used by the startup in order to initialize the .data secion */_sidata = .;} > ROM__exidx_end = .;/* .data section which is used for initialized data */.data : AT (_sidata){. = ALIGN(4);/* This is used by the startup in order to initialize the .data secion */_sdata = . ;*(.data)*(.data.*)*(.gnu.linkonce.d*)PROVIDE(__dtors_start__ = .);KEEP(*(SORT(.dtors.*)))KEEP(*(.dtors))PROVIDE(__dtors_end__ = .);. = ALIGN(4);/* This is used by the startup in order to initialize the .data secion */_edata = . ;} >RAM.stack :{. = ALIGN(4);_sstack = .;. = . + _system_stack_size;. = ALIGN(4);_estack = .;} >RAM__bss_start = .;.bss :{. = ALIGN(4);/* This is used by the startup in order to initialize the .bss secion */_sbss = .;*(.bss)*(.bss.*)*(COMMON). = ALIGN(4);/* This is used by the startup in order to initialize the .bss secion */_ebss = . ;*(.bss.init)} > RAM__bss_end = .;_end = .;/* Stabs debugging sections.  */.stab          0 : { *(.stab) }.stabstr       0 : { *(.stabstr) }.stab.excl     0 : { *(.stab.excl) }.stab.exclstr  0 : { *(.stab.exclstr) }.stab.index    0 : { *(.stab.index) }.stab.indexstr 0 : { *(.stab.indexstr) }.comment       0 : { *(.comment) }/* DWARF debug sections.* Symbols in the DWARF debugging sections are relative to the beginning* of the section so we begin them at 0.  *//* DWARF 1 */.debug          0 : { *(.debug) }.line           0 : { *(.line) }/* GNU DWARF 1 extensions */.debug_srcinfo  0 : { *(.debug_srcinfo) }.debug_sfnames  0 : { *(.debug_sfnames) }/* DWARF 1.1 and DWARF 2 */.debug_aranges  0 : { *(.debug_aranges) }.debug_pubnames 0 : { *(.debug_pubnames) }/* DWARF 2 */.debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }.debug_abbrev   0 : { *(.debug_abbrev) }.debug_line     0 : { *(.debug_line) }.debug_frame    0 : { *(.debug_frame) }.debug_str      0 : { *(.debug_str) }.debug_loc      0 : { *(.debug_loc) }.debug_macinfo  0 : { *(.debug_macinfo) }/* SGI/MIPS DWARF 2 extensions */.debug_weaknames 0 : { *(.debug_weaknames) }.debug_funcnames 0 : { *(.debug_funcnames) }.debug_typenames 0 : { *(.debug_typenames) }.debug_varnames  0 : { *(.debug_varnames) }
}

main.c,最小例程里边带了LED闪烁功能

/** Copyright (c) 2006-2025 RT-Thread Development Team** SPDX-License-Identifier: Apache-2.0** Change Logs:* Date           Author       Notes* 2025-3-17      hywing       first version*/#include <board.h>
#include <rtthread.h>
#ifndef RT_USING_NANO
#include <rtdevice.h>
#endif /* RT_USING_NANO *//* defined the LED0 pin: PB4 */
#define LED0_PIN    GET_PIN(B, 4)int main(void)
{/* set LED0 pin mode to output */rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);rt_kprintf("Welcome to the world of IoT Stuff!\r\n");while (1){rt_pin_write(LED0_PIN, PIN_HIGH);rt_thread_mdelay(500);rt_pin_write(LED0_PIN, PIN_LOW);rt_thread_mdelay(500);}return RT_EOK;
}

工程模板

我们先把Template工程配置好,然后后面就可以通过scons自动生成想要的工程配置,打开Template工程模板选择STM32G030C8TX

在这里插入图片描述

时钟配置为16MHz,检查IROM1IRAM1的起始地址以及大小是否正确

在这里插入图片描述

下载器配置为ST-Link Debugger

在这里插入图片描述

ST-Link Debug配置,Clock Req设为10MHz

在这里插入图片描述

Flash Download配置

在这里插入图片描述

Include Paths调整:拷贝过来的例程有些是不对的,需要修正过来

在这里插入图片描述

导出MDK Keil5工程

scons --target=mdk5

导出的rtconfig.h文件配置如下

#ifndef RT_CONFIG_H__
#define RT_CONFIG_H__#define SOC_STM32G030RB
#define BOARD_STM32G030_TINY_BOARD/* RT-Thread Kernel *//* klibc options *//* rt_vsnprintf options */#define RT_KLIBC_USING_LIBC_VSNPRINTF
/* end of rt_vsnprintf options *//* rt_vsscanf options */#define RT_KLIBC_USING_LIBC_VSSCANF
/* end of rt_vsscanf options *//* rt_memset options *//* end of rt_memset options *//* rt_memcpy options *//* end of rt_memcpy options *//* rt_memmove options *//* end of rt_memmove options *//* rt_memcmp options *//* end of rt_memcmp options *//* rt_strstr options *//* end of rt_strstr options *//* rt_strcasecmp options *//* end of rt_strcasecmp options *//* rt_strncpy options *//* end of rt_strncpy options *//* rt_strcpy options *//* end of rt_strcpy options *//* rt_strncmp options *//* end of rt_strncmp options *//* rt_strcmp options *//* end of rt_strcmp options *//* rt_strlen options *//* end of rt_strlen options *//* rt_strnlen options *//* end of rt_strnlen options */
/* end of klibc options */
#define RT_NAME_MAX 8
#define RT_CPUS_NR 1
#define RT_ALIGN_SIZE 8
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 1000
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_HOOK
#define RT_HOOK_USING_FUNC_PTR
#define RT_USING_IDLE_HOOK
#define RT_IDLE_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 256/* kservice options *//* end of kservice options */
#define RT_USING_DEBUG
#define RT_DEBUGING_ASSERT
#define RT_DEBUGING_COLOR
#define RT_DEBUGING_CONTEXT/* Inter-Thread communication */#define RT_USING_SEMAPHORE
#define RT_USING_MUTEX
#define RT_USING_EVENT
#define RT_USING_MAILBOX
#define RT_USING_MESSAGEQUEUE
/* end of Inter-Thread communication *//* Memory Management */#define RT_USING_MEMPOOL
#define RT_USING_SMALL_MEM
#define RT_USING_SMALL_MEM_AS_HEAP
#define RT_USING_HEAP
/* end of Memory Management */
#define RT_USING_DEVICE
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart1"
#define RT_VER_NUM 0x50200
#define RT_BACKTRACE_LEVEL_MAX_NR 32
/* end of RT-Thread Kernel */
#define ARCH_ARM
#define ARCH_ARM_CORTEX_M
#define ARCH_ARM_CORTEX_M0/* RT-Thread Components */#define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 1024
#define RT_MAIN_THREAD_PRIORITY 10
#define RT_USING_MSH
#define RT_USING_FINSH
#define FINSH_USING_MSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_THREAD_PRIORITY 20
#define FINSH_THREAD_STACK_SIZE 768
#define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
#define FINSH_CMD_SIZE 80
#define MSH_USING_BUILT_IN_COMMANDS
#define FINSH_USING_DESCRIPTION
#define FINSH_ARG_MAX 10
#define FINSH_USING_OPTION_COMPLETION/* DFS: device virtual file system *//* end of DFS: device virtual file system *//* Device Drivers */#define RT_USING_DEVICE_IPC
#define RT_UNAMED_PIPE_NUMBER 64
#define RT_USING_SERIAL
#define RT_USING_SERIAL_V1
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_PIN
/* end of Device Drivers *//* C/C++ and POSIX layer *//* ISO-ANSI C layer *//* Timezone and Daylight Saving Time */#define RT_LIBC_USING_LIGHT_TZ_DST
#define RT_LIBC_TZ_DEFAULT_HOUR 8
#define RT_LIBC_TZ_DEFAULT_MIN 0
#define RT_LIBC_TZ_DEFAULT_SEC 0
/* end of Timezone and Daylight Saving Time */
/* end of ISO-ANSI C layer *//* POSIX (Portable Operating System Interface) layer *//* Interprocess Communication (IPC) *//* Socket is in the 'Network' category *//* end of Interprocess Communication (IPC) */
/* end of POSIX (Portable Operating System Interface) layer */
/* end of C/C++ and POSIX layer *//* Network *//* end of Network *//* Memory protection *//* end of Memory protection *//* Utilities *//* end of Utilities *//* Using USB legacy version *//* end of Using USB legacy version */
/* end of RT-Thread Components *//* RT-Thread Utestcases *//* end of RT-Thread Utestcases *//* RT-Thread online packages *//* IoT - internet of things *//* Wi-Fi *//* Marvell WiFi *//* end of Marvell WiFi *//* Wiced WiFi *//* end of Wiced WiFi *//* CYW43012 WiFi *//* end of CYW43012 WiFi *//* BL808 WiFi *//* end of BL808 WiFi *//* CYW43439 WiFi *//* end of CYW43439 WiFi */
/* end of Wi-Fi *//* IoT Cloud *//* end of IoT Cloud */
/* end of IoT - internet of things *//* security packages *//* end of security packages *//* language packages *//* JSON: JavaScript Object Notation, a lightweight data-interchange format *//* end of JSON: JavaScript Object Notation, a lightweight data-interchange format *//* XML: Extensible Markup Language *//* end of XML: Extensible Markup Language */
/* end of language packages *//* multimedia packages *//* LVGL: powerful and easy-to-use embedded GUI library *//* end of LVGL: powerful and easy-to-use embedded GUI library *//* u8g2: a monochrome graphic library *//* end of u8g2: a monochrome graphic library */
/* end of multimedia packages *//* tools packages *//* end of tools packages *//* system packages *//* enhanced kernel services *//* end of enhanced kernel services *//* acceleration: Assembly language or algorithmic acceleration packages *//* end of acceleration: Assembly language or algorithmic acceleration packages *//* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard *//* end of CMSIS: ARM Cortex-M Microcontroller Software Interface Standard *//* Micrium: Micrium software products porting for RT-Thread *//* end of Micrium: Micrium software products porting for RT-Thread */
/* end of system packages *//* peripheral libraries and drivers *//* HAL & SDK Drivers *//* STM32 HAL & SDK Drivers *//* end of STM32 HAL & SDK Drivers *//* Infineon HAL Packages *//* end of Infineon HAL Packages *//* Kendryte SDK *//* end of Kendryte SDK */
/* end of HAL & SDK Drivers *//* sensors drivers *//* end of sensors drivers *//* touch drivers *//* end of touch drivers */
/* end of peripheral libraries and drivers *//* AI packages *//* end of AI packages *//* Signal Processing and Control Algorithm Packages *//* end of Signal Processing and Control Algorithm Packages *//* miscellaneous packages *//* project laboratory *//* end of project laboratory *//* samples: kernel and components samples *//* end of samples: kernel and components samples *//* entertainment: terminal games and other interesting software packages *//* end of entertainment: terminal games and other interesting software packages */
/* end of miscellaneous packages *//* Arduino libraries *//* Projects and Demos *//* end of Projects and Demos *//* Sensors *//* end of Sensors *//* Display *//* end of Display *//* Timing *//* end of Timing *//* Data Processing *//* end of Data Processing *//* Data Storage *//* Communication *//* end of Communication *//* Device Control *//* end of Device Control *//* Other *//* end of Other *//* Signal IO *//* end of Signal IO *//* Uncategorized *//* end of Arduino libraries */
/* end of RT-Thread online packages */
#define SOC_FAMILY_STM32
#define SOC_SERIES_STM32G0
#define BOARD_SERIES_STM32_NUCLEO_64/* Hardware Drivers Config *//* Onboard Peripheral Drivers *//* On-chip Peripheral Drivers */#define BSP_USING_GPIO
#define BSP_USING_UART
#define BSP_STM32_UART_V1_TX_TIMEOUT 2000
#define BSP_USING_UART1
/* end of On-chip Peripheral Drivers *//* Board extended module Drivers *//* end of Hardware Drivers Config */#endif

遇到的问题

  1. 断点失效:尽量不用Browse Information就OK

在这里插入图片描述

  1. 没有msh提示符输出:把msh线程的栈空间大小FINSH_THREAD_STACK_SIZE调小一点就OK,512也是可以的但ps命令会卡死
#define FINSH_THREAD_STACK_SIZE 768
  1. 资源紧张,SRAM比较有限,任务的堆栈尽量小一些

在这里插入图片描述

开源

移植的工程已经push到RT-Thread GitHub仓库:rt-thread/bsp/stm32/stm32g030-tiny-board at master · RT-Thread/rt-thread

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/39370.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【网络】网关

【网络】网关 网关 是计算机网络中用于连接两个不同网络的设备或服务器&#xff0c;它充当着“翻译器”和“转发器”的角色&#xff0c;将数据包从一个网络传递到另一个网络&#xff0c;并在必要时进行协议转换和数据重包装。 主要功能 数据转发&#xff1a;当本地网络设备发…

用JS+Promise实现简单消息队列

一、什么是消息队列 消息队列是一种用于在软件系统之间传递消息的技术。它常被用于解耦不同组件或模块之间的通信&#xff0c;减少系统中各个部分之间的直接依赖关系。消息队列可以实现异步通信&#xff0c;发送方将消息发送到队列中&#xff0c;接收方从队列中获取消息并进行处…

【Python爬虫】使用python脚本拉取汽车网站品牌数据

示例代码说明&#xff1a; 在汽车之家网站拉取当月排行榜中汽车品牌、销量和价格信息&#xff0c;存为csv文档输出&#xff0c;使用正则表达式获取网页内容 import re import pandas as pd import requests# 汽车之家车型列表页URL url https://cars.app.autohome.com.cn/ca…

批量修改 PPT 文档中主题、编辑时长、来源等元数据信息

每一个 PPT 文档被创建之后&#xff0c;都会包含一些元数据信息。这些元数据信息记录着文件的作者、创建时间、修改时间、打印时间等信息。这些信息默认都是自动生成的&#xff0c;如果我们想要对这些元数据进行修改&#xff0c;当然也是可以的。今天就给大家介绍一下如何批量修…

丐版插入selectdb模拟

为了模拟不断插入数据到库里&#xff0c;写个简单的循环脚本 #!/bin/bash #计算时差 function getTiming(){start$1end$2start_secho $start | cut -d . -f 1start_nsecho $start | cut -d . -f 2end_secho $end | cut -d . -f 1end_nsecho $end | cut -d . -f 2time_micro$((…

Off-Road-Freespace-Detection配置pytorch2.0.0

一、概述 在github上进行开源代码搜索&#xff0c;发现了Off-Road-Freespace-Detection&#xff08;链接如下所示&#xff09;。这是对越野环境可通行区域的检测&#xff0c;在经过测试之后&#xff0c;发现对自己有益。 GitHub - chaytonmin/Off-Road-Freespace-Detection: O…

常见中间件漏洞之四:Apache

1. CVE-2021-41773 Apache HTTP Server 路径穿越漏洞 漏洞简介 该漏洞是由于Apache HTTP Server 2.4.49版本存在⽬录穿越漏洞,在路径穿越⽬录<Directory/>Require all granted</Directory>允许被访问的的情况下&#xff08;默认开启&#xff09;&#xff0c;攻击…

Pytorch中Tensorboard的学习

1、Tensorboard介绍 TensorBoard 是 TensorFlow 开发的一个可视化工具&#xff0c;用于帮助用户理解和调试机器学习模型的训练过程。尽管它最初是为 TensorFlow 设计的&#xff0c;但通过 PyTorch 的 torch.utils.tensorboard 模块&#xff0c;PyTorch 用户也可以方便地使用 Te…

刷机维修进阶教程-----adb禁用错了系统app导致无法开机 如何保数据无损恢复机型

在刷机维修过程中 。我们会遇到一些由于客户使用adb指令来禁用手机app而导致手机无法开机进入系统的故障机型。通常此类问题机型有好几种解决方法。但如果客户需要保数据来恢复机型。其实操作也是很简单的.还有类似误删除应用导致不开机等等如何保数据。 通过博文了解💝💝�…

哪吒汽车:一边熬夜蹦迪,一边找药投医

两年前&#xff0c;威马CEO沈晖发了个短视频&#xff0c;内容是“活下去&#xff0c;像牲口一样活下去”。 如今最能体会沈晖当时心情的&#xff0c;估计就是方运舟了。 作为哪吒汽车创始人兼董事长&#xff0c;他连续多次被限高&#xff0c;为了让哪吒汽车活下去&#xff0c…

2025 cs144 Lab Checkpoint 1小白超详细版

cs144官网&#xff1a;https://cs144.github.io/ 我的github&#xff1a;https://github.com/Albert-tru/cs144-2025 文章目录 1 手动发送internet数据报协议号5、7&#xff1f;思路&#xff1f; 2 实现一个Reassembler类2.1 几个帮助理解代码的Q&AQ1&#xff1a;insert的参…

使用 OpenCV 拼接进行图像处理对比:以形态学操作为例

图像处理在计算机视觉中起着至关重要的作用&#xff0c;而 OpenCV 作为一个强大的图像处理库&#xff0c;提供了丰富的函数来实现各类图像处理任务。形态学操作&#xff08;Morphological Operations&#xff09;是其中常用的技术&#xff0c;尤其适用于二值图像的处理。常见的…

单链表的查找和插入,删除操作

1.单链表的查找 snode* slistfind(snode* stlheap, stltype x) {while (stlheap){if (stlheap->data x){return stlheap;}stlheap stlheap->next;}return NULL; } 2.单链表的插入操作 2.1在指定位置之前插入节点 void slistinsert(snode** stlheap, snode* pos, stl…

一文速通Python并行计算:00 并行计算的基本概念

一文速通 Python 并行计算&#xff1a;00 并行计算的基本概念 摘要&#xff1a; 该文介绍了 Python 并行计算的核心概念、编程模型及其应用&#xff0c;并介绍了了并行程序的性能分析与优化方法&#xff0c;如并行效率、加速比及 Amdahl 定律。此外&#xff0c;该文介绍了共享…

vue中keep-alive组件的使用

keep-alive是vue的内置组件&#xff0c;它的主要作用是对组件进行缓存&#xff0c;避免组件在切换时被重复创建和销毁&#xff0c;从而提高应用的性能和用户体验。它自身不会渲染一个 DOM 元素&#xff0c;也不会出现在父组件链中。使用时&#xff0c;只需要将需要缓存的组件包…

Python Excel表格数据对比工具

【Excel对比工具】提升工作效率的神奇助手&#xff1a;基于PyQt5和Pandas的文件数据对比应用 相关资源文件已经打包成EXE文件&#xff0c;可双击直接运行程序&#xff0c;且文章末尾已附上相关源码&#xff0c;以供大家学习交流&#xff0c;博主主页还有更多Python相关程序案例…

注册登录表单

html登录页面&#xff1a; <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>创建一个登录页面</t…

JAVA:Spring Boot @Conditional 注解详解及实践

1、简述 在 Spring Boot 中&#xff0c;Conditional 注解用于实现 条件化 Bean 装配&#xff0c;即根据特定的条件来决定是否加载某个 Bean。它是 Spring 框架中的一个扩展机制&#xff0c;常用于实现模块化、可配置的组件加载。 本文将详细介绍 Conditional 相关的注解&…

Java高频面试之集合-17

hello啊&#xff0c;各位观众姥爷们&#xff01;&#xff01;&#xff01;本baby今天来报道了&#xff01;哈哈哈哈哈嗝&#x1f436; 面试官&#xff1a;JDK 8 对 HashMap 主要做了哪些优化呢&#xff1f;为什么要这么做&#xff1f; JDK 8 对 HashMap 的主要优化及原因 JDK…

力扣DAY24 | 热100 | 回文链表

前言 简单 √ 是反转链表的衍生题&#xff0c;很快写完了。不过没考虑到恢复链表结构的问题。 题目 给你一个单链表的头节点 head &#xff0c;请你判断该链表是否为回文链表。如果是&#xff0c;返回 true &#xff1b;否则&#xff0c;返回 false 。 示例 1&#xff1a; 输…