Refs #962. Renamed UART to RS232.

git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@740 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
Frank Voorburg 2020-02-06 16:22:58 +00:00
parent 313992a7bc
commit e88477f0d4
356 changed files with 42739 additions and 44413 deletions

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -153,7 +153,7 @@ void HAL_MspInit(void)
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -173,7 +173,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -202,7 +202,7 @@ void HAL_MspDeInit(void)
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOA);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
/************************************************************************************//**
@ -47,8 +47,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -61,8 +61,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -79,7 +79,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -90,20 +90,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -111,19 +111,19 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -132,9 +132,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -143,11 +143,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -161,7 +161,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -183,7 +183,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -192,7 +192,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -201,12 +201,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -215,8 +215,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -143,10 +143,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
@ -161,7 +161,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -169,7 +169,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
} /*** end of HAL_MspInit ***/
@ -182,18 +182,18 @@ void HAL_MspInit(void)
****************************************************************************************/
void HAL_MspDeInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_9);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -164,7 +164,7 @@
<ColumnWidth0>24</ColumnWidth0>
<ColumnWidth1>1863</ColumnWidth1>
<FilterLevel>2</FilterLevel>
<LiveFile></LiveFile>
<LiveFile />
<LiveLogEnabled>0</LiveLogEnabled>
<LiveFilterLevel>-1</LiveFilterLevel>
</IarPane-34048>
@ -213,18 +213,20 @@
</IarPane-34050>
<IarPane-34063>
<ColumnWidths>
<Column0>190</Column0>
<Column0>172</Column0>
<Column1>30</Column1>
<Column2>30</Column2>
<Column3>30</Column3>
</ColumnWidths>
<NodeDict>
<ExpandedNode>stm32f0</ExpandedNode>
<ExpandedNode>stm32f0/src</ExpandedNode>
<ExpandedNode>stm32f0/src/core</ExpandedNode>
</NodeDict>
</IarPane-34063>
<ControlBarVersion>
<Major>14</Major>
<Minor>11</Minor>
<Minor>20</Minor>
</ControlBarVersion>
<MFCToolBarParameters>
<Tooltips>1</Tooltips>
@ -238,12 +240,12 @@
</MFCToolBarParameters>
<CommandManager>
<CommandsWithoutImages>08000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000</CommandsWithoutImages>
<MenuUserImages>040030840000520000000E840000500000000B8100001F0000000D81000021000000</MenuUserImages>
<MenuUserImages>0600048400004C000000068400004E0000000E8400005000000030840000520000000B8100001F0000000D81000021000000</MenuUserImages>
</CommandManager>
<Pane-59393>
<ID>0</ID>
<RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>
<RectRecentDocked>00000000F00300008007000003040000</RectRecentDocked>
<RectRecentDocked>00000000E903000080070000FE030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -269,8 +271,8 @@
<IarPane-34051 />
<Pane--1>
<ID>4294967295</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>000000003F03000080070000F0030000</RectRecentDocked>
<RectRecentFloat>0000000079030000800700002A040000</RectRecentFloat>
<RectRecentDocked>000000003803000080070000E9030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -283,7 +285,7 @@
<Pane-34052>
<ID>34052</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>32768</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -306,7 +308,7 @@
<Pane-34048>
<ID>34048</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -319,7 +321,7 @@
<Pane-34056>
<ID>34056</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -333,7 +335,7 @@
<Pane-34057>
<ID>34057</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -347,7 +349,7 @@
<Pane-34058>
<ID>34058</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -361,7 +363,7 @@
<Pane-34059>
<ID>34059</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -375,7 +377,7 @@
<Pane-34062>
<ID>34062</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -459,7 +461,7 @@
<Pane-34063>
<ID>34063</ID>
<RectRecentFloat>00000000350000000601000096010000</RectRecentFloat>
<RectRecentDocked>0000000032000000060100003B030000</RectRecentDocked>
<RectRecentDocked>00000000320000000601000034030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -470,11 +472,11 @@
<IsVisible>1</IsVisible>
</BasePane-34063>
<DockingManager-256>
<DockingPaneAndPaneDividers>0000000010000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A0100003B0300000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000010040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000010040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000001000000FFFFFFFFFFFFFFFF000000003B030000800700003F030000010000000100001004000000010000000000000000000000FFFFFFFF07000000048500000085000008850000098500000A8500000B8500000E850000FFFF02000B004354616262656450616E650080000001000000000000003500000022010000E6000000000000003F03000080070000F0030000000000004080005607000000FFFEFF054200750069006C006400010000000485000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000085000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000000000000000000</DockingPaneAndPaneDividers>
<DockingPaneAndPaneDividers>0000000010000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A010000340300000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000001000000FFFFFFFFFFFFFFFF00000000340300008007000038030000010000000100001004000000010000000000000000000000FFFFFFFF07000000048500000085000008850000098500000A8500000B8500000E850000FFFF02000B004354616262656450616E6500800000010000000000000079030000800700002A040000000000003803000080070000E9030000000000004080005607000000FFFEFF054200750069006C006400010000000485000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000085000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000000000000000000</DockingPaneAndPaneDividers>
</DockingManager-256>
<MFCToolBar-34049>
<Name>CMSIS-Pack</Name>
<Buttons>00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED1840000000000000C000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B00FF7F0000</Buttons>
<Buttons>00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED1840000000000000C000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B0018000000</Buttons>
</MFCToolBar-34049>
<Pane-34049>
<ID>34049</ID>
@ -483,7 +485,7 @@
<RecentFrameAlignment>8192</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
<MRUWidth>32767</MRUWidth>
<MRUWidth>24</MRUWidth>
<PinState>0</PinState>
</Pane-34049>
<BasePane-34049>
@ -491,7 +493,7 @@
</BasePane-34049>
<MFCToolBar-34050>
<Name>Main</Name>
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00FF7F0000</Buttons>
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0001000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>
</MFCToolBar-34050>
<Pane-34050>
<ID>34050</ID>
@ -500,7 +502,7 @@
<RecentFrameAlignment>8192</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
<MRUWidth>32767</MRUWidth>
<MRUWidth>744</MRUWidth>
<PinState>0</PinState>
</Pane-34050>
<BasePane-34050>

View File

@ -1356,6 +1356,12 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\rs232.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\rs232.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\timer.c</name>
</file>
@ -1365,12 +1371,6 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\types.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\uart.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\uart.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\usb.h</name>
</file>

View File

@ -150,7 +150,7 @@ void HAL_MspInit(void)
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -170,7 +170,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -199,7 +199,7 @@ void HAL_MspDeInit(void)
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOA);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
/************************************************************************************//**
@ -47,8 +47,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -61,8 +61,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -79,7 +79,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -90,20 +90,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -111,19 +111,19 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -132,9 +132,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -143,11 +143,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -161,7 +161,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -183,7 +183,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -192,7 +192,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -201,12 +201,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -215,8 +215,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -141,10 +141,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
@ -159,7 +159,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -167,7 +167,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
} /*** end of HAL_MspInit ***/
@ -180,18 +180,18 @@ void HAL_MspInit(void)
****************************************************************************************/
void HAL_MspDeInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_9);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -1389,18 +1389,6 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\uart.h</PathWithFileName>
<FilenameWithoutPath>uart.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>99</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\usb.h</PathWithFileName>
<FilenameWithoutPath>usb.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
@ -1408,7 +1396,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>100</FileNumber>
<FileNumber>99</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1420,7 +1408,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>101</FileNumber>
<FileNumber>100</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1432,7 +1420,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>102</FileNumber>
<FileNumber>101</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1444,7 +1432,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>103</FileNumber>
<FileNumber>102</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1456,7 +1444,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>104</FileNumber>
<FileNumber>103</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1468,7 +1456,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>105</FileNumber>
<FileNumber>104</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1480,7 +1468,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>106</FileNumber>
<FileNumber>105</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1492,7 +1480,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>107</FileNumber>
<FileNumber>106</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1504,7 +1492,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>108</FileNumber>
<FileNumber>107</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1516,13 +1504,25 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>109</FileNumber>
<FileNumber>108</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32F0\uart.c</PathWithFileName>
<FilenameWithoutPath>uart.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32F0\Keil\cpu_comp.c</PathWithFileName>
<FilenameWithoutPath>cpu_comp.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>109</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\rs232.h</PathWithFileName>
<FilenameWithoutPath>rs232.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1533,8 +1533,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32F0\Keil\cpu_comp.c</PathWithFileName>
<FilenameWithoutPath>cpu_comp.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32F0\rs232.c</PathWithFileName>
<FilenameWithoutPath>rs232.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>

View File

