mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
add flash_openocd_adi() for use with max32
add feather max32666 to the hil pool
This commit is contained in:
parent
76eb2f5066
commit
e345380723
@ -480,6 +480,25 @@ function(family_flash_openocd_wch TARGET)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Add flash openocd adi (Analog Devices) target
|
||||
# included with msdk or compiled from release branch of https://github.com/analogdevicesinc/openocd
|
||||
function(family_flash_openocd_adi TARGET)
|
||||
if (DEFINED $ENV{MAXIM_PATH})
|
||||
# use openocd from msdk
|
||||
set(OPENOCD ENV{MAXIM_PATH}/Tools/OpenOCD/openocd)
|
||||
set(OPENOCD_OPTION2 "-s ENV{MAXIM_PATH}/Tools/OpenOCD/scripts")
|
||||
else()
|
||||
# compiled from source
|
||||
if (NOT DEFINED OPENOCD_ADI_PATH)
|
||||
set(OPENOCD_ADI_PATH $ENV{HOME}/app/openocd_adi)
|
||||
endif ()
|
||||
set(OPENOCD ${OPENOCD_ADI_PATH}/src/openocd)
|
||||
set(OPENOCD_OPTION2 "-s ${OPENOCD_ADI_PATH}/tcl")
|
||||
endif ()
|
||||
|
||||
family_flash_openocd(${TARGET})
|
||||
endfunction()
|
||||
|
||||
# Add flash with https://github.com/ch32-rs/wlink
|
||||
function(family_flash_wlink_rs TARGET)
|
||||
if (NOT DEFINED WLINK_RS)
|
||||
|
@ -14,6 +14,7 @@ set(LD_FILE_Clang ${LD_FILE_GNU})
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
set(JLINK_DEVICE max32650)
|
||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/max32650.cfg")
|
||||
|
||||
set(FAMILY_MCUS MAX32650 CACHE INTERNAL "")
|
||||
|
||||
@ -150,6 +151,7 @@ function(family_configure_example TARGET RTOS)
|
||||
|
||||
# Add the optional MSDK OpenOCD flashing
|
||||
family_flash_msdk(${TARGET})
|
||||
family_flash_openocd_adi(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_flash_msdk TARGET)
|
||||
|
@ -15,6 +15,7 @@ set(LD_FILE_Clang ${LD_FILE_GNU})
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
set(JLINK_DEVICE max32666)
|
||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/max32665.cfg")
|
||||
|
||||
set(FAMILY_MCUS MAX32666 CACHE INTERNAL "")
|
||||
|
||||
@ -142,18 +143,5 @@ function(family_configure_example TARGET RTOS)
|
||||
|
||||
# Flashing
|
||||
family_flash_jlink(${TARGET})
|
||||
family_flash_msdk(${TARGET})
|
||||
endfunction()
|
||||
|
||||
# Add flash msdk target
|
||||
function(family_flash_msdk TARGET)
|
||||
set(MAXIM_PATH "$ENV{MAXIM_PATH}")
|
||||
|
||||
add_custom_target(${TARGET}-msdk
|
||||
DEPENDS ${TARGET}
|
||||
COMMAND ${MAXIM_PATH}/Tools/OpenOCD/openocd -s ${MAXIM_PATH}/Tools/OpenOCD/scripts
|
||||
-f interface/cmsis-dap.cfg -f target/max32665.cfg
|
||||
-c "program $<TARGET_FILE:${TARGET}> verify; init; reset; exit"
|
||||
VERBATIM
|
||||
)
|
||||
family_flash_openocd_adi(${TARGET})
|
||||
endfunction()
|
||||
|
@ -173,10 +173,20 @@ echo "Ready for Remote Connections"
|
||||
with open(f_wch, 'w') as file:
|
||||
file.write(cfg_content)
|
||||
|
||||
ret = run_cmd(f'openocd_wch -c "adapter serial {board["flasher_sn"]}" -f {f_wch} -c "program {firmware}.elf reset exit"')
|
||||
ret = run_cmd(f'openocd_wch -c "adapter serial {board["flasher_sn"]}" -f {f_wch} '
|
||||
f'-c "program {firmware}.elf reset exit"')
|
||||
return ret
|
||||
|
||||
|
||||
def flash_openocd_adi(board, firmware):
|
||||
openocd_adi_script_path = f'{os.getenv("HOME")}/app/openocd_adi/tcl'
|
||||
if not os.path.exists(openocd_adi_script_path):
|
||||
openocd_adi_script_path = '/home/pi/openocd_adi/tcl'
|
||||
|
||||
ret = run_cmd(f'openocd_adi -c "adapter serial {board["flasher_sn"]}" -s {openocd_adi_script_path} '
|
||||
f'{board["flasher_args"]} -c "program {firmware}.elf reset exit"')
|
||||
return ret
|
||||
|
||||
def flash_wlink_rs(board, firmware):
|
||||
# wlink use index for probe selection and lacking usb serial support
|
||||
ret = run_cmd(f'wlink flash {firmware}.elf')
|
||||
|
@ -14,6 +14,13 @@
|
||||
"flasher_sn": "E6614C311B597D32",
|
||||
"flasher_args": "-f interface/cmsis-dap.cfg -f target/atsame5x.cfg -c \"adapter speed 5000\""
|
||||
},
|
||||
{
|
||||
"name": "max32666fthr",
|
||||
"uid": "0C81464124010B20FF0A08CC2C",
|
||||
"flasher": "openocd_adi",
|
||||
"flasher_sn": "040917023bffc88100000000000000000000000097969906",
|
||||
"flasher_args": "-f interface/cmsis-dap.cfg -f target/max32665.cfg"
|
||||
},
|
||||
{
|
||||
"name": "lpcxpresso11u37",
|
||||
"uid": "17121919",
|
||||
|
Loading…
x
Reference in New Issue
Block a user