M350b版本

This commit is contained in:
xin
2025-12-24 09:19:07 +08:00
parent 257708ae42
commit 7396728ea7
627 changed files with 42382 additions and 250967 deletions

View File

@ -75,6 +75,9 @@ T_DjiReturnCode Osal_TaskCreate(const char *name, void *(*taskFunc)(void *), uin
T_DjiReturnCode Osal_TaskDestroy(T_DjiTaskHandle task)
{
if (task == NULL) {
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
}
pthread_cancel(*(pthread_t *) task);
free(task);
@ -344,4 +347,4 @@ void Osal_Free(void *ptr)
free(ptr);
}
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/

View File

@ -142,7 +142,7 @@ T_DjiReturnCode Osal_UdpSendData(T_DjiSocketHandle socketHandle, const char *ipA
T_SocketHandleStruct *socketHandleStruct = (T_SocketHandleStruct *) socketHandle;
int32_t ret;
if (socketHandle <= 0 || ipAddr == NULL || port == 0 || buf == NULL || len == 0 || realLen == NULL) {
if (socketHandle == NULL || ipAddr == NULL || port == 0 || buf == NULL || len == 0 || realLen == NULL) {
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
}

View File

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
project(dji_sdk_demo_linux C)
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
@ -11,10 +12,11 @@ if (NOT USE_SYSTEM_ARCH)
add_definitions(-DSYSTEM_ARCH_LINUX)
endif ()
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
if (BUILD_TEST_CASES_ON MATCHES TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
endif ()
set(PACKAGE_NAME payloadsdk)

View File

@ -64,7 +64,7 @@ extern "C" {
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
#define CONFIG_MODULE_SAMPLE_HMS_ON
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
/*!< Attention: This function needs to be used together with mobile sdk mop sample.
* */

View File

@ -57,7 +57,7 @@
/* Private constants ---------------------------------------------------------*/
#define DJI_LOG_PATH "Logs/DJI"
#define DJI_LOG_INDEX_FILE_NAME "Logs/latest"
#define DJI_LOG_INDEX_FILE_NAME "Logs/index"
#define DJI_LOG_FOLDER_NAME "Logs"
#define DJI_LOG_PATH_MAX_SIZE (128)
#define DJI_LOG_FOLDER_NAME_MAX_SIZE (32)
@ -97,6 +97,7 @@ int main(int argc, char **argv)
T_DjiReturnCode returnCode;
T_DjiUserInfo userInfo;
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
T_DjiAircraftVersion aircraftInfoVersion;
T_DjiFirmwareVersion firmwareVersion = {
.majorVersion = 1,
.minorVersion = 0,
@ -137,6 +138,17 @@ int main(int argc, char **argv)
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
if (aircraftInfoBaseInfo.mountPositionType != DJI_MOUNT_POSITION_TYPE_PAYLOAD_PORT) {
returnCode = DjiAircraftInfo_GetAircraftVersion(&aircraftInfoVersion);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get aircraft version info error");
} else {
USER_LOG_INFO("Aircraft version is V%02d.%02d.%02d.%02d", aircraftInfoVersion.majorVersion,
aircraftInfoVersion.minorVersion, aircraftInfoVersion.modifyVersion,
aircraftInfoVersion.debugVersion);
}
}
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set alias error");
@ -193,6 +205,30 @@ int main(int argc, char **argv)
USER_LOG_ERROR("widget speaker test init error");
}
#ifdef CONFIG_MODULE_SAMPLE_UPGRADE_ON
T_DjiTestUpgradePlatformOpt linuxUpgradePlatformOpt = {
.rebootSystem = DjiUpgradePlatformLinux_RebootSystem,
.cleanUpgradeProgramFileStoreArea = DjiUpgradePlatformLinux_CleanUpgradeProgramFileStoreArea,
.createUpgradeProgramFile = DjiUpgradePlatformLinux_CreateUpgradeProgramFile,
.writeUpgradeProgramFile = DjiUpgradePlatformLinux_WriteUpgradeProgramFile,
.readUpgradeProgramFile = DjiUpgradePlatformLinux_ReadUpgradeProgramFile,
.closeUpgradeProgramFile = DjiUpgradePlatformLinux_CloseUpgradeProgramFile,
.replaceOldProgram = DjiUpgradePlatformLinux_ReplaceOldProgram,
.setUpgradeRebootState = DjiUpgradePlatformLinux_SetUpgradeRebootState,
.getUpgradeRebootState = DjiUpgradePlatformLinux_GetUpgradeRebootState,
.cleanUpgradeRebootState = DjiUpgradePlatformLinux_CleanUpgradeRebootState,
};
T_DjiTestUpgradeConfig testUpgradeConfig = {
.firmwareVersion = firmwareVersion,
.transferType = DJI_FIRMWARE_TRANSFER_TYPE_DCFTP,
.needReplaceProgramBeforeReboot = true
};
if (DjiTest_UpgradeStartService(&linuxUpgradePlatformOpt, testUpgradeConfig) !=
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("psdk upgrade init error");
}
#endif
#ifdef CONFIG_MODULE_SAMPLE_MOP_CHANNEL_ON
returnCode = DjiTest_MopChannelStartService();
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
@ -290,7 +326,7 @@ int main(int argc, char **argv)
.cleanUpgradeRebootState = DjiUpgradePlatformLinux_CleanUpgradeRebootState,
};
T_DjiTestUpgradeConfig testUpgradeConfig = {
.firmwareVersion = {1, 0, 0, 0},
.firmwareVersion = firmwareVersion,
.transferType = DJI_FIRMWARE_TRANSFER_TYPE_DCFTP,
.needReplaceProgramBeforeReboot = true
};
@ -301,8 +337,8 @@ int main(int argc, char **argv)
#endif
}
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
returnCode = DjiTest_HmsStartService();
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
returnCode = DjiTest_HmsCustomizationStartService();
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("hms test init error");
}
@ -663,6 +699,8 @@ static T_DjiReturnCode DjiUser_LocalWriteFsInit(const char *path)
}
}
sprintf(systemCmd, "ln -sfrv %s " DJI_LOG_FOLDER_NAME "/latest.log", filePath);
system(systemCmd);
return djiReturnCode;
}

