提交 0e28321c 编写于 作者: L linyuanbo_breo_server

feat : n32g452xx direct structure base at32

1. 重新整理目录结构
上级 516d2a36
import rtconfig
from building import *
# get current directory
cwd = GetCurrentDir()
# The set of source files associated with this SConscript file.
# src = Split("""
# n32g45x_std_periph_driver/src/misc.c
# n32g45x_std_periph_driver/src/n32g45x_adc.c
# n32g45x_std_periph_driver/src/n32g45x_bkp.c
# n32g45x_std_periph_driver/src/n32g45x_can.c
# n32g45x_std_periph_driver/src/n32g45x_comp.c
# n32g45x_std_periph_driver/src/n32g45x_crc.c
# n32g45x_std_periph_driver/src/n32g45x_dac.c
# n32g45x_std_periph_driver/src/n32g45x_dbg.c
# n32g45x_std_periph_driver/src/n32g45x_dma.c
# n32g45x_std_periph_driver/src/n32g45x_dvp.c
# n32g45x_std_periph_driver/src/n32g45x_eth.c
# n32g45x_std_periph_driver/src/n32g45x_exti.c
# n32g45x_std_periph_driver/src/n32g45x_flash.c
# n32g45x_std_periph_driver/src/n32g45x_gpio.c
# n32g45x_std_periph_driver/src/n32g45x_i2c.c
# n32g45x_std_periph_driver/src/n32g45x_iwdg.c
# n32g45x_std_periph_driver/src/n32g45x_opamp.c
# n32g45x_std_periph_driver/src/n32g45x_pwr.c
# n32g45x_std_periph_driver/src/n32g45x_qspi.c
# n32g45x_std_periph_driver/src/n32g45x_rcc.c
# n32g45x_std_periph_driver/src/n32g45x_rtc.c
# n32g45x_std_periph_driver/src/n32g45x_sdio.c
# n32g45x_std_periph_driver/src/n32g45x_spi.c
# n32g45x_std_periph_driver/src/n32g45x_tim.c
# n32g45x_std_periph_driver/src/n32g45x_tsc.c
# n32g45x_std_periph_driver/src/n32g45x_usart.c
# n32g45x_std_periph_driver/src/n32g45x_wwdg.c
# n32g45x_std_periph_driver/src/n32g45x_xfmc.c
# """)
src = Glob('n32g45x_std_periph_driver/src/*.c')
src += [cwd + '/CMSIS/device/system_n32g45x.c']
path = [
cwd + '/CMSIS/core',
cwd + '/CMSIS/device',
cwd + '/n32g45x_std_periph_driver/inc',]
if GetDepend(['RT_USING_BSP_USB']):
path += [cwd + '/n32g45x_usbfs_driver/inc']
src += [cwd + '/n32g45x_usbfs_driver/src']
CPPDEFINES = ['USE_STDPERIPH_DRIVER']
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
Return('group')
import rtconfig
Import('RTT_ROOT')
from building import *
# get current directory
cwd = GetCurrentDir()
# The set of source files associated with this SConscript file.
src = Glob('n32g45x_std_periph_driver/src/*.c')
src += [cwd + '/CMSIS/device/system_n32g45x.c']
#add for startup script
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/CMSIS/device/startup/startup_n32g45x_gcc.S']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/CMSIS/device/startup/startup_n32g45x.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/CMSIS/device/startup/startup_n32g45x_EWARM.s']
path = [
cwd + '/CMSIS/core',
cwd + '/CMSIS/device',
cwd + '/n32g45x_std_periph_driver/inc',]
if GetDepend(['RT_USING_BSP_USB']):
path += [cwd + '/n32g45x_usbfs_driver/inc']
src += [cwd + '/n32g45x_usbfs_driver/src']
CPPDEFINES = ['USE_STDPERIPH_DRIVER', 'N32G45X']
group = DefineGroup('N32_Lib', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
#print('CROSS_TOOL=[%s]' %(rtconfig.CROSS_TOOL))
#print('path=[%s]' %(path))
Return('group')
# RT-Thread building script for component
Import('RTT_ROOT')
Import('rtconfig')
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Split("""
""")
src += ['drv_common.c']
if GetDepend(['RT_USING_PIN']):
src += ['drv_gpio.c']
if GetDepend(['RT_USING_WDT']):
src += ['drv_wdt.c']
if GetDepend(['RT_USING_SERIAL']):
src += ['drv_usart.c']
if GetDepend(['RT_USING_PWM']):
src += ['drv_pwm.c']
if GetDepend(['RT_USING_HWTIMER']):
src += ['drv_hwtimer.c']
if GetDepend(['RT_USING_SPI']):
src += ['drv_spi.c']
if GetDepend(['RT_USING_ETH', 'RT_USING_LWIP']):
src += ['drv_eth.c']
if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):
if GetDepend('RT_USING_I2C1') or GetDepend('RT_USING_I2C2') or GetDepend('RT_USING_I2C3') or GetDepend('RT_USING_I2C4'):
src += ['drv_soft_i2c.c']
if GetDepend(['RT_USING_ADC']):
src += Glob('drv_adc.c')
if GetDepend('RT_USING_SRAM'):
src += ['drv_sram.c']
if GetDepend('RT_USING_RTC'):
src += ['drv_rtc.c']
if GetDepend('RT_USING_ON_CHIP_FLASH'):
src += ['drv_flash.c']
if GetDepend(['RT_USING_WDT']):
src += ['drv_wdt.c']
if GetDepend(['RT_USING_CAN']):
src += ['drv_can.c']
if GetDepend(['RT_USING_SDIO']):
src += ['drv_sdio.c']
CPPPATH = [cwd]
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-11-7 SummerGift first version
*/
#include "drv_common.h"
#include "board.h"
#ifdef RT_USING_SERIAL
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
#endif
#ifdef RT_USING_FINSH
#include <finsh.h>
static void reboot(uint8_t argc, char **argv)
{
rt_hw_cpu_reset();
}
FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System);
#endif /* RT_USING_FINSH */
/**
* This function will delay for some us.
*
* @param us the delay time of us
*/
void rt_hw_us_delay(rt_uint32_t us)
{
rt_uint32_t ticks;
rt_uint32_t told, tnow, tcnt = 0;
rt_uint32_t reload = SysTick->LOAD;
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
told = SysTick->VAL;
while (1)
{
tnow = SysTick->VAL;
if (tnow != told)
{
if (tnow < told)
{
tcnt += told - tnow;
}
else
{
tcnt += reload - tnow + told;
}
told = tnow;
if (tcnt >= ticks)
{
break;
}
}
}
}
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-11-7 SummerGift first version
*/
#ifndef __DRV_COMMON_H__
#define __DRV_COMMON_H__
#include <rtthread.h>
#include <rthw.h>
#ifdef RT_USING_DEVICE
#include <rtdevice.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
void rt_hw_us_delay(rt_uint32_t us);
#ifdef __cplusplus
}
#endif
#endif
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#ifdef RT_USING_PIN #ifdef RT_USING_PIN
#define N32F10X_PIN_NUMBERS 100 //[48, 64, 100, 144 ] #define N32F10X_PIN_NUMBERS 64 //[48, 64, 100, 144 ]
#define __N32_PIN(index, rcc, gpio, gpio_index) \ #define __N32_PIN(index, rcc, gpio, gpio_index) \
{ \ { \
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册