@ -928,11 +928,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\timer.h</FilePath>
</File>
<File>
<FileName>uart.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\uart.h</FilePath>
</File>
<File>
<FileName>usb.h</FileName>
<FileType>5</FileType>
@ -983,16 +978,21 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32F0\types.h</FilePath>
</File>
<File>
<FileName>uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32F0\uart.c</FilePath>
</File>
<File>
<FileName>cpu_comp.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32F0\Keil\cpu_comp.c</FilePath>
</File>
<File>
<FileName>rs232.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\rs232.h</FilePath>
</File>
<File>
<FileName>rs232.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32F0\rs232.c</FilePath>
</File>
</Files>
</Group>
</Groups>

View File

@ -153,7 +153,7 @@ void HAL_MspInit(void)
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -173,7 +173,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -202,7 +202,7 @@ void HAL_MspDeInit(void)
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOA);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
/************************************************************************************//**
@ -47,8 +47,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -61,8 +61,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -79,7 +79,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -90,20 +90,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -111,19 +111,19 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -132,9 +132,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -143,11 +143,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -161,7 +161,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -183,7 +183,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -192,7 +192,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -201,12 +201,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -215,8 +215,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -143,10 +143,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
@ -161,7 +161,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -169,7 +169,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
} /*** end of HAL_MspInit ***/
@ -182,18 +182,18 @@ void HAL_MspInit(void)
****************************************************************************************/
void HAL_MspDeInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_9);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -153,7 +153,7 @@ void HAL_MspInit(void)
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -173,7 +173,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -202,7 +202,7 @@ void HAL_MspDeInit(void)
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOA);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
/************************************************************************************//**
@ -47,8 +47,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -61,8 +61,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -79,7 +79,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -90,20 +90,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -111,19 +111,19 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -132,9 +132,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -143,11 +143,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -161,7 +161,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -183,7 +183,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -192,7 +192,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -201,12 +201,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -215,8 +215,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -143,10 +143,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
@ -161,7 +161,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -169,7 +169,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
} /*** end of HAL_MspInit ***/
@ -182,18 +182,18 @@ void HAL_MspInit(void)
****************************************************************************************/
void HAL_MspDeInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_9);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -84,24 +84,24 @@
/** \brief Select the desired CAN peripheral as a zero based index. */
#define BOOT_COM_CAN_CHANNEL_INDEX (0)
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -154,7 +154,7 @@ void HAL_MspInit(void)
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -179,7 +179,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -225,7 +225,7 @@ void HAL_MspDeInit(void)
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_CAN);
#endif
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
static void BootComCanInit(void);
@ -51,8 +51,8 @@ static void BootComCanCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanInit();
@ -68,8 +68,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanCheckActivationRequest();
@ -89,7 +89,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -100,20 +100,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -121,19 +121,19 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -142,9 +142,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -153,11 +153,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -171,7 +171,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -193,7 +193,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -202,7 +202,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -211,12 +211,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -225,8 +225,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)

View File

@ -154,10 +154,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_CAN1_CLK_ENABLE();
@ -176,7 +176,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -184,7 +184,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)
/* CAN TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
@ -210,10 +210,10 @@ void HAL_MspDeInit(void)
/* Reset CAN GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8 | GPIO_PIN_9);
#endif /* BOOT_COM_CAN_ENABLE > 0 */
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
@ -222,10 +222,10 @@ void HAL_MspDeInit(void)
/* Peripheral clock enable. */
__HAL_RCC_CAN1_CLK_DISABLE();
#endif /* BOOT_COM_CAN_ENABLE > 0 */
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -84,24 +84,24 @@
/** \brief Select the desired CAN peripheral as a zero based index. */
#define BOOT_COM_CAN_CHANNEL_INDEX (0)
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
@echo on
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\settings\stm32f091.Debug.general.xcl" --backend -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\settings\stm32f091.Debug.driver.xcl"
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\settings\stm32f091.Debug.general.xcl" --backend -f "C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\settings\stm32f091.Debug.driver.xcl"
@echo off
goto end
@ -34,7 +34,7 @@ goto end
@echo on
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\settings\stm32f091.Debug.general.xcl" "--debug_file=%~1" --backend -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\settings\stm32f091.Debug.driver.xcl"
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\settings\stm32f091.Debug.general.xcl" "--debug_file=%~1" --backend -f "C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\settings\stm32f091.Debug.driver.xcl"
@echo off
:end

View File

@ -2,7 +2,7 @@
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\arm\bin\armstlink2.dll"
"C:\Work\software\OpenBLT\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\..\bin\openblt_stm32f091.out"
"C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_STM32F0_Nucleo_F091RC_IAR\Boot\ide\..\bin\openblt_stm32f091.out"
--plugin="C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\arm\bin\armbat.dll"

View File

@ -161,7 +161,7 @@
<ColumnWidth0>24</ColumnWidth0>
<ColumnWidth1>1863</ColumnWidth1>
<FilterLevel>2</FilterLevel>
<LiveFile></LiveFile>
<LiveFile />
<LiveLogEnabled>0</LiveLogEnabled>
<LiveFilterLevel>-1</LiveFilterLevel>
</IarPane-34048>
@ -210,7 +210,7 @@
</IarPane-34050>
<IarPane-34063>
<ColumnWidths>
<Column0>190</Column0>
<Column0>172</Column0>
<Column1>30</Column1>
<Column2>30</Column2>
<Column3>30</Column3>
@ -218,11 +218,13 @@
<NodeDict>
<ExpandedNode>stm32f091</ExpandedNode>
<ExpandedNode>stm32f091/Boot</ExpandedNode>
<ExpandedNode>stm32f091/Source</ExpandedNode>
<ExpandedNode>stm32f091/Source/ARMCM0_STM32F0</ExpandedNode>
</NodeDict>
</IarPane-34063>
<ControlBarVersion>
<Major>14</Major>
<Minor>11</Minor>
<Minor>20</Minor>
</ControlBarVersion>
<MFCToolBarParameters>
<Tooltips>1</Tooltips>
@ -235,13 +237,13 @@
<CommandsUsage>02000000030010860000010000000E810000020000004681000001000000</CommandsUsage>
</MFCToolBarParameters>
<CommandManager>
<CommandsWithoutImages>08000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000</CommandsWithoutImages>
<MenuUserImages>040030840000520000000E840000500000000B8100001F0000000D81000021000000</MenuUserImages>
<CommandsWithoutImages>09000D8400000F84000008840000FFFFFFFF54840000328100001C8100000984000053840000</CommandsWithoutImages>
<MenuUserImages>0600048400004C000000068400004E0000000E8400005000000030840000520000000B8100001F0000000D81000021000000</MenuUserImages>
</CommandManager>
<Pane-59393>
<ID>0</ID>
<RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>
<RectRecentDocked>00000000F00300008007000003040000</RectRecentDocked>
<RectRecentDocked>00000000E903000080070000FE030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -267,8 +269,8 @@
<IarPane-34051 />
<Pane--1>
<ID>4294967295</ID>
<RectRecentFloat>00000000740300008007000025040000</RectRecentFloat>
<RectRecentDocked>000000003F03000080070000F0030000</RectRecentDocked>
<RectRecentFloat>0000000079030000800700002A040000</RectRecentFloat>
<RectRecentDocked>000000003803000080070000E9030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -281,7 +283,7 @@
<Pane-34052>
<ID>34052</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>32768</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -304,7 +306,7 @@
<Pane-34048>
<ID>34048</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -317,7 +319,7 @@
<Pane-34056>
<ID>34056</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -331,7 +333,7 @@
<Pane-34057>
<ID>34057</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -345,7 +347,7 @@
<Pane-34058>
<ID>34058</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -359,7 +361,7 @@
<Pane-34059>
<ID>34059</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -373,7 +375,7 @@
<Pane-34062>
<ID>34062</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -457,7 +459,7 @@
<Pane-34063>
<ID>34063</ID>
<RectRecentFloat>00000000350000000601000096010000</RectRecentFloat>
<RectRecentDocked>0000000032000000060100003B030000</RectRecentDocked>
<RectRecentDocked>00000000320000000601000034030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -468,7 +470,7 @@
<IsVisible>1</IsVisible>
</BasePane-34063>
<DockingManager-256>
<DockingPaneAndPaneDividers>0000000010000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A0100003B0300000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000001000000FFFFFFFFFFFFFFFF000000003B030000800700003F030000010000000100001004000000010000000000000000000000FFFFFFFF07000000048500000085000008850000098500000A8500000B8500000E850000FFFF02000B004354616262656450616E65008000000100000000000000740300008007000025040000000000003F03000080070000F0030000000000004080005607000000FFFEFF054200750069006C006400010000000485000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000085000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000000000000000000</DockingPaneAndPaneDividers>
<DockingPaneAndPaneDividers>0000000010000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A010000340300000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000001000000FFFFFFFFFFFFFFFF00000000340300008007000038030000010000000100001004000000010000000000000000000000FFFFFFFF07000000048500000085000008850000098500000A8500000B8500000E850000FFFF02000B004354616262656450616E6500800000010000000000000079030000800700002A040000000000003803000080070000E9030000000000004080005607000000FFFEFF054200750069006C006400010000000485000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000085000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000000000000000000</DockingPaneAndPaneDividers>
</DockingManager-256>
<MFCToolBar-34049>
<Name>CMSIS-Pack</Name>
@ -489,7 +491,7 @@
</BasePane-34049>
<MFCToolBar-34050>
<Name>Main</Name>
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0001000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>
</MFCToolBar-34050>
<Pane-34050>
<ID>34050</ID>
@ -525,7 +527,7 @@
</ChildIdMap>
<MDIWindows>
<MDIClientArea-0>
<MDITabsState>010000000300000001000000000000000000000001000000010000000200000000000000010000000100000000000000280000002800000001000000010000000000000001000000FFFEFF122400570053005F0044004900520024005C002E002E005C006D00610069006E002E00630001000000FFFF010014004966436F6E74656E7453746F72616765496D706CFFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00330033003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0033003200300032003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0033003200300032003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF066D00610069006E002E00630000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000000A010000670000008007000070030000</MDITabsState>
<MDITabsState>010000000300000001000000000000000000000001000000010000000200000000000000010000000100000000000000280000002800000001000000010000000000000001000000FFFEFF122400570053005F0044004900520024005C002E002E005C006D00610069006E002E00630001000000FFFF010014004966436F6E74656E7453746F72616765496D706CFFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00330033003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0033003200300032003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0033003200300032003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF066D00610069006E002E00630000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000000A0100006C000000800700006E030000</MDITabsState>
</MDIClientArea-0>
</MDIWindows>
</WindowStorage>

