LAPTOP-KB7QFH2U\ChenJie-PC 1 год назад
Родитель
Сommit
4a02ebd907

+ 1 - 1
FreeRTOS/Source/include/FreeRTOSConfig.h

@@ -29,7 +29,7 @@
 #ifndef FREERTOS_CONFIG_H
 #define FREERTOS_CONFIG_H
 //#define SEGGER_SYSTEMVIEW //选择SYSTEM查看
-#define SEGGER_RTT_PRINTF //选择RTT打印
+//#define SEGGER_RTT_PRINTF //选择RTT打印
 #ifdef SEGGER_SYSTEMVIEW
 	#include "SEGGER_SYSVIEW_FreeRTOS.h"
 #endif

+ 17 - 12
Project_Settings/Linker_Files/linker_flash_s32k146.ld

@@ -31,13 +31,18 @@
 
 MEMORY
 {         
-    int_flash_interrupts    : ORIGIN = 0x00000000, LENGTH = 0x00000400    /* 1K */    /* Do not change this section */
-    int_flash_config        : ORIGIN = 0x00000400, LENGTH = 0x00000010    /* 16bytes */ /* Do not change this section */
-    int_flash               : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0    /* ~1.0MB */ 
+    int_flash_interrupts    : ORIGIN = 0x00014200, LENGTH = 0x00000400    /* 1K */    /* Do not change this section */
+   /* int_flash_config        : ORIGIN = 0x00000400, LENGTH = 0x00000010    /* 16bytes */ /* Do not change this section */
+     int_flash               : ORIGIN = 0x00014600, LENGTH = 0x000EBA00    /* ~1.0MB */ 
+/*	int_flash_interrupts    : ORIGIN = 0x00080200, LENGTH = 0x00000400	/**/
+/*	int_flash               : ORIGIN = 0x00080600, LENGTH = 0x0007FA00	/**/
+	
+	m_flexram				: ORIGIN = 0x14000000, LENGTH = 0x00001000	
     int_sram_results        : ORIGIN = 0x1FFF0000, LENGTH = 0x00000100    /* 256bytes */
     int_sram                : ORIGIN = 0x1FFF0100, LENGTH = 0x0001DF00    /* ~120K */
-    int_sram_stack_c0       : ORIGIN = 0x2000E000, LENGTH = 0x00001000    /* 4K  */
-    ram_rsvd2               : ORIGIN = 0x2000F000, LENGTH = 0             /* End of SRAM */
+    int_sram_stack_c0       : ORIGIN = 0x2000E000, LENGTH = 0x00001000 - 0x10    /* 4K  */
+    ram_rsvd2               : ORIGIN = 0x2000EFF0, LENGTH = 0             /* End of SRAM */
+    ExchangeInfo            : ORIGIN = 0x2000EFF0, LENGTH = 0x10          
 }
 
 
@@ -51,20 +56,19 @@ SECTIONS
    {						
     	*(.eeprom)			
     } >m_flexram			
-    
 	.flash_interrupts :
 	{
-		. = ALIGN(4096);
+		. = ALIGN(512);
         __interrupts_rom_start = .;
         KEEP(*(.intc_vector))    
-        . = ALIGN(4);
+        . = ALIGN(512);
         __interrupts_rom_end = .;
 	} > int_flash_interrupts
 	
-	.flash_config :
-	{
-		KEEP(*(.flash_config))
-	} > int_flash_config
+/*	.flash_config :				*/
+/*	{							*/
+/*		KEEP(*(.flash_config))	*/
+/*	} > int_flash_config		*/
 	
 	.flash :
 	{
@@ -111,6 +115,7 @@ SECTIONS
 		__DATA_ROM = .;
 	} > int_flash
     
+    
     . = ALIGN(4);
     PROVIDE(__exidx_start = .);
     .ARM.exidx :

+ 12 - 17
Project_Settings/Linker_Files/linker_flash_s32k146.ldota → Project_Settings/Linker_Files/linker_flash_s32k146.ldfls

