mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 09:26:25 +08:00
Add Tropic teensy loader upload support
This commit is contained in:
committed by
Daniel Agar
parent
04b6412731
commit
c6e86fdea0
@@ -297,6 +297,29 @@ else()
|
||||
|
||||
endif()
|
||||
|
||||
# create .hex if configured in NuttX
|
||||
if (CONFIG_INTELHEX_BINARY)
|
||||
|
||||
string(REPLACE ".elf" ".hex" hex_package ${PX4_BINARY_DIR}/${FW_NAME})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${hex_package}
|
||||
COMMAND
|
||||
${CMAKE_OBJCOPY} -O ihex
|
||||
${PX4_BINARY_DIR}/${PX4_CONFIG}.elf
|
||||
${hex_package}
|
||||
DEPENDS
|
||||
${PX4_BINARY_DIR}/${PX4_CONFIG}.bin
|
||||
airframes_xml
|
||||
parameters_xml
|
||||
COMMENT "Creating ${hex_package}"
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(px4_hex ALL DEPENDS ${hex_package})
|
||||
|
||||
endif()
|
||||
|
||||
# create .px4 with parameter and airframe metadata
|
||||
if (TARGET parameters_xml AND TARGET airframes_xml)
|
||||
|
||||
@@ -383,7 +406,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/gdbinit.in ${PX4_BINARY_DIR}/.g
|
||||
if(NOT NUTTX_DIR MATCHES "external")
|
||||
if(CONFIG_ARCH_CHIP_MIMXRT1062DVL6A)
|
||||
set(DEBUG_DEVICE "MIMXRT1062XXX6A")
|
||||
set(DEBUG_SVD_FILE "MIMXRT1052.svd")
|
||||
set(DEBUG_SVD_FILE "MIMXRT1062.xml")
|
||||
elseif(CONFIG_ARCH_CHIP_MIMXRT1176DVMAA)
|
||||
set(DEBUG_DEVICE "MIMXRT1176DVMAA")
|
||||
set(DEBUG_SVD_FILE "MIMXRT1176_cm7.xml")
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
set(vendorstr_underscore)
|
||||
set(productstr_underscore)
|
||||
string(REPLACE " " "_" vendorstr_underscore ${CONFIG_CDCACM_VENDORSTR})
|
||||
string(REPLACE "," "_" vendorstr_underscore "${vendorstr_underscore}")
|
||||
string(REPLACE " " "_" productstr_underscore ${CONFIG_CDCACM_PRODUCTSTR})
|
||||
|
||||
set(serial_ports)
|
||||
|
||||
@@ -35,7 +35,9 @@ px4_add_library(arch_board_reset
|
||||
board_reset.cpp
|
||||
)
|
||||
|
||||
if (CONFIG_ARCH_FAMILY_IMXRT117x)
|
||||
target_link_libraries(arch_board_reset PRIVATE arch_board_romapi)
|
||||
endif()
|
||||
|
||||
# up_systemreset
|
||||
if (NOT DEFINED CONFIG_BUILD_FLAT)
|
||||
|
||||
@@ -42,11 +42,12 @@
|
||||
#include <errno.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arm_internal.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_FAMILY_IMXRT117x
|
||||
#include <hardware/rt117x/imxrt117x_snvs.h>
|
||||
|
||||
|
||||
#include <px4_arch/imxrt_flexspi_nor_flash.h>
|
||||
#include <px4_arch/imxrt_romapi.h>
|
||||
#endif
|
||||
|
||||
#define BOOT_RTC_SIGNATURE 0xb007b007
|
||||
#define PX4_IMXRT_RTC_REBOOT_REG 3
|
||||
@@ -58,9 +59,13 @@
|
||||
|
||||
static int board_reset_enter_bootloader()
|
||||
{
|
||||
#ifdef CONFIG_ARCH_FAMILY_IMXRT117x
|
||||
uint32_t regvalue = BOOT_RTC_SIGNATURE;
|
||||
modifyreg32(IMXRT_SNVS_LPCR, 0, SNVS_LPCR_GPR_Z_DIS);
|
||||
putreg32(regvalue, PX4_IMXRT_RTC_REBOOT_REG_ADDRESS);
|
||||
#elif defined(BOARD_HAS_TEENSY_BOOTLOADER)
|
||||
asm("BKPT #251"); /* Enter Teensy MKL02 bootloader */
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -68,13 +73,18 @@ int board_reset(int status)
|
||||
{
|
||||
if (status == REBOOT_TO_BOOTLOADER) {
|
||||
board_reset_enter_bootloader();
|
||||
}
|
||||
|
||||
} else if (status == REBOOT_TO_ISP) {
|
||||
#if defined(BOARD_HAS_ISP_BOOTLOADER)
|
||||
|
||||
else if (status == REBOOT_TO_ISP) {
|
||||
uint32_t arg = 0xeb100000;
|
||||
ROM_API_Init();
|
||||
ROM_RunBootloader(&arg);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOARD_HAS_ON_RESET)
|
||||
board_on_reset(status);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user