View File

@ -2383,15 +2383,15 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\nvm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\rs232.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\types.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\uart.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
@ -2448,10 +2448,10 @@
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\rs232.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\uart.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\usb.h</name>

View File

@ -2644,15 +2644,15 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\nvm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\rs232.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\types.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32F0\uart.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
@ -2709,10 +2709,10 @@
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\rs232.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\uart.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\usb.h</name>

View File

@ -151,7 +151,7 @@ void HAL_MspInit(void)
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -176,7 +176,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -222,7 +222,7 @@ void HAL_MspDeInit(void)
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_CAN);
#endif
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
static void BootComCanInit(void);
@ -51,8 +51,8 @@ static void BootComCanCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanInit();
@ -68,8 +68,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanCheckActivationRequest();
@ -89,7 +89,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -100,20 +100,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -121,19 +121,19 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -142,9 +142,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -153,11 +153,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -171,7 +171,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -193,7 +193,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -202,7 +202,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -211,12 +211,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -225,8 +225,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)

View File

@ -152,10 +152,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_CAN1_CLK_ENABLE();
@ -174,7 +174,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -182,7 +182,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)
/* CAN TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
@ -208,10 +208,10 @@ void HAL_MspDeInit(void)
/* Reset CAN GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8 | GPIO_PIN_9);
#endif /* BOOT_COM_CAN_ENABLE > 0 */
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
@ -220,10 +220,10 @@ void HAL_MspDeInit(void)
/* Peripheral clock enable. */
__HAL_RCC_CAN1_CLK_DISABLE();
#endif /* BOOT_COM_CAN_ENABLE > 0 */
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -84,24 +84,24 @@
/** \brief Select the desired CAN peripheral as a zero based index. */
#define BOOT_COM_CAN_CHANNEL_INDEX (0)
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -1150,7 +1150,7 @@
<Group>
<GroupName>Core</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -1389,18 +1389,6 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\uart.h</PathWithFileName>
<FilenameWithoutPath>uart.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>99</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\usb.h</PathWithFileName>
<FilenameWithoutPath>usb.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
@ -1408,7 +1396,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>100</FileNumber>
<FileNumber>99</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1420,7 +1408,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>101</FileNumber>
<FileNumber>100</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1432,7 +1420,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>102</FileNumber>
<FileNumber>101</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1444,7 +1432,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>103</FileNumber>
<FileNumber>102</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1456,7 +1444,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>104</FileNumber>
<FileNumber>103</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1468,7 +1456,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>105</FileNumber>
<FileNumber>104</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1480,7 +1468,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>106</FileNumber>
<FileNumber>105</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1492,7 +1480,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>107</FileNumber>
<FileNumber>106</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1504,7 +1492,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>108</FileNumber>
<FileNumber>107</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1516,13 +1504,25 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>109</FileNumber>
<FileNumber>108</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32F0\uart.c</PathWithFileName>
<FilenameWithoutPath>uart.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32F0\Keil\cpu_comp.c</PathWithFileName>
<FilenameWithoutPath>cpu_comp.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>109</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\rs232.h</PathWithFileName>
<FilenameWithoutPath>rs232.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1533,8 +1533,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32F0\Keil\cpu_comp.c</PathWithFileName>
<FilenameWithoutPath>cpu_comp.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32F0\rs232.c</PathWithFileName>
<FilenameWithoutPath>rs232.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>

View File

@ -877,11 +877,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\timer.h</FilePath>
</File>
<File>
<FileName>uart.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\uart.h</FilePath>
</File>
<File>
<FileName>usb.h</FileName>
<FileType>5</FileType>
@ -932,16 +927,21 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32F0\types.h</FilePath>
</File>
<File>
<FileName>uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32F0\uart.c</FilePath>
</File>
<File>
<FileName>cpu_comp.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32F0\Keil\cpu_comp.c</FilePath>
</File>
<File>
<FileName>rs232.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\rs232.h</FilePath>
</File>
<File>
<FileName>rs232.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32F0\rs232.c</FilePath>
</File>
</Files>
</Group>
</Groups>

View File

@ -154,7 +154,7 @@ void HAL_MspInit(void)
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -179,7 +179,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -225,7 +225,7 @@ void HAL_MspDeInit(void)
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_CAN);
#endif
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
static void BootComCanInit(void);
@ -51,8 +51,8 @@ static void BootComCanCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanInit();
@ -68,8 +68,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanCheckActivationRequest();
@ -89,7 +89,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -100,20 +100,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -121,19 +121,19 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -142,9 +142,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -153,11 +153,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -171,7 +171,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -193,7 +193,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -202,7 +202,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -211,12 +211,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -225,8 +225,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)

View File

@ -154,10 +154,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_CAN1_CLK_ENABLE();
@ -176,7 +176,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -184,7 +184,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)
/* CAN TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
@ -210,10 +210,10 @@ void HAL_MspDeInit(void)
/* Reset CAN GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8 | GPIO_PIN_9);
#endif /* BOOT_COM_CAN_ENABLE > 0 */
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
@ -222,10 +222,10 @@ void HAL_MspDeInit(void)
/* Peripheral clock enable. */
__HAL_RCC_CAN1_CLK_DISABLE();
#endif /* BOOT_COM_CAN_ENABLE > 0 */
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -84,24 +84,24 @@
/** \brief Select the desired CAN peripheral as a zero based index. */
#define BOOT_COM_CAN_CHANNEL_INDEX (0)
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -154,7 +154,7 @@ void HAL_MspInit(void)
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -179,7 +179,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -225,7 +225,7 @@ void HAL_MspDeInit(void)
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_CAN);
#endif
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
static void BootComCanInit(void);
@ -51,8 +51,8 @@ static void BootComCanCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanInit();
@ -68,8 +68,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanCheckActivationRequest();
@ -89,7 +89,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -100,20 +100,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -121,19 +121,19 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -142,9 +142,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -153,11 +153,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -171,7 +171,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -193,7 +193,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -202,7 +202,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -211,12 +211,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -225,8 +225,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)

View File

@ -154,10 +154,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_CAN1_CLK_ENABLE();
@ -176,7 +176,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -184,7 +184,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)
/* CAN TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
@ -210,10 +210,10 @@ void HAL_MspDeInit(void)
/* Reset CAN GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8 | GPIO_PIN_9);
#endif /* BOOT_COM_CAN_ENABLE > 0 */
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
@ -222,10 +222,10 @@ void HAL_MspDeInit(void)
/* Peripheral clock enable. */
__HAL_RCC_CAN1_CLK_DISABLE();
#endif /* BOOT_COM_CAN_ENABLE > 0 */
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -196,7 +196,7 @@ void HAL_MspInit(void)
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -216,7 +216,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -245,7 +245,7 @@ void HAL_MspDeInit(void)
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOA);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
@ -48,8 +48,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -62,8 +62,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -80,7 +80,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -91,20 +91,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -112,22 +112,22 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
uartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
uartHandle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
uartHandle.Init.ClockPrescaler = UART_PRESCALER_DIV1;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Init.OverSampling = UART_OVERSAMPLING_16;
rs232Handle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
rs232Handle.Init.ClockPrescaler = UART_PRESCALER_DIV1;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -136,9 +136,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -147,11 +147,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -165,7 +165,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -187,7 +187,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -196,7 +196,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -205,12 +205,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -219,8 +219,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -166,10 +166,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
@ -184,7 +184,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -192,7 +192,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
} /*** end of HAL_MspInit ***/
@ -205,18 +205,18 @@ void HAL_MspInit(void)
****************************************************************************************/
void HAL_MspDeInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -1281,15 +1281,15 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\nvm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\rs232.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\types.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\uart.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
@ -1346,10 +1346,10 @@
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\rs232.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\uart.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\usb.h</name>

