mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-07 09:52:08 +08:00
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : main.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009 RT-Thread Develop Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -47,6 +44,7 @@ void HAL_MspInit(void)
|
||||
__HAL_AFIO_REMAP_SWJ_NOJTAG();
|
||||
}
|
||||
|
||||
|
||||
void SystemClock_Config(void)
|
||||
{
|
||||
rt_err_t ret = RT_EOK;
|
||||
@@ -63,7 +61,19 @@ void SystemClock_Config(void)
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
|
||||
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
RT_ASSERT(ret == HAL_OK);
|
||||
if(ret == HAL_TIMEOUT)
|
||||
{
|
||||
/* HSE timeout switch to HSI */
|
||||
rt_memset(&RCC_OscInitStruct, 0, sizeof(RCC_OscInitStruct));
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSICalibrationValue = 16;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16;
|
||||
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
RT_ASSERT(ret == HAL_OK);
|
||||
}
|
||||
|
||||
/* Initializes the CPU, AHB and APB busses clocks */
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK |
|
||||
@@ -103,6 +113,39 @@ void SystemClock_Config(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void m3_m4_delay_us(rt_uint32_t us)
|
||||
{
|
||||
__IO uint32_t Delay = us * (SystemCoreClock / 8U / 1000000U);
|
||||
do
|
||||
{
|
||||
__NOP();
|
||||
}
|
||||
while (Delay --);
|
||||
}
|
||||
|
||||
void HAL_Delay(__IO uint32_t Delay)
|
||||
{
|
||||
m3_m4_delay_us(Delay * 10);
|
||||
}
|
||||
|
||||
extern __IO uint32_t uwTick;
|
||||
uint32_t HAL_GetTick(void)
|
||||
{
|
||||
HAL_Delay(1);
|
||||
uwTick ++;
|
||||
return uwTick;
|
||||
}
|
||||
|
||||
void HAL_SuspendTick(void)
|
||||
{
|
||||
/* we should not suspend tick */
|
||||
}
|
||||
|
||||
void HAL_ResumeTick(void)
|
||||
{
|
||||
/* we should not resume tick */
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the timer interrupt service routine.
|
||||
*
|
||||
@@ -111,6 +154,7 @@ void SysTick_Handler(void)
|
||||
{
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
HAL_IncTick();
|
||||
rt_tick_increase();
|
||||
/* leave interrupt */
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : board.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : drv_gpio.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2015, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : drv_gpio.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2015, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,21 +1,8 @@
|
||||
/*
|
||||
* File : drv_sdcard.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,21 +1,8 @@
|
||||
/*
|
||||
* File : drv_sdcard.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : dev_gpio.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2015, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : gpio.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2015, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : drv_usart.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : usart.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : drv_usb.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2015, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
* File : drv_usb.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2015, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,16 +14,16 @@
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>STM32F103RB</Device>
|
||||
<Device>STM32F103RC</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.2.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x5000) IROM(0x08000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||
<Cpu>IRAM(0x20000000,0xC000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))</FlashDriverDll>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000 -FP0($$Device:STM32F103RC$Flash\STM32F10x_512.FLM))</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:STM32F103RB$Device\Include\stm32f10x.h</RegisterFile>
|
||||
<RegisterFile>$$Device:STM32F103RC$Device\Include\stm32f10x.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
@@ -33,7 +33,7 @@
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>$$Device:STM32F103RB$SVD\STM32F103xx.svd</SFDFile>
|
||||
<SFDFile>$$Device:STM32F103RC$SVD\STM32F103xx.svd</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
@@ -111,8 +111,8 @@
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> -REMAP</SimDllArguments>
|
||||
<SimDlgDll>DCM.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM3</SimDlgDllArguments>
|
||||
<SimDlgDll>DARMSTM.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pSTM32F103RC</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments></TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
@@ -138,7 +138,7 @@
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash3></Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
@@ -244,12 +244,12 @@
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x5000</Size>
|
||||
<Size>0xc000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x8000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
<Size>0x40000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
@@ -274,7 +274,7 @@
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x8000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
@@ -299,7 +299,7 @@
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x5000</Size>
|
||||
<Size>0xc000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
@@ -324,6 +324,7 @@
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
|
||||
@@ -297,20 +297,24 @@ config RT_HSE_VALUE
|
||||
config RT_HSE_HCLK
|
||||
int "System Clock Value"
|
||||
default 84000000
|
||||
config RT_USING_UART1
|
||||
config BSP_USING_UART1
|
||||
bool "Using UART1"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
config RT_USING_UART2
|
||||
config BSP_USING_UART2
|
||||
bool "Using UART2"
|
||||
select RT_USING_SERIAL
|
||||
default n
|
||||
|
||||
config RT_USING_UART3
|
||||
config BSP_USING_UART3
|
||||
bool "Using UART3"
|
||||
select RT_USING_SERIAL
|
||||
default n
|
||||
|
||||
config RT_USING_UART6
|
||||
config BSP_USING_UART6
|
||||
bool "Using UART6"
|
||||
select RT_USING_SERIAL
|
||||
default n
|
||||
|
||||
if RT_USING_CAN
|
||||
|
||||
@@ -78,11 +78,12 @@ static rt_int32_t drv_get_scl(void *data)
|
||||
|
||||
static void drv_udelay(rt_uint32_t us)
|
||||
{
|
||||
int i = (HAL_RCC_GetHCLKFreq() / 4000000 * us);
|
||||
while (i)
|
||||
__IO uint32_t Delay = us * (SystemCoreClock / 8U / 1000000U);
|
||||
do
|
||||
{
|
||||
i--;
|
||||
}
|
||||
__NOP();
|
||||
}
|
||||
while (Delay --);
|
||||
}
|
||||
|
||||
static const struct rt_i2c_bit_ops drv_bit_ops =
|
||||
|
||||
@@ -147,7 +147,7 @@ static const struct rt_uart_ops drv_uart_ops =
|
||||
drv_getc,
|
||||
};
|
||||
|
||||
#if defined(RT_USING_UART1)
|
||||
#if defined(BSP_USING_UART1)
|
||||
/* UART1 device driver structure */
|
||||
static struct drv_uart uart1;
|
||||
struct rt_serial_device serial1;
|
||||
@@ -168,9 +168,9 @@ void USART1_IRQHandler(void)
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
#endif /* RT_USING_UART1 */
|
||||
#endif /* BSP_USING_UART1 */
|
||||
|
||||
#if defined(RT_USING_UART2)
|
||||
#if defined(BSP_USING_UART2)
|
||||
/* UART2 device driver structure */
|
||||
static struct drv_uart uart2;
|
||||
struct rt_serial_device serial2;
|
||||
@@ -191,9 +191,9 @@ void USART2_IRQHandler(void)
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
#endif /* RT_USING_UART2 */
|
||||
#endif /* BSP_USING_UART2 */
|
||||
|
||||
#if defined(RT_USING_UART3)
|
||||
#if defined(BSP_USING_UART3)
|
||||
/* UART3 device driver structure */
|
||||
static struct drv_uart uart3;
|
||||
struct rt_serial_device serial3;
|
||||
@@ -214,9 +214,9 @@ void USART3_IRQHandler(void)
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
#endif /* RT_USING_UART3 */
|
||||
#endif /* BSP_USING_UART3 */
|
||||
|
||||
#if defined(RT_USING_UART6)
|
||||
#if defined(BSP_USING_UART6)
|
||||
/* UART6 device driver structure */
|
||||
static struct drv_uart uart6;
|
||||
struct rt_serial_device serial6;
|
||||
@@ -237,7 +237,7 @@ void USART6_IRQHandler(void)
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
#endif /* RT_USING_UART6 */
|
||||
#endif /* BSP_USING_UART6 */
|
||||
|
||||
/**
|
||||
* @brief UART MSP Initialization
|
||||
@@ -365,7 +365,7 @@ int hw_usart_init(void)
|
||||
{
|
||||
struct drv_uart *uart;
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
#ifdef RT_USING_UART1
|
||||
#ifdef BSP_USING_UART1
|
||||
uart = &uart1;
|
||||
uart->UartHandle.Instance = USART1;
|
||||
uart->irq = USART1_IRQn;
|
||||
@@ -375,8 +375,8 @@ int hw_usart_init(void)
|
||||
rt_hw_serial_register(&serial1, "uart1",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
uart);
|
||||
#endif /* RT_USING_UART1 */
|
||||
#ifdef RT_USING_UART2
|
||||
#endif /* BSP_USING_UART1 */
|
||||
#ifdef BSP_USING_UART2
|
||||
uart = &uart2;
|
||||
uart->UartHandle.Instance = USART2;
|
||||
uart->irq = USART2_IRQn;
|
||||
@@ -386,8 +386,8 @@ int hw_usart_init(void)
|
||||
rt_hw_serial_register(&serial2, "uart2",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
uart);
|
||||
#endif /* RT_USING_UART2 */
|
||||
#ifdef RT_USING_UART3
|
||||
#endif /* BSP_USING_UART2 */
|
||||
#ifdef BSP_USING_UART3
|
||||
uart = &uart3;
|
||||
uart->UartHandle.Instance = USART3;
|
||||
uart->irq = USART3_IRQn;
|
||||
@@ -397,18 +397,19 @@ int hw_usart_init(void)
|
||||
rt_hw_serial_register(&serial3, "uart3",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
uart);
|
||||
#endif /* RT_USING_UART3 */
|
||||
#ifdef RT_USING_UART6
|
||||
#endif /* BSP_USING_UART3 */
|
||||
#ifdef BSP_USING_UART6
|
||||
uart = &uart6;
|
||||
uart->UartHandle.Instance = USART6;
|
||||
uart->irq = USART6_IRQn;
|
||||
serial6.ops = &drv_uart_ops;
|
||||
serial6.config = config;
|
||||
/* register UART2 device */
|
||||
/* register UART6 device */
|
||||
rt_hw_serial_register(&serial6, "uart6",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
uart);
|
||||
#endif /* RT_USING_UART6 */
|
||||
#endif /* BSP_USING_UART6 */
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_BOARD_EXPORT(hw_usart_init);
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
import os
|
||||
|
||||
# toolchains options
|
||||
ARCH='arm'
|
||||
CPU='cortex-m4'
|
||||
CROSS_TOOL='gcc'
|
||||
ARCH = 'arm'
|
||||
CPU = 'cortex-m4'
|
||||
CROSS_TOOL = 'gcc'
|
||||
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
|
||||
#device options
|
||||
|
||||
|
||||
# cross_tool provides the cross compiler
|
||||
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
|
||||
if CROSS_TOOL == 'gcc':
|
||||
@@ -44,7 +43,7 @@ if PLATFORM == 'gcc':
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
|
||||
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
|
||||
CFLAGS = DEVICE + ' -std=c99 -Dgcc' # -D' + PART_TYPE
|
||||
CFLAGS = DEVICE + ' -std=c99'
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-stm32.map,-cref,-u,Reset_Handler -T stm32_rom.ld'
|
||||
|
||||
|
||||
@@ -85,13 +85,15 @@ typedef uint16_t in_port_t;
|
||||
#define AF_INET6 10
|
||||
#define AF_CAN 29 /* Controller Area Network */
|
||||
#define AF_AT 45 /* AT socket */
|
||||
#define AF_WIZ 46 /* WIZnet socket */
|
||||
#define PF_INET AF_INET
|
||||
#define PF_INET6 AF_INET6
|
||||
#define PF_UNSPEC AF_UNSPEC
|
||||
#define PF_CAN AF_CAN
|
||||
#define PF_AT AF_AT
|
||||
#define PF_WIZ AF_WIZ
|
||||
|
||||
#define AF_MAX (AF_AT + 1) /* For now.. */
|
||||
#define AF_MAX (AF_WIZ + 1) /* For now.. */
|
||||
|
||||
#define IPPROTO_IP 0
|
||||
#define IPPROTO_ICMP 1
|
||||
|
||||
Reference in New Issue
Block a user