[stm32][nano] stm32f103-bluepill support nano version

This commit is contained in:
Meco Man 2023-11-30 11:02:50 +08:00 committed by guo
parent 005828eba7
commit 53aa771aa5
6 changed files with 144 additions and 126 deletions

View File

@ -3,10 +3,15 @@ Import('rtconfig')
from building import *
cwd = GetCurrentDir()
# add the general drivers.
group = []
src = []
path = [cwd]
if not GetDepend('PKG_CMSIS_CORE'):
path += [cwd + '/CMSIS/Include']
if not GetDepend(['RT_USING_NANO']):
src += ['drv_common.c']
if GetDepend(['RT_USING_PIN']):
src += ['drv_gpio.c']
@ -114,14 +119,8 @@ if GetDepend(['BSP_USING_PULSE_ENCODER']):
if GetDepend(['BSP_USING_USBH']):
src += ['drv_usbh.c']
src += ['drv_common.c']
path = [cwd]
path += [cwd + '/config']
if not GetDepend('PKG_CMSIS_CORE'):
path += [cwd + '/CMSIS/Include']
if GetDepend('BSP_USING_ON_CHIP_FLASH'):
path += [cwd + '/drv_flash']

View File

@ -15,8 +15,17 @@ config PKGS_DIR
option env="PKGS_ROOT"
default "packages"
config SOC_STM32F103C8
bool
select SOC_SERIES_STM32F1
select RT_USING_COMPONENTS_INIT
select RT_USING_USER_MAIN
default y
source "$RTT_DIR/Kconfig"
source "$PKGS_DIR/Kconfig"
if !RT_USING_NANO
source "../libraries/Kconfig"
source "board/Kconfig"
endif

View File

@ -12,6 +12,7 @@
#include <rtdevice.h>
#include <board.h>
#ifndef RT_USING_NANO
/* defined the LED0 pin: PC13 */
#define LED0_PIN GET_PIN(C, 13)
@ -28,3 +29,12 @@ int main(void)
rt_thread_mdelay(500);
}
}
#else
int main(void)
{
while (1)
{
rt_thread_mdelay(500);
}
}
#endif

View File

@ -1,12 +1,5 @@
menu "Hardware Drivers Config"
config SOC_STM32F103C8
bool
select SOC_SERIES_STM32F1
select RT_USING_COMPONENTS_INIT
select RT_USING_USER_MAIN
default y
menu "Onboard Peripheral Drivers"
config BSP_USING_USB_TO_USART

View File

@ -51,3 +51,10 @@ void SystemClock_Config(void)
Error_Handler();
}
}
#ifdef RT_USING_NANO
void rt_hw_board_init(void)
{
}
#endif

View File

@ -13,8 +13,8 @@
#include <rtthread.h>
#include <stm32f1xx.h>
#include "drv_common.h"
#include "drv_gpio.h"
#include <drv_common.h>
#include <drv_gpio.h>
#ifdef __cplusplus
extern "C" {