Explorar o código

LD文件修改,加入三轴数据读取

CHENJIE-PC\QiXiang_CHENJIE %!s(int64=2) %!d(string=hai) anos
pai
achega
378b19ef1b

+ 1 - 1
Project_Settings/Debugger/S32K146_4G_Debug_FLASH_PNE.launch

@@ -216,5 +216,5 @@
 </listAttribute>
 <stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;536806032&quot; label=&quot;RX_Buffer[UART_LPUART2]&quot;/&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;536823956&quot; label=&quot;GpsBufferGet&quot;/&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;255&quot; label=&quot;SocketId&quot;/&gt;&#13;&#10;&lt;/memoryBlockExpressionList&gt;&#13;&#10;"/>
 <stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
-<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="0x1fff4894,0x1fff04e8,0x1fff01c8,0x1fff2ce8,0x1fff0100,0x1fff08d0,0x1fff4b48,0x1fff4b50,0x1fff0103,1fff3798,0x1fff3798,0x1fffab2c,0x1fffa82c,0x1fff01f3,0x1fff050e"/>
+<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="0x1fff0100,0x1fff08d0,0x1fff4b48,0x1fff4b50,0x1fff0103,1fff3798,0x1fff3798,0x1fffab2c,0x1fffa82c,0x1fff01f3,0x1fff050e,0,0x14200,0x14000,0x0"/>
 </launchConfiguration>

+ 11 - 12
Project_Settings/Linker_Files/linker_flash_s32k146.ld

@@ -31,14 +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 = 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 */
 }
 
 
@@ -51,17 +50,17 @@ SECTIONS
     
 	.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 :
 	{

+ 12 - 11
Project_Settings/Linker_Files/linker_flash_s32k147.ld.bak → Project_Settings/Linker_Files/linker_flash_s32k146.ld.bak2

@@ -31,13 +31,14 @@
 
 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_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          
 }
 
 
@@ -50,17 +51,17 @@ SECTIONS
     
 	.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 :
 	{

+ 2 - 0
src/AppGlobalVar.c

@@ -102,6 +102,8 @@ uint16 ErrorArray[5] = {0};
 /*以下变量均为App_CAN相关变量*/
 #ifdef APP_CAN_ENABLE
 // VCU相关
+uint16 bmsHwVersion = 0;
+uint32 bmsSwVersion = 0;
 uint8 vehicleStatus = 0;
 uint8 bmsHVOn = 0;
 uint8 currentGearPosition = 0;

+ 4 - 2
src/AppGlobalVar.h

@@ -16,8 +16,8 @@
 #ifndef APPGLOBALVAR_H_
 #define APPGLOBALVAR_H_
 
-#define APP_UART0_ENABLE //平峰项目
-//#define APP_CAN_ENABLE //重卡项目
+//#define APP_UART0_ENABLE //平峰项目
+#define APP_CAN_ENABLE //重卡项目
 
 #include "hal_adapter.h"
 // test Var
@@ -112,6 +112,8 @@ extern uint16 ErrorArray[5];
 #endif
 /*以下变量均为App_CAN相关变量*/
 #ifdef APP_CAN_ENABLE
+extern uint16 bmsHwVersion;
+extern uint32 bmsSwVersion;
 extern uint8 vehicleStatus;
 extern uint8 bmsHVOn;
 extern uint8 currentGearPosition;

+ 3 - 0
src/AppTaskGps.c

@@ -14,6 +14,8 @@ void GpsTask(void *pvParameters)
 	GpsDataQueueHandle = xQueueCreate(1, sizeof(GPSInfo));//长度为1才可以允许覆写
 	Dio_WriteChannel(DioConf_DioChannel_PTD1_GPIO_OUT_MCU_GPS_POW_EN, STD_ON);//GPS开机
 	uint16 pReadLen = 0;
+	GsensorInit();
+	sint16 SL_SC7A20_Data_XYZ_Buf[3];
 	while(1)
 	{
 		vTaskDelay(pdMS_TO_TICKS(100));
@@ -22,6 +24,7 @@ void GpsTask(void *pvParameters)
 		if(pReadLen>0)
 		{
 			GpsDataDecode(RX_Buffer[UART_LPUART2]);
+			SL_SC7A20_Read_XYZ_Data(SL_SC7A20_Data_XYZ_Buf);
 		}
 	}
 }

+ 2 - 0
src/AppTaskUart1.c

@@ -1181,6 +1181,7 @@ static void TcpDataInfoRecvHandle(uint8 *DataRecv,uint16 DataRecvLen)
                 break;
             case TCP_CONCMD_SYM:
             {
+#ifdef APP_UART0_ENABLE
                 TcpCmdAnswer[0] = TCP_START_SYM1;
                 TcpCmdAnswer[1] = TCP_START_SYM1;
                 TcpCmdAnswer[2] = TCP_CONCMD_SYM;
@@ -1206,6 +1207,7 @@ static void TcpDataInfoRecvHandle(uint8 *DataRecv,uint16 DataRecvLen)
                         tcpipConnectionSend(SocketId, TcpCmdAnswer, 31);
                     }
                 }
+#endif
             }
             default:
             {

+ 1 - 0
src/hal_adapter.h

@@ -38,6 +38,7 @@
  #include "semphr.h"
  #include "Adc.h"
  #include "Eep.h"
+ #include "SL_Sc7a20_Driver.h"
 #ifndef min
 #define min(A,B) ((A) <= (B) ? (A) : (B))
 #endif

+ 6 - 5
src/main.c

@@ -139,7 +139,7 @@ int main(void)
 
 	Boot_CheckDownlaodAPPStatus();
 
-
+	Spi_Init(NULL_PTR);
 	    /* Initialize the Gpt driver */
 	Gpt_Init(&Gpt_Config_VS_0);
 
@@ -152,10 +152,11 @@ int main(void)
 	IP_LPUART1->CTRL |= LPUART_CTRL_ILT(1);
 	IP_LPUART2->CTRL |= LPUART_CTRL_ILT(1);
 
-	Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_ON);
-	Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_ON);
-	Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_ON);
-	Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_ON);
+	Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+	Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+	Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+	Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	Dio_WriteChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5, STD_OFF);
 
 	xTaskCreate(MainTask, (const char *const)"MainTask", 128, (void *)0, main_TASK_PRIORITY + 3, NULL);
 	xTaskCreate(Uart_4G_Task, (const char *const)"Uart_4G_Task", 2048, (void *)0, main_TASK_PRIORITY + 0, NULL);