View File

@ -1405,15 +1405,15 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\nvm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\rs232.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\types.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_STM32G0\uart.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
@ -1470,10 +1470,10 @@
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\rs232.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\uart.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\usb.h</name>

View File

@ -193,7 +193,7 @@ void HAL_MspInit(void)
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -213,7 +213,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -242,7 +242,7 @@ void HAL_MspDeInit(void)
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOA);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
@ -48,8 +48,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -62,8 +62,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -80,7 +80,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -91,20 +91,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -112,22 +112,22 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
uartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
uartHandle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
uartHandle.Init.ClockPrescaler = UART_PRESCALER_DIV1;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Init.OverSampling = UART_OVERSAMPLING_16;
rs232Handle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
rs232Handle.Init.ClockPrescaler = UART_PRESCALER_DIV1;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -136,9 +136,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -147,11 +147,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -165,7 +165,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -187,7 +187,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -196,7 +196,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -205,12 +205,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -219,8 +219,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -163,10 +163,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
@ -181,7 +181,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -189,7 +189,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
} /*** end of HAL_MspInit ***/
@ -202,18 +202,18 @@ void HAL_MspInit(void)
****************************************************************************************/
void HAL_MspDeInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -1303,18 +1303,6 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\uart.h</PathWithFileName>
<FilenameWithoutPath>uart.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>92</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\usb.h</PathWithFileName>
<FilenameWithoutPath>usb.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
@ -1322,7 +1310,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>93</FileNumber>
<FileNumber>92</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1334,7 +1322,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>94</FileNumber>
<FileNumber>93</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1346,7 +1334,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>95</FileNumber>
<FileNumber>94</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1358,7 +1346,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>96</FileNumber>
<FileNumber>95</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1370,7 +1358,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>97</FileNumber>
<FileNumber>96</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1382,7 +1370,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>98</FileNumber>
<FileNumber>97</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1394,7 +1382,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>99</FileNumber>
<FileNumber>98</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1406,7 +1394,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>100</FileNumber>
<FileNumber>99</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1418,13 +1406,25 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>101</FileNumber>
<FileNumber>100</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32G0\uart.c</PathWithFileName>
<FilenameWithoutPath>uart.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32G0\Keil\cpu_comp.c</PathWithFileName>
<FilenameWithoutPath>cpu_comp.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>101</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\rs232.h</PathWithFileName>
<FilenameWithoutPath>rs232.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1435,8 +1435,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32G0\Keil\cpu_comp.c</PathWithFileName>
<FilenameWithoutPath>cpu_comp.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\Source\ARMCM0_STM32G0\rs232.c</PathWithFileName>
<FilenameWithoutPath>rs232.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>

View File

@ -842,11 +842,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\timer.h</FilePath>
</File>
<File>
<FileName>uart.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\uart.h</FilePath>
</File>
<File>
<FileName>usb.h</FileName>
<FileType>5</FileType>
@ -892,16 +887,21 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32G0\types.h</FilePath>
</File>
<File>
<FileName>uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32G0\uart.c</FilePath>
</File>
<File>
<FileName>cpu_comp.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32G0\Keil\cpu_comp.c</FilePath>
</File>
<File>
<FileName>rs232.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\rs232.h</FilePath>
</File>
<File>
<FileName>rs232.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\ARMCM0_STM32G0\rs232.c</FilePath>
</File>
</Files>
</Group>
</Groups>

View File

@ -196,7 +196,7 @@ void HAL_MspInit(void)
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -216,7 +216,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -245,7 +245,7 @@ void HAL_MspDeInit(void)
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOA);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
@ -48,8 +48,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -62,8 +62,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -80,7 +80,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -91,20 +91,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -112,22 +112,22 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
uartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
uartHandle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
uartHandle.Init.ClockPrescaler = UART_PRESCALER_DIV1;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Init.OverSampling = UART_OVERSAMPLING_16;
rs232Handle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
rs232Handle.Init.ClockPrescaler = UART_PRESCALER_DIV1;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -136,9 +136,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -147,11 +147,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -165,7 +165,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -187,7 +187,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -196,7 +196,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -205,12 +205,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -219,8 +219,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -166,10 +166,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
@ -184,7 +184,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -192,7 +192,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
} /*** end of HAL_MspInit ***/
@ -205,18 +205,18 @@ void HAL_MspInit(void)
****************************************************************************************/
void HAL_MspDeInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -196,7 +196,7 @@ void HAL_MspInit(void)
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock enable. */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif
@ -216,7 +216,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_2 | LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
@ -245,7 +245,7 @@ void HAL_MspDeInit(void)
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOA);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART clock disable. */
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART2);
#endif

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
@ -48,8 +48,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -62,8 +62,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -80,7 +80,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -91,20 +91,20 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief UART handle to be used in API calls. */
static UART_HandleTypeDef uartHandle;
static UART_HandleTypeDef rs232Handle;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -112,22 +112,22 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* Configure UART peripheral. */
uartHandle.Instance = USART2;
uartHandle.Init.BaudRate = BOOT_COM_UART_BAUDRATE;
uartHandle.Init.WordLength = UART_WORDLENGTH_8B;
uartHandle.Init.StopBits = UART_STOPBITS_1;
uartHandle.Init.Parity = UART_PARITY_NONE;
uartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uartHandle.Init.Mode = UART_MODE_TX_RX;
uartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
uartHandle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
uartHandle.Init.ClockPrescaler = UART_PRESCALER_DIV1;
rs232Handle.Instance = USART2;
rs232Handle.Init.BaudRate = BOOT_COM_RS232_BAUDRATE;
rs232Handle.Init.WordLength = UART_WORDLENGTH_8B;
rs232Handle.Init.StopBits = UART_STOPBITS_1;
rs232Handle.Init.Parity = UART_PARITY_NONE;
rs232Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
rs232Handle.Init.Mode = UART_MODE_TX_RX;
rs232Handle.Init.OverSampling = UART_OVERSAMPLING_16;
rs232Handle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
rs232Handle.Init.ClockPrescaler = UART_PRESCALER_DIV1;
/* Initialize the UART peripheral. */
HAL_UART_Init(&uartHandle);
} /*** end of BootComUartInit ***/
HAL_UART_Init(&rs232Handle);
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -136,9 +136,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -147,11 +147,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -165,7 +165,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -187,7 +187,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -196,7 +196,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -205,12 +205,12 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
HAL_StatusTypeDef result;
/* receive a byte in a non-blocking manner */
result = HAL_UART_Receive(&uartHandle, data, 1, 0);
result = HAL_UART_Receive(&rs232Handle, data, 1, 0);
/* process the result */
if (result == HAL_OK)
{
@ -219,8 +219,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* error occurred */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -166,10 +166,10 @@ void HAL_MspInit(void)
/* GPIO ports clock enable. */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock enable. */
__HAL_RCC_USART2_CLK_ENABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
@ -184,7 +184,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* UART TX and RX GPIO pin configuration. */
GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
@ -192,7 +192,7 @@ void HAL_MspInit(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
} /*** end of HAL_MspInit ***/
@ -205,18 +205,18 @@ void HAL_MspInit(void)
****************************************************************************************/
void HAL_MspDeInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Reset UART GPIO pin configuration. */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3);
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* Deconfigure GPIO pin for the LED. */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* Peripheral clock disable. */
__HAL_RCC_USART2_CLK_DISABLE();
#endif /* BOOT_COM_UART_ENABLE > 0 */
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/* GPIO ports clock disable. */
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

View File

