Add Tropic teensy loader upload support

This commit is contained in:
Peter van der Perk
2024-11-06 17:28:35 -05:00
committed by Daniel Agar
parent 04b6412731
commit c6e86fdea0
5 changed files with 221 additions and 4 deletions
@@ -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