diff --git a/classes/flashlayout-stm32mp.bbclass b/classes/flashlayout-stm32mp.bbclass index 4bf4595..b866ce3 100644 --- a/classes/flashlayout-stm32mp.bbclass +++ b/classes/flashlayout-stm32mp.bbclass @@ -100,6 +100,8 @@ FLASHLAYOUT_DESTDIR = "${IMGDEPLOYDIR}/${FLASHLAYOUT_SUBDIR}" FLASHLAYOUT_BASENAME ??= "FlashLayout" FLASHLAYOUT_SUFFIX ??= "tsv" +# Configure flashlayout file generation for stm32wrapper4dbg +ENABLE_FLASHLAYOUT_CONFIG_WRAPPER4DBG ??= "0" FLASHLAYOUT_BOOTSCHEME_LABELS ??= "" FLASHLAYOUT_CONFIG_LABELS ??= "" @@ -408,4 +410,37 @@ python do_create_flashlayout_config() { (partition_enable, partition_id, partition_name, partition_type, partition_device, partition_offset, partition_bin2load)) except OSError: bb.fatal('Unable to open %s' % (fl_file)) + + if d.getVar("ENABLE_FLASHLAYOUT_CONFIG_WRAPPER4DBG") == "1": + bb.note('*** Loop for flashlayout for the wrapper for debug %s' % labeltype) + + tmp_flashlayout_file = os.path.join(flashlayout_subfolder_path, "flashlayout.tmp") + debug_flashlayout = False + + try: + with open(flashlayout_file, 'r') as fl_file: + try: + with open(tmp_flashlayout_file, 'w') as debug_fl_file: + for line in fl_file: + if re.match('^.*/tf-a.*$', line) : + line_tmp = re.sub(r'(.*)/',r'\1/debug/debug-', line) + filename = re.sub(r'.*[\t ](.*)$',r'\1', line_tmp).strip() + if os.path.isfile(os.path.join(d.getVar('DEPLOY_DIR_IMAGE'), filename)): + line = line_tmp + debug_flashlayout = True + + debug_fl_file.write('%s' % (line)) + except OSError: + bb.fatal('Unable to open %s' % (debug_fl_file)) + except OSError: + bb.fatal('Unable to open %s' % (fl_file)) + if debug_flashlayout: + flashlayout_wrapper4dbg_subfolder_path = os.path.join(d.getVar('FLASHLAYOUT_DESTDIR'), bootscheme, "debug") + bb.utils.mkdirhier(flashlayout_wrapper4dbg_subfolder_path) + # Wrapper4dbg output filename + debug_flashlayout_file = os.path.join(flashlayout_wrapper4dbg_subfolder_path,d.expand("debug-${FLASHLAYOUT_BASENAME}%s%s.${FLASHLAYOUT_SUFFIX}" % (config_append, labeltype_append))) + bb.note(">>> Update tf-a in %s" % (debug_flashlayout_file)) + os.rename(tmp_flashlayout_file, debug_flashlayout_file) + else: + os.remove(tmp_flashlayout_file) } diff --git a/conf/machine/include/st-machine-common-stm32mp.inc b/conf/machine/include/st-machine-common-stm32mp.inc index 563e7d9..1a31d64 100644 --- a/conf/machine/include/st-machine-common-stm32mp.inc +++ b/conf/machine/include/st-machine-common-stm32mp.inc @@ -184,6 +184,7 @@ IMAGE_SUMMARY_LIST_append = ":${STM32MP_USERFS_IMAGE}" EXTRA_IMAGEDEPENDS_append = " \ gdb-cross-arm \ openocd-stm32mp-native \ + stm32wrapper4dbg-native \ sdcard-raw-tools-native \ " @@ -192,6 +193,7 @@ ST_TOOLS_FOR_SDK = " \ nativesdk-gcc-arm-none-eabi \ nativesdk-binutils \ nativesdk-openocd-stm32mp \ + nativesdk-stm32wrapper4dbg \ nativesdk-sdcard-raw-tools \ nativesdk-ncurses-libncursesw \ " diff --git a/recipes-devtools/stm32wrapper4dbg/nativesdk-stm32wrapper4dbg_1.0.0.bb b/recipes-devtools/stm32wrapper4dbg/nativesdk-stm32wrapper4dbg_1.0.0.bb new file mode 100644 index 0000000..dc6e8ec --- /dev/null +++ b/recipes-devtools/stm32wrapper4dbg/nativesdk-stm32wrapper4dbg_1.0.0.bb @@ -0,0 +1,6 @@ +SUMMARY = "Wrapper for FSBL to debug TF-A U-Boot and bare metal on MP1" +LICENSE = "GPLv2+ | BSD-3-Clause" + +require stm32wrapper4dbg_${PV}.inc + +inherit nativesdk diff --git a/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg-native_1.0.0.bb b/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg-native_1.0.0.bb new file mode 100644 index 0000000..d5c87a0 --- /dev/null +++ b/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg-native_1.0.0.bb @@ -0,0 +1,6 @@ +SUMMARY = "Wrapper for FSBL to debug TF-A U-Boot and bare metal on MP1" +LICENSE = "GPLv2+ | BSD-3-Clause" + +require stm32wrapper4dbg_${PV}.inc + +inherit native diff --git a/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg_1.0.0.bb b/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg_1.0.0.bb new file mode 100644 index 0000000..1fa3fe0 --- /dev/null +++ b/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg_1.0.0.bb @@ -0,0 +1,4 @@ +SUMMARY = "Wrapper for FSBL to debug TF-A U-Boot and bare metal on MP1" +LICENSE = "GPLv2+ | BSD-3-Clause" + +require stm32wrapper4dbg_${PV}.inc diff --git a/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg_1.0.0.inc b/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg_1.0.0.inc new file mode 100644 index 0000000..433bf81 --- /dev/null +++ b/recipes-devtools/stm32wrapper4dbg/stm32wrapper4dbg_1.0.0.inc @@ -0,0 +1,14 @@ +SUMMARY = "Wrapper for FSBL to debug TF-A U-Boot and bare metal on STM32MP1" +LICENSE = "GPLv2+ | BSD-3-Clause" +LIC_FILES_CHKSUM = "file://COPYING;md5=7c996e24cb10a869efb08b521b20242f" + +SRC_URI = "git://github.com/STMicroelectronics/stm32wrapper4dbg;protocol=https;branch=master" +SRCREV = "4b3887fa31754825b63608b7c88ce4cab472f6fd" + +S = "${WORKDIR}/git" + +SECTION = "devel" + +do_install() { + install -D -m 0755 stm32wrapper4dbg -t ${D}${bindir} +}