@ -84,24 +84,24 @@
/** \brief Select the desired CAN peripheral as a zero based index. */
#define BOOT_COM_CAN_CHANNEL_INDEX (1)
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -72,22 +72,22 @@ int main(void)
****************************************************************************************/
static void PostInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
XMC_GPIO_CONFIG_t rx_uart_config;
XMC_GPIO_CONFIG_t tx_uart_config;
#if (BOOT_COM_RS232_ENABLE > 0)
XMC_GPIO_CONFIG_t rx_rs232_config;
XMC_GPIO_CONFIG_t tx_rs232_config;
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
XMC_GPIO_CONFIG_t rx_can_config;
XMC_GPIO_CONFIG_t tx_can_config;
#endif
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* initialize UART Rx pin */
rx_uart_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(P1_3, &rx_uart_config);
rx_rs232_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(P1_3, &rx_rs232_config);
/* initialize UART Tx pin */
tx_uart_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7;
XMC_GPIO_Init(P1_2, &tx_uart_config);
tx_rs232_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7;
XMC_GPIO_Init(P1_2, &tx_rs232_config);
/* set input source path to DXnA to connect P1_3 to ASC Receive. note that this
* function must be called after XMC_UART_CH_Init(), which is called when initializing
* the bootloader core with BootInit().

View File

@ -38,9 +38,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
static void BootComCanInit(void);
@ -54,8 +54,8 @@ static void BootComCanCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanInit();
@ -71,8 +71,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanCheckActivationRequest();
@ -92,7 +92,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -103,13 +103,13 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -117,20 +117,20 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
XMC_GPIO_CONFIG_t rx_config;
XMC_GPIO_CONFIG_t tx_config;
XMC_UART_CH_CONFIG_t uart_config;
XMC_UART_CH_CONFIG_t rs232_config;
/* set configuration and initialize UART channel */
uart_config.baudrate = BOOT_COM_UART_BAUDRATE;
uart_config.data_bits = 8;
uart_config.frame_length = 8;
uart_config.stop_bits = 1;
uart_config.oversampling = 16;
uart_config.parity_mode = XMC_USIC_CH_PARITY_MODE_NONE;
XMC_UART_CH_Init(XMC_UART0_CH1, &uart_config);
rs232_config.baudrate = BOOT_COM_RS232_BAUDRATE;
rs232_config.data_bits = 8;
rs232_config.frame_length = 8;
rs232_config.stop_bits = 1;
rs232_config.oversampling = 16;
rs232_config.parity_mode = XMC_USIC_CH_PARITY_MODE_NONE;
XMC_UART_CH_Init(XMC_UART0_CH1, &rs232_config);
/* initialize UART Rx pin */
rx_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(P1_3, &rx_config);
@ -147,7 +147,7 @@ static void BootComUartInit(void)
XMC_USIC_CH_RXFIFO_Configure(XMC_UART0_CH1, 0U, XMC_USIC_CH_FIFO_SIZE_16WORDS, 1U);
/* start UART */
XMC_UART_CH_Start(XMC_UART0_CH1);
} /*** end of BootComUartInit ***/
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -156,9 +156,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -167,11 +167,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -185,7 +185,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -207,7 +207,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -216,7 +216,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -225,7 +225,7 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
if (XMC_USIC_CH_RXFIFO_IsEmpty(XMC_UART0_CH1) == 0)
{
@ -236,8 +236,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* still here to no new byte received */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)

View File

@ -84,24 +84,24 @@
/** \brief Select the desired CAN peripheral as a zero based index. */
#define BOOT_COM_CAN_CHANNEL_INDEX (1)
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
@echo on
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\settings\xmc1400.Debug.general.xcl" --backend -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\settings\xmc1400.Debug.driver.xcl"
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\settings\xmc1400.Debug.general.xcl" --backend -f "C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\settings\xmc1400.Debug.driver.xcl"
@echo off
goto end
@ -34,7 +34,7 @@ goto end
@echo on
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\settings\xmc1400.Debug.general.xcl" "--debug_file=%~1" --backend -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\settings\xmc1400.Debug.driver.xcl"
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\settings\xmc1400.Debug.general.xcl" "--debug_file=%~1" --backend -f "C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\settings\xmc1400.Debug.driver.xcl"
@echo off
:end

View File

@ -2,7 +2,7 @@
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\arm\bin\armjlink2.dll"
"C:\Work\software\OpenBLT\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\..\bin\openblt_xmc1400.out"
"C:\Work\software\OpenBLT_uart_refactoring\Target\Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_IAR\Boot\ide\..\bin\openblt_xmc1400.out"
--plugin="C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\arm\bin\armbat.dll"

View File

@ -201,7 +201,7 @@
<ColumnWidth0>24</ColumnWidth0>
<ColumnWidth1>1863</ColumnWidth1>
<FilterLevel>2</FilterLevel>
<LiveFile></LiveFile>
<LiveFile />
<LiveLogEnabled>0</LiveLogEnabled>
<LiveFilterLevel>-1</LiveFilterLevel>
</IarPane-34048>
@ -257,11 +257,13 @@
</ColumnWidths>
<NodeDict>
<ExpandedNode>xmc1400</ExpandedNode>
<ExpandedNode>xmc1400/Source</ExpandedNode>
<ExpandedNode>xmc1400/Source/ARMCM0_XMC1</ExpandedNode>
</NodeDict>
</IarPane-34063>
<ControlBarVersion>
<Major>14</Major>
<Minor>11</Minor>
<Minor>20</Minor>
</ControlBarVersion>
<MFCToolBarParameters>
<Tooltips>1</Tooltips>
@ -275,12 +277,12 @@
</MFCToolBarParameters>
<CommandManager>
<CommandsWithoutImages>08000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000</CommandsWithoutImages>
<MenuUserImages>040030840000520000000E840000500000000B8100001F0000000D81000021000000</MenuUserImages>
<MenuUserImages>0600048400004C000000068400004E0000000E8400005000000030840000520000000B8100001F0000000D81000021000000</MenuUserImages>
</CommandManager>
<Pane-59393>
<ID>0</ID>
<RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>
<RectRecentDocked>00000000F00300008007000003040000</RectRecentDocked>
<RectRecentDocked>00000000E903000080070000FE030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -306,8 +308,8 @@
<IarPane-34051 />
<Pane--1>
<ID>4294967295</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>000000003F03000080070000F0030000</RectRecentDocked>
<RectRecentFloat>0000000079030000800700002A040000</RectRecentFloat>
<RectRecentDocked>000000003803000080070000E9030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -320,7 +322,7 @@
<Pane-34052>
<ID>34052</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>32768</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -343,7 +345,7 @@
<Pane-34048>
<ID>34048</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -356,7 +358,7 @@
<Pane-34056>
<ID>34056</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -370,7 +372,7 @@
<Pane-34057>
<ID>34057</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -384,7 +386,7 @@
<Pane-34058>
<ID>34058</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -398,7 +400,7 @@
<Pane-34059>
<ID>34059</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -412,7 +414,7 @@
<Pane-34062>
<ID>34062</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -496,7 +498,7 @@
<Pane-34063>
<ID>34063</ID>
<RectRecentFloat>00000000350000000601000096010000</RectRecentFloat>
<RectRecentDocked>0000000032000000060100003B030000</RectRecentDocked>
<RectRecentDocked>00000000320000000601000034030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -507,11 +509,11 @@
<IsVisible>1</IsVisible>
</BasePane-34063>
<DockingManager-256>
<DockingPaneAndPaneDividers>0000000010000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A0100003B0300000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000010040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000010040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000001000000FFFFFFFFFFFFFFFF000000003B030000800700003F030000010000000100001004000000010000000000000000000000FFFFFFFF07000000048500000085000008850000098500000A8500000B8500000E850000FFFF02000B004354616262656450616E650080000001000000000000003500000022010000E6000000000000003F03000080070000F0030000000000004080005607000000FFFEFF054200750069006C006400010000000485000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000085000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000000000000000000</DockingPaneAndPaneDividers>
<DockingPaneAndPaneDividers>0000000010000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A010000340300000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000001000000FFFFFFFFFFFFFFFF00000000340300008007000038030000010000000100001004000000010000000000000000000000FFFFFFFF07000000048500000085000008850000098500000A8500000B8500000E850000FFFF02000B004354616262656450616E6500800000010000000000000079030000800700002A040000000000003803000080070000E9030000000000004080005607000000FFFEFF054200750069006C006400010000000485000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000085000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000000000000000000</DockingPaneAndPaneDividers>
</DockingManager-256>
<MFCToolBar-34049>
<Name>CMSIS-Pack</Name>
<Buttons>00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED1840000000000000C000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B00FF7F0000</Buttons>
<Buttons>00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED1840000000000000C000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B0018000000</Buttons>
</MFCToolBar-34049>
<Pane-34049>
<ID>34049</ID>
@ -520,7 +522,7 @@
<RecentFrameAlignment>8192</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
<MRUWidth>32767</MRUWidth>
<MRUWidth>24</MRUWidth>
<PinState>0</PinState>
</Pane-34049>
<BasePane-34049>
@ -528,7 +530,7 @@
</BasePane-34049>
<MFCToolBar-34050>
<Name>Main</Name>
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00FF7F0000</Buttons>
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0001000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>
</MFCToolBar-34050>
<Pane-34050>
<ID>34050</ID>
@ -537,7 +539,7 @@
<RecentFrameAlignment>8192</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
<MRUWidth>32767</MRUWidth>
<MRUWidth>744</MRUWidth>
<PinState>0</PinState>
</Pane-34050>
<BasePane-34050>

View File

@ -2458,15 +2458,15 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\nvm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\rs232.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\types.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\uart.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
@ -2523,10 +2523,10 @@
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\rs232.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\uart.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\usb.h</name>

View File

@ -2722,15 +2722,15 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\nvm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\rs232.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\types.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM0_XMC1\uart.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
@ -2787,10 +2787,10 @@
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\rs232.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\uart.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\usb.h</name>

