mirror of https://gerrit.osmocom.org/simtrace2
DFU: disable configured console UART before starting main app
The DFU uses the UART peripheral (with IRQ/ISR) for the debug output console. Before starting the main application we should make sure this configuration is reset to avoid interference (particularly the IRQ/ISR). This is not too important though since the main application reconfigures the UART for console output. Other peripheral could also be disabled (e.g. all other PIO used by DFU), but most of them also get configured by the main application. Change-Id: I8234d1b85938ad6393094c08183f613ad09ee01b
This commit is contained in:
parent
9e29a3eb37
commit
d44cb80bc5
|
@ -34,6 +34,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
extern void UART_Configure( uint32_t dwBaudrate, uint32_t dwMasterClock ) ;
|
||||
extern void UART_Exit(void) ;
|
||||
extern void UART_PutChar( uint8_t uc ) ;
|
||||
extern uint32_t UART_GetChar( void ) ;
|
||||
extern uint32_t UART_IsRxReady( void ) ;
|
||||
|
|
|
@ -173,6 +173,8 @@ void ResetException( void )
|
|||
* the second entry in the vector table is the reset address, corresponding to the application start
|
||||
*/
|
||||
if (((*((uint32_t*)(IFLASH_ADDR+BOARD_DFU_BOOT_SIZE)))&0xFFFF0000)==0x20000000) {
|
||||
UART_Exit();
|
||||
__disable_irq();
|
||||
BootIntoApp();
|
||||
/* Infinite loop */
|
||||
while ( 1 ) ;
|
||||
|
|
|
@ -103,6 +103,22 @@ extern void UART_Configure( uint32_t baudrate, uint32_t masterClock)
|
|||
_ucIsConsoleInitialized=1 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Disables the USART peripheral and related IRQ
|
||||
*/
|
||||
void UART_Exit(void)
|
||||
{
|
||||
if (!_ucIsConsoleInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
Uart *pUart = CONSOLE_UART;
|
||||
pUart->UART_IDR = UART_IDR_TXRDY;
|
||||
pUart->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RXDIS | UART_CR_TXDIS | UART_CR_RSTSTA;
|
||||
PMC->PMC_PCDR0 = 1 << CONSOLE_ID;
|
||||
NVIC_DisableIRQ(CONSOLE_IRQ);
|
||||
}
|
||||
|
||||
/** Interrupt Service routine to transmit queued data */
|
||||
void CONSOLE_ISR(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue