Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
qitas committed Oct 29, 2021
1 parent 90cbace commit 11c5124
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 40 deletions.
10 changes: 2 additions & 8 deletions project/IAP/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,9 @@ int main(void)
MX_RTC_Init();
MX_IWDG_Init();
/* USER CODE BEGIN 2 */
uart_init();
char buf[50];

char buf[50];
#ifdef BLT
// uint8_t buf[32] = "\r\nSTM32G030 UART1(115200) BLT\r\n";
// HAL_UART_Transmit(&huart1,buf,sizeof(buf)-1,100);
bootinit();
LL_mDelay(30);
memset((char *)buf,0,sizeof(buf));
Expand All @@ -122,7 +119,6 @@ int main(void)
sprintf((char *)buf, "BLT:%x-%x,%x-%x,%dk\r\n",IAP_Get(bkp_app1_addr),IAP_Get(bkp_app2_addr),IAP_Get(bkp_app1_mark),IAP_Get(bkp_app2_mark),fsize);
// HAL_UART_Transmit(&huart1,(uint8_t *)buf,strlen((char *)buf),100);
uart_tx_str((uint8_t *)buf,strlen((char *)buf));
feed_dog();
#endif
// FlashTestWR();
/* USER CODE END 2 */
Expand All @@ -135,19 +131,17 @@ int main(void)

/* USER CODE BEGIN 3 */
rcnt++;
LL_mDelay(0);
LL_mDelay(0);
feed_dog();
// HAL_Delay(2);
#ifdef BLT
bootloop();
// uart_tx_int(uwCRCValue);
if(rcnt%1000==0)
{
feed_dog();
memset((char *)buf,0,sizeof(buf));
sprintf((char *)buf, "\r\nBKP:%x,%x,%x,%x,%x\r\n",IAP_Get(bkp_app1_addr),IAP_Get(bkp_app2_addr),IAP_Get(bkp_app1_mark),IAP_Get(bkp_app2_mark),IAP_Get(bkp_boot_mark));
uart_tx_str((uint8_t *)buf,strlen((char *)buf));
// LL_mDelay(3);
}
#endif
#ifdef APP1
Expand Down
4 changes: 2 additions & 2 deletions project/IAP/MDK-ARM/IAP.uvoptx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
Expand Down Expand Up @@ -263,7 +263,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
Expand Down
1 change: 0 additions & 1 deletion project/IAP/User/Inc/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void PortTimerInterrupt(void);
void BootPortInterrupt(void);
void uart_init(void);
void uart_tx_char(uint8_t ch);
void uart_tx_int(uint32_t num);
void uart_tx_str(uint8_t *str, uint16_t Len);
#ifdef __cplusplus
}
Expand Down
2 changes: 2 additions & 0 deletions project/IAP/User/Src/bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ uint8_t appjump(const uint32_t addr)
*******************************************************************************/
void bootinit(void)
{
uart_init();
uint16_t fsize = *(uint16_t *)(FLASHSIZE_BASE);
if(IAP_Get(bkp_app1_addr)==0 && IAP_Get(bkp_app2_addr)==0 && IAP_Get(bkp_app1_mark)==0 && IAP_Get(bkp_app2_mark)==0)
{
Expand Down Expand Up @@ -179,6 +180,7 @@ void bootinit(void)
void bootloop(void)
{
if(app_ptr) Ymodem_Transmit(app_ptr);

// uart_tx_char(u16Uart1RxIndex);
// uart_tx_char(u8CntUart1Timer1ms);
}
Expand Down
31 changes: 2 additions & 29 deletions project/IAP/User/Src/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ uint16_t u16Uart1RxIndex;
uint8_t u8UartRxBuf[UART1BUF_SIZE];
uint8_t u8CntUart1Timer1ms;
uint8_t Uart1Rxing;
//static uint8_t u8UartRxChar;

/******************************************************************************
**函数信息 :
**功能描述 :
**输入参数 :无
**输出参数 :无
*******************************************************************************/
//static uint8_t u8UartRxChar;
//void HAL_UART_RxCpltCallback(UART_HandleTypeDef *uartHandle)
//{
// if(uartHandle == &huart1)
Expand Down Expand Up @@ -40,9 +41,6 @@ void BootPortInterrupt(void)
{
if(u16Uart1RxIndex >= UART1BUF_SIZE) u16Uart1RxIndex = 0;
u8UartRxBuf[u16Uart1RxIndex++] = USART1->RDR;
// u8UartRxBuf[u16Uart1RxIndex] = LL_USART_ReceiveData8(USART1);
// LL_USART_TransmitData8(USART1, u8UartRxBuf[u16Uart1RxIndex]);
// u16Uart1RxIndex++;
Uart1Rxing = 1;
u8CntUart1Timer1ms = 0;
// LL_USART_TransmitData8(USART1, u16Uart1RxIndex);
Expand Down Expand Up @@ -113,30 +111,5 @@ void uart_tx_char(uint8_t ch)
// while((USART1->ISR&0X40)==0);
// USART1->TDR = 0;
}
/******************************************************************************
**函数信息 :
**功能描述 :
**输入参数 :无
**输出参数 :无
*******************************************************************************/
void uart_tx_int(uint32_t num)
{
// LL_USART_TransmitData8(USART1, num>>24);
// while(!LL_USART_IsActiveFlag_TC(USART1));
// LL_USART_TransmitData8(USART1, num>>16);
// while(!LL_USART_IsActiveFlag_TC(USART1));
// LL_USART_TransmitData8(USART1, num>>8);
// while(!LL_USART_IsActiveFlag_TC(USART1));
// LL_USART_TransmitData8(USART1, num);
// while(!LL_USART_IsActiveFlag_TC(USART1));
USART1->TDR = num>>24;
while((USART1->ISR&0X40)==0);
USART1->TDR = num>>16;
while((USART1->ISR&0X40)==0);
USART1->TDR = num>>8;
while((USART1->ISR&0X40)==0);
USART1->TDR = num;
while((USART1->ISR&0X40)==0);
}

/*------------------------- (C) COPYRIGHT 2021 OS-Q --------------------------*/

0 comments on commit 11c5124

Please sign in to comment.