Skip to content

Commit 72832c7

Browse files
author
Jamie Smith
authored
Add upload method support for MIMXRT1050 EVK (#84)
1 parent 0840a29 commit 72832c7

File tree

13 files changed

+206
-11
lines changed

13 files changed

+206
-11
lines changed

hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ if(NOT "DEVICE_RTC=1" IN_LIST MBED_TARGET_DEFINITIONS)
55
set(TEST_SKIPPED "RTC is not supported for this target")
66
endif()
77

8+
if(MBED_TARGET STREQUAL "MIMXRT1050_EVK")
9+
# This test causes this target to die. See https://github.com/mbed-ce/mbed-os/issues/83
10+
set(TEST_SKIPPED "Temporarily disabled for this target, see #83")
11+
endif()
12+
813
mbed_greentea_add_test(
914
TEST_NAME
1015
mbed-hal-rtc-reset

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/TARGET_EVK/flash_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,8 @@ int32_t flash_free(flash_t *obj)
604604
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
605605
{
606606
uint32_t sectorsize = MBED_FLASH_INVALID_SIZE;
607-
uint32_t devicesize = BOARD_FLASH_SIZE;
608-
uint32_t startaddr = BOARD_FLASH_START_ADDR;
607+
uint32_t devicesize = BOARD_FLASHIAP_SIZE;
608+
uint32_t startaddr = BOARD_FLASHIAP_START_ADDR;
609609

610610
if ((address >= startaddr) && (address < (startaddr + devicesize))) {
611611
sectorsize = BOARD_FLASH_SECTOR_SIZE;

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/device/cmsis_nvic.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ extern uint32_t __VECTOR_RAM[];
4242
#define NVIC_NUM_VECTORS (16 + 160) // CORE + MCU Peripherals
4343
#define NVIC_RAM_VECTOR_ADDRESS (__VECTOR_RAM) // Vectors positioned at start of RAM
4444

45+
#define MBED_RAM_SIZE 0x01E00000 // from linker script
46+
4547
#endif
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Mbed OS upload method configuration file for target MIMXRT1050_EVK.
2+
# To change any of these parameters from their default values, set them in your build script between where you
3+
# include app.cmake and where you add mbed os as a subdirectory.
4+
5+
# General config parameters
6+
# -------------------------------------------------------------
7+
set(UPLOAD_METHOD_DEFAULT MBED)
8+
9+
# Config options for MBED
10+
# -------------------------------------------------------------
11+
set(MBED_UPLOAD_ENABLED TRUE)
12+
set(MBED_RESET_BAUDRATE 115200)
13+
14+
# Config options for PYOCD
15+
# -------------------------------------------------------------
16+
set(PYOCD_UPLOAD_ENABLED TRUE)
17+
set(PYOCD_TARGET_NAME mimxrt1050_hyperflash) # Note: change to "mimxrt1050_quadspi" if onboard QSPI flash is used
18+
set(PYOCD_CLOCK_SPEED 4000k)
19+
20+
# Config options for REDLINK
21+
# -------------------------------------------------------------
22+
set(REDLINK_UPLOAD_ENABLED TRUE)
23+
set(REDLINK_PART_NUMBER MIMXRT1052xxxxB)
24+
set(REDLINK_PART_XML_DIR ${CMAKE_CURRENT_LIST_DIR}/redlink_cfgs)
25+
set(REDLINK_CLOCK_SPEED 4000)
26+
set(REDLINK_CONNECT_ARGS
27+
--connectscript=RT1050_connect.scp
28+
--reset=
29+
--coreindex 0
30+
--cache disable
31+
--no-packed)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<directory>
2+
<chips chipVendor='NXP' >
3+
<chip name='MIMXRT1052xxxxB' xml_file='MIMXRT1052xxxxB_part.xml' />
4+
</chips>
5+
</directory>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Mbed OS: Modified this file to replace MIMXRT1050_SFDP_HYPERFLASH.cfx with MIMXRT1050-EVK_S26KS512S.cfx -->
3+
<infoList vendor="NXP">&#x0A;<info chip="MIMXRT1052xxxxB" name="MIMXRT1052xxxxB">&#x0A;<chip>&#x0A;<name>MIMXRT1052xxxxB</name>&#x0A;<family>MIMXRT1050</family>&#x0A;<vendor>NXP</vendor>&#x0A;<memory can_program="true" id="Flash" is_ro="true" size="0" type="Flash"/>&#x0A;<memory id="RAM" size="512" type="RAM"/>&#x0A;<memoryInstance derived_from="Flash" driver="MIMXRT1050-EVK_S26KS512S.cfx" id="BOARD_FLASH" location="0x60000000" size="0x4000000"/>&#x0A;<memoryInstance derived_from="RAM" id="SRAM_DTC" location="0x20000000" size="0x20000"/>&#x0A;<memoryInstance derived_from="RAM" id="SRAM_ITC" location="0x0" size="0x20000"/>&#x0A;<memoryInstance derived_from="RAM" id="SRAM_OC" location="0x20200000" size="0x40000"/>&#x0A;<memoryInstance derived_from="RAM" id="BOARD_SDRAM" location="0x80000000" size="0x1e00000"/>&#x0A;<memoryInstance derived_from="RAM" id="NCACHE_REGION" location="0x81e00000" size="0x200000"/>&#x0A;</chip>&#x0A;<processor>&#x0A;<name gcc_name="cortex-m7">Cortex-M7</name>&#x0A;<family>Cortex-M</family>&#x0A;</processor>&#x0A;</info>&#x0A;</infoList>

tools/cmake/UploadMethodManager.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ message(STATUS "Board upload method set to ${UPLOAD_METHOD}")
3131

3232
if(UPLOAD_SUPPORTS_DEBUG)
3333
# create init file for GDB client
34+
if(UPLOAD_WANTS_EXTENDED_REMOTE)
35+
set(UPLOAD_GDB_REMOTE_KEYWORD "extended-remote")
36+
else()
37+
set(UPLOAD_GDB_REMOTE_KEYWORD "remote")
38+
endif()
39+
3440
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/mbed-cmake.gdbinit CONTENT
3541
"# connect to GDB server
36-
target remote localhost:${GDB_PORT}
42+
target ${UPLOAD_GDB_REMOTE_KEYWORD} localhost:${GDB_PORT}
3743
")
3844
endif()
3945

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) 2022 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# ----------------------------------------------
5+
# CMake finder for Redlink, the NXP MCUXpresso debug tool
6+
#
7+
# This module defines:
8+
# Redlink_FOUND - Whether the reqested tools were found.
9+
# crt_emu_cm_redlink_PATH - full path to the Redlink command line tool (crt_emu_cm_redlink).
10+
# REDLINK_FLASH_LOADER_PATH - path to the directory where flash loaders are (contains MIMXRT1050_SFDP_HYPERFLASH.cfx)
11+
12+
# first try to locate MCUXpresso IDE in its default location
13+
set(MCUXPRESSO_IDE_LINUX_HINTS "")
14+
set(MCUXPRESSO_IDE_WINDOWS_HINTS "")
15+
if(EXISTS "C:/nxp/")
16+
# On Windows, MCUXpresso by default is installed into a subdirectory of
17+
# C:/nxp
18+
file(GLOB MCUXPRESSO_IDE_WINDOWS_HINTS LIST_DIRECTORIES TRUE "C:/nxp/MCUXpressoIDE_*/ide")
19+
endif()
20+
21+
find_path(MCUXPRESSO_IDE_PATH
22+
NAMES mcuxpressoide.ini
23+
DOC "Path to MCUXPresso IDE. This directory should contain mcuxpressoide.ini. Used to find Redlink"
24+
PATHS
25+
${MCUXPRESSO_IDE_WINDOWS_HINTS} # Windows
26+
/usr/local/mcuxpressoide/ide # Linux
27+
/Applications/MCUXpressoIDE.app/Contents/Eclipse # OS X
28+
)
29+
30+
set(Redlink_HINTS "")
31+
if(EXISTS "${MCUXPRESSO_IDE_PATH}")
32+
message(STATUS "Located MCUXpresso IDE: ${MCUXPRESSO_IDE_PATH}")
33+
34+
# find install dirs inside IDE, which also have version numbers
35+
file(GLOB REDLINK_INSTALL_DIRS LIST_DIRECTORIES TRUE "${MCUXPRESSO_IDE_PATH}/plugins/com.nxp.mcuxpresso.tools.bin.*/binaries")
36+
list(GET REDLINK_INSTALL_DIRS 0 REDLINK_INSTALL_DIR) # If glob returns multiple just pick one
37+
if(EXISTS "${REDLINK_INSTALL_DIR}")
38+
list(APPEND Redlink_HINTS ${REDLINK_INSTALL_DIR})
39+
endif()
40+
elseif()
41+
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.")
42+
endif()
43+
44+
find_program(crt_emu_cm_redlink_PATH
45+
NAMES crt_emu_cm_redlink
46+
DOC "Path to the Redlink crt_emu_cm_redlink executable."
47+
HINTS ${Redlink_HINTS})
48+
49+
find_path(REDLINK_FLASH_LOADER_PATH
50+
NAMES MIMXRT1050_SFDP_HYPERFLASH.cfx
51+
DOC "Path to the directory where the Redlink flash loaders are (contains MIMXRT1050_SFDP_HYPERFLASH.cfx)."
52+
HINTS ${Redlink_HINTS}
53+
PATH_SUFFIXES Flash)
54+
55+
find_package_handle_standard_args(Redlink REQUIRED_VARS crt_emu_cm_redlink_PATH REDLINK_FLASH_LOADER_PATH)
56+
57+

tools/cmake/upload_methods/UploadMethodJLINK.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set(UPLOAD_JLINK_FOUND ${JLINK_FOUND})
1515

1616
# default to JTAG
1717
if(NOT DEFINED JLINK_UPLOAD_INTERFACE)
18-
set(JLINK_UPLOAD_INTERFACE JTAG)
18+
set(JLINK_UPLOAD_INTERFACE JTAG CACHE INTERNAL "" FORCE)
1919
endif()
2020

2121
### Function to generate upload target

tools/cmake/upload_methods/UploadMethodOPENOCD.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set(UPLOAD_OPENOCD_FOUND ${OpenOCD_FOUND})
1717
set(OPENOCD_ADAPTER_SERIAL "" CACHE STRING "Serial number of the debug adapter to select for OpenOCD. Set to empty to detect any matching adapter.")
1818

1919
### Function to generate upload target
20-
set(OPENOCD_ADAPTER_SERIAL_COMMAND "")
20+
set(OPENOCD_ADAPTER_SERIAL_COMMAND "" CACHE INTERNAL "" FORCE)
2121
if(NOT "${OPENOCD_ADAPTER_SERIAL}" STREQUAL "")
2222

2323
# Generate script file that tells OpenOCD how to find the correct debug adapter.
@@ -36,7 +36,7 @@ if { [adapter name] == \"hla\" } {
3636
adapter serial $adapter_serial
3737
}")
3838

39-
set(OPENOCD_ADAPTER_SERIAL_COMMAND -f ${CMAKE_BINARY_DIR}/openocd_adapter_config.cfg)
39+
set(OPENOCD_ADAPTER_SERIAL_COMMAND -f ${CMAKE_BINARY_DIR}/openocd_adapter_config.cfg CACHE INTERNAL "" FORCE)
4040
endif()
4141

4242
function(gen_upload_target TARGET_NAME BIN_FILE)
@@ -63,3 +63,6 @@ add_custom_target(gdbserver
6363
-c "gdb_port ${GDB_PORT}"
6464
USES_TERMINAL
6565
VERBATIM)
66+
67+
# request extended-remote GDB sessions
68+
set(UPLOAD_WANTS_EXTENDED_REMOTE TRUE)

0 commit comments

Comments
 (0)