View File

@ -84,22 +84,22 @@ static void Init(void)
****************************************************************************************/
static void PostInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
XMC_GPIO_CONFIG_t rx_uart_config;
XMC_GPIO_CONFIG_t tx_uart_config;
#if (BOOT_COM_RS232_ENABLE > 0)
XMC_GPIO_CONFIG_t rx_rs232_config;
XMC_GPIO_CONFIG_t tx_rs232_config;
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
XMC_GPIO_CONFIG_t rx_can_config;
XMC_GPIO_CONFIG_t tx_can_config;
#endif
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* initialize UART Rx pin */
rx_uart_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(P1_3, &rx_uart_config);
rx_rs232_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(P1_3, &rx_rs232_config);
/* initialize UART Tx pin */
tx_uart_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7;
XMC_GPIO_Init(P1_2, &tx_uart_config);
tx_rs232_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7;
XMC_GPIO_Init(P1_2, &tx_rs232_config);
/* set input source path to DXnA to connect P1_3 to ASC Receive. note that this
* function must be called after XMC_UART_CH_Init(), which is called when initializing
* the bootloader core with BootInit().

View File

@ -38,9 +38,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
static void BootComCanInit(void);
@ -54,8 +54,8 @@ static void BootComCanCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanInit();
@ -71,8 +71,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
#if (BOOT_COM_CAN_ENABLE > 0)
BootComCanCheckActivationRequest();
@ -92,7 +92,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -103,13 +103,13 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -117,20 +117,20 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
XMC_GPIO_CONFIG_t rx_config;
XMC_GPIO_CONFIG_t tx_config;
XMC_UART_CH_CONFIG_t uart_config;
XMC_UART_CH_CONFIG_t rs232_config;
/* set configuration and initialize UART channel */
uart_config.baudrate = BOOT_COM_UART_BAUDRATE;
uart_config.data_bits = 8;
uart_config.frame_length = 8;
uart_config.stop_bits = 1;
uart_config.oversampling = 16;
uart_config.parity_mode = XMC_USIC_CH_PARITY_MODE_NONE;
XMC_UART_CH_Init(XMC_UART0_CH1, &uart_config);
rs232_config.baudrate = BOOT_COM_RS232_BAUDRATE;
rs232_config.data_bits = 8;
rs232_config.frame_length = 8;
rs232_config.stop_bits = 1;
rs232_config.oversampling = 16;
rs232_config.parity_mode = XMC_USIC_CH_PARITY_MODE_NONE;
XMC_UART_CH_Init(XMC_UART0_CH1, &rs232_config);
/* initialize UART Rx pin */
rx_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(P1_3, &rx_config);
@ -147,7 +147,7 @@ static void BootComUartInit(void)
XMC_USIC_CH_RXFIFO_Configure(XMC_UART0_CH1, 0U, XMC_USIC_CH_FIFO_SIZE_16WORDS, 1U);
/* start UART */
XMC_UART_CH_Start(XMC_UART0_CH1);
} /*** end of BootComUartInit ***/
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -156,9 +156,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -167,11 +167,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -185,7 +185,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -207,7 +207,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -216,7 +216,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -225,7 +225,7 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
if (XMC_USIC_CH_RXFIFO_IsEmpty(XMC_UART0_CH1) == 0)
{
@ -236,8 +236,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* still here to no new byte received */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
#if (BOOT_COM_CAN_ENABLE > 0)

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (9600)
#define BOOT_COM_RS232_BAUDRATE (9600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -52,10 +52,10 @@
<file file_name="../../../../Source/ARMCM3_EFM32/nvm.c" />
<file file_name="../../../../Source/ARMCM3_EFM32/timer.c" />
<file file_name="../../../../Source/ARMCM3_EFM32/types.h" />
<file file_name="../../../../Source/ARMCM3_EFM32/uart.c" />
<folder Name="GCC">
<file file_name="../../../../Source/ARMCM3_EFM32/GCC/cpu_comp.c" />
</folder>
<file file_name="../../../../Source/ARMCM3_EFM32/rs232.c" />
</folder>
<file file_name="../../../../Source/assert.c" />
<file file_name="../../../../Source/assert.h" />
@ -73,7 +73,7 @@
<file file_name="../../../../Source/cpu.h" />
<file file_name="../../../../Source/nvm.h" />
<file file_name="../../../../Source/timer.h" />
<file file_name="../../../../Source/uart.h" />
<file file_name="../../../../Source/rs232.h" />
</folder>
<folder Name="Demo">
<folder Name="Boot">

View File

@ -60,5 +60,5 @@
<Files>
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Default" x="0" debugPath="../main.c" y="10" path="../main.c" left="0" selected="1" name="unnamed" top="0" />
</Files>
<ARMCrossStudioWindow activeProject="openbtl_olimex_efm32g880" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:/Work/software/OpenBLT/Target/Source/ARMCM3_EFM32/GCC" fileDialogDefaultFilter="" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
<ARMCrossStudioWindow activeProject="openbtl_olimex_efm32g880" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:/Work/software/OpenBLT_uart_refactoring/Target/Source/ARMCM3_EFM32" fileDialogDefaultFilter="" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
</session>

View File

@ -98,7 +98,7 @@ static void Init(void)
CMU_ClockEnable(cmuClock_ADC0, false);
CMU_ClockEnable(cmuClock_I2C0, false);
CMU_ClockEnable(cmuClock_VCMP, false);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* enable power to U2 (RS232_PWR_E) */
GPIO_PinModeSet(gpioPortB, 9, gpioModePushPullDrive, 1);
/* set port B outputs to drive up to 20 mA */

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
/************************************************************************************//**
@ -47,8 +47,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -61,8 +61,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -79,7 +79,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -90,13 +90,13 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -104,7 +104,7 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
LEUART_Init_TypeDef init = LEUART_INIT_DEFAULT;
@ -124,14 +124,14 @@ static void BootComUartInit(void)
/* configure LEUART */
init.enable = leuartDisable;
LEUART_Init(LEUART1, &init);
LEUART_BaudrateSet(LEUART1, 0, BOOT_COM_UART_BAUDRATE);
LEUART_BaudrateSet(LEUART1, 0, BOOT_COM_RS232_BAUDRATE);
/* enable pins at default location */
LEUART1->ROUTE = LEUART_ROUTE_RXPEN | LEUART_ROUTE_TXPEN;
/* clear previous RX interrupts */
LEUART_IntClear(LEUART1, LEUART_IF_RXDATAV);
/* finally enable it */
LEUART_Enable(LEUART1, leuartEnable);
} /*** end of BootUartComInit ***/
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -140,9 +140,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -151,11 +151,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -169,7 +169,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -191,7 +191,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -200,7 +200,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -209,7 +209,7 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
/* check to see if a new bytes was received */
if ((LEUART1->IF & LEUART_IF_RXDATAV) != 0)
@ -220,8 +220,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* still here to no new byte received */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -96,7 +96,7 @@ static void Init(void)
CMU_ClockEnable(cmuClock_ADC0, false);
CMU_ClockEnable(cmuClock_I2C0, false);
CMU_ClockEnable(cmuClock_VCMP, false);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* enable power to U2 (RS232_PWR_E) */
GPIO_PinModeSet(gpioPortB, 9, gpioModePushPullDrive, 1);
/* set port B outputs to drive up to 20 mA */

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (9600)
#define BOOT_COM_RS232_BAUDRATE (9600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -98,7 +98,7 @@ static void Init(void)
CMU_ClockEnable(cmuClock_ADC0, false);
CMU_ClockEnable(cmuClock_I2C0, false);
CMU_ClockEnable(cmuClock_VCMP, false);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* enable power to U2 (RS232_PWR_E) */
GPIO_PinModeSet(gpioPortB, 9, gpioModePushPullDrive, 1);
/* set port B outputs to drive up to 20 mA */

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
/************************************************************************************//**
@ -47,8 +47,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -61,8 +61,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -79,7 +79,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -90,13 +90,13 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -104,7 +104,7 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
LEUART_Init_TypeDef init = LEUART_INIT_DEFAULT;
@ -124,14 +124,14 @@ static void BootComUartInit(void)
/* configure LEUART */
init.enable = leuartDisable;
LEUART_Init(LEUART1, &init);
LEUART_BaudrateSet(LEUART1, 0, BOOT_COM_UART_BAUDRATE);
LEUART_BaudrateSet(LEUART1, 0, BOOT_COM_RS232_BAUDRATE);
/* enable pins at default location */
LEUART1->ROUTE = LEUART_ROUTE_RXPEN | LEUART_ROUTE_TXPEN;
/* clear previous RX interrupts */
LEUART_IntClear(LEUART1, LEUART_IF_RXDATAV);
/* finally enable it */
LEUART_Enable(LEUART1, leuartEnable);
} /*** end of BootUartComInit ***/
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -140,9 +140,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -151,11 +151,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -169,7 +169,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -191,7 +191,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -200,7 +200,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -209,7 +209,7 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
/* check to see if a new bytes was received */
if ((LEUART1->IF & LEUART_IF_RXDATAV) != 0)
@ -220,8 +220,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* still here to no new byte received */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -96,7 +96,7 @@ static void Init(void)
CMU_ClockEnable(cmuClock_ADC0, false);
CMU_ClockEnable(cmuClock_I2C0, false);
CMU_ClockEnable(cmuClock_VCMP, false);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* enable power to U2 (RS232_PWR_E) */
GPIO_PinModeSet(gpioPortB, 9, gpioModePushPullDrive, 1);
/* set port B outputs to drive up to 20 mA */

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (9600)
#define BOOT_COM_RS232_BAUDRATE (9600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (1)
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
/****************************************************************************************

View File

@ -2367,15 +2367,15 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM3_EFM32\nvm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM3_EFM32\rs232.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM3_EFM32\timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM3_EFM32\types.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM3_EFM32\uart.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
@ -2417,10 +2417,10 @@
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\rs232.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\uart.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\xcp.c</name>

View File

@ -199,7 +199,7 @@
<ColumnWidth0>24</ColumnWidth0>
<ColumnWidth1>1863</ColumnWidth1>
<FilterLevel>2</FilterLevel>
<LiveFile></LiveFile>
<LiveFile />
<LiveLogEnabled>0</LiveLogEnabled>
<LiveFilterLevel>-1</LiveFilterLevel>
</IarPane-34048>
@ -255,11 +255,13 @@
</ColumnWidths>
<NodeDict>
<ExpandedNode>efm32G880</ExpandedNode>
<ExpandedNode>efm32G880/Source</ExpandedNode>
<ExpandedNode>efm32G880/Source/ARMCM3_EFM32</ExpandedNode>
</NodeDict>
</IarPane-34063>
<ControlBarVersion>
<Major>14</Major>
<Minor>11</Minor>
<Minor>20</Minor>
</ControlBarVersion>
<MFCToolBarParameters>
<Tooltips>1</Tooltips>
@ -273,12 +275,12 @@
</MFCToolBarParameters>
<CommandManager>
<CommandsWithoutImages>08000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000</CommandsWithoutImages>
<MenuUserImages>040030840000520000000E840000500000000B8100001F0000000D81000021000000</MenuUserImages>
<MenuUserImages>0600048400004C000000068400004E0000000E8400005000000030840000520000000B8100001F0000000D81000021000000</MenuUserImages>
</CommandManager>
<Pane-59393>
<ID>0</ID>
<RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>
<RectRecentDocked>00000000F00300008007000003040000</RectRecentDocked>
<RectRecentDocked>00000000E903000080070000FE030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -304,8 +306,8 @@
<IarPane-34051 />
<Pane--1>
<ID>4294967295</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>000000003F03000080070000F0030000</RectRecentDocked>
<RectRecentFloat>0000000079030000800700002A040000</RectRecentFloat>
<RectRecentDocked>000000003803000080070000E9030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -318,7 +320,7 @@
<Pane-34052>
<ID>34052</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>32768</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -341,7 +343,7 @@
<Pane-34048>
<ID>34048</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -354,7 +356,7 @@
<Pane-34056>
<ID>34056</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -368,7 +370,7 @@
<Pane-34057>
<ID>34057</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -382,7 +384,7 @@
<Pane-34058>
<ID>34058</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -396,7 +398,7 @@
<Pane-34059>
<ID>34059</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -410,7 +412,7 @@
<Pane-34062>
<ID>34062</ID>
<RectRecentFloat>000000003500000022010000E6000000</RectRecentFloat>
<RectRecentDocked>04000000570300007C070000D6030000</RectRecentDocked>
<RectRecentDocked>04000000550300007C070000CD030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -494,7 +496,7 @@
<Pane-34063>
<ID>34063</ID>
<RectRecentFloat>00000000350000000601000096010000</RectRecentFloat>
<RectRecentDocked>0000000032000000060100003B030000</RectRecentDocked>
<RectRecentDocked>00000000320000000601000034030000</RectRecentDocked>
<RecentFrameAlignment>4096</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
@ -505,11 +507,11 @@
<IsVisible>1</IsVisible>
</BasePane-34063>
<DockingManager-256>
<DockingPaneAndPaneDividers>0000000010000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A0100003B0300000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000010040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000010040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000001000000FFFFFFFFFFFFFFFF000000003B030000800700003F030000010000000100001004000000010000000000000000000000FFFFFFFF07000000048500000085000008850000098500000A8500000B8500000E850000FFFF02000B004354616262656450616E650080000001000000000000003500000022010000E6000000000000003F03000080070000F0030000000000004080005607000000FFFEFF054200750069006C006400010000000485000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000085000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000000000000000000</DockingPaneAndPaneDividers>
<DockingPaneAndPaneDividers>0000000010000000000000000010000001000000FFFFFFFFFFFFFFFF06010000320000000A010000340300000100000002000010040000000100000000000000000000000F85000000000000000000000000000000000000010000000F850000010000000F850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000D85000000000000000000000000000000000000010000000D850000010000000D850000000000000080000000000000FFFFFFFFFFFFFFFF000000000000000004000000040000000000000001000000040000000100000000000000000000000C85000000000000000000000000000000000000010000000C850000010000000C850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000001000000FFFFFFFFFFFFFFFF00000000340300008007000038030000010000000100001004000000010000000000000000000000FFFFFFFF07000000048500000085000008850000098500000A8500000B8500000E850000FFFF02000B004354616262656450616E6500800000010000000000000079030000800700002A040000000000003803000080070000E9030000000000004080005607000000FFFEFF054200750069006C006400010000000485000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000085000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0485000001000000FFFFFFFF04850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000000000000000000</DockingPaneAndPaneDividers>
</DockingManager-256>
<MFCToolBar-34049>
<Name>CMSIS-Pack</Name>
<Buttons>00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED1840000000000000C000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B00FF7F0000</Buttons>
<Buttons>00200000010000000100FFFF01001100434D4643546F6F6C426172427574746F6ED1840000000000000C000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B0018000000</Buttons>
</MFCToolBar-34049>
<Pane-34049>
<ID>34049</ID>
@ -518,7 +520,7 @@
<RecentFrameAlignment>8192</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
<MRUWidth>32767</MRUWidth>
<MRUWidth>24</MRUWidth>
<PinState>0</PinState>
</Pane-34049>
<BasePane-34049>
@ -526,7 +528,7 @@
</BasePane-34049>
<MFCToolBar-34050>
<Name>Main</Name>
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00FF7F0000</Buttons>
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0001000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>
</MFCToolBar-34050>
<Pane-34050>
<ID>34050</ID>
@ -535,7 +537,7 @@
<RecentFrameAlignment>8192</RecentFrameAlignment>
<RecentRowIndex>0</RecentRowIndex>
<IsFloating>0</IsFloating>
<MRUWidth>32767</MRUWidth>
<MRUWidth>744</MRUWidth>
<PinState>0</PinState>
</Pane-34050>
<BasePane-34050>

View File

@ -95,7 +95,7 @@ static void Init(void)
CMU_ClockEnable(cmuClock_ADC0, false);
CMU_ClockEnable(cmuClock_I2C0, false);
CMU_ClockEnable(cmuClock_VCMP, false);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* enable power to U2 (RS232_PWR_E) */
GPIO_PinModeSet(gpioPortB, 9, gpioModePushPullDrive, 1);
/* set port B outputs to drive up to 20 mA */

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
/************************************************************************************//**
@ -47,8 +47,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -61,8 +61,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -79,7 +79,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -90,13 +90,13 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -104,7 +104,7 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
LEUART_Init_TypeDef init = LEUART_INIT_DEFAULT;
@ -124,14 +124,14 @@ static void BootComUartInit(void)
/* configure LEUART */
init.enable = leuartDisable;
LEUART_Init(LEUART1, &init);
LEUART_BaudrateSet(LEUART1, 0, BOOT_COM_UART_BAUDRATE);
LEUART_BaudrateSet(LEUART1, 0, BOOT_COM_RS232_BAUDRATE);
/* enable pins at default location */
LEUART1->ROUTE = LEUART_ROUTE_RXPEN | LEUART_ROUTE_TXPEN;
/* clear previous RX interrupts */
LEUART_IntClear(LEUART1, LEUART_IF_RXDATAV);
/* finally enable it */
LEUART_Enable(LEUART1, leuartEnable);
} /*** end of BootUartComInit ***/
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -140,9 +140,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -151,11 +151,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -169,7 +169,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -191,7 +191,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -200,7 +200,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -209,7 +209,7 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
/* check to see if a new bytes was received */
if ((LEUART1->IF & LEUART_IF_RXDATAV) != 0)
@ -220,8 +220,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* still here to no new byte received */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

