Merge pull request #2093 from nongxiaoming/master
[bsp][stm32h743-nucleo] fix the bug of HEAP_BEGIN define.
This commit is contained in:
commit
2befae8873
|
@ -33,16 +33,8 @@
|
||||||
#define EXT_SDRAM_END (EXT_SDRAM_BEGIN + EXT_SDRAM_SIZE)
|
#define EXT_SDRAM_END (EXT_SDRAM_BEGIN + EXT_SDRAM_SIZE)
|
||||||
// </e>
|
// </e>
|
||||||
|
|
||||||
#ifdef __CC_ARM
|
|
||||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
#define HEAP_BEGIN 0x24000000
|
||||||
#define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
|
|
||||||
#elif __ICCARM__
|
|
||||||
#pragma section="HEAP"
|
|
||||||
#define HEAP_BEGIN (__segment_end("HEAP"))
|
|
||||||
#else
|
|
||||||
extern int __bss_end;
|
|
||||||
#define HEAP_BEGIN (&__bss_end)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// <o> Internal SRAM memory size[Kbytes] <8-64>
|
// <o> Internal SRAM memory size[Kbytes] <8-64>
|
||||||
// <i>Default: 64
|
// <i>Default: 64
|
||||||
|
|
|
@ -30,6 +30,22 @@
|
||||||
#define USART1_RX_GPIO_PORT GPIOB
|
#define USART1_RX_GPIO_PORT GPIOB
|
||||||
#define USART1_RX_AF GPIO_AF7_USART1
|
#define USART1_RX_AF GPIO_AF7_USART1
|
||||||
|
|
||||||
|
/* Definition for USART3 clock resources */
|
||||||
|
#define USART3_CLK_ENABLE() __USART3_CLK_ENABLE()
|
||||||
|
#define USART3_RX_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
|
||||||
|
#define USART3_TX_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
|
||||||
|
|
||||||
|
#define USART3_FORCE_RESET() __USART3_FORCE_RESET()
|
||||||
|
#define USART3_RELEASE_RESET() __USART3_RELEASE_RESET()
|
||||||
|
|
||||||
|
/* Definition for USARTx Pins */
|
||||||
|
#define USART3_TX_PIN GPIO_PIN_8
|
||||||
|
#define USART3_TX_GPIO_PORT GPIOD
|
||||||
|
#define USART3_TX_AF GPIO_AF7_USART3
|
||||||
|
#define USART3_RX_PIN GPIO_PIN_9
|
||||||
|
#define USART3_RX_GPIO_PORT GPIOD
|
||||||
|
#define USART3_RX_AF GPIO_AF7_USART3
|
||||||
|
|
||||||
/* STM32 uart driver */
|
/* STM32 uart driver */
|
||||||
struct stm32_uart
|
struct stm32_uart
|
||||||
{
|
{
|
||||||
|
@ -195,8 +211,33 @@ void USART1_IRQHandler(void)
|
||||||
/* leave interrupt */
|
/* leave interrupt */
|
||||||
rt_interrupt_leave();
|
rt_interrupt_leave();
|
||||||
}
|
}
|
||||||
#endif /* RT_USING_UART1 */
|
#endif /* RT_USING_UART3 */
|
||||||
|
#if defined(RT_USING_UART3)
|
||||||
|
/* UART1 device driver structure */
|
||||||
|
|
||||||
|
static struct stm32_uart uart3;
|
||||||
|
struct rt_serial_device serial3;
|
||||||
|
|
||||||
|
void USART3_IRQHandler(void)
|
||||||
|
{
|
||||||
|
struct stm32_uart *uart;
|
||||||
|
|
||||||
|
uart = &uart3;
|
||||||
|
|
||||||
|
/* enter interrupt */
|
||||||
|
rt_interrupt_enter();
|
||||||
|
|
||||||
|
/* 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))
|
||||||
|
{
|
||||||
|
rt_hw_serial_isr(&serial3, RT_SERIAL_EVENT_RX_IND);
|
||||||
|
/* Clear RXNE interrupt flag */
|
||||||
|
__HAL_UART_SEND_REQ(&uart->UartHandle, UART_RXDATA_FLUSH_REQUEST);
|
||||||
|
}
|
||||||
|
/* leave interrupt */
|
||||||
|
rt_interrupt_leave();
|
||||||
|
}
|
||||||
|
#endif /* RT_USING_UART3 */
|
||||||
/**
|
/**
|
||||||
* @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:
|
||||||
|
@ -233,6 +274,31 @@ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
||||||
/* 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);
|
||||||
|
}
|
||||||
|
if (huart->Instance == USART3)
|
||||||
|
{
|
||||||
|
/* Enable GPIO TX/RX clock */
|
||||||
|
USART3_TX_GPIO_CLK_ENABLE();
|
||||||
|
USART3_RX_GPIO_CLK_ENABLE();
|
||||||
|
/* Enable USARTx clock */
|
||||||
|
USART3_CLK_ENABLE();
|
||||||
|
|
||||||
|
/* UART TX GPIO pin configuration */
|
||||||
|
GPIO_InitStruct.Pin = USART3_TX_PIN;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = USART3_TX_AF;
|
||||||
|
HAL_GPIO_Init(USART3_TX_GPIO_PORT, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* UART RX GPIO pin configuration */
|
||||||
|
GPIO_InitStruct.Pin = USART3_RX_PIN;
|
||||||
|
GPIO_InitStruct.Alternate = USART3_RX_AF;
|
||||||
|
HAL_GPIO_Init(USART3_RX_GPIO_PORT, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* NVIC for USART */
|
||||||
|
HAL_NVIC_SetPriority(USART3_IRQn, 0, 1);
|
||||||
|
HAL_NVIC_EnableIRQ(USART3_IRQn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,6 +326,21 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
||||||
|
|
||||||
/* Disable the NVIC for UART */
|
/* Disable the NVIC for UART */
|
||||||
HAL_NVIC_DisableIRQ(USART1_IRQn);
|
HAL_NVIC_DisableIRQ(USART1_IRQn);
|
||||||
|
}
|
||||||
|
if (huart->Instance == USART3)
|
||||||
|
{
|
||||||
|
/* Reset peripherals */
|
||||||
|
USART3_FORCE_RESET();
|
||||||
|
USART3_RELEASE_RESET();
|
||||||
|
|
||||||
|
/* Disable peripherals and GPIO Clocks */
|
||||||
|
/* Configure UART Tx as alternate function */
|
||||||
|
HAL_GPIO_DeInit(USART3_TX_GPIO_PORT, USART3_TX_PIN);
|
||||||
|
/* Configure UART Rx as alternate function */
|
||||||
|
HAL_GPIO_DeInit(USART3_RX_GPIO_PORT, USART3_RX_PIN);
|
||||||
|
|
||||||
|
/* Disable the NVIC for UART */
|
||||||
|
HAL_NVIC_DisableIRQ(USART3_IRQn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +361,18 @@ int stm32_hw_usart_init(void)
|
||||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||||
uart);
|
uart);
|
||||||
#endif /* RT_USING_UART1 */
|
#endif /* RT_USING_UART1 */
|
||||||
|
#ifdef RT_USING_UART3
|
||||||
|
uart = &uart3;
|
||||||
|
uart->UartHandle.Instance = USART3;
|
||||||
|
|
||||||
|
serial3.ops = &stm32_uart_ops;
|
||||||
|
serial3.config = config;
|
||||||
|
|
||||||
|
/* register UART3 device */
|
||||||
|
rt_hw_serial_register(&serial3, "uart3",
|
||||||
|
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||||
|
uart);
|
||||||
|
#endif /* RT_USING_UART3 */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(stm32_hw_usart_init);
|
INIT_BOARD_EXPORT(stm32_hw_usart_init);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -56,7 +56,7 @@
|
||||||
/* RT_USING_INTERRUPT_INFO is not set */
|
/* RT_USING_INTERRUPT_INFO is not set */
|
||||||
#define RT_USING_CONSOLE
|
#define RT_USING_CONSOLE
|
||||||
#define RT_CONSOLEBUF_SIZE 128
|
#define RT_CONSOLEBUF_SIZE 128
|
||||||
#define RT_CONSOLE_DEVICE_NAME "uart1"
|
#define RT_CONSOLE_DEVICE_NAME "uart3"
|
||||||
|
|
||||||
/* RT-Thread Components */
|
/* RT-Thread Components */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue