提交 fc54a74a 编写于 作者: B Bernard Xiong

[BSP] stm32f7-disco cleanup

上级 33b95be4
...@@ -10,35 +10,38 @@ ...@@ -10,35 +10,38 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2009-01-05 Bernard the first version * 2009-01-05 Bernard the first version
* 2014-04-27 Bernard make code cleanup. * 2014-04-27 Bernard make code cleanup.
*/ */
#include <board.h>
#include <rtthread.h> #include <rtthread.h>
#include <components.h>
#include "drv_led.h" #include "drv_led.h"
static void led_thread_entry(void* parameter) static void led_thread_entry(void *parameter)
{ {
led_hw_init(); led_hw_init();
while(1) while (1)
{ {
led_on(); led_on();
rt_thread_delay(RT_TICK_PER_SECOND); rt_thread_delay(RT_TICK_PER_SECOND);
led_off(); led_off();
rt_thread_delay(RT_TICK_PER_SECOND); rt_thread_delay(RT_TICK_PER_SECOND);
} }
} }
void rt_init_thread_entry(void* parameter) void rt_init_thread_entry(void *parameter)
{ {
rt_thread_t tid; rt_thread_t tid;
rt_components_init();
tid = rt_thread_create("led", tid = rt_thread_create("led",
led_thread_entry, RT_NULL, led_thread_entry, RT_NULL,
512, 12, 5); 512, 12, 5);
if (tid != RT_NULL) if (tid != RT_NULL)
rt_thread_startup(tid); rt_thread_startup(tid);
...@@ -49,8 +52,8 @@ int rt_application_init() ...@@ -49,8 +52,8 @@ int rt_application_init()
rt_thread_t tid; rt_thread_t tid;
tid = rt_thread_create("init", tid = rt_thread_create("init",
rt_init_thread_entry, RT_NULL, rt_init_thread_entry, RT_NULL,
2048, RT_THREAD_PRIORITY_MAX/3, 20); 2048, RT_THREAD_PRIORITY_MAX / 3, 20);
if (tid != RT_NULL) if (tid != RT_NULL)
rt_thread_startup(tid); rt_thread_startup(tid);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "drv_sdram.h" #include "drv_sdram.h"
#include "sram.h" #include "sram.h"
#endif #endif
/** /**
* @addtogroup STM32 * @addtogroup STM32
*/ */
...@@ -27,11 +28,6 @@ ...@@ -27,11 +28,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef USE_FULL_ASSERT #ifdef USE_FULL_ASSERT
/** /**
...@@ -91,12 +87,6 @@ void rtthread_startup(void) ...@@ -91,12 +87,6 @@ void rtthread_startup(void)
/* init application */ /* init application */
rt_application_init(); rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
/* init timer thread */ /* init timer thread */
rt_system_timer_thread_init(); rt_system_timer_thread_init();
......
...@@ -14,17 +14,19 @@ ...@@ -14,17 +14,19 @@
#include <rthw.h> #include <rthw.h>
#include <rtthread.h> #include <rtthread.h>
#include <components.h>
#include "board.h" #include "board.h"
#include "drv_usart.h" #include "drv_usart.h"
#include "drv_mpu.h" #include "drv_mpu.h"
/** /**
* @addtogroup STM32 * @addtogroup STM32
*/ */
/** /**
* @brief System Clock Configuration * @brief System Clock Configuration
* The system Clock is configured as follow : * The system Clock is configured as follow :
* System Clock source = PLL (HSE) * System Clock source = PLL (HSE)
* SYSCLK(Hz) = 200000000 * SYSCLK(Hz) = 200000000
* HCLK(Hz) = 200000000 * HCLK(Hz) = 200000000
...@@ -45,35 +47,38 @@ ...@@ -45,35 +47,38 @@
*/ */
static void SystemClock_Config(void) static void SystemClock_Config(void)
{ {
RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct; RCC_OscInitTypeDef RCC_OscInitStruct;
HAL_StatusTypeDef ret = HAL_OK; HAL_StatusTypeDef ret = HAL_OK;
/* Enable HSE Oscillator and activate PLL with HSE as source */ /* Enable HSE Oscillator and activate PLL with HSE as source */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 25; RCC_OscInitStruct.PLL.PLLM = 25;
RCC_OscInitStruct.PLL.PLLN = 400; RCC_OscInitStruct.PLL.PLLN = 400;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
HAL_RCC_OscConfig(&RCC_OscInitStruct); HAL_RCC_OscConfig(&RCC_OscInitStruct);
ret = HAL_PWREx_EnableOverDrive(); ret = HAL_PWREx_EnableOverDrive();
if(ret != HAL_OK) if (ret != HAL_OK)
{ {
while(1) { ; } while (1)
} {
;
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 }
clocks dividers */ }
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; clocks dividers */
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6); RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6);
} }
/** /**
...@@ -83,15 +88,15 @@ static void SystemClock_Config(void) ...@@ -83,15 +88,15 @@ static void SystemClock_Config(void)
*/ */
static void CPU_CACHE_Enable(void) static void CPU_CACHE_Enable(void)
{ {
/* Enable branch prediction */ /* Enable branch prediction */
SCB->CCR |= (1 <<18); SCB->CCR |= (1 << 18);
__DSB(); __DSB();
/* Enable I-Cache */ /* Enable I-Cache */
SCB_EnableICache(); SCB_EnableICache();
/* Enable D-Cache */ /* Enable D-Cache */
SCB_EnableDCache(); SCB_EnableDCache();
} }
/** /**
...@@ -100,9 +105,9 @@ static void CPU_CACHE_Enable(void) ...@@ -100,9 +105,9 @@ static void CPU_CACHE_Enable(void)
*/ */
void SysTick_Handler(void) void SysTick_Handler(void)
{ {
/* tick for HAL Library */ /* tick for HAL Library */
HAL_IncTick(); HAL_IncTick();
/* enter interrupt */ /* enter interrupt */
rt_interrupt_enter(); rt_interrupt_enter();
...@@ -117,28 +122,28 @@ void SysTick_Handler(void) ...@@ -117,28 +122,28 @@ void SysTick_Handler(void)
*/ */
void rt_hw_board_init() void rt_hw_board_init()
{ {
/* Configure the MPU attributes as Write Through */ /* Configure the MPU attributes as Write Through */
mpu_init(); mpu_init();
/* Enable the CPU Cache */ /* Enable the CPU Cache */
CPU_CACHE_Enable(); CPU_CACHE_Enable();
/* STM32F7xx HAL library initialization: /* STM32F7xx HAL library initialization:
- Configure the Flash ART accelerator on ITCM interface - Configure the Flash ART accelerator on ITCM interface
- Configure the Systick to generate an interrupt each 1 msec - Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4 - Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization - Global MSP (MCU Support Package) initialization
*/ */
HAL_Init(); HAL_Init();
/* Configure the system clock @ 200 Mhz */ /* Configure the system clock @ 200 Mhz */
SystemClock_Config(); SystemClock_Config();
/* init systick */ /* init systick */
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
/* set pend exception priority */ /* set pend exception priority */
NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1); NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
stm32_hw_usart_init(); rt_components_board_init();
#ifdef RT_USING_CONSOLE #ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME); rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif #endif
......
...@@ -24,15 +24,15 @@ ...@@ -24,15 +24,15 @@
#define RT_USING_UART3 #define RT_USING_UART3
// <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card // <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card
// <i>Default: 1 // <i>Default: 1
#define STM32_USE_SDIO 0 #define STM32_USE_SDIO 0
/* whether use board external SDRAM memory */ /* whether use board external SDRAM memory */
// <e>Use external SDRAM memory on the board // <e>Use external SDRAM memory on the board
// <o>Begin Address of External SDRAM // <o>Begin Address of External SDRAM
#define EXT_SDRAM_BEGIN 0xC0000000 #define EXT_SDRAM_BEGIN 0xC0000000
#define EXT_SDRAM_SIZE (0x800000) #define EXT_SDRAM_SIZE (0x800000)
// <o>End Address of External SDRAM // <o>End Address of External SDRAM
#define EXT_SDRAM_END (EXT_SDRAM_BEGIN + EXT_SDRAM_SIZE) #define EXT_SDRAM_END (EXT_SDRAM_BEGIN + EXT_SDRAM_SIZE)
// </e> // </e>
...@@ -48,7 +48,7 @@ extern int __bss_end; ...@@ -48,7 +48,7 @@ extern int __bss_end;
#endif #endif
// <o> Internal SRAM memory size[Kbytes] <8-64> // <o> Internal SRAM memory size[Kbytes] <8-64>
// <i>Default: 64 // <i>Default: 64
#define STM32_SRAM_SIZE (256 * 1024) #define STM32_SRAM_SIZE (256 * 1024)
#define HEAP_END (0x20010000 + STM32_SRAM_SIZE) #define HEAP_END (0x20010000 + STM32_SRAM_SIZE)
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#ifndef __DRV_LED_H #ifndef __DRV_LED_H
#define __DRV_LED_H #define __DRV_LED_H
#include "board.h"
#define led_on() HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, GPIO_PIN_SET) #define led_on() HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, GPIO_PIN_SET)
#define led_off() HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, GPIO_PIN_RESET) #define led_off() HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, GPIO_PIN_RESET)
......
...@@ -51,62 +51,62 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c ...@@ -51,62 +51,62 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
RT_ASSERT(cfg != RT_NULL); RT_ASSERT(cfg != RT_NULL);
uart = (struct stm32_uart *)serial->parent.user_data; uart = (struct stm32_uart *)serial->parent.user_data;
uart->UartHandle.Init.BaudRate = cfg->baud_rate; uart->UartHandle.Init.BaudRate = cfg->baud_rate;
uart->UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; uart->UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uart->UartHandle.Init.Mode = UART_MODE_TX_RX; uart->UartHandle.Init.Mode = UART_MODE_TX_RX;
uart->UartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; uart->UartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
switch(cfg->data_bits) switch (cfg->data_bits)
{ {
case DATA_BITS_7: case DATA_BITS_7:
uart->UartHandle.Init.WordLength = UART_WORDLENGTH_7B; uart->UartHandle.Init.WordLength = UART_WORDLENGTH_7B;
break; break;
case DATA_BITS_8: case DATA_BITS_8:
uart->UartHandle.Init.WordLength = UART_WORDLENGTH_8B; uart->UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
break; break;
case DATA_BITS_9: case DATA_BITS_9:
uart->UartHandle.Init.WordLength = UART_WORDLENGTH_9B; uart->UartHandle.Init.WordLength = UART_WORDLENGTH_9B;
break; break;
default: default:
uart->UartHandle.Init.WordLength = UART_WORDLENGTH_8B; uart->UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
break; break;
} }
switch(cfg->stop_bits) switch (cfg->stop_bits)
{ {
case STOP_BITS_1: case STOP_BITS_1:
uart->UartHandle.Init.StopBits = UART_STOPBITS_1; uart->UartHandle.Init.StopBits = UART_STOPBITS_1;
break; break;
case STOP_BITS_2: case STOP_BITS_2:
uart->UartHandle.Init.StopBits = UART_STOPBITS_2; uart->UartHandle.Init.StopBits = UART_STOPBITS_2;
break; break;
default: default:
uart->UartHandle.Init.StopBits = UART_STOPBITS_1; uart->UartHandle.Init.StopBits = UART_STOPBITS_1;
break; break;
} }
switch(cfg->parity) switch (cfg->parity)
{ {
case PARITY_NONE: case PARITY_NONE:
uart->UartHandle.Init.Parity = UART_PARITY_NONE; uart->UartHandle.Init.Parity = UART_PARITY_NONE;
break; break;
case PARITY_ODD: case PARITY_ODD:
uart->UartHandle.Init.Parity = UART_PARITY_ODD; uart->UartHandle.Init.Parity = UART_PARITY_ODD;
break; break;
case PARITY_EVEN: case PARITY_EVEN:
uart->UartHandle.Init.Parity = UART_PARITY_EVEN; uart->UartHandle.Init.Parity = UART_PARITY_EVEN;
break; break;
default: default:
uart->UartHandle.Init.Parity = UART_PARITY_NONE; uart->UartHandle.Init.Parity = UART_PARITY_NONE;
break; break;
} }
if(HAL_UART_DeInit(&uart->UartHandle) != HAL_OK) if (HAL_UART_DeInit(&uart->UartHandle) != HAL_OK)
{ {
return RT_ERROR; return RT_ERROR;
} }
if(HAL_UART_Init(&uart->UartHandle) != HAL_OK) if (HAL_UART_Init(&uart->UartHandle) != HAL_OK)
{ {
return RT_ERROR; return RT_ERROR;
} }
return RT_EOK; return RT_EOK;
} }
...@@ -124,7 +124,7 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar ...@@ -124,7 +124,7 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar
/* disable rx irq */ /* disable rx irq */
UART_DISABLE_IRQ(uart->irq); UART_DISABLE_IRQ(uart->irq);
/* disable interrupt */ /* disable interrupt */
__HAL_UART_DISABLE_IT(&uart->UartHandle, UART_IT_RXNE); __HAL_UART_DISABLE_IT(&uart->UartHandle, UART_IT_RXNE);
break; break;
case RT_DEVICE_CTRL_SET_INT: case RT_DEVICE_CTRL_SET_INT:
/* enable rx irq */ /* enable rx irq */
...@@ -190,59 +190,59 @@ void USART1_IRQHandler(void) ...@@ -190,59 +190,59 @@ void USART1_IRQHandler(void)
/* enter interrupt */ /* enter interrupt */
rt_interrupt_enter(); rt_interrupt_enter();
/* UART in mode Receiver ---------------------------------------------------*/ /* UART in mode Receiver ---------------------------------------------------*/
if((__HAL_UART_GET_IT(&uart->UartHandle, UART_IT_RXNE) != RESET) && (__HAL_UART_GET_IT_SOURCE(&uart->UartHandle, UART_IT_RXNE) != RESET)) if ((__HAL_UART_GET_IT(&uart->UartHandle, UART_IT_RXNE) != RESET) && (__HAL_UART_GET_IT_SOURCE(&uart->UartHandle, UART_IT_RXNE) != RESET))
{ {
rt_hw_serial_isr(&serial1,RT_SERIAL_EVENT_RX_IND); rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND);
/* Clear RXNE interrupt flag */ /* Clear RXNE interrupt flag */
__HAL_UART_SEND_REQ(&uart->UartHandle, UART_RXDATA_FLUSH_REQUEST); __HAL_UART_SEND_REQ(&uart->UartHandle, UART_RXDATA_FLUSH_REQUEST);
} }
/* leave interrupt */ /* leave interrupt */
rt_interrupt_leave(); rt_interrupt_leave();
} }
#endif /* RT_USING_UART1 */ #endif /* RT_USING_UART1 */
/** /**
* @brief UART MSP Initialization * @brief UART MSP Initialization
* This function configures the hardware resources used in this example: * This function configures the hardware resources used in this example:
* - Peripheral's clock enable * - Peripheral's clock enable
* - Peripheral's GPIO Configuration * - Peripheral's GPIO Configuration
* - NVIC configuration for UART interrupt request enable * - NVIC configuration for UART interrupt request enable
* @param huart: UART handle pointer * @param huart: UART handle pointer
* @retval None * @retval None
*/ */
void HAL_UART_MspInit(UART_HandleTypeDef *huart) void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ {
GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitTypeDef GPIO_InitStruct;
if(huart->Instance == USART1) if (huart->Instance == USART1)
{ {
/* Enable GPIO TX/RX clock */ /* Enable GPIO TX/RX clock */
USART1_TX_GPIO_CLK_ENABLE(); USART1_TX_GPIO_CLK_ENABLE();
USART1_RX_GPIO_CLK_ENABLE(); USART1_RX_GPIO_CLK_ENABLE();
/* Enable USARTx clock */ /* Enable USARTx clock */
USART1_CLK_ENABLE(); USART1_CLK_ENABLE();
/* UART TX GPIO pin configuration */ /* UART TX GPIO pin configuration */
GPIO_InitStruct.Pin = USART1_TX_PIN; GPIO_InitStruct.Pin = USART1_TX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = USART1_TX_AF; GPIO_InitStruct.Alternate = USART1_TX_AF;
HAL_GPIO_Init(USART1_TX_GPIO_PORT, &GPIO_InitStruct); HAL_GPIO_Init(USART1_TX_GPIO_PORT, &GPIO_InitStruct);
/* UART RX GPIO pin configuration */ /* UART RX GPIO pin configuration */
GPIO_InitStruct.Pin = USART1_RX_PIN; GPIO_InitStruct.Pin = USART1_RX_PIN;
GPIO_InitStruct.Alternate = USART1_RX_AF; GPIO_InitStruct.Alternate = USART1_RX_AF;
HAL_GPIO_Init(USART1_RX_GPIO_PORT, &GPIO_InitStruct); HAL_GPIO_Init(USART1_RX_GPIO_PORT, &GPIO_InitStruct);
/* NVIC for USART */ /* NVIC for USART */
HAL_NVIC_SetPriority(USART1_IRQn, 0, 1); HAL_NVIC_SetPriority(USART1_IRQn, 0, 1);
HAL_NVIC_EnableIRQ(USART1_IRQn); HAL_NVIC_EnableIRQ(USART1_IRQn);
} }
} }
/** /**
* @brief UART MSP De-Initialization * @brief UART MSP De-Initialization
* This function frees the hardware resources used in this example: * This function frees the hardware resources used in this example:
* - Disable the Peripheral's clock * - Disable the Peripheral's clock
* - Revert GPIO and NVIC configuration to their default state * - Revert GPIO and NVIC configuration to their default state
...@@ -251,21 +251,21 @@ void HAL_UART_MspInit(UART_HandleTypeDef *huart) ...@@ -251,21 +251,21 @@ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
*/ */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ {
if(huart->Instance == USART1) if (huart->Instance == USART1)
{ {
/* Reset peripherals */ /* Reset peripherals */
USART1_FORCE_RESET(); USART1_FORCE_RESET();
USART1_RELEASE_RESET(); USART1_RELEASE_RESET();
/* Disable peripherals and GPIO Clocks */ /* Disable peripherals and GPIO Clocks */
/* Configure UART Tx as alternate function */ /* Configure UART Tx as alternate function */
HAL_GPIO_DeInit(USART1_TX_GPIO_PORT, USART1_TX_PIN); HAL_GPIO_DeInit(USART1_TX_GPIO_PORT, USART1_TX_PIN);
/* Configure UART Rx as alternate function */ /* Configure UART Rx as alternate function */
HAL_GPIO_DeInit(USART1_RX_GPIO_PORT, USART1_RX_PIN); HAL_GPIO_DeInit(USART1_RX_GPIO_PORT, USART1_RX_PIN);
/* Disable the NVIC for UART */ /* Disable the NVIC for UART */
HAL_NVIC_DisableIRQ(USART1_IRQn); HAL_NVIC_DisableIRQ(USART1_IRQn);
} }
} }
int stm32_hw_usart_init(void) int stm32_hw_usart_init(void)
...@@ -276,7 +276,7 @@ int stm32_hw_usart_init(void) ...@@ -276,7 +276,7 @@ int stm32_hw_usart_init(void)
#ifdef RT_USING_UART1 #ifdef RT_USING_UART1
uart = &uart1; uart = &uart1;
uart->UartHandle.Instance = USART1; uart->UartHandle.Instance = USART1;
serial1.ops = &stm32_uart_ops; serial1.ops = &stm32_uart_ops;
serial1.config = config; serial1.config = config;
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
// </section> // </section>
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" /> // <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
//#define RT_USING_COMPONENTS_INIT #define RT_USING_COMPONENTS_INIT
// <section name="RT_USING_FINSH" description="Using finsh as shell, which is a C-Express shell" default="true" > // <section name="RT_USING_FINSH" description="Using finsh as shell, which is a C-Express shell" default="true" >
#define RT_USING_FINSH #define RT_USING_FINSH
#define FINSH_THREAD_PRIORITY 0xa #define FINSH_THREAD_PRIORITY 0xa
...@@ -113,8 +113,8 @@ ...@@ -113,8 +113,8 @@
// </section> // </section>
// <section name="LIBC" description="C Runtime library setting" default="always" > // <section name="LIBC" description="C Runtime library setting" default="always" >
// <bool name="RT_USING_NEWLIB" description="Using newlib library, only available under GNU GCC" default="true" /> // <bool name="RT_USING_LIBC" description="Using libc library" default="true" />
//#define RT_USING_NEWLIB #define RT_USING_NEWLIB
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" /> // <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
//#define RT_USING_PTHREADS //#define RT_USING_PTHREADS
// </section> // </section>
......
...@@ -41,7 +41,7 @@ if PLATFORM == 'gcc': ...@@ -41,7 +41,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy' OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
CFLAGS = DEVICE + ' -g -Wall G -DSTM32F756xx -DUSE_HAL_DRIVER -D__ASSEMBLY__ -D__FPU_USED' CFLAGS = DEVICE + ' -g -Wall -DSTM32F756xx -DUSE_HAL_DRIVER -D__ASSEMBLY__ -D__FPU_USED'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread_stm32f7xx.map,-cref,-u,Reset_Handler -T rtthread-stm32f7xx.ld' LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread_stm32f7xx.map,-cref,-u,Reset_Handler -T rtthread-stm32f7xx.ld'
......
...@@ -94,8 +94,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -94,8 +94,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#ifdef __CC_ARM /* ARM Compiler */ #ifdef __CC_ARM /* ARM Compiler */
#include <stdarg.h> #include <stdarg.h>
#define SECTION(x) __attribute__((section(x))) #define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused)) #define RT_UNUSED __attribute__((unused))
#define USED __attribute__((used)) #define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n))) #define ALIGN(n) __attribute__((aligned(n)))
#define WEAK __weak #define WEAK __weak
#define rt_inline static __inline #define rt_inline static __inline
...@@ -109,8 +109,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -109,8 +109,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */ #elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
#include <stdarg.h> #include <stdarg.h>
#define SECTION(x) @ x #define SECTION(x) @ x
#define UNUSED #define RT_UNUSED
#define USED #define RT_USED
#define PRAGMA(x) _Pragma(#x) #define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) PRAGMA(data_alignment=n) #define ALIGN(n) PRAGMA(data_alignment=n)
#define WEAK __weak #define WEAK __weak
...@@ -130,17 +130,17 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -130,17 +130,17 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#endif #endif
#define SECTION(x) __attribute__((section(x))) #define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused)) #define RT_UNUSED __attribute__((unused))
#define USED __attribute__((used)) #define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n))) #define ALIGN(n) __attribute__((aligned(n)))
#define WEAK __attribute__((weak)) #define WEAK __attribute__((weak))
#define rt_inline static __inline #define rt_inline static __inline
#define RTT_API #define RTT_API
#elif defined (__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */ #elif defined (__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */
#include <stdarg.h> #include <stdarg.h>
#define SECTION(x) __attribute__((section(x))) #define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused)) #define RT_UNUSED __attribute__((unused))
#define USED __attribute__((used)) #define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n))) #define ALIGN(n) __attribute__((aligned(n)))
#define WEAK __attribute__((weak)) #define WEAK __attribute__((weak))
#define rt_inline static inline #define rt_inline static inline
...@@ -148,8 +148,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -148,8 +148,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#elif defined (_MSC_VER) #elif defined (_MSC_VER)
#include <stdarg.h> #include <stdarg.h>
#define SECTION(x) #define SECTION(x)
#define UNUSED #define RT_UNUSED
#define USED #define RT_USED
#define ALIGN(n) __declspec(align(n)) #define ALIGN(n) __declspec(align(n))
#define WEAK #define WEAK
#define rt_inline static __inline #define rt_inline static __inline
...@@ -160,11 +160,11 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -160,11 +160,11 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
* GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more * GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more
* details. */ * details. */
#define SECTION(x) #define SECTION(x)
#define UNUSED #define RT_UNUSED
#define USED #define RT_USED
#define PRAGMA(x) _Pragma(#x) #define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) #define ALIGN(n)
#define WEAK #define WEAK
#define rt_inline static inline #define rt_inline static inline
#define RTT_API #define RTT_API
#else #else
......
...@@ -224,7 +224,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ ...@@ -224,7 +224,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
AddOption('--verbose', AddOption('--verbose',
dest='verbose', dest='verbose',
action='store_true', action='store_true',
default=True, default=False,
help='print verbose information during build') help='print verbose information during build')
if not GetOption('verbose'): if not GetOption('verbose'):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册