From f42d27eef4c379bdbada675e00bc8d69efd14427 Mon Sep 17 00:00:00 2001 From: Romuald JEANNE Date: Mon, 15 Mar 2021 16:04:45 +0100 Subject: [PATCH] M4PROJECTS-STM32MP1: update to V1.4.0 Signed-off-by: Anthony NOURRY Change-Id: Ib7401a0c52aa74eac1a364ed11c38459398bcd26 --- .../m4projects/files/parse_project_config.py | 87 +++++++++++-------- .../m4projects/m4projects-stm32mp1.bb | 7 +- recipes-extended/m4projects/m4projects.inc | 2 +- 3 files changed, 54 insertions(+), 42 deletions(-) diff --git a/recipes-extended/m4projects/files/parse_project_config.py b/recipes-extended/m4projects/files/parse_project_config.py index 153213f..2cae405 100644 --- a/recipes-extended/m4projects/files/parse_project_config.py +++ b/recipes-extended/m4projects/files/parse_project_config.py @@ -1,14 +1,41 @@ import os +import re import sys import xml.etree.ElementTree as ET from sys import argv as arg # -# the goal is to parse SW4STM32 project configs files to get +# the goal is to parse project configs files to get # list of files to compile # cflags # ldflags +# +# convert path and checks that path is valid +# +def fullpath(filename): + # workaround: there is a mistake in some projects + p=filename.replace("STM32_USB_HOST_Library","STM32_USB_Host_Library") + # some path contain windows style + p=p.replace("\\","/") + # contains space at the end + p=p.replace(" ","") + # is enclosed in double quotes + p=filename.replace("\"","") + + # get absolute path + p=os.path.abspath(p); + + # check if path is valid + #print("check path: "+p) + if os.path.exists(p)!=True: + print("prj: "+prj) + print("original path: "+filename) + sys.stderr.write("error check path: "+p+" fails\n") + exit(1); + return p + + print("start") # arg1: path of the project @@ -30,8 +57,6 @@ os.chdir(prj) proj_tree = ET.parse(".project") cproj_tree = ET.parse(".cproject") -#os.chdir(myroot) - if os.path.exists(confdir)!=True: os.mkdir(confdir) @@ -40,29 +65,6 @@ if prj.find("(")!=-1: sys.stderr.write("bad prj path: "+prj+"\n") exit(1) -# -# convert path and checks that path is valid -# -def fullpath(filename): - # get absolute path - p=os.path.abspath(filename); - - # workaround: there is a mistake in some projects - p=p.replace("STM32_USB_HOST_Library","STM32_USB_Host_Library") - # some path contain windows style - p=p.replace("\\","/") - # containts space at the end - p=p.replace(" ","") - - # check if path is valid - #print("check path: "+p) - if os.path.exists(p)!=True: - print("prj: "+prj) - print("original path: "+filename) - sys.stderr.write("error check path: "+p+" fails\n") - exit(1); - return p - # # get the source code file list # @@ -89,6 +91,14 @@ for i in root.iter('link'): temp=a.text if ((temp.find(".txt")==-1) & (temp.find(".gdb")==-1) & (temp.find(".launch")==-1) & (temp.find(".sh")==-1) & (temp.find("README")==-1)): + + # Format locationURI value + if re.search(r'\$\%7BPARENT-.-PROJECT_LOC\%7D', temp): + temp = re.sub('\$\%7BPARENT-(.)-PROJECT_LOC\%7D', r'PARENT-\1-PROJECT_LOC', temp) + elif re.search(r'\$\%7BPROJECT_LOC\%7D', temp): + temp = re.sub('\$\%7BPROJECT_LOC\%7D', r'PROJECT_LOC', temp) + + temp=temp.replace("PARENT-0-PROJECT_LOC/", "./") temp=temp.replace("PARENT-1-PROJECT_LOC/", "../") temp=temp.replace("PARENT-2-PROJECT_LOC/", "../../") temp=temp.replace("PARENT-3-PROJECT_LOC/", "../../../") @@ -97,7 +107,6 @@ for i in root.iter('link'): temp=temp.replace("PARENT-6-PROJECT_LOC/", "../../../../../../") temp=temp.replace("PARENT-7-PROJECT_LOC/", "../../../../../../../") temp=temp.replace("PROJECT_LOC/", "../") - #print(temp) temp=fullpath(temp) @@ -117,47 +126,49 @@ for j in root.iter('configuration'): if temp == buildconfig: for i in j.iter('option'): a=i.get('superClass') - if a == 'gnu.c.compiler.option.include.paths': + if a == 'com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths': for j in i.iter('listOptionValue'): temp=j.get('value') if temp != "": temp=temp.replace("\\","/") - #workaround remove first occurency of "../" + # New workaround to override value when configured with ${workspace_loc:/${ProjName}/xxx} + temp = re.sub('\$\{[^:]*:/\$\{[^\}]*\}([^\}]*)\}', r'..\1', temp) + #workaround remove first occurence of "../" temp=temp.replace("../", "",1) temp=fullpath(temp) #print(temp) cflags=cflags+" -I"+temp+" \\\n" - if a == 'gnu.c.compiler.option.preprocessor.def.symbols': + if a == 'com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols': for j in i.iter('listOptionValue'): temp=j.get('value') if temp != "": #print(temp) - cflags=cflags+" -D"+temp+" \\\n" + cflags=cflags+" '-D"+temp+"' \\\n" - if a == 'fr.ac6.managedbuild.tool.gnu.cross.c.linker.script': + if a == 'com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script': temp=i.get('value') + # New workaround to override value when configured with ${workspace_loc:/${ProjName}/xxx} + temp = re.sub('\$\{[^:]*:/\$\{[^\}]*\}([^\}]*)\}', r'..\1', temp) temp=temp.replace("../", "",1) temp=fullpath(temp) #print(temp) ldscript=temp - if a == 'gnu.c.link.option.paths': + if a == 'com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.directories': for j in i.iter('listOptionValue'): temp=j.get('value') + # New workaround to override value when configured with ${workspace_loc:/${ProjName}/xxx} + temp = re.sub('\$\{[^:]*:/\$\{[^\}]*\}([^\}]*)\}', r'..\1', temp) temp=temp.replace("../", "",1) temp=fullpath(temp) ldlibs=ldlibs+" -L"+temp+"/" - if a == 'gnu.c.link.option.libs': + if a == 'com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.libraries': for j in i.iter('listOptionValue'): temp=j.get('value') ldlibs=ldlibs+" -l"+temp - -#workaround for STM327x6G_EVAL -#cflags=cflags+" -DUSE_IOEXPANDER" - print("cflags="+cflags) f.write("CFLAGS += "+cflags+"\n") f.write("\n") diff --git a/recipes-extended/m4projects/m4projects-stm32mp1.bb b/recipes-extended/m4projects/m4projects-stm32mp1.bb index fa5fff0..49f8fe7 100644 --- a/recipes-extended/m4projects/m4projects-stm32mp1.bb +++ b/recipes-extended/m4projects/m4projects-stm32mp1.bb @@ -7,9 +7,9 @@ LICENSE = " \ LIC_FILES_CHKSUM = "file://License.md;md5=5272d12bc1c2e29908b787134d73dae9" SRC_URI = "git://github.com/STMicroelectronics/STM32CubeMP1.git;protocol=https;branch=master" -SRCREV = "39fe4ecb2871a844720f6e039f7fa91be9294bdf" +SRCREV = "8206e534360c77f22f616243c3ccf9311af83f33" -PV = "1.3.0" +PV = "1.4.0" S = "${WORKDIR}/git" @@ -42,6 +42,7 @@ PROJECTS_LIST_EV1 = " \ STM32MP157C-EV1/Applications/CoproSync/CoproSync_ShutDown \ STM32MP157C-EV1/Demonstrations/AI_Character_Recognition \ " + PROJECTS_LIST_DK2 = " \ STM32MP157C-DK2/Examples/ADC/ADC_SingleConversion_TriggerTimer_DMA \ STM32MP157C-DK2/Examples/Cortex/CORTEXM_MPU \ @@ -64,9 +65,9 @@ PROJECTS_LIST_DK2 = " \ STM32MP157C-DK2/Examples/WWDG/WWDG_Example \ STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_raw \ STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo \ - STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo_wakeup \ STM32MP157C-DK2/Applications/FreeRTOS/FreeRTOS_ThreadCreation \ STM32MP157C-DK2/Applications/CoproSync/CoproSync_ShutDown \ + STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo_wakeup \ STM32MP157C-DK2/Demonstrations/AI_Character_Recognition \ " diff --git a/recipes-extended/m4projects/m4projects.inc b/recipes-extended/m4projects/m4projects.inc index a7bf270..e6d78a7 100644 --- a/recipes-extended/m4projects/m4projects.inc +++ b/recipes-extended/m4projects/m4projects.inc @@ -58,7 +58,7 @@ do_compile() { BIN_NAME=$(basename ${project}) PROJECT_DIR=${B}/${project} - PROJECT_APP="${S}/Projects/${project}/SW4STM32/${BIN_NAME}" + PROJECT_APP="${S}/Projects/${project}/STM32CubeIDE/CM4" bbnote "BIN_NAME : ${BIN_NAME}" bbnote "PROJECT_DIR : ${PROJECT_DIR}"