@@ -31,18 +31,13 @@
 
 MEMORY
 {         
-    int_flash_interrupts    : ORIGIN = 0x00014200, LENGTH = 0x00000400    /* 1K */    /* Do not change this section */
-   /* int_flash_config        : ORIGIN = 0x00000400, LENGTH = 0x00000010    /* 16bytes */ /* Do not change this section */
-     int_flash               : ORIGIN = 0x00014600, LENGTH = 0x000EBA00    /* ~1.0MB */ 
-/*	int_flash_interrupts    : ORIGIN = 0x00080200, LENGTH = 0x00000400	/**/
-/*	int_flash               : ORIGIN = 0x00080600, LENGTH = 0x0007FA00	/**/
-	
-	m_flexram				: ORIGIN = 0x14000000, LENGTH = 0x00001000	
+    int_flash_interrupts    : ORIGIN = 0x00000000, LENGTH = 0x00000400    /* 1K */    /* Do not change this section */
+    int_flash_config        : ORIGIN = 0x00000400, LENGTH = 0x00000010    /* 16bytes */ /* Do not change this section */
+    int_flash               : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0    /* ~1.0MB */ 
     int_sram_results        : ORIGIN = 0x1FFF0000, LENGTH = 0x00000100    /* 256bytes */
     int_sram                : ORIGIN = 0x1FFF0100, LENGTH = 0x0001DF00    /* ~120K */
-    int_sram_stack_c0       : ORIGIN = 0x2000E000, LENGTH = 0x00001000 - 0x10    /* 4K  */
-    ram_rsvd2               : ORIGIN = 0x2000EFF0, LENGTH = 0             /* End of SRAM */
-    ExchangeInfo            : ORIGIN = 0x2000EFF0, LENGTH = 0x10          
+    int_sram_stack_c0       : ORIGIN = 0x2000E000, LENGTH = 0x00001000    /* 4K  */
+    ram_rsvd2               : ORIGIN = 0x2000F000, LENGTH = 0             /* End of SRAM */
 }
 
 
@@ -56,19 +51,20 @@ SECTIONS
    {						
     	*(.eeprom)			
     } >m_flexram			
+    
 	.flash_interrupts :
 	{
-		. = ALIGN(512);
+		. = ALIGN(4096);
         __interrupts_rom_start = .;
         KEEP(*(.intc_vector))    
-        . = ALIGN(512);
+        . = ALIGN(4);
         __interrupts_rom_end = .;
 	} > int_flash_interrupts
 	
-/*	.flash_config :				*/
-/*	{							*/
-/*		KEEP(*(.flash_config))	*/
-/*	} > int_flash_config		*/
+	.flash_config :
+	{
+		KEEP(*(.flash_config))
+	} > int_flash_config
 	
 	.flash :
 	{
@@ -115,7 +111,6 @@ SECTIONS
 		__DATA_ROM = .;
 	} > int_flash
     
-    
     . = ALIGN(4);
     PROVIDE(__exidx_start = .);
     .ARM.exidx :

+ 2 - 2
code/app/AppGlobalVar.c

@@ -35,9 +35,9 @@ uint16 WebSitePort = 8812;
 #endif
 
 //*全局变量*//
-const uint32 AppSwVersion = 0x00010003;
+const uint32 AppSwVersion = 0x00020004;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
-const uint16 HwVersion = 0x0101;
+const uint16 HwVersion = 0x0102;
 const uint32 BlSwVersion = 0x00000001;
 const uint32 DrvSwVersion = 0x00000004;
 const uint8 BmsManuFacture = 0xff;

+ 25 - 6
code/app/AppTaskCan.c

@@ -46,6 +46,10 @@ void CanTask(void *pvParameters)
 				else
 				{
 					BcuDecodeFunction(CanRxMsg.id, CanRxMsg.data); // can协议解析
+					if(CanRxMsg.id==0x1C00EDEA)
+					{
+						UDSAnsFunc(CanRxMsg.data);
+					}
 				}
 			}
 			if (timerCANIdle > 20000)
@@ -412,9 +416,6 @@ void BcuDecodeFunction(uint32 ID, uint8 *rawData)
 		TMS_FaultLevel = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 6) & 0x3);
 		BcuRxFlag[27] = 0x01;
 		break;
-	case 0x1C00EDEA:
-		UDSAnsFunc(rawData);
-		break;
 	default:
 		break;
 	}