View File

@ -88,7 +88,7 @@ T_DjiReturnCode HalUart_Init(E_DjiHalUartNum uartNum, uint32_t baudRate, T_DjiUa
sprintf(systemCmd, "chmod 777 %s", uartName);
fp = popen(systemCmd, "r");
if (fp == NULL) {
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
goto free_uart_handle;
}
#endif

View File

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
project(dji_sdk_demo_on_jetson C)
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
@ -11,10 +12,11 @@ if (NOT USE_SYSTEM_ARCH)
add_definitions(-DSYSTEM_ARCH_LINUX)
endif ()
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
if (BUILD_TEST_CASES_ON MATCHES TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
endif ()
set(PACKAGE_NAME payloadsdk)

View File

@ -62,7 +62,7 @@ extern "C" {
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
#define CONFIG_MODULE_SAMPLE_HMS_ON
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON

View File

@ -96,6 +96,7 @@ int main(int argc, char **argv)
T_DjiReturnCode returnCode;
T_DjiUserInfo userInfo;
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
T_DjiAircraftVersion aircraftInfoVersion;
T_DjiFirmwareVersion firmwareVersion = {
.majorVersion = 1,
.minorVersion = 0,
@ -136,6 +137,15 @@ int main(int argc, char **argv)
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
returnCode = DjiAircraftInfo_GetAircraftVersion(&aircraftInfoVersion);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get aircraft version info error");
} else {
USER_LOG_INFO("Aircraft version is V%02d.%02d.%02d.%02d", aircraftInfoVersion.majorVersion,
aircraftInfoVersion.minorVersion, aircraftInfoVersion.modifyVersion,
aircraftInfoVersion.debugVersion);
}
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set alias error");
@ -281,7 +291,7 @@ int main(int argc, char **argv)
.cleanUpgradeRebootState = DjiUpgradePlatformLinux_CleanUpgradeRebootState,
};
T_DjiTestUpgradeConfig testUpgradeConfig = {
.firmwareVersion = {1, 0, 0, 0},
.firmwareVersion = firmwareVersion,
.transferType = DJI_FIRMWARE_TRANSFER_TYPE_DCFTP,
.needReplaceProgramBeforeReboot = true
};
@ -291,8 +301,8 @@ int main(int argc, char **argv)
}
#endif
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
returnCode = DjiTest_HmsStartService();
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
returnCode = DjiTest_HmsCustomizationStartService();
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("hms test init error");
}

