From 41f087b7183a5730e46b7eaa322b6852d602babf Mon Sep 17 00:00:00 2001
From: tao_z <tzj0429@163.com>
Date: Tue, 31 May 2022 01:04:15 +0800
Subject: [PATCH] 调试更新,非完全体

---
 xl6600_flash.ld                      |    6 +++---
 Application/source/main.c            |    4 ++--
 Application/source/uds_modules/uds.c |    9 +++++++--
 Application/source/fbl_ap.c          |    2 +-
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Application/source/fbl_ap.c b/Application/source/fbl_ap.c
index d8c94d2..d148ac8 100644
--- a/Application/source/fbl_ap.c
+++ b/Application/source/fbl_ap.c
@@ -2,7 +2,7 @@
 #include "fbl_def.h"
 #include "xl_nvic.h"
 #include <string.h>
-__IO uint8_t ProgramRequest[8] __attribute__((section(".noinit_bootReqFlag_ram")));
+__IO uint8_t ProgramRequest[8] __attribute__((section(".noinit_bootReqFlag")));
 // __IO uint32_t VectorTable[99] __attribute__((section(".RAMVectorTable")));
 
 void FblSetFblProgramRequestFlag(void)
diff --git a/Application/source/main.c b/Application/source/main.c
index 1e5a2c3..8932ce5 100644
--- a/Application/source/main.c
+++ b/Application/source/main.c
@@ -75,8 +75,8 @@
 		}
 	}
 
-	OSTaskCreate(UDS_Task_1ms, 1, 1, NULL);	  /*UDS 1ms����*/
-	OSTaskCreate(UDS_Task_10ms, 10, 9, NULL); /*UDS 10ms����*/
+	OSTaskCreate(UDS_Task_1ms, 1, 1, NULL);
+	OSTaskCreate(UDS_Task_10ms, 10, 9, NULL);
 	OSTaskCreate(light_task, 50, 49, NULL);
 
 	OSSchedule(&OS_GetTick);
diff --git a/Application/source/uds_modules/uds.c b/Application/source/uds_modules/uds.c
index 7f1040c..f65d787 100644
--- a/Application/source/uds_modules/uds.c
+++ b/Application/source/uds_modules/uds.c
@@ -1773,11 +1773,15 @@
                 if (transferType == DOWNLOAD_FLASH)
                 {
                     UDS_L_CRCCheckFail_b = !MEM_PartitionCRCOK((uint8_t)MEM_PARTITION_CODEFLASH);
+                    if (UDS_L_CRCCheckFail_b == false)
+                    {
+                        NVM_ReInitFlashDriveRam(); // CLEAR FLASH DRIVE IN RAM
+                    }
                 }
                 else
                 {
                     UDS_L_CRCCheckFail_b = !MEM_PartitionCRCOK((uint8_t)MEM_PARTITION_RAM);
-                    if (UDS_L_CRCCheckFail_b == false)
+                    if (UDS_L_CRCCheckFail_b == true)
                     {
                         NVM_ReInitFlashDriveRam(); // CLEAR FLASH DRIVE IN RAM
                     }
@@ -1914,7 +1918,7 @@
         UDS_L_tx_msg_buffer[1] = 0x01;
         UDS_L_tx_msg_buffer[2] = 0xff;
         UDS_L_tx_msg_buffer[3] = 0x00;
-        UDS_L_tx_msg_buffer[4] = (uint8_t) true;
+        UDS_L_tx_msg_buffer[4] = 0; // 0:ok 1��error
         /* Specify the send payload size */
         UDS_L_tx_msg_size = 5;
         UDS_RespTxMessage();
@@ -2184,6 +2188,7 @@
     operation_write.current_sequenc = expectedSequenceCnt;
     operation_write.prev_seqence = currentSequenceCnt;
 
+    UDS_SendNegResp(NRC_SERVICE_BUSY);              // first send busy
     write_result = NEM_WriteData(&operation_write); // todo write all data at this function
     if (write_result == OP_STATUS_OK)
     {
diff --git a/xl6600_flash.ld b/xl6600_flash.ld
index 5f92114..3e75d5f 100644
--- a/xl6600_flash.ld
+++ b/xl6600_flash.ld
@@ -57,14 +57,14 @@
 SECTIONS
 {
     /* no init ram data */
-  .RAMNoInitSector :
+  .RAMNoInitSector (NOLOAD):
   {
     . = ALIGN(8);
-    KEEP(*(.noinit_bootReqFlag_ram)) /* Startup code */
+    KEEP(*(.noinit_bootReqFlag)) /* Startup code */
     . = ALIGN(8);
   } >BOOTFLAG
 
-  .flashdriver_ram  : {KEEP(*(.flashdriver_ram))} > FALSH_DRIVER_RAM
+  .flashdriver_ram (NOLOAD)  : {KEEP(*(.flashdriver_ram))} > FALSH_DRIVER_RAM
   
   
   /* file define  */

--
Gitblit v1.8.0