boards: arm: introduce NXP MR-CANHUBK3 board
NXP MR-CANHUBK3 is an evaluation board for mobile robotics applications. It features an NXP S32K344 MCU based on an Arm Cortex-M7 core (lock-step). By default, this board configuration uses Lauterbach TRACE32 West runner for flashing and debugging applications, but other debuggers can be used to download the program to flash. Co-authored-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com> Co-authored-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com> Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
This commit is contained in:
parent
b22f1162f3
commit
493f7b10d2
7
boards/arm/mr_canhubk3/Kconfig.board
Normal file
7
boards/arm/mr_canhubk3/Kconfig.board
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Copyright 2023 NXP
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config BOARD_MR_CANHUBK3
|
||||||
|
bool "mr_canhubk3"
|
||||||
|
depends on SOC_SERIES_S32K3_M7
|
||||||
|
select SOC_PART_NUMBER_S32K344
|
9
boards/arm/mr_canhubk3/Kconfig.defconfig
Normal file
9
boards/arm/mr_canhubk3/Kconfig.defconfig
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Copyright 2023 NXP
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
if BOARD_MR_CANHUBK3
|
||||||
|
|
||||||
|
config BOARD
|
||||||
|
default "mr_canhubk3"
|
||||||
|
|
||||||
|
endif # BOARD_MR_CANHUBK3
|
17
boards/arm/mr_canhubk3/board.cmake
Normal file
17
boards/arm/mr_canhubk3/board.cmake
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# Copyright 2023 NXP
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
board_runner_args(trace32
|
||||||
|
"--startup-args"
|
||||||
|
"elfFile=${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME}"
|
||||||
|
)
|
||||||
|
if(${CONFIG_XIP})
|
||||||
|
board_runner_args(trace32 "loadTo=flash")
|
||||||
|
else()
|
||||||
|
board_runner_args(trace32 "loadTo=sram")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
board_runner_args(jlink "--device=S32K344")
|
||||||
|
|
||||||
|
include(${ZEPHYR_BASE}/boards/common/trace32.board.cmake)
|
||||||
|
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
39
boards/arm/mr_canhubk3/mr_canhubk3.dts
Normal file
39
boards/arm/mr_canhubk3/mr_canhubk3.dts
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 NXP
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
#include <arm/nxp/nxp_s32k344_m7.dtsi>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "NXP MR-CANHUBK3";
|
||||||
|
compatible = "nxp,mr_canhubk3";
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
zephyr,sram = &sram0_1;
|
||||||
|
zephyr,flash = &flash0;
|
||||||
|
zephyr,itcm = &itcm;
|
||||||
|
zephyr,dtcm = &dtcm;
|
||||||
|
zephyr,code-partition = &code_partition;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
ivt_header: partition@0 {
|
||||||
|
label = "ivt-header";
|
||||||
|
reg = <0x00000000 0x100>;
|
||||||
|
};
|
||||||
|
|
||||||
|
code_partition: partition@100 {
|
||||||
|
label = "code-partition";
|
||||||
|
reg = <0x00000100 (DT_SIZE_K(4048) - 0x100)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
11
boards/arm/mr_canhubk3/mr_canhubk3.yaml
Normal file
11
boards/arm/mr_canhubk3/mr_canhubk3.yaml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Copyright 2023 NXP
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
identifier: mr_canhubk3
|
||||||
|
name: NXP MR-CANHUBK3
|
||||||
|
type: mcu
|
||||||
|
arch: arm
|
||||||
|
ram: 1024
|
||||||
|
flash: 1024
|
||||||
|
toolchain:
|
||||||
|
- zephyr
|
19
boards/arm/mr_canhubk3/mr_canhubk3_defconfig
Normal file
19
boards/arm/mr_canhubk3/mr_canhubk3_defconfig
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Copyright 2023 NXP
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
CONFIG_BOARD_MR_CANHUBK3=y
|
||||||
|
CONFIG_SOC_S32K344_M7=y
|
||||||
|
CONFIG_SOC_SERIES_S32K3_M7=y
|
||||||
|
CONFIG_BUILD_OUTPUT_HEX=y
|
||||||
|
|
||||||
|
# Use Systick as system clock
|
||||||
|
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=160000000
|
||||||
|
|
||||||
|
# Run from internal Flash
|
||||||
|
CONFIG_XIP=y
|
||||||
|
|
||||||
|
# Enable MPU
|
||||||
|
CONFIG_ARM_MPU=y
|
||||||
|
|
||||||
|
# Use no-cached memory for HAL
|
||||||
|
CONFIG_NOCACHE_MEMORY=y
|
13
boards/arm/mr_canhubk3/support/debug.cmm
Normal file
13
boards/arm/mr_canhubk3/support/debug.cmm
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
;*******************************************************************************
|
||||||
|
; Copyright 2023 NXP *
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 *
|
||||||
|
; *
|
||||||
|
; Lauterbach TRACE32 start-up script for debugging mr_canhubk3 *
|
||||||
|
; *
|
||||||
|
;*******************************************************************************
|
||||||
|
|
||||||
|
ENTRY %LINE &args
|
||||||
|
|
||||||
|
DO ~~~~/startup.cmm command=debug &args
|
||||||
|
|
||||||
|
ENDDO
|
13
boards/arm/mr_canhubk3/support/flash.cmm
Normal file
13
boards/arm/mr_canhubk3/support/flash.cmm
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
;*******************************************************************************
|
||||||
|
; Copyright 2023 NXP *
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 *
|
||||||
|
; *
|
||||||
|
; Lauterbach TRACE32 start-up script for flashing mr_canhubk3 *
|
||||||
|
; *
|
||||||
|
;*******************************************************************************
|
||||||
|
|
||||||
|
ENTRY %LINE &args
|
||||||
|
|
||||||
|
DO ~~~~/startup.cmm command=flash &args
|
||||||
|
|
||||||
|
ENDDO
|
128
boards/arm/mr_canhubk3/support/startup.cmm
Normal file
128
boards/arm/mr_canhubk3/support/startup.cmm
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
;*******************************************************************************
|
||||||
|
; Copyright 2023 NXP *
|
||||||
|
; *
|
||||||
|
; Lauterbach Trace32 start-up script for S32K344 / Cortex-M7 *
|
||||||
|
; *
|
||||||
|
; Parameters: *
|
||||||
|
; - command operation to execute *
|
||||||
|
; valid values: flash, debug *
|
||||||
|
; - elfFile filepath of ELF to load *
|
||||||
|
; - loadTo if "flash", the application will be downloaded to SoC *
|
||||||
|
; program flash by a flash programming routine; if "sram" it *
|
||||||
|
; will be downloaded to SoC SRAM. *
|
||||||
|
; valid values: flash, sram *
|
||||||
|
; default: flash *
|
||||||
|
; - eraseFlash if set to "yes", the whole content in Flash device will be *
|
||||||
|
; erased before the application is downloaded to either Flash *
|
||||||
|
; or SRAM. This routine takes time to execute *
|
||||||
|
; default: "no" *
|
||||||
|
; - verifyFlash if set to "yes", verify after program application to Flash *
|
||||||
|
; default: "no" *
|
||||||
|
;*******************************************************************************
|
||||||
|
|
||||||
|
ENTRY %LINE &args
|
||||||
|
|
||||||
|
&command=STRing.SCANAndExtract("&args","command=","")
|
||||||
|
&elfFile=STRing.SCANAndExtract("&args","elfFile=","")
|
||||||
|
&loadTo=STRing.SCANAndExtract("&args","loadTo=","flash")
|
||||||
|
&eraseFlash=STRing.SCANAndExtract("&args","eraseFlash=","no")
|
||||||
|
&verifyFlash=STRing.SCANAndExtract("&args","verifyFlash=","no")
|
||||||
|
|
||||||
|
IF ("&elfFile"=="")
|
||||||
|
(
|
||||||
|
PRINT %ERROR "Missing ELF file path"
|
||||||
|
PLIST
|
||||||
|
STOP
|
||||||
|
ENDDO
|
||||||
|
)
|
||||||
|
|
||||||
|
; Initialize debugger
|
||||||
|
RESet
|
||||||
|
SYStem.RESet
|
||||||
|
SYStem.CPU S32K344-M7
|
||||||
|
SYStem.CONFIG.DEBUGPORTTYPE JTAG
|
||||||
|
SYStem.Option.DUALPORT ON
|
||||||
|
SYStem.Option.DisMode THUMB
|
||||||
|
SYStem.MemAccess DAP
|
||||||
|
SYStem.JtagClock 10MHz
|
||||||
|
Trace.DISable
|
||||||
|
TrOnchip.Set MMERR OFF
|
||||||
|
TrOnchip.Set BUSERR OFF
|
||||||
|
SYStem.Up
|
||||||
|
|
||||||
|
; Init SRAM
|
||||||
|
DO ~~/demo/arm/hardware/s32k3/scripts/init_sram.cmm
|
||||||
|
|
||||||
|
; Only declares flash, does not execute flash programming
|
||||||
|
DO ~~/demo/arm/flash/s32k3.cmm PREPAREONLY
|
||||||
|
|
||||||
|
; The prepare cmm is protecting flash area for HSE firmware, but
|
||||||
|
; since HSE firmware usage feature is not enabled, this region can
|
||||||
|
; be used by application core, marked as programmable.
|
||||||
|
FLASH.CHANGEtype 0x007D4000--0x7F3FFF TARGET
|
||||||
|
|
||||||
|
IF ("&eraseFlash"=="yes")
|
||||||
|
(
|
||||||
|
FLASH.Erase ALL
|
||||||
|
)
|
||||||
|
|
||||||
|
IF ("&loadTo"=="flash")
|
||||||
|
(
|
||||||
|
; Switch target flash to reprogramming state, erase virtual flash programming memory,
|
||||||
|
; all target non-empty flash sectors are marked as pending, to be reprogrammed.
|
||||||
|
FLASH.ReProgram ALL /Erase
|
||||||
|
|
||||||
|
; Write contents of the file to virtual Flash programming memory
|
||||||
|
Data.LOAD.Elf &elfFile
|
||||||
|
|
||||||
|
; Program only changed sectors to target flash and erase obsolete code
|
||||||
|
FLASH.ReProgram off
|
||||||
|
|
||||||
|
IF ("&verifyFlash"=="yes")
|
||||||
|
(
|
||||||
|
Data.LOAD.Elf &elfFile /DIFF
|
||||||
|
|
||||||
|
IF FOUND()
|
||||||
|
(
|
||||||
|
AREA.view
|
||||||
|
PRINT %ERROR "ERROR ! Failed to download the code to flash"
|
||||||
|
Data.LOAD.Elf &elfFile /ComPare
|
||||||
|
ENDDO
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
; Reset the processor
|
||||||
|
SYStem.Up
|
||||||
|
)
|
||||||
|
ELSE
|
||||||
|
(
|
||||||
|
; Init ITCM
|
||||||
|
DO ~~/demo/arm/hardware/s32k3/scripts/init_itcm.cmm
|
||||||
|
|
||||||
|
Data.LOAD.Elf &elfFile
|
||||||
|
)
|
||||||
|
|
||||||
|
IF ("&command"=="flash")
|
||||||
|
(
|
||||||
|
; Execute the application and quit
|
||||||
|
Go
|
||||||
|
QUIT
|
||||||
|
)
|
||||||
|
ELSE IF ("&command"=="debug")
|
||||||
|
(
|
||||||
|
; Setup minimal debug environment
|
||||||
|
WinCLEAR
|
||||||
|
SETUP.Var.%SpotLight
|
||||||
|
WinPOS 0. 0. 120. 30.
|
||||||
|
List.auto
|
||||||
|
WinPOS 125. 0. 80. 10.
|
||||||
|
Frame.view
|
||||||
|
WinPOS 125. 18.
|
||||||
|
Register.view /SpotLight
|
||||||
|
)
|
||||||
|
ELSE
|
||||||
|
(
|
||||||
|
PRINT %ERROR "Invalid command"
|
||||||
|
)
|
||||||
|
|
||||||
|
ENDDO
|
Loading…
Reference in a new issue