mirror of https://github.com/ARMmbed/mbed-os.git
Add upload method support for MIMXRT1050 EVK (#84)
parent
0840a295eb
commit
72832c7bba
|
@ -5,6 +5,11 @@ if(NOT "DEVICE_RTC=1" IN_LIST MBED_TARGET_DEFINITIONS)
|
|||
set(TEST_SKIPPED "RTC is not supported for this target")
|
||||
endif()
|
||||
|
||||
if(MBED_TARGET STREQUAL "MIMXRT1050_EVK")
|
||||
# This test causes this target to die. See https://github.com/mbed-ce/mbed-os/issues/83
|
||||
set(TEST_SKIPPED "Temporarily disabled for this target, see #83")
|
||||
endif()
|
||||
|
||||
mbed_greentea_add_test(
|
||||
TEST_NAME
|
||||
mbed-hal-rtc-reset
|
||||
|
|
|
@ -604,8 +604,8 @@ int32_t flash_free(flash_t *obj)
|
|||
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
|
||||
{
|
||||
uint32_t sectorsize = MBED_FLASH_INVALID_SIZE;
|
||||
uint32_t devicesize = BOARD_FLASH_SIZE;
|
||||
uint32_t startaddr = BOARD_FLASH_START_ADDR;
|
||||
uint32_t devicesize = BOARD_FLASHIAP_SIZE;
|
||||
uint32_t startaddr = BOARD_FLASHIAP_START_ADDR;
|
||||
|
||||
if ((address >= startaddr) && (address < (startaddr + devicesize))) {
|
||||
sectorsize = BOARD_FLASH_SECTOR_SIZE;
|
||||
|
|
|
@ -42,4 +42,6 @@ extern uint32_t __VECTOR_RAM[];
|
|||
#define NVIC_NUM_VECTORS (16 + 160) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (__VECTOR_RAM) // Vectors positioned at start of RAM
|
||||
|
||||
#define MBED_RAM_SIZE 0x01E00000 // from linker script
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# Mbed OS upload method configuration file for target MIMXRT1050_EVK.
|
||||
# To change any of these parameters from their default values, set them in your build script between where you
|
||||
# include app.cmake and where you add mbed os as a subdirectory.
|
||||
|
||||
# General config parameters
|
||||
# -------------------------------------------------------------
|
||||
set(UPLOAD_METHOD_DEFAULT MBED)
|
||||
|
||||
# Config options for MBED
|
||||
# -------------------------------------------------------------
|
||||
set(MBED_UPLOAD_ENABLED TRUE)
|
||||
set(MBED_RESET_BAUDRATE 115200)
|
||||
|
||||
# Config options for PYOCD
|
||||
# -------------------------------------------------------------
|
||||
set(PYOCD_UPLOAD_ENABLED TRUE)
|
||||
set(PYOCD_TARGET_NAME mimxrt1050_hyperflash) # Note: change to "mimxrt1050_quadspi" if onboard QSPI flash is used
|
||||
set(PYOCD_CLOCK_SPEED 4000k)
|
||||
|
||||
# Config options for REDLINK
|
||||
# -------------------------------------------------------------
|
||||
set(REDLINK_UPLOAD_ENABLED TRUE)
|
||||
set(REDLINK_PART_NUMBER MIMXRT1052xxxxB)
|
||||
set(REDLINK_PART_XML_DIR ${CMAKE_CURRENT_LIST_DIR}/redlink_cfgs)
|
||||
set(REDLINK_CLOCK_SPEED 4000)
|
||||
set(REDLINK_CONNECT_ARGS
|
||||
--connectscript=RT1050_connect.scp
|
||||
--reset=
|
||||
--coreindex 0
|
||||
--cache disable
|
||||
--no-packed)
|
|
@ -0,0 +1,5 @@
|
|||
<directory>
|
||||
<chips chipVendor='NXP' >
|
||||
<chip name='MIMXRT1052xxxxB' xml_file='MIMXRT1052xxxxB_part.xml' />
|
||||
</chips>
|
||||
</directory>
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Mbed OS: Modified this file to replace MIMXRT1050_SFDP_HYPERFLASH.cfx with MIMXRT1050-EVK_S26KS512S.cfx -->
|
||||
<infoList vendor="NXP">
<info chip="MIMXRT1052xxxxB" name="MIMXRT1052xxxxB">
<chip>
<name>MIMXRT1052xxxxB</name>
<family>MIMXRT1050</family>
<vendor>NXP</vendor>
<memory can_program="true" id="Flash" is_ro="true" size="0" type="Flash"/>
<memory id="RAM" size="512" type="RAM"/>
<memoryInstance derived_from="Flash" driver="MIMXRT1050-EVK_S26KS512S.cfx" id="BOARD_FLASH" location="0x60000000" size="0x4000000"/>
<memoryInstance derived_from="RAM" id="SRAM_DTC" location="0x20000000" size="0x20000"/>
<memoryInstance derived_from="RAM" id="SRAM_ITC" location="0x0" size="0x20000"/>
<memoryInstance derived_from="RAM" id="SRAM_OC" location="0x20200000" size="0x40000"/>
<memoryInstance derived_from="RAM" id="BOARD_SDRAM" location="0x80000000" size="0x1e00000"/>
<memoryInstance derived_from="RAM" id="NCACHE_REGION" location="0x81e00000" size="0x200000"/>
</chip>
<processor>
<name gcc_name="cortex-m7">Cortex-M7</name>
<family>Cortex-M</family>
</processor>
</info>
</infoList>
|
|
@ -31,9 +31,15 @@ message(STATUS "Board upload method set to ${UPLOAD_METHOD}")
|
|||
|
||||
if(UPLOAD_SUPPORTS_DEBUG)
|
||||
# create init file for GDB client
|
||||
if(UPLOAD_WANTS_EXTENDED_REMOTE)
|
||||
set(UPLOAD_GDB_REMOTE_KEYWORD "extended-remote")
|
||||
else()
|
||||
set(UPLOAD_GDB_REMOTE_KEYWORD "remote")
|
||||
endif()
|
||||
|
||||
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/mbed-cmake.gdbinit CONTENT
|
||||
"# connect to GDB server
|
||||
target remote localhost:${GDB_PORT}
|
||||
target ${UPLOAD_GDB_REMOTE_KEYWORD} localhost:${GDB_PORT}
|
||||
")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# Copyright (c) 2022 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# ----------------------------------------------
|
||||
# CMake finder for Redlink, the NXP MCUXpresso debug tool
|
||||
#
|
||||
# This module defines:
|
||||
# Redlink_FOUND - Whether the reqested tools were found.
|
||||
# crt_emu_cm_redlink_PATH - full path to the Redlink command line tool (crt_emu_cm_redlink).
|
||||
# REDLINK_FLASH_LOADER_PATH - path to the directory where flash loaders are (contains MIMXRT1050_SFDP_HYPERFLASH.cfx)
|
||||
|
||||
# first try to locate MCUXpresso IDE in its default location
|
||||
set(MCUXPRESSO_IDE_LINUX_HINTS "")
|
||||
set(MCUXPRESSO_IDE_WINDOWS_HINTS "")
|
||||
if(EXISTS "C:/nxp/")
|
||||
# On Windows, MCUXpresso by default is installed into a subdirectory of
|
||||
# C:/nxp
|
||||
file(GLOB MCUXPRESSO_IDE_WINDOWS_HINTS LIST_DIRECTORIES TRUE "C:/nxp/MCUXpressoIDE_*/ide")
|
||||
endif()
|
||||
|
||||
find_path(MCUXPRESSO_IDE_PATH
|
||||
NAMES mcuxpressoide.ini
|
||||
DOC "Path to MCUXPresso IDE. This directory should contain mcuxpressoide.ini. Used to find Redlink"
|
||||
PATHS
|
||||
${MCUXPRESSO_IDE_WINDOWS_HINTS} # Windows
|
||||
/usr/local/mcuxpressoide/ide # Linux
|
||||
/Applications/MCUXpressoIDE.app/Contents/Eclipse # OS X
|
||||
)
|
||||
|
||||
set(Redlink_HINTS "")
|
||||
if(EXISTS "${MCUXPRESSO_IDE_PATH}")
|
||||
message(STATUS "Located MCUXpresso IDE: ${MCUXPRESSO_IDE_PATH}")
|
||||
|
||||
# find install dirs inside IDE, which also have version numbers
|
||||
file(GLOB REDLINK_INSTALL_DIRS LIST_DIRECTORIES TRUE "${MCUXPRESSO_IDE_PATH}/plugins/com.nxp.mcuxpresso.tools.bin.*/binaries")
|
||||
list(GET REDLINK_INSTALL_DIRS 0 REDLINK_INSTALL_DIR) # If glob returns multiple just pick one
|
||||
if(EXISTS "${REDLINK_INSTALL_DIR}")
|
||||
list(APPEND Redlink_HINTS ${REDLINK_INSTALL_DIR})
|
||||
endif()
|
||||
elseif()
|
||||
message(WARNING "Failed to find MCUXpresso IDE, will still look for Redlink (crt_emu_cm_redlink) on your PATH. Recommend setting MCUXPRESSO_IDE_PATH to the location of MCUXpresso IDE.")
|
||||
endif()
|
||||
|
||||
find_program(crt_emu_cm_redlink_PATH
|
||||
NAMES crt_emu_cm_redlink
|
||||
DOC "Path to the Redlink crt_emu_cm_redlink executable."
|
||||
HINTS ${Redlink_HINTS})
|
||||
|
||||
find_path(REDLINK_FLASH_LOADER_PATH
|
||||
NAMES MIMXRT1050_SFDP_HYPERFLASH.cfx
|
||||
DOC "Path to the directory where the Redlink flash loaders are (contains MIMXRT1050_SFDP_HYPERFLASH.cfx)."
|
||||
HINTS ${Redlink_HINTS}
|
||||
PATH_SUFFIXES Flash)
|
||||
|
||||
find_package_handle_standard_args(Redlink REQUIRED_VARS crt_emu_cm_redlink_PATH REDLINK_FLASH_LOADER_PATH)
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ set(UPLOAD_JLINK_FOUND ${JLINK_FOUND})
|
|||
|
||||
# default to JTAG
|
||||
if(NOT DEFINED JLINK_UPLOAD_INTERFACE)
|
||||
set(JLINK_UPLOAD_INTERFACE JTAG)
|
||||
set(JLINK_UPLOAD_INTERFACE JTAG CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
### Function to generate upload target
|
||||
|
|
|
@ -17,7 +17,7 @@ set(UPLOAD_OPENOCD_FOUND ${OpenOCD_FOUND})
|
|||
set(OPENOCD_ADAPTER_SERIAL "" CACHE STRING "Serial number of the debug adapter to select for OpenOCD. Set to empty to detect any matching adapter.")
|
||||
|
||||
### Function to generate upload target
|
||||
set(OPENOCD_ADAPTER_SERIAL_COMMAND "")
|
||||
set(OPENOCD_ADAPTER_SERIAL_COMMAND "" CACHE INTERNAL "" FORCE)
|
||||
if(NOT "${OPENOCD_ADAPTER_SERIAL}" STREQUAL "")
|
||||
|
||||
# Generate script file that tells OpenOCD how to find the correct debug adapter.
|
||||
|
@ -36,7 +36,7 @@ if { [adapter name] == \"hla\" } {
|
|||
adapter serial $adapter_serial
|
||||
}")
|
||||
|
||||
set(OPENOCD_ADAPTER_SERIAL_COMMAND -f ${CMAKE_BINARY_DIR}/openocd_adapter_config.cfg)
|
||||
set(OPENOCD_ADAPTER_SERIAL_COMMAND -f ${CMAKE_BINARY_DIR}/openocd_adapter_config.cfg CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
function(gen_upload_target TARGET_NAME BIN_FILE)
|
||||
|
@ -63,3 +63,6 @@ add_custom_target(gdbserver
|
|||
-c "gdb_port ${GDB_PORT}"
|
||||
USES_TERMINAL
|
||||
VERBATIM)
|
||||
|
||||
# request extended-remote GDB sessions
|
||||
set(UPLOAD_WANTS_EXTENDED_REMOTE TRUE)
|
||||
|
|
|
@ -21,7 +21,7 @@ set(PYOCD_PROBE_UID "" CACHE STRING "Probe UID to pass to pyOCD commands. You ca
|
|||
### Function to generate upload target
|
||||
set(PYOCD_PROBE_ARGS "")
|
||||
if(NOT "${PYOCD_PROBE_UID}" STREQUAL "")
|
||||
set(PYOCD_PROBE_ARGS --probe ${PYOCD_PROBE_UID})
|
||||
set(PYOCD_PROBE_ARGS --probe ${PYOCD_PROBE_UID} CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
function(gen_upload_target TARGET_NAME BIN_FILE)
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
# Copyright (c) 2022 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
### Redlink Upload Method
|
||||
# This method needs the following parameters:
|
||||
# REDLINK_PART_NUMBER - Part number (-p) argument to pass to the upload tool
|
||||
# REDLINK_PART_XML_DIR - Directory where the XML files for this MCU can be found.
|
||||
# REDLINK_CLOCK_SPEED - JTAG/SWD clock speed to talk to the target at.
|
||||
# REDLINK_CONNECT_ARGS - Extra connect arguments to pass to Redlink tool. These can be gotten by watching the command that MCUXpresso IDE executes when you start a debug session.
|
||||
# This method creates the following options:
|
||||
# REDLINK_PROBE_SN - Serial number of the debug probe to connect to. If blank, will connect to any probe.
|
||||
|
||||
### Handle options
|
||||
set(REDLINK_PROBE_SN "" CACHE STRING "Serial number of the debug probe to connect to for Redlink. Set to empty to detect any matching adapter.")
|
||||
|
||||
if("${REDLINK_PROBE_SN}" STREQUAL "")
|
||||
# This argument causes Redlink to connect to the first available debug probe
|
||||
set(REDLINK_PROBE_ARGS --probehandle 1 CACHE INTERNAL "" FORCE)
|
||||
else()
|
||||
set(REDLINK_PROBE_ARGS --probeserial ${REDLINK_PROBE_SN} CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
if("${REDLINK_PART_NUMBER}" STREQUAL "")
|
||||
message(FATAL_ERROR "You must set REDLINK_PART_NUMBER in your CMake scripts to use REDLINK")
|
||||
endif()
|
||||
|
||||
if("${REDLINK_PART_XML_DIR}" STREQUAL "")
|
||||
message(FATAL_ERROR "You must set REDLINK_PART_XML_DIR in your CMake scripts to use REDLINK")
|
||||
endif()
|
||||
|
||||
if("${REDLINK_CLOCK_SPEED}" STREQUAL "")
|
||||
message(FATAL_ERROR "You must set REDLINK_CLOCK_SPEED in your CMake scripts to use REDLINK")
|
||||
endif()
|
||||
|
||||
### Check if upload method can be enabled on this machine
|
||||
find_package(Redlink)
|
||||
set(UPLOAD_REDLINK_FOUND ${Redlink_FOUND})
|
||||
|
||||
### Function to generate upload target
|
||||
|
||||
function(gen_upload_target TARGET_NAME BIN_FILE HEX_FILE)
|
||||
|
||||
add_custom_target(flash-${TARGET_NAME}
|
||||
COMMENT "Flashing ${TARGET_NAME} with Redlink..."
|
||||
COMMAND ${crt_emu_cm_redlink_PATH}
|
||||
-p ${REDLINK_PART_NUMBER}
|
||||
--flash-hashing
|
||||
-x ${REDLINK_PART_XML_DIR}
|
||||
--flash-dir ${REDLINK_FLASH_LOADER_PATH}
|
||||
-g
|
||||
-s ${REDLINK_CLOCK_SPEED}
|
||||
${REDLINK_CONNECT_ARGS}
|
||||
${REDLINK_PROBE_ARGS}
|
||||
--flash-load-exec $<TARGET_FILE:${TARGET_NAME}>)
|
||||
|
||||
add_dependencies(flash-${TARGET_NAME} ${TARGET_NAME})
|
||||
|
||||
endfunction(gen_upload_target)
|
||||
|
||||
### Function to generate debug target
|
||||
add_custom_target(gdbserver
|
||||
COMMENT "Starting Redlink GDB server"
|
||||
COMMAND
|
||||
${crt_emu_cm_redlink_PATH}
|
||||
-p ${REDLINK_PART_NUMBER}
|
||||
--flash-hashing
|
||||
-x ${REDLINK_PART_XML_DIR}
|
||||
--flash-dir ${REDLINK_FLASH_LOADER_PATH}
|
||||
-g
|
||||
-s ${REDLINK_CLOCK_SPEED}
|
||||
-2
|
||||
${REDLINK_CONNECT_ARGS}
|
||||
${REDLINK_PROBE_ARGS}
|
||||
--server :${GDB_PORT}
|
||||
--vc
|
||||
--connect-reset system
|
||||
--kill-server # Because redlink seems to not handle Ctrl-C, we use this to close it when GDB exits
|
||||
USES_TERMINAL
|
||||
VERBATIM)
|
||||
|
||||
|
||||
# request extended-remote GDB sessions
|
||||
set(UPLOAD_WANTS_EXTENDED_REMOTE TRUE)
|
|
@ -22,12 +22,12 @@ endif()
|
|||
|
||||
### Function to generate upload target
|
||||
|
||||
set(STM32CUBE_UPLOAD_PROBE_ARGS "")
|
||||
set(STM32CUBE_GDB_PROBE_ARGS "")
|
||||
set(STM32CUBE_UPLOAD_PROBE_ARGS "" CACHE INTERNAL "" FORCE)
|
||||
set(STM32CUBE_GDB_PROBE_ARGS "" CACHE INTERNAL "" FORCE)
|
||||
|
||||
if(NOT "${STM32CUBE_PROBE_SN}" STREQUAL "")
|
||||
set(STM32CUBE_UPLOAD_PROBE_ARGS sn=${STM32CUBE_PROBE_SN})
|
||||
set(STM32CUBE_GDB_PROBE_ARGS --serial-number ${STM32CUBE_PROBE_SN})
|
||||
set(STM32CUBE_UPLOAD_PROBE_ARGS sn=${STM32CUBE_PROBE_SN} CACHE INTERNAL "" FORCE)
|
||||
set(STM32CUBE_GDB_PROBE_ARGS --serial-number ${STM32CUBE_PROBE_SN} CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
function(gen_upload_target TARGET_NAME BIN_FILE HEX_FILE)
|
||||
|
|
Loading…
Reference in New Issue