M4PROJECTS-STM32MP1: update to V1.4.0

Signed-off-by: Anthony NOURRY <anthony.nourry@st.com>
Change-Id: Ib7401a0c52aa74eac1a364ed11c38459398bcd26
This commit is contained in:
Romuald JEANNE 2021-03-15 16:04:45 +01:00
parent 43ba51fc32
commit f42d27eef4
3 changed files with 54 additions and 42 deletions

View File

@ -1,14 +1,41 @@
import os import os
import re
import sys import sys
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from sys import argv as arg 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 # list of files to compile
# cflags # cflags
# ldflags # 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") print("start")
# arg1: path of the project # arg1: path of the project
@ -30,8 +57,6 @@ os.chdir(prj)
proj_tree = ET.parse(".project") proj_tree = ET.parse(".project")
cproj_tree = ET.parse(".cproject") cproj_tree = ET.parse(".cproject")
#os.chdir(myroot)
if os.path.exists(confdir)!=True: if os.path.exists(confdir)!=True:
os.mkdir(confdir) os.mkdir(confdir)
@ -40,29 +65,6 @@ if prj.find("(")!=-1:
sys.stderr.write("bad prj path: "+prj+"\n") sys.stderr.write("bad prj path: "+prj+"\n")
exit(1) 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 # get the source code file list
# #
@ -89,6 +91,14 @@ for i in root.iter('link'):
temp=a.text temp=a.text
if ((temp.find(".txt")==-1) & (temp.find(".gdb")==-1) & (temp.find(".launch")==-1) & (temp.find(".sh")==-1) & (temp.find("README")==-1)): 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-1-PROJECT_LOC/", "../")
temp=temp.replace("PARENT-2-PROJECT_LOC/", "../../") temp=temp.replace("PARENT-2-PROJECT_LOC/", "../../")
temp=temp.replace("PARENT-3-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-6-PROJECT_LOC/", "../../../../../../")
temp=temp.replace("PARENT-7-PROJECT_LOC/", "../../../../../../../") temp=temp.replace("PARENT-7-PROJECT_LOC/", "../../../../../../../")
temp=temp.replace("PROJECT_LOC/", "../") temp=temp.replace("PROJECT_LOC/", "../")
#print(temp) #print(temp)
temp=fullpath(temp) temp=fullpath(temp)
@ -117,47 +126,49 @@ for j in root.iter('configuration'):
if temp == buildconfig: if temp == buildconfig:
for i in j.iter('option'): for i in j.iter('option'):
a=i.get('superClass') 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'): for j in i.iter('listOptionValue'):
temp=j.get('value') temp=j.get('value')
if temp != "": if temp != "":
temp=temp.replace("\\","/") 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=temp.replace("../", "",1)
temp=fullpath(temp) temp=fullpath(temp)
#print(temp) #print(temp)
cflags=cflags+" -I"+temp+" \\\n" 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'): for j in i.iter('listOptionValue'):
temp=j.get('value') temp=j.get('value')
if temp != "": if temp != "":
#print(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') 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=temp.replace("../", "",1)
temp=fullpath(temp) temp=fullpath(temp)
#print(temp) #print(temp)
ldscript=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'): for j in i.iter('listOptionValue'):
temp=j.get('value') 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=temp.replace("../", "",1)
temp=fullpath(temp) temp=fullpath(temp)
ldlibs=ldlibs+" -L"+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'): for j in i.iter('listOptionValue'):
temp=j.get('value') temp=j.get('value')
ldlibs=ldlibs+" -l"+temp ldlibs=ldlibs+" -l"+temp
#workaround for STM327x6G_EVAL
#cflags=cflags+" -DUSE_IOEXPANDER"
print("cflags="+cflags) print("cflags="+cflags)
f.write("CFLAGS += "+cflags+"\n") f.write("CFLAGS += "+cflags+"\n")
f.write("\n") f.write("\n")

View File

@ -7,9 +7,9 @@ LICENSE = " \
LIC_FILES_CHKSUM = "file://License.md;md5=5272d12bc1c2e29908b787134d73dae9" LIC_FILES_CHKSUM = "file://License.md;md5=5272d12bc1c2e29908b787134d73dae9"
SRC_URI = "git://github.com/STMicroelectronics/STM32CubeMP1.git;protocol=https;branch=master" 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" S = "${WORKDIR}/git"
@ -42,6 +42,7 @@ PROJECTS_LIST_EV1 = " \
STM32MP157C-EV1/Applications/CoproSync/CoproSync_ShutDown \ STM32MP157C-EV1/Applications/CoproSync/CoproSync_ShutDown \
STM32MP157C-EV1/Demonstrations/AI_Character_Recognition \ STM32MP157C-EV1/Demonstrations/AI_Character_Recognition \
" "
PROJECTS_LIST_DK2 = " \ PROJECTS_LIST_DK2 = " \
STM32MP157C-DK2/Examples/ADC/ADC_SingleConversion_TriggerTimer_DMA \ STM32MP157C-DK2/Examples/ADC/ADC_SingleConversion_TriggerTimer_DMA \
STM32MP157C-DK2/Examples/Cortex/CORTEXM_MPU \ STM32MP157C-DK2/Examples/Cortex/CORTEXM_MPU \
@ -64,9 +65,9 @@ PROJECTS_LIST_DK2 = " \
STM32MP157C-DK2/Examples/WWDG/WWDG_Example \ STM32MP157C-DK2/Examples/WWDG/WWDG_Example \
STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_raw \ STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_raw \
STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo \ STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo \
STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo_wakeup \
STM32MP157C-DK2/Applications/FreeRTOS/FreeRTOS_ThreadCreation \ STM32MP157C-DK2/Applications/FreeRTOS/FreeRTOS_ThreadCreation \
STM32MP157C-DK2/Applications/CoproSync/CoproSync_ShutDown \ STM32MP157C-DK2/Applications/CoproSync/CoproSync_ShutDown \
STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo_wakeup \
STM32MP157C-DK2/Demonstrations/AI_Character_Recognition \ STM32MP157C-DK2/Demonstrations/AI_Character_Recognition \
" "

View File

@ -58,7 +58,7 @@ do_compile() {
BIN_NAME=$(basename ${project}) BIN_NAME=$(basename ${project})
PROJECT_DIR=${B}/${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 "BIN_NAME : ${BIN_NAME}"
bbnote "PROJECT_DIR : ${PROJECT_DIR}" bbnote "PROJECT_DIR : ${PROJECT_DIR}"