@@ -618,18 +619,18 @@ static void UDSAnsFunc(uint8 *rawData)
 		{
 			switch (UdsSubService)
 			{
-			case 0x01:
+			case 0x01://下线检测SN写入,自动存储
 			{
 				setbit(deviceSnRecvFlg, Data[3]);
 				if (Data[3] < 0x04)
 				{
 					memcpy(&AppConfigInfo.deviceSn[Data[3] * 4], &Data[4], 4);
-					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[3], 1);
+					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[4], 4);
 				}
 				else if (Data[3] == 0x04)
 				{
 					memcpy(&AppConfigInfo.deviceSn[Data[3] * 4], &Data[4], 1);
-					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[3], 1);
+					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[4], 4);
 				}
 				if (deviceSnRecvFlg == 0x1F)
 				{
@@ -639,6 +640,24 @@ static void UDSAnsFunc(uint8 *rawData)
 				}
 				break;
 			}
+			case 0x02://出厂检测联网测试
+			{
+				if(Data[4]==0x01)
+				{
+					AppConfigInfo.eolFlg = true;
+					AppConfigInfo.appSaveFlg = false;
+				}
+				else
+				{
+					AppConfigInfo.eolFlg = false;
+					AppConfigInfo.appSaveFlg = true;
+				}
+				UdsAns(true, UdsService, UdsSubService, 0x00, &Data[4], 1);
+				break;
+			}
+			default:
+				UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
+				break;
 			}
 		}
 		else

+ 2 - 2
code/app/AppTaskGps.c

@@ -134,8 +134,8 @@ void GpsDataDecode(uint8 *msg)
 			}
 			else
 			{
-				GpsInfoData.direction[0] = 0xff;
-				GpsInfoData.direction[1] = 0xff;
+				GpsInfoData.direction[0] = 0;
+				GpsInfoData.direction[1] = 0;
 			}
 			if (speedtemp >= 50 && speedtemp <= 1500)
 			{

+ 1 - 1
code/app/AppTaskMain.c

@@ -48,7 +48,7 @@ void MainTask(void *pvParameters)
 			HAL_EEP_Write(0, (uint8 *)&AppConfigInfo, sizeof(AppConfigInfo));
 			SystemSoftwareReset();
 		}
-//		MCUEnterSleep();
+		MCUEnterSleep();
 	}
 }
 static void vTimerCallback(TimerHandle_t pxTimer)

+ 0 - 4
code/app/AppTaskUart1.c

@@ -953,10 +953,6 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
 				returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4]);
 
 		BufferLen = strlen((const char *)rbuf);
-#ifdef SEGGER_RTT_PRINTF
-			SEGGER_RTT_printf("[%d]BufferLen=%d\r\n",__LINE__,BufferLen);
-			SEGGER_RTT_printf("[%d]rbuf=%s\r\n",__LINE__,rbuf);
-#endif
 		*SendLen = BufferLen + sizeof(DebugMsgInfo);
 		SendBuffer = pvPortMalloc(*SendLen);
 		memcpy(SendBuffer + sizeof(DebugMsgInfo) - 1, rbuf, BufferLen);

+ 1 - 1
code/app/USER_CONFIG.h

@@ -38,6 +38,6 @@
 
 #define UART0_BAUDRATE UART_BAUDRATE_9600
 #define UART1_BAUDRATE UART_BAUDRATE_115200
-#define UART2_BAUDRATE UART_BAUDRATE_9600
+#define UART2_BAUDRATE UART_BAUDRATE_115200
 
 

+ 0 - 6
code/hal/hal_adapter.c

@@ -316,12 +316,6 @@ Std_ReturnType UART_Send_Data(uint8 transChannel, const uint8 *txBuffer, uint32
 						UartRecvMsg.DataLen = UartHalMsgRecv.value;
 						UartRecvMsg.dataAddr = (uint32)(uartRingBuffer[UartHalMsgRecv.Channel].bw + uartRingBuffer[UartHalMsgRecv.Channel].source - UartHalMsgRecv.value);
 						ret_send = xQueueSend(UartRecvQueue[UartHalMsgRecv.Channel],&UartRecvMsg,10);
-#ifdef SEGGER_RTT_PRINTF1
-						if(UartHalMsgRecv.Channel==1)
-						{
-							SEGGER_RTT_printf("[%d]source=%X,dataAddr=%s\r\n",__LINE__,uartRingBuffer[UartHalMsgRecv.Channel].source,(uint8 *)UartRecvMsg.dataAddr);
-						}
-#endif
 					}
 					T_timeout[UartHalMsgRecv.Channel] = 0;
 					UartState[UartHalMsgRecv.Channel] = UartRecvComplete;