View File

@ -64,7 +64,7 @@
#define configTICK_RATE_HZ ((TickType_t)1000)
#define configMAX_PRIORITIES ( 7 )
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
#define configTOTAL_HEAP_SIZE ((size_t)75000)
#define configTOTAL_HEAP_SIZE ((size_t)90000)
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1

View File

@ -112,10 +112,10 @@ void DjiUser_StartTask(void const *argument)
.UartGetStatus = HalUart_GetStatus,
};
T_DjiFirmwareVersion firmwareVersion = {
.majorVersion = 1,
.minorVersion = 0,
.modifyVersion = 0,
.debugVersion = 0,
.majorVersion = USER_FIRMWARE_MAJOR_VERSION,
.minorVersion = USER_FIRMWARE_MINOR_VERSION,
.modifyVersion = USER_FIRMWARE_MODIFY_VERSION,
.debugVersion = USER_FIRMWARE_DEBUG_VERSION,
};
UART_Init(DJI_CONSOLE_UART_NUM, DJI_CONSOLE_UART_BAUD);
@ -226,14 +226,13 @@ void DjiUser_StartTask(void const *argument)
}
#endif
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
returnCode = DjiTest_HmsStartService();
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
returnCode = DjiTest_HmsCustomizationStartService();
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("hms test init error");
}
#endif
#if !USE_USB_HOST_UART
#ifdef CONFIG_MODULE_SAMPLE_CAMERA_ON
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK
&& aircraftInfoBaseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_NONE) {
@ -242,7 +241,6 @@ void DjiUser_StartTask(void const *argument)
returnCode = DjiTest_CameraEmuBaseStartService();
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("camera emu common init error");
goto out;
}
}
#endif
@ -319,7 +317,12 @@ void DjiUser_StartTask(void const *argument)
.cleanUpgradeRebootState = DjiUpgradePlatformStm32_CleanUpgradeRebootState,
};
T_DjiTestUpgradeConfig testUpgradeConfig = {
.firmwareVersion = {1, 0, 0, 0},
.firmwareVersion = {
USER_FIRMWARE_MAJOR_VERSION,
USER_FIRMWARE_MINOR_VERSION,
USER_FIRMWARE_MODIFY_VERSION,
USER_FIRMWARE_DEBUG_VERSION
},
.transferType = DJI_FIRMWARE_TRANSFER_TYPE_DCFTP,
.needReplaceProgramBeforeReboot = false
};
@ -327,7 +330,6 @@ void DjiUser_StartTask(void const *argument)
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
printf("psdk upgrade init error");
}
#endif
#endif
returnCode = DjiCore_ApplicationStart();

View File