View File

@ -93,7 +93,7 @@ static void Init(void)
CMU_ClockEnable(cmuClock_ADC0, false);
CMU_ClockEnable(cmuClock_I2C0, false);
CMU_ClockEnable(cmuClock_VCMP, false);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/* enable power to U2 (RS232_PWR_E) */
GPIO_PinModeSet(gpioPortB, 9, gpioModePushPullDrive, 1);
/* set port B outputs to drive up to 20 mA */

View File

@ -56,24 +56,24 @@
/****************************************************************************************
* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
* in bits/second. The maximum amount of data bytes in a message for data transmission
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
* and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA,
* respectively. It is common for a microcontroller to have more than 1 UART interface
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
* on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
*
*/
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_UART_ENABLE (1)
#define BOOT_COM_RS232_ENABLE (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_UART_BAUDRATE (57600)
#define BOOT_COM_RS232_BAUDRATE (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_UART_TX_MAX_DATA (64)
#define BOOT_COM_RS232_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_UART_RX_MAX_DATA (64)
#define BOOT_COM_RS232_RX_MAX_DATA (64)
/** \brief Select the desired UART peripheral as a zero based index. */
#define BOOT_COM_UART_CHANNEL_INDEX (0)
#define BOOT_COM_RS232_CHANNEL_INDEX (0)
/* The NET communication interface for firmware updates via TCP/IP is selected by setting

View File

@ -112,10 +112,10 @@
<file file_name="../../../../Source/ARMCM3_LM3S/nvm.c" />
<file file_name="../../../../Source/ARMCM3_LM3S/timer.c" />
<file file_name="../../../../Source/ARMCM3_LM3S/types.h" />
<file file_name="../../../../Source/ARMCM3_LM3S/uart.c" />
<folder Name="GCC">
<file file_name="../../../../Source/ARMCM3_LM3S/GCC/cpu_comp.c" />
</folder>
<file file_name="../../../../Source/ARMCM3_LM3S/rs232.c" />
</folder>
<file file_name="../../../../Source/assert.c" />
<file file_name="../../../../Source/assert.h" />
@ -168,7 +168,7 @@
<file file_name="../../../../Source/cpu.h" />
<file file_name="../../../../Source/nvm.h" />
<file file_name="../../../../Source/timer.h" />
<file file_name="../../../../Source/uart.h" />
<file file_name="../../../../Source/rs232.h" />
</folder>
</folder>
<folder Name="System Files">

View File

@ -30,9 +30,6 @@
<ProjectSessionItem path="lm3s6965_crossworks;openblt_ek_lm3s6965;Source Files;Demo;Boot" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;openblt_ek_lm3s6965;Source Files;Source" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;openblt_ek_lm3s6965;Source Files;Source;ARMCM3_LM3S" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;openblt_ek_lm3s6965;Source Files;Source;ARMCM3_LM3S;GCC" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;openblt_ek_lm3s6965;Source Files;Source;third_party" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;openblt_ek_lm3s6965;Source Files;Source;third_party;uip" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;openblt_ek_lm3s6965;System Files" name="unnamed" />
</Project>
<Register1>
@ -70,5 +67,5 @@
<Files>
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="../main.c" y="33" path="../main.c" left="0" selected="1" name="unnamed" top="26" />
</Files>
<ARMCrossStudioWindow activeProject="openblt_ek_lm3s6965" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:/Work/software/OpenBLT_DHCP_Support/Target/Source/third_party/uip/apps/dhcpc" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Debug" />
<ARMCrossStudioWindow activeProject="openblt_ek_lm3s6965" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:/Work/software/OpenBLT_uart_refactoring/Target/Source/ARMCM3_LM3S" fileDialogDefaultFilter="" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Debug" />
</session>

View File

@ -123,8 +123,8 @@ static void Init(void)
GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_UART_CHANNEL_INDEX == 0)
#if (BOOT_COM_RS232_ENABLE > 0)
#if (BOOT_COM_RS232_CHANNEL_INDEX == 0)
/* enable and configure UART0 related peripherals and pins */
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

