diff options
Diffstat (limited to 'bsp')
| -rw-r--r-- | bsp/beaglebone/applications/application.c | 8 | ||||
| -rw-r--r-- | bsp/beaglebone/drivers/serial.c | 11 | ||||
| -rw-r--r-- | bsp/beaglebone/rtconfig.h | 6 | ||||
| -rw-r--r-- | bsp/beaglebone/rtconfig.py | 2 | ||||
| -rw-r--r-- | bsp/stm32f40x/applications/application.c | 10 | ||||
| -rw-r--r-- | bsp/stm32f40x/drivers/board.h | 1 | ||||
| -rw-r--r-- | bsp/stm32f40x/drivers/stm32f4xx_it.c | 11 | ||||
| -rw-r--r-- | bsp/stm32f40x/drivers/usart.c | 60 | ||||
| -rw-r--r-- | bsp/stm32f40x/rtconfig.h | 3 | ||||
| -rw-r--r-- | bsp/stm32f40x/stm32_rom.ld | 2 |
10 files changed, 104 insertions, 10 deletions
diff --git a/bsp/beaglebone/applications/application.c b/bsp/beaglebone/applications/application.c index 99c2991df7..f34821e748 100644 --- a/bsp/beaglebone/applications/application.c +++ b/bsp/beaglebone/applications/application.c @@ -16,6 +16,10 @@ #include <rtthread.h> #include <components.h> +#ifdef RT_USING_GDB +#include <gdb_stub.h> +#endif + int rt_application_init() { /* do component initialization */ @@ -23,6 +27,10 @@ int rt_application_init() #ifdef RT_USING_NEWLIB libc_system_init(RT_CONSOLE_DEVICE_NAME); #endif +#ifdef RT_USING_GDB + gdb_set_device("uart4"); + gdb_start(); +#endif return 0; } diff --git a/bsp/beaglebone/drivers/serial.c b/bsp/beaglebone/drivers/serial.c index 8dcd389123..1ecd96ced6 100644 --- a/bsp/beaglebone/drivers/serial.c +++ b/bsp/beaglebone/drivers/serial.c @@ -80,6 +80,11 @@ static rt_err_t am33xx_configure(struct rt_serial_device *serial, struct serial_ UART_DLL_REG(base) = 26; UART_DLH_REG(base) = 0; } + else if (cfg->baud_rate == BAUD_RATE_9600) + { + UART_DLL_REG(base) = 0x38; + UART_DLH_REG(base) = 1; + } else { NOT_IMPLEMENTED(); @@ -439,7 +444,7 @@ int rt_hw_serial_init(void) #endif #ifdef RT_USING_UART4 - config.baud_rate = BAUD_RATE_115200; + config.baud_rate = BAUD_RATE_9600; config.bit_order = BIT_ORDER_LSB; config.data_bits = DATA_BITS_8; config.parity = PARITY_NONE; @@ -450,14 +455,14 @@ int rt_hw_serial_init(void) serial4.ops = &am33xx_uart_ops; serial4.config = config; /* enable RX interrupt */ - UART_IER_REG(uart4.base) = 0x01; + UART_IER_REG(uart4.base) = 0x00; /* install ISR */ rt_hw_interrupt_install(uart4.irq, am33xx_uart_isr, &serial4, "uart4"); rt_hw_interrupt_control(uart4.irq, 0, 0); rt_hw_interrupt_mask(uart4.irq); /* register UART4 device */ rt_hw_serial_register(&serial4, "uart4", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, + RT_DEVICE_FLAG_RDWR, &uart4); #endif diff --git a/bsp/beaglebone/rtconfig.h b/bsp/beaglebone/rtconfig.h index 15326d74cf..018b2862f1 100644 --- a/bsp/beaglebone/rtconfig.h +++ b/bsp/beaglebone/rtconfig.h @@ -2,6 +2,12 @@ #ifndef __RTTHREAD_CFG_H__ #define __RTTHREAD_CFG_H__ +// <section name="RT_USING_GDB" description="Gdb Stub for rtt" default="true" > +//#define RT_USING_GDB +//#define RT_GDB_DEBUG +#define RT_GDB_ICACHE +// </section> + // <RDTConfigurator URL="http://www.rt-thread.com/eclipse"> // <integer name="RT_NAME_MAX" description="Maximal size of kernel object name length" default="6" /> diff --git a/bsp/beaglebone/rtconfig.py b/bsp/beaglebone/rtconfig.py index 3c7f228d86..a5561f54d3 100644 --- a/bsp/beaglebone/rtconfig.py +++ b/bsp/beaglebone/rtconfig.py @@ -23,7 +23,7 @@ elif CROSS_TOOL == 'iar': if os.getenv('RTT_EXEC_PATH'): EXEC_PATH = os.getenv('RTT_EXEC_PATH') -BUILD = 'release' +BUILD = 'debug' if PLATFORM == 'gcc': # toolchains diff --git a/bsp/stm32f40x/applications/application.c b/bsp/stm32f40x/applications/application.c index 2a01107f6b..c5e5bcf296 100644 --- a/bsp/stm32f40x/applications/application.c +++ b/bsp/stm32f40x/applications/application.c @@ -23,8 +23,18 @@ #include "stm32_eth.h" #endif +#ifdef RT_USING_GDB +#include <gdb_stub.h> +#endif + void rt_init_thread_entry(void* parameter) { + /* GDB STUB */ +#ifdef RT_USING_GDB + gdb_set_device("uart6"); + gdb_start(); +#endif + /* LwIP Initialization */ #ifdef RT_USING_LWIP { diff --git a/bsp/stm32f40x/drivers/board.h b/bsp/stm32f40x/drivers/board.h index 44fef35cb3..b3a1cb4a08 100644 --- a/bsp/stm32f40x/drivers/board.h +++ b/bsp/stm32f40x/drivers/board.h @@ -43,6 +43,7 @@ //#define RT_USING_UART1 #define RT_USING_UART2 //#define RT_USING_UART3 +//#define RT_USING_UART6 // <o> Console on USART: <0=> no console <1=>USART 1 <2=>USART 2 <3=> USART 3 // <i>Default: 1 diff --git a/bsp/stm32f40x/drivers/stm32f4xx_it.c b/bsp/stm32f40x/drivers/stm32f4xx_it.c index 69a6068746..6c4ea2226a 100644 --- a/bsp/stm32f40x/drivers/stm32f4xx_it.c +++ b/bsp/stm32f40x/drivers/stm32f4xx_it.c @@ -117,9 +117,10 @@ void SVC_Handler(void) * @param None * @retval None */ -void DebugMon_Handler(void) -{ -} +//void DebugMon_Handler(void) +//{ + // defined in gdb/libcpu/cortexm/gdb_gcc.S +//} /** * @brief This function handles PendSVC exception. @@ -128,7 +129,7 @@ void DebugMon_Handler(void) */ //void PendSV_Handler(void) //{ -// // definition in libcpu/arm/cortex-m4/context_*.S +// // defined in libcpu/arm/cortex-m4/context_*.S //} /** @@ -138,7 +139,7 @@ void DebugMon_Handler(void) */ //void SysTick_Handler(void) //{ -// // definition in boarc.c +// // defined in boarc.c //} /******************************************************************************/ diff --git a/bsp/stm32f40x/drivers/usart.c b/bsp/stm32f40x/drivers/usart.c index 6864a3fc92..8b87dbbb10 100644 --- a/bsp/stm32f40x/drivers/usart.c +++ b/bsp/stm32f40x/drivers/usart.c @@ -69,6 +69,17 @@ struct stm32_serial_device uart3 = struct rt_device uart3_device; #endif +#ifdef RT_USING_UART6 +struct stm32_serial_int_rx uart6_int_rx; +struct stm32_serial_device uart6 = +{ + USART6, + &uart6_int_rx, + RT_NULL +}; +struct rt_device uart6_device; +#endif + //#define USART1_DR_Base 0x40013804 //#define USART2_DR_Base 0x40004404 //#define USART3_DR_Base 0x40004804 @@ -103,6 +114,14 @@ struct rt_device uart3_device; #define UART3_TX_DMA DMA1_Stream1 #define UART3_RX_DMA DMA1_Stream3 +#define UART6_GPIO_TX GPIO_Pin_6 +#define UART6_TX_PIN_SOURCE GPIO_PinSource6 +#define UART6_GPIO_RX GPIO_Pin_7 +#define UART6_RX_PIN_SOURCE GPIO_PinSource7 +#define UART6_GPIO GPIOC +#define UART6_GPIO_RCC RCC_AHB1Periph_GPIOC +#define RCC_APBPeriph_UART6 RCC_APB2Periph_USART6 + static void RCC_Configuration(void) { #ifdef RT_USING_UART1 @@ -128,6 +147,13 @@ static void RCC_Configuration(void) /* DMA clock enable */ RCC_APB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE); #endif + +#ifdef RT_USING_UART6 + /* Enable USART6 GPIO clocks */ + RCC_AHB1PeriphClockCmd(UART6_GPIO_RCC, ENABLE); + /* Enable USART6 clock */ + RCC_APB2PeriphClockCmd(RCC_APBPeriph_UART6, ENABLE); +#endif } static void GPIO_Configuration(void) @@ -168,6 +194,16 @@ static void GPIO_Configuration(void) GPIO_PinAFConfig(UART3_GPIO, UART3_TX_PIN_SOURCE, GPIO_AF_USART3); GPIO_PinAFConfig(UART3_GPIO, UART3_RX_PIN_SOURCE, GPIO_AF_USART3); #endif + +#ifdef RT_USING_UART6 + /* Configure USART6 Rx/tx PIN */ + GPIO_InitStructure.GPIO_Pin = UART6_GPIO_TX | UART6_GPIO_RX; + GPIO_Init(UART6_GPIO, &GPIO_InitStructure); + + /* Connect alternate function */ + GPIO_PinAFConfig(UART6_GPIO, UART6_TX_PIN_SOURCE, GPIO_AF_USART6); + GPIO_PinAFConfig(UART6_GPIO, UART6_RX_PIN_SOURCE, GPIO_AF_USART6); +#endif } static void NVIC_Configuration(void) @@ -204,6 +240,15 @@ static void NVIC_Configuration(void) NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); #endif + +#ifdef RT_USING_UART6 + /* Enable the USART6 Interrupt */ + NVIC_InitStructure.NVIC_IRQChannel = USART6_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init(&NVIC_InitStructure); +#endif } static void DMA_Configuration(void) @@ -346,4 +391,19 @@ void rt_hw_usart_init() /* enable interrupt */ USART_ITConfig(USART3, USART_IT_RXNE, ENABLE); #endif + +#ifdef RT_USING_UART6 + USART_InitStructure.USART_BaudRate = 9600; + USART_InitStructure.USART_WordLength = USART_WordLength_8b; + USART_InitStructure.USART_StopBits = USART_StopBits_1; + USART_InitStructure.USART_Parity = USART_Parity_No; + USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; + USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; + USART_Init(USART6, &USART_InitStructure); + + /* register uart6 */ + rt_hw_serial_register(&uart6_device, "uart6", + RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM, + &uart6); +#endif } diff --git a/bsp/stm32f40x/rtconfig.h b/bsp/stm32f40x/rtconfig.h index e961fb2e8f..64cc047ad8 100644 --- a/bsp/stm32f40x/rtconfig.h +++ b/bsp/stm32f40x/rtconfig.h @@ -2,6 +2,9 @@ #ifndef __RTTHREAD_CFG_H__ #define __RTTHREAD_CFG_H__ +/* RT_GDB_STUB */ +//#define RT_USING_GDB + /* RT_NAME_MAX*/ #define RT_NAME_MAX 8 diff --git a/bsp/stm32f40x/stm32_rom.ld b/bsp/stm32f40x/stm32_rom.ld index bd2ef9fe44..aa9c9b2af2 100644 --- a/bsp/stm32f40x/stm32_rom.ld +++ b/bsp/stm32f40x/stm32_rom.ld @@ -10,7 +10,7 @@ MEMORY DATA (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 128K sram */ } ENTRY(Reset_Handler) -_system_stack_size = 0x100; +_system_stack_size = 0x200; SECTIONS { |