@ -40,19 +40,19 @@ extern "C" {
#define CONFIG_MODULE_SAMPLE_WIDGET_SPEAKER_ON
#define CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON
// #define CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
// #define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
#define CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON
#define CONFIG_MODULE_SAMPLE_CAMERA_ON
// #define CONFIG_MODULE_SAMPLE_CAMERA_ON
#define CONFIG_MODULE_SAMPLE_XPORT_ON
// #define CONFIG_MODULE_SAMPLE_XPORT_ON
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
#define CONFIG_MODULE_SAMPLE_HMS_ON
// #define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
/*!< Attention: Please uncomment it in gps environment.
* */
@ -62,6 +62,11 @@ extern "C" {
//#endif
#define USER_FIRMWARE_MAJOR_VERSION (1)
#define USER_FIRMWARE_MINOR_VERSION (33)
#define USER_FIRMWARE_MODIFY_VERSION (88)
#define USER_FIRMWARE_DEBUG_VERSION (99)
/* Exported types ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/

View File

@ -27,6 +27,8 @@
#include "application.h"
#include "FreeRTOS.h"
#include "task.h"
#include "core_cm4.h"
#include "flash_if.h"
/* Private constants ---------------------------------------------------------*/
#define USER_START_TASK_STACK_SIZE 2048

View File

@ -29,7 +29,7 @@
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4; /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x800 ; /* required amount of heap */
_Min_Stack_Size = 0x800 ; /* required amount of stack */
@ -39,7 +39,7 @@ MEMORY
{
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
FLASH (rx) : ORIGIN = 0x8010000, LENGTH = 448K
}
/* Sections */

View File

@ -1,9 +1,13 @@
# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
# http://www.st.com/internet/evalboard/product/252419.jsp
source [find interface/jlink.cfg]
### use stlink-v2-1
source [find interface/stlink-v2-1.cfg]
transport select hla_swd
transport select swd
### use jlink
# source [find interface/jlink.cfg]
# transport select swd
# increase working area to 64KB
set WORKAREASIZE 0x10000

View File

@ -0,0 +1,14 @@
LR_IROM1 0x08010000 0x00070000 {
ER_IROM1 0x08010000 0x00070000 {
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
CCMRAM 0x10000000 0x00400000 {
.ANY (.ccmram)
}
RW_IRAM1 0x20000000 0x00020000 {
.ANY (+RW +ZI)
}
}

View File

@ -382,7 +382,7 @@
</VariousControls>
</Aads>
<LDads>
<umfTarg>1</umfTarg>
<umfTarg>0</umfTarg><ScatterFile>mdk_app.sct</ScatterFile>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
@ -405,6 +405,16 @@
<Files>
<File>
<FileType>1</FileType>
<FileName>cJSON.c</FileName>
<FilePath>..\..\..\..\..\module_sample\utils\cJSON.c</FilePath>
</File>
<File>
<FileType>1</FileType>
<FileName>dji_config_manager.c</FileName>
<FilePath>..\..\..\..\..\module_sample\utils\dji_config_manager.c</FilePath>
</File>
<File>
<FileType>1</FileType>
<FileName>file_binary_array_list_en.c</FileName>
<FilePath>..\..\..\..\..\module_sample\widget\file_binary_array_list_en.c</FilePath>
</File>
@ -530,6 +540,11 @@
</File>
<File>
<FileType>1</FileType>
<FileName>util_link_list.c</FileName>
<FilePath>..\..\..\..\..\module_sample\utils\util_link_list.c</FilePath>
</File>
<File>
<FileType>1</FileType>
<FileName>util_md5.c</FileName>
<FilePath>..\..\..\..\..\module_sample\utils\util_md5.c</FilePath>
</File>
@ -940,11 +955,21 @@
</File>
<File>
<FileType>5</FileType>
<FileName>dji_hms_customization.h</FileName>
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_customization.h</FilePath>
</File>
<File>
<FileType>5</FileType>
<FileName>dji_hms_info_table.h</FileName>
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_info_table.h</FilePath>
</File>
<File>
<FileType>5</FileType>
<FileName>dji_hms_manager.h</FileName>
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_manager.h</FilePath>
</File>
<File>
<FileType>5</FileType>
<FileName>dji_liveview.h</FileName>
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_liveview.h</FilePath>
</File>