mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-18 10:03:30 +08:00
feat : n32g452xx direct structure base at32
1. 重新整理目录结构
This commit is contained in:
parent
516d2a3640
commit
0e28321c2c
@ -1,47 +0,0 @@
|
||||
mainmenu "RT-Thread Configuration"
|
||||
|
||||
config BSP_DIR
|
||||
string
|
||||
option env="BSP_ROOT"
|
||||
default "."
|
||||
|
||||
config RTT_DIR
|
||||
string
|
||||
option env="RTT_ROOT"
|
||||
default "../.."
|
||||
|
||||
config PKGS_DIR
|
||||
string
|
||||
option env="PKGS_ROOT"
|
||||
default "packages"
|
||||
|
||||
source "$RTT_DIR/Kconfig"
|
||||
source "$PKGS_DIR/Kconfig"
|
||||
|
||||
config SOC_N32G452XX
|
||||
bool
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
default y
|
||||
|
||||
config RT_USING_UART1
|
||||
bool "Using UART1"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
config RT_USING_UART2
|
||||
bool "Using UART2"
|
||||
select RT_USING_SERIAL
|
||||
default n
|
||||
|
||||
config RT_USING_UART3
|
||||
bool "Using UART3"
|
||||
select RT_USING_SERIAL
|
||||
default n
|
||||
|
||||
config RT_USING_UART4
|
||||
bool "Using UART4"
|
||||
select RT_USING_SERIAL
|
||||
default n
|
||||
|
||||
|
54
bsp/n32g452xx/Libraries/N32_Std_Driver/SConscript
Executable file
54
bsp/n32g452xx/Libraries/N32_Std_Driver/SConscript
Executable file
@ -0,0 +1,54 @@
|
||||
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')
|
@ -1,37 +0,0 @@
|
||||
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')
|
64
bsp/n32g452xx/Libraries/rt_drivers/SConscript
Executable file
64
bsp/n32g452xx/Libraries/rt_drivers/SConscript
Executable file
@ -0,0 +1,64 @@
|
||||
# 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')
|
64
bsp/n32g452xx/Libraries/rt_drivers/drv_common.c
Executable file
64
bsp/n32g452xx/Libraries/rt_drivers/drv_common.c
Executable file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
30
bsp/n32g452xx/Libraries/rt_drivers/drv_common.h
Executable file
30
bsp/n32g452xx/Libraries/rt_drivers/drv_common.h
Executable file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user