M4PROJECTS-STM32MP1: rework recipe and manage compliance with python3
Align also gcc option to STM32CubeIDE ones Change-Id: I415f79bd655e354faebff16b628537fc281e2ac4 Signed-off-by: Romuald JEANNE <romuald.jeanne@st.com>
This commit is contained in:
parent
a0b7db0c1e
commit
8391f7b748
|
|
@ -378,6 +378,10 @@ CUBE_M4_EXAMPLES_DT ?= ""
|
|||
# This name is cherry picked from list defined in m4projects-stm32mp1.bb
|
||||
DEFAULT_COPRO_FIRMWARE = "OpenAMP_TTY_echo"
|
||||
|
||||
# Define M4 example installation dir
|
||||
M4_INSTALLDIR = "${STM32MP_USERFS_MOUNTPOINT}"
|
||||
M4_PACKAGE_4USERFS = "${@bb.utils.contains('ST_USERFS','1','1','0',d)}"
|
||||
|
||||
# =========================================================================
|
||||
# GCNANO userland configuration
|
||||
# =========================================================================
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ TESTBIN := $(BUILD_OUT)/$(PROJ_NAME).bin
|
|||
# CFLAGS rules
|
||||
CFLAGS += $(COMMONFLAGS)
|
||||
CFLAGS += -Os
|
||||
#CFLAGS += -Og
|
||||
CFLAGS += -std=gnu11
|
||||
CFLAGS += -fstack-usage
|
||||
CFLAGS += -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP
|
||||
#CFLAGS += -Wno-unused-function
|
||||
#CFLAGS += -Wno-unused-variable
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ from sys import argv as arg
|
|||
# cflags
|
||||
# ldflags
|
||||
|
||||
|
||||
print "start"
|
||||
print("start")
|
||||
|
||||
# arg1: path of the project
|
||||
prj=arg[1]
|
||||
|
|
@ -21,10 +20,10 @@ myroot=arg[3]
|
|||
|
||||
confdir=myroot+"/out/"+buildconfig+"/conf"
|
||||
|
||||
print "prj: "+prj
|
||||
print "myroot: "+myroot
|
||||
print "confdir: "+confdir
|
||||
print "buildconfig: "+buildconfig
|
||||
print("prj: "+prj)
|
||||
print("myroot: "+myroot)
|
||||
print("confdir: "+confdir)
|
||||
print("buildconfig: "+buildconfig)
|
||||
|
||||
os.chdir(prj)
|
||||
|
||||
|
|
@ -34,42 +33,40 @@ cproj_tree = ET.parse(".cproject")
|
|||
#os.chdir(myroot)
|
||||
|
||||
if os.path.exists(confdir)!=True:
|
||||
os.mkdir(confdir)
|
||||
os.mkdir(confdir)
|
||||
|
||||
if prj.find("(")!=-1:
|
||||
print "bad prj path"
|
||||
sys.stderr.write("bad prj path: "+prj+"\n")
|
||||
exit(1)
|
||||
print("bad prj path")
|
||||
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);
|
||||
# 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
|
||||
# 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
|
||||
#
|
||||
print "file list"
|
||||
print("file list")
|
||||
|
||||
f=open(confdir+"/config.in", 'w')
|
||||
|
||||
|
|
@ -77,39 +74,37 @@ root = proj_tree.getroot()
|
|||
|
||||
f.write("CSRC += \\\n")
|
||||
|
||||
|
||||
for i in root.iter('link'):
|
||||
a=i.find('locationURI')
|
||||
if a==None:
|
||||
a=i.find('location')
|
||||
if a==None:
|
||||
print "could not find any file"
|
||||
exit(1)
|
||||
a=i.find('locationURI')
|
||||
if a==None:
|
||||
a=i.find('location')
|
||||
if a==None:
|
||||
print("could not find any file")
|
||||
exit(1)
|
||||
|
||||
if a.text is None:
|
||||
print "no text"
|
||||
else:
|
||||
#print "text:"+a.text
|
||||
temp=a.text
|
||||
if a.text is None:
|
||||
print("no text")
|
||||
else:
|
||||
#print("text:"+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)):
|
||||
temp=temp.replace("PARENT-1-PROJECT_LOC/", "../")
|
||||
temp=temp.replace("PARENT-2-PROJECT_LOC/", "../../")
|
||||
temp=temp.replace("PARENT-3-PROJECT_LOC/", "../../../")
|
||||
temp=temp.replace("PARENT-4-PROJECT_LOC/", "../../../../")
|
||||
temp=temp.replace("PARENT-5-PROJECT_LOC/", "../../../../../")
|
||||
temp=temp.replace("PARENT-6-PROJECT_LOC/", "../../../../../../")
|
||||
temp=temp.replace("PARENT-7-PROJECT_LOC/", "../../../../../../../")
|
||||
temp=temp.replace("PROJECT_LOC/", "../")
|
||||
if ((temp.find(".txt")==-1) & (temp.find(".gdb")==-1) & (temp.find(".launch")==-1) & (temp.find(".sh")==-1) & (temp.find("README")==-1)):
|
||||
temp=temp.replace("PARENT-1-PROJECT_LOC/", "../")
|
||||
temp=temp.replace("PARENT-2-PROJECT_LOC/", "../../")
|
||||
temp=temp.replace("PARENT-3-PROJECT_LOC/", "../../../")
|
||||
temp=temp.replace("PARENT-4-PROJECT_LOC/", "../../../../")
|
||||
temp=temp.replace("PARENT-5-PROJECT_LOC/", "../../../../../")
|
||||
temp=temp.replace("PARENT-6-PROJECT_LOC/", "../../../../../../")
|
||||
temp=temp.replace("PARENT-7-PROJECT_LOC/", "../../../../../../../")
|
||||
temp=temp.replace("PROJECT_LOC/", "../")
|
||||
|
||||
#print temp
|
||||
temp=fullpath(temp)
|
||||
#print(temp)
|
||||
temp=fullpath(temp)
|
||||
|
||||
f.write(temp+" \\\n")
|
||||
f.write(temp+" \\\n")
|
||||
|
||||
f.write("\n")
|
||||
|
||||
|
||||
cflags=""
|
||||
ldlibs=""
|
||||
ldscript=""
|
||||
|
|
@ -118,56 +113,56 @@ root = cproj_tree.getroot()
|
|||
|
||||
count=0
|
||||
for j in root.iter('configuration'):
|
||||
temp=j.get('name')
|
||||
if temp == buildconfig:
|
||||
for i in j.iter('option'):
|
||||
a=i.get('superClass')
|
||||
if a == 'gnu.c.compiler.option.include.paths':
|
||||
for j in i.iter('listOptionValue'):
|
||||
temp=j.get('value')
|
||||
if temp != "":
|
||||
temp=temp.replace("\\","/")
|
||||
#workaround remove first occurency of "../"
|
||||
temp=temp.replace("../", "",1)
|
||||
temp=fullpath(temp)
|
||||
#print temp
|
||||
cflags=cflags+" -I"+temp+" \\\n"
|
||||
temp=j.get('name')
|
||||
if temp == buildconfig:
|
||||
for i in j.iter('option'):
|
||||
a=i.get('superClass')
|
||||
if a == 'gnu.c.compiler.option.include.paths':
|
||||
for j in i.iter('listOptionValue'):
|
||||
temp=j.get('value')
|
||||
if temp != "":
|
||||
temp=temp.replace("\\","/")
|
||||
#workaround remove first occurency of "../"
|
||||
temp=temp.replace("../", "",1)
|
||||
temp=fullpath(temp)
|
||||
#print(temp)
|
||||
cflags=cflags+" -I"+temp+" \\\n"
|
||||
|
||||
if a == 'gnu.c.compiler.option.preprocessor.def.symbols':
|
||||
for j in i.iter('listOptionValue'):
|
||||
temp=j.get('value')
|
||||
if temp != "":
|
||||
#print temp
|
||||
cflags=cflags+" -D"+temp+" \\\n"
|
||||
if a == 'gnu.c.compiler.option.preprocessor.def.symbols':
|
||||
for j in i.iter('listOptionValue'):
|
||||
temp=j.get('value')
|
||||
if temp != "":
|
||||
#print(temp)
|
||||
cflags=cflags+" -D"+temp+" \\\n"
|
||||
|
||||
if a == 'fr.ac6.managedbuild.tool.gnu.cross.c.linker.script':
|
||||
temp=i.get('value')
|
||||
temp=temp.replace("../", "",1)
|
||||
temp=fullpath(temp)
|
||||
#print temp
|
||||
ldscript=temp
|
||||
if a == 'fr.ac6.managedbuild.tool.gnu.cross.c.linker.script':
|
||||
temp=i.get('value')
|
||||
temp=temp.replace("../", "",1)
|
||||
temp=fullpath(temp)
|
||||
#print(temp)
|
||||
ldscript=temp
|
||||
|
||||
if a == 'gnu.c.link.option.paths':
|
||||
for j in i.iter('listOptionValue'):
|
||||
temp=j.get('value')
|
||||
temp=temp.replace("../", "",1)
|
||||
temp=fullpath(temp)
|
||||
ldlibs=ldlibs+" -L"+temp+"/"
|
||||
if a == 'gnu.c.link.option.paths':
|
||||
for j in i.iter('listOptionValue'):
|
||||
temp=j.get('value')
|
||||
temp=temp.replace("../", "",1)
|
||||
temp=fullpath(temp)
|
||||
ldlibs=ldlibs+" -L"+temp+"/"
|
||||
|
||||
if a == 'gnu.c.link.option.libs':
|
||||
for j in i.iter('listOptionValue'):
|
||||
temp=j.get('value')
|
||||
ldlibs=ldlibs+" -l"+temp
|
||||
if a == 'gnu.c.link.option.libs':
|
||||
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
|
||||
print("cflags="+cflags)
|
||||
f.write("CFLAGS += "+cflags+"\n")
|
||||
f.write("\n")
|
||||
|
||||
print "ldlibs="+ldlibs
|
||||
print("ldlibs="+ldlibs)
|
||||
f.write("LDLIBS += "+ldlibs+"\n")
|
||||
f.write("\n")
|
||||
|
||||
|
|
@ -176,4 +171,4 @@ f.write("\n")
|
|||
|
||||
f.close();
|
||||
|
||||
print "exit"
|
||||
print("exit")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh -
|
||||
|
||||
# test if we are a stm32mp1
|
||||
if ! $(grep -q "stm32mp157[acdf]-dk\|ev" /proc/device-tree/compatible) ;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
halt)
|
||||
# action to do in case of halt
|
||||
/sbin/st-m4firmware-load-default.sh stop
|
||||
;;
|
||||
poweroff)
|
||||
# action to do in case of poweroff
|
||||
/sbin/st-m4firmware-load-default.sh stop
|
||||
;;
|
||||
reboot)
|
||||
# action to do in case of reboot
|
||||
;;
|
||||
kexec)
|
||||
# action to do in case of kexec (for crashdump on memory)
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
|
||||
|
|
@ -8,10 +8,10 @@ then
|
|||
fi
|
||||
|
||||
#search on device tree compatible entry the board type
|
||||
if $(grep -q "stm32mp157c-ev" /proc/device-tree/compatible) ;
|
||||
if $(grep -q "stm32mp157[acdf]-ev" /proc/device-tree/compatible) ;
|
||||
then
|
||||
board="STM32MP15_M4_EVAL"
|
||||
else if $(grep -q "stm32mp157c-dk" /proc/device-tree/compatible) ;
|
||||
else if $(grep -q "stm32mp157[acdf]-dk" /proc/device-tree/compatible) ;
|
||||
then
|
||||
board="STM32MP15_M4_DISCO"
|
||||
else
|
||||
|
|
@ -47,8 +47,12 @@ echo "Booting fw image ${board}_@default_fw@.elf" > /dev/kmsg
|
|||
|
||||
firmware_load_stop() {
|
||||
# Stop the firmware
|
||||
echo stop >/sys/class/remoteproc/remoteproc0/state
|
||||
echo "Stoping fw image ${board}_@default_fw@.elf" > /dev/kmsg
|
||||
if [ $(cat /sys/class/remoteproc/remoteproc0/state) == "running" ]; then
|
||||
echo stop >/sys/class/remoteproc/remoteproc0/state
|
||||
echo "Stopping fw image ${board}_@default_fw@.elf" > /dev/kmsg
|
||||
else
|
||||
echo "Default copro already stopped" > /dev/kmsg
|
||||
fi
|
||||
}
|
||||
|
||||
board=""
|
||||
|
|
|
|||
|
|
@ -16,58 +16,58 @@ S = "${WORKDIR}/git"
|
|||
require recipes-extended/m4projects/m4projects.inc
|
||||
|
||||
PROJECTS_LIST_EV1 = " \
|
||||
'STM32MP157C-EV1/Examples/ADC/ADC_SingleConversion_TriggerTimer_DMA' \
|
||||
'STM32MP157C-EV1/Examples/Cortex/CORTEXM_MPU' \
|
||||
'STM32MP157C-EV1/Examples/CRC/CRC_UserDefinedPolynomial' \
|
||||
'STM32MP157C-EV1/Examples/CRYP/CRYP_AES_DMA' \
|
||||
'STM32MP157C-EV1/Examples/DAC/DAC_SimpleConversion' \
|
||||
'STM32MP157C-EV1/Examples/DMA/DMA_FIFOMode' \
|
||||
'STM32MP157C-EV1/Examples/GPIO/GPIO_EXTI' \
|
||||
'STM32MP157C-EV1/Examples/HASH/HASH_SHA224SHA256_DMA' \
|
||||
'STM32MP157C-EV1/Examples/I2C/I2C_TwoBoards_ComDMA' \
|
||||
'STM32MP157C-EV1/Examples/I2C/I2C_TwoBoards_ComIT' \
|
||||
'STM32MP157C-EV1/Examples/PWR/PWR_STOP_CoPro' \
|
||||
'STM32MP157C-EV1/Examples/QSPI/QSPI_ReadWrite_IT' \
|
||||
'STM32MP157C-EV1/Examples/SPI/SPI_FullDuplex_ComDMA_Master' \
|
||||
'STM32MP157C-EV1/Examples/SPI/SPI_FullDuplex_ComDMA_Slave' \
|
||||
'STM32MP157C-EV1/Examples/TIM/TIM_DMABurst' \
|
||||
'STM32MP157C-EV1/Examples/UART/UART_TwoBoards_ComIT' \
|
||||
'STM32MP157C-EV1/Examples/UART/UART_Receive_Transmit_Console' \
|
||||
'STM32MP157C-EV1/Examples/WWDG/WWDG_Example' \
|
||||
'STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_Dynamic_ResMgr' \
|
||||
'STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_raw' \
|
||||
'STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_TTY_echo' \
|
||||
'STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_TTY_echo_wakeup' \
|
||||
'STM32MP157C-EV1/Applications/FreeRTOS/FreeRTOS_ThreadCreation' \
|
||||
'STM32MP157C-EV1/Applications/CoproSync/CoproSync_ShutDown' \
|
||||
'STM32MP157C-EV1/Demonstrations/AI_Character_Recognition' \
|
||||
STM32MP157C-EV1/Examples/ADC/ADC_SingleConversion_TriggerTimer_DMA \
|
||||
STM32MP157C-EV1/Examples/Cortex/CORTEXM_MPU \
|
||||
STM32MP157C-EV1/Examples/CRC/CRC_UserDefinedPolynomial \
|
||||
STM32MP157C-EV1/Examples/CRYP/CRYP_AES_DMA \
|
||||
STM32MP157C-EV1/Examples/DAC/DAC_SimpleConversion \
|
||||
STM32MP157C-EV1/Examples/DMA/DMA_FIFOMode \
|
||||
STM32MP157C-EV1/Examples/GPIO/GPIO_EXTI \
|
||||
STM32MP157C-EV1/Examples/HASH/HASH_SHA224SHA256_DMA \
|
||||
STM32MP157C-EV1/Examples/I2C/I2C_TwoBoards_ComDMA \
|
||||
STM32MP157C-EV1/Examples/I2C/I2C_TwoBoards_ComIT \
|
||||
STM32MP157C-EV1/Examples/PWR/PWR_STOP_CoPro \
|
||||
STM32MP157C-EV1/Examples/QSPI/QSPI_ReadWrite_IT \
|
||||
STM32MP157C-EV1/Examples/SPI/SPI_FullDuplex_ComDMA_Master \
|
||||
STM32MP157C-EV1/Examples/SPI/SPI_FullDuplex_ComDMA_Slave \
|
||||
STM32MP157C-EV1/Examples/TIM/TIM_DMABurst \
|
||||
STM32MP157C-EV1/Examples/UART/UART_TwoBoards_ComIT \
|
||||
STM32MP157C-EV1/Examples/UART/UART_Receive_Transmit_Console \
|
||||
STM32MP157C-EV1/Examples/WWDG/WWDG_Example \
|
||||
STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_Dynamic_ResMgr \
|
||||
STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_raw \
|
||||
STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_TTY_echo \
|
||||
STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_TTY_echo_wakeup \
|
||||
STM32MP157C-EV1/Applications/FreeRTOS/FreeRTOS_ThreadCreation \
|
||||
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' \
|
||||
'STM32MP157C-DK2/Examples/CRC/CRC_UserDefinedPolynomial' \
|
||||
'STM32MP157C-DK2/Examples/CRYP/CRYP_AES_DMA' \
|
||||
'STM32MP157C-DK2/Examples/DMA/DMA_FIFOMode' \
|
||||
'STM32MP157C-DK2/Examples/GPIO/GPIO_EXTI' \
|
||||
'STM32MP157C-DK2/Examples/HASH/HASH_SHA224SHA256_DMA' \
|
||||
'STM32MP157C-DK2/Examples/I2C/I2C_TwoBoards_ComIT' \
|
||||
'STM32MP157C-DK2/Examples/LPTIM/LPTIM_PulseCounter' \
|
||||
'STM32MP157C-DK2/Examples/PWR/PWR_STOP_CoPro' \
|
||||
'STM32MP157C-DK2/Examples/SPI/SPI_FullDuplex_ComDMA_Master' \
|
||||
'STM32MP157C-DK2/Examples/SPI/SPI_FullDuplex_ComDMA_Slave' \
|
||||
'STM32MP157C-DK2/Examples/SPI/SPI_FullDuplex_ComIT_Master' \
|
||||
'STM32MP157C-DK2/Examples/SPI/SPI_FullDuplex_ComIT_Slave' \
|
||||
'STM32MP157C-DK2/Examples/TIM/TIM_DMABurst' \
|
||||
'STM32MP157C-DK2/Examples/UART/UART_TwoBoards_ComDMA' \
|
||||
'STM32MP157C-DK2/Examples/UART/UART_TwoBoards_ComIT' \
|
||||
'STM32MP157C-DK2/Examples/UART/UART_Receive_Transmit_Console' \
|
||||
'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/Demonstrations/AI_Character_Recognition' \
|
||||
STM32MP157C-DK2/Examples/ADC/ADC_SingleConversion_TriggerTimer_DMA \
|
||||
STM32MP157C-DK2/Examples/Cortex/CORTEXM_MPU \
|
||||
STM32MP157C-DK2/Examples/CRC/CRC_UserDefinedPolynomial \
|
||||
STM32MP157C-DK2/Examples/CRYP/CRYP_AES_DMA \
|
||||
STM32MP157C-DK2/Examples/DMA/DMA_FIFOMode \
|
||||
STM32MP157C-DK2/Examples/GPIO/GPIO_EXTI \
|
||||
STM32MP157C-DK2/Examples/HASH/HASH_SHA224SHA256_DMA \
|
||||
STM32MP157C-DK2/Examples/I2C/I2C_TwoBoards_ComIT \
|
||||
STM32MP157C-DK2/Examples/LPTIM/LPTIM_PulseCounter \
|
||||
STM32MP157C-DK2/Examples/PWR/PWR_STOP_CoPro \
|
||||
STM32MP157C-DK2/Examples/SPI/SPI_FullDuplex_ComDMA_Master \
|
||||
STM32MP157C-DK2/Examples/SPI/SPI_FullDuplex_ComDMA_Slave \
|
||||
STM32MP157C-DK2/Examples/SPI/SPI_FullDuplex_ComIT_Master \
|
||||
STM32MP157C-DK2/Examples/SPI/SPI_FullDuplex_ComIT_Slave \
|
||||
STM32MP157C-DK2/Examples/TIM/TIM_DMABurst \
|
||||
STM32MP157C-DK2/Examples/UART/UART_TwoBoards_ComDMA \
|
||||
STM32MP157C-DK2/Examples/UART/UART_TwoBoards_ComIT \
|
||||
STM32MP157C-DK2/Examples/UART/UART_Receive_Transmit_Console \
|
||||
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/Demonstrations/AI_Character_Recognition \
|
||||
"
|
||||
|
||||
PROJECTS_LIST = "${PROJECTS_LIST_EV1} ${PROJECTS_LIST_DK2}"
|
||||
|
|
|
|||
|
|
@ -5,35 +5,45 @@ COMPATIBLE_MACHINE = "(stm32mpcommon)"
|
|||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
B = "${WORKDIR}/build"
|
||||
# for external source support with devtools
|
||||
# For external source support with devtools
|
||||
EXTERNALSRC_BUILD_pn-${PN} = "${WORKDIR}/build"
|
||||
|
||||
# M4 firwmare build file
|
||||
SRC_URI += "file://Makefile.stm32"
|
||||
SRC_URI += "file://parse_project_config.py"
|
||||
|
||||
# default service for systemd
|
||||
inherit systemd update-rc.d
|
||||
# Default service for systemd
|
||||
inherit systemd update-rc.d python3native
|
||||
SRC_URI += "file://st-m4firmware-load-default.sh"
|
||||
SRC_URI += "file://st-m4firmware-load.service"
|
||||
|
||||
PACKAGES += "${PN}-userfs"
|
||||
SRC_URI += "file://shutdown-stm32mp1-m4.sh"
|
||||
|
||||
DEPENDS += " gcc-arm-none-eabi-native "
|
||||
RDEPENDS_${PN}-userfs += "busybox"
|
||||
|
||||
# Create specific userfs package
|
||||
M4_PACKAGE_4USERFS ?= "1"
|
||||
PACKAGES += "${@bb.utils.contains('M4_PACKAGE_4USERFS', '1', '${PN}-userfs', '', d)}"
|
||||
|
||||
# Define default board reference for M4
|
||||
M4_BOARDS ?= "STM32MP157C-EV1 STM32MP157C-DK2"
|
||||
|
||||
# Init M4 board service install
|
||||
M4_BOARDS_SERVICE ?= "1"
|
||||
|
||||
# Init default copro example to load/execute
|
||||
DEFAULT_COPRO_FIRMWARE ?= ""
|
||||
|
||||
USERFS_ROOTPATH = "/local/Cube-M4-examples"
|
||||
BUILD_CONFIG ?= "Debug"
|
||||
|
||||
# Init default installation path
|
||||
M4_FOLDER ?= "Cube-M4-examples"
|
||||
M4_INSTALLDIR ?= "${prefix}local"
|
||||
M4_OUTPUT_4USERFS = "${M4_INSTALLDIR}/${M4_FOLDER}"
|
||||
|
||||
# Use gcc bare toolchain
|
||||
export CROSS_COMPILE = "${RECIPE_SYSROOT_NATIVE}/${datadir}/gcc-arm-none-eabi/bin/arm-none-eabi-"
|
||||
export CPU_TYPE = "M4"
|
||||
export BUILD_CONFIG = "Debug"
|
||||
EXTRA_OEMAKE += "CROSS_COMPILE=${RECIPE_SYSROOT_NATIVE}/${datadir}/gcc-arm-none-eabi/bin/arm-none-eabi-"
|
||||
EXTRA_OEMAKE += "CPU_TYPE=M4"
|
||||
EXTRA_OEMAKE += "BUILD_CONFIG=${BUILD_CONFIG}"
|
||||
|
||||
do_compile() {
|
||||
# Compile M4 firmwares listed in bb file. They can be for eval or disco board as specified in bb file
|
||||
|
|
@ -41,15 +51,14 @@ do_compile() {
|
|||
bbnote "Compile M4 project for : ${BIN_MACHINE}"
|
||||
for project in ${PROJECTS_LIST} ; do
|
||||
bbnote "Parsing M4 project : ${project}"
|
||||
|
||||
if [ "$(echo ${project} | cut -d'/' -f1)" = "${BIN_MACHINE}" ]; then
|
||||
bbnote "Selected M4 project : ${project}"
|
||||
|
||||
unset LDFLAGS CFLAGS CPPFLAGS CFLAGS_ASM
|
||||
# Export variables as used by Makefile
|
||||
export BIN_NAME=$(basename ${project})
|
||||
export PROJECT_DIR=${B}/${project}
|
||||
export PROJECT_APP="${S}/Projects/${project}/SW4STM32/${BIN_NAME}"
|
||||
|
||||
BIN_NAME=$(basename ${project})
|
||||
PROJECT_DIR=${B}/${project}
|
||||
PROJECT_APP="${S}/Projects/${project}/SW4STM32/${BIN_NAME}"
|
||||
|
||||
bbnote "BIN_NAME : ${BIN_NAME}"
|
||||
bbnote "PROJECT_DIR : ${PROJECT_DIR}"
|
||||
|
|
@ -60,16 +69,12 @@ do_compile() {
|
|||
|
||||
mkdir -p ${PROJECT_DIR}/out/${BUILD_CONFIG}
|
||||
|
||||
# parse project to get file list and build flags
|
||||
python ${WORKDIR}/parse_project_config.py ${PROJECT_APP} ${BUILD_CONFIG} ${PROJECT_DIR}
|
||||
|
||||
# make clean
|
||||
bbnote "Parsing M4 project to get file list and build flags for ${project}"
|
||||
${PYTHON} ${WORKDIR}/parse_project_config.py "${PROJECT_APP}" "${BUILD_CONFIG}" "${PROJECT_DIR}"
|
||||
bbnote "Cleaning M4 project : ${project}"
|
||||
oe_runmake -f ${WORKDIR}/Makefile.stm32 clean
|
||||
|
||||
# make build
|
||||
oe_runmake -f ${WORKDIR}/Makefile.stm32 BIN_NAME=${BIN_NAME} PROJECT_DIR=${PROJECT_DIR} clean
|
||||
bbnote "Building M4 project : ${project}"
|
||||
oe_runmake -f ${WORKDIR}/Makefile.stm32 all
|
||||
oe_runmake -f ${WORKDIR}/Makefile.stm32 BIN_NAME=${BIN_NAME} PROJECT_DIR=${PROJECT_DIR} all
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
|
@ -77,7 +82,7 @@ do_compile() {
|
|||
|
||||
do_install() {
|
||||
# Install M4 firmwares, scripts and README in userfs:
|
||||
# <userfs>/local/Cube-M4-examples/${project} (ie STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_TTY_echo)
|
||||
# <userfs>/Cube-M4-examples/${project} (ie STM32MP157C-EV1/Applications/OpenAMP/OpenAMP_TTY_echo)
|
||||
# |-- fw_cortex_m4.sh
|
||||
# |-- README
|
||||
# |--lib
|
||||
|
|
@ -86,47 +91,51 @@ do_install() {
|
|||
for BIN_MACHINE in ${M4_BOARDS}; do
|
||||
for project in ${PROJECTS_LIST} ; do
|
||||
if [ "$(echo ${project} | cut -d'/' -f1)" = "${BIN_MACHINE}" ]; then
|
||||
# BIN_NAME=$(echo ${project} | cut -d'/' -f4)
|
||||
BIN_NAME=$(basename ${project})
|
||||
|
||||
# Install M4 firmwares
|
||||
install -d ${D}${prefix}${USERFS_ROOTPATH}/${project}/lib/firmware/
|
||||
install -m 0755 ${B}/${project}/out/${BUILD_CONFIG}/${BIN_NAME}.elf ${D}${prefix}${USERFS_ROOTPATH}/${project}/lib/firmware/
|
||||
install -d ${D}${M4_OUTPUT_4USERFS}/${project}/lib/firmware/
|
||||
install -m 0755 ${B}/${project}/out/${BUILD_CONFIG}/${BIN_NAME}.elf ${D}${M4_OUTPUT_4USERFS}/${project}/lib/firmware/
|
||||
|
||||
# Install sh and README files if any for each example
|
||||
if [ -e ${S}/Projects/${project}/Remoteproc/fw_cortex_m4.sh ]; then
|
||||
install -m 0755 ${S}/Projects/${project}/Remoteproc/fw_cortex_m4.sh ${D}${prefix}${USERFS_ROOTPATH}/${project}
|
||||
install -m 0755 ${S}/Projects/${project}/Remoteproc/fw_cortex_m4.sh ${D}${M4_OUTPUT_4USERFS}/${project}
|
||||
fi
|
||||
if [ -e ${S}/Projects/${project}/Remoteproc/README ]; then
|
||||
install -m 0755 ${S}/Projects/${project}/Remoteproc/README ${D}${prefix}${USERFS_ROOTPATH}/${project}
|
||||
install -m 0755 ${S}/Projects/${project}/Remoteproc/README ${D}${M4_OUTPUT_4USERFS}/${project}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Install sh script to load/execute DEFAULT_COPRO_FIRMWARE @boot up
|
||||
if [ -n "${DEFAULT_COPRO_FIRMWARE}" ]; then
|
||||
# Install systemd service
|
||||
install -d ${D}${sysconfdir}/init.d/
|
||||
install -d ${D}${base_sbindir}/
|
||||
install -m 0755 ${WORKDIR}/st-m4firmware-load-default.sh ${D}${sysconfdir}/init.d/st-m4firmware-load-default.sh
|
||||
install -m 0755 ${WORKDIR}/st-m4firmware-load-default.sh ${D}${base_sbindir}/st-m4firmware-load-default.sh
|
||||
if [ "${M4_BOARDS_SERVICE}" -eq 1 ]; then
|
||||
# Install sh script to load/execute DEFAULT_COPRO_FIRMWARE @boot up
|
||||
if [ -n "${DEFAULT_COPRO_FIRMWARE}" ]; then
|
||||
# Install systemd service
|
||||
install -d ${D}${sysconfdir}/init.d/
|
||||
install -d ${D}${base_sbindir}/
|
||||
install -m 0755 ${WORKDIR}/st-m4firmware-load-default.sh ${D}${sysconfdir}/init.d/st-m4firmware-load-default.sh
|
||||
install -m 0755 ${WORKDIR}/st-m4firmware-load-default.sh ${D}${base_sbindir}/st-m4firmware-load-default.sh
|
||||
install -m 0755 ${WORKDIR}/shutdown-stm32mp1-m4.sh ${D}${base_sbindir}/shutdown-stm32mp1-m4.sh
|
||||
|
||||
sed -i -e "s:@default_fw@:${DEFAULT_COPRO_FIRMWARE}:" \
|
||||
${D}${sysconfdir}/init.d/st-m4firmware-load-default.sh
|
||||
sed -i -e "s:@default_fw@:${DEFAULT_COPRO_FIRMWARE}:" \
|
||||
${D}${base_sbindir}/st-m4firmware-load-default.sh
|
||||
sed -i -e "s:@default_fw@:${DEFAULT_COPRO_FIRMWARE}:" \
|
||||
${D}${sysconfdir}/init.d/st-m4firmware-load-default.sh
|
||||
sed -i -e "s:@default_fw@:${DEFAULT_COPRO_FIRMWARE}:" \
|
||||
${D}${base_sbindir}/st-m4firmware-load-default.sh
|
||||
|
||||
sed -i -e "s:@userfs_mount_point@:${STM32MP_USERFS_MOUNTPOINT_IMAGE}:" \
|
||||
${D}${sysconfdir}/init.d/st-m4firmware-load-default.sh
|
||||
sed -i -e "s:@userfs_mount_point@:${STM32MP_USERFS_MOUNTPOINT_IMAGE}:" \
|
||||
${D}${base_sbindir}/st-m4firmware-load-default.sh
|
||||
fi
|
||||
sed -i -e "s:@userfs_mount_point@:${M4_OUTPUT_4USERFS}:" \
|
||||
${D}${sysconfdir}/init.d/st-m4firmware-load-default.sh
|
||||
sed -i -e "s:@userfs_mount_point@:${M4_OUTPUT_4USERFS}:" \
|
||||
${D}${base_sbindir}/st-m4firmware-load-default.sh
|
||||
fi
|
||||
|
||||
# install systemd service for all machines configurations
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -m 644 ${WORKDIR}/st-m4firmware-load.service ${D}/${systemd_unitdir}/system
|
||||
# Install systemd service for all machines configurations
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -d ${D}${systemd_unitdir}/system-shutdown
|
||||
install -m 644 ${WORKDIR}/st-m4firmware-load.service ${D}/${systemd_unitdir}/system
|
||||
install -m 755 ${WORKDIR}/shutdown-stm32mp1-m4.sh ${D}/${systemd_unitdir}/system-shutdown
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -143,5 +152,8 @@ INITSCRIPT_PARAMS = "stop 22 5 3 ."
|
|||
INHIBIT_PACKAGE_STRIP = "1"
|
||||
INHIBIT_SYSROOT_STRIP = "1"
|
||||
|
||||
FILES_${PN} += "${nonarch_base_libdir}/firmware ${sysconfdir}/init.d ${systemd_unitdir}/system"
|
||||
FILES_${PN}-userfs = "${prefix}${USERFS_ROOTPATH}"
|
||||
FILES_${PN} += "${nonarch_base_libdir}/firmware ${sysconfdir}/init.d ${systemd_unitdir}/system ${systemd_unitdir}/system-shutdown"
|
||||
# Configure package split
|
||||
FILES_${PN} += "${@bb.utils.contains('M4_PACKAGE_4USERFS', '1', '', '${M4_OUTPUT_4USERFS}', d)}"
|
||||
FILES_${PN}-userfs = "${@bb.utils.contains('M4_PACKAGE_4USERFS', '1', '${M4_OUTPUT_4USERFS}', '', d)}"
|
||||
RDEPENDS_${PN}-userfs += "busybox"
|
||||
|
|
|
|||
Loading…
Reference in New Issue