View File

@ -35,9 +35,9 @@
/****************************************************************************************
* Function prototypes
****************************************************************************************/
#if (BOOT_COM_UART_ENABLE > 0)
static void BootComUartInit(void);
static void BootComUartCheckActivationRequest(void);
#if (BOOT_COM_RS232_ENABLE > 0)
static void BootComRs232Init(void);
static void BootComRs232CheckActivationRequest(void);
#endif
/************************************************************************************//**
@ -47,8 +47,8 @@ static void BootComUartCheckActivationRequest(void);
****************************************************************************************/
void BootComInit(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartInit();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232Init();
#endif
} /*** end of BootComInit ***/
@ -61,8 +61,8 @@ void BootComInit(void)
****************************************************************************************/
void BootComCheckActivationRequest(void)
{
#if (BOOT_COM_UART_ENABLE > 0)
BootComUartCheckActivationRequest();
#if (BOOT_COM_RS232_ENABLE > 0)
BootComRs232CheckActivationRequest();
#endif
} /*** end of BootComCheckActivationRequest ***/
@ -79,7 +79,7 @@ void BootActivate(void)
} /*** end of BootActivate ***/
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_RS232_ENABLE > 0)
/****************************************************************************************
* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E
****************************************************************************************/
@ -90,13 +90,13 @@ void BootActivate(void)
/** \brief Timeout time for the reception of a CTO packet. The timer is started upon
* reception of the first packet byte.
*/
#define UART_CTO_RX_PACKET_TIMEOUT_MS (100u)
#define RS232_CTO_RX_PACKET_TIMEOUT_MS (100u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data);
static unsigned char Rs232ReceiveByte(unsigned char *data);
/************************************************************************************//**
@ -104,7 +104,7 @@ static unsigned char UartReceiveByte(unsigned char *data);
** \return none.
**
****************************************************************************************/
static void BootComUartInit(void)
static void BootComRs232Init(void)
{
/* enable the UART0 peripheral */
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
@ -112,10 +112,10 @@ static void BootComUartInit(void)
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
/* configure the UART0 baudrate and communication parameters */
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), BOOT_COM_UART_BAUDRATE,
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), BOOT_COM_RS232_BAUDRATE,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
} /*** end of BootUartComInit ***/
} /*** end of BootComRs232Init ***/
/************************************************************************************//**
@ -124,9 +124,9 @@ static void BootComUartInit(void)
** \return none.
**
****************************************************************************************/
static void BootComUartCheckActivationRequest(void)
static void BootComRs232CheckActivationRequest(void)
{
static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1];
static unsigned char xcpCtoReqPacket[BOOT_COM_RS232_RX_MAX_DATA+1];
static unsigned char xcpCtoRxLength;
static unsigned char xcpCtoRxInProgress = 0;
static unsigned long xcpCtoRxStartTime = 0;
@ -135,11 +135,11 @@ static void BootComUartCheckActivationRequest(void)
if (xcpCtoRxInProgress == 0)
{
/* store the message length when received */
if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[0]) == 1)
{
/* check that the length has a valid value. it should not be 0 */
if ( (xcpCtoReqPacket[0] > 0) &&
(xcpCtoReqPacket[0] <= BOOT_COM_UART_RX_MAX_DATA) )
(xcpCtoReqPacket[0] <= BOOT_COM_RS232_RX_MAX_DATA) )
{
/* store the start time */
xcpCtoRxStartTime = TimerGet();
@ -153,7 +153,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* store the next packet byte */
if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
@ -175,7 +175,7 @@ static void BootComUartCheckActivationRequest(void)
else
{
/* check packet reception timeout */
if (TimerGet() > (xcpCtoRxStartTime + UART_CTO_RX_PACKET_TIMEOUT_MS))
if (TimerGet() > (xcpCtoRxStartTime + RS232_CTO_RX_PACKET_TIMEOUT_MS))
{
/* cancel cto packet reception due to timeout. note that this automatically
* discards the already received packet bytes, allowing the host to retry.
@ -184,7 +184,7 @@ static void BootComUartCheckActivationRequest(void)
}
}
}
} /*** end of BootComUartCheckActivationRequest ***/
} /*** end of BootComRs232CheckActivationRequest ***/
/************************************************************************************//**
@ -193,7 +193,7 @@ static void BootComUartCheckActivationRequest(void)
** \return 1 if a byte was received, 0 otherwise.
**
****************************************************************************************/
static unsigned char UartReceiveByte(unsigned char *data)
static unsigned char Rs232ReceiveByte(unsigned char *data)
{
signed long result;
@ -209,8 +209,8 @@ static unsigned char UartReceiveByte(unsigned char *data)
}
/* inform caller that no new data was received */
return 0;
} /*** end of UartReceiveByte ***/
#endif /* BOOT_COM_UART_ENABLE > 0 */
} /*** end of Rs232ReceiveByte ***/
#endif /* BOOT_COM_RS232_ENABLE > 0 */
/*********************************** end of boot.c *************************************/

Some files were not shown because too many files have changed in this diff Show More