Skip to content

Commit 8717bd0

Browse files
committed
ci(stm32cube): add openamp patch support
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 3381c7f commit 8717bd0

File tree

2 files changed

+60
-18
lines changed

2 files changed

+60
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 662b735916d90db341464143c16b6bf54178366d Mon Sep 17 00:00:00 2001
2+
From: Frederic Pillon <[email protected]>
3+
Date: Tue, 20 Dec 2022 11:06:26 +0100
4+
Subject: [PATCH 1/1] chore(openamp): allow RPMSG_SERVICE_NAME redefiniton
5+
6+
Since openSTLinux distribution 4.0 with Linux 5.15,
7+
RPMSG_SERVICE_NAME has been renamed from 'rpmsg-tty-channel' to 'rpmsg-tty'
8+
if older distribution is used, it is required to redefine it to 'rpmsg-tty-channel'
9+
10+
Signed-off-by: Frederic Pillon <[email protected]>
11+
---
12+
system/Middlewares/OpenAMP/virtual_driver/virt_uart.c | 8 +++++++-
13+
1 file changed, 7 insertions(+), 1 deletion(-)
14+
15+
diff --git a/system/Middlewares/OpenAMP/virtual_driver/virt_uart.c b/system/Middlewares/OpenAMP/virtual_driver/virt_uart.c
16+
index 8d01ecef6..7d60f2911 100644
17+
--- a/system/Middlewares/OpenAMP/virtual_driver/virt_uart.c
18+
+++ b/system/Middlewares/OpenAMP/virtual_driver/virt_uart.c
19+
@@ -46,7 +46,13 @@
20+
/* Private typedef -----------------------------------------------------------*/
21+
/* Private define ------------------------------------------------------------*/
22+
/* this string will be sent to remote processor */
23+
-#define RPMSG_SERVICE_NAME "rpmsg-tty"
24+
+/* Since openSTLinux distribution 4.0 with Linux 5.15,
25+
+ RPMSG_SERVICE_NAME has been renamed from 'rpmsg-tty-channel' to 'rpmsg-tty'
26+
+ if older distribution is used, it is required to redefine it to 'rpmsg-tty-channel'
27+
+*/
28+
+#ifndef RPMSG_SERVICE_NAME
29+
+ #define RPMSG_SERVICE_NAME "rpmsg-tty"
30+
+#endif
31+
32+
/* Private macro -------------------------------------------------------------*/
33+
/* Private variables ---------------------------------------------------------*/
34+
--
35+
2.38.0.windows.1
36+

Diff for: CI/update/stm32cube.py

+24-18
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def commitFiles(repo_path, commit_msg):
501501
["git", "-C", repo_path, "status", "--untracked-files", "--short"], None
502502
)
503503
if not status:
504-
return
504+
return False
505505
# Staged all files: new, modified and deleted
506506
execute_cmd(["git", "-C", repo_path, "add", "--all"], subprocess.DEVNULL)
507507
# Commit all stage files with signoff and message
@@ -522,10 +522,11 @@ def commitFiles(repo_path, commit_msg):
522522
["git", "-C", repo_path, "rebase", "--whitespace=fix", "HEAD~1"],
523523
subprocess.DEVNULL,
524524
)
525+
return True
525526

526527

527528
# Apply all patches found for the dedicated serie
528-
def applyPatch(serie, HAL_updated, CMSIS_updated, repo_path):
529+
def applyPatch(serie, HAL_updated, CMSIS_updated, openamp_updated, repo_path):
529530
# First check if some patch need to be applied
530531
patch_path = script_path / "patch"
531532
patch_list = []
@@ -541,6 +542,12 @@ def applyPatch(serie, HAL_updated, CMSIS_updated, repo_path):
541542
for file in CMSIS_patch_path.iterdir():
542543
if file.name.endswith(".patch"):
543544
patch_list.append(CMSIS_patch_path / file)
545+
if CMSIS_updated:
546+
openamp_patch_path = patch_path / "openamp"
547+
if openamp_patch_path.is_dir():
548+
for file in openamp_patch_path.iterdir():
549+
if file.name.endswith(".patch"):
550+
patch_list.append(openamp_patch_path / file)
544551

545552
if len(patch_list):
546553
patch_failed = []
@@ -790,6 +797,7 @@ def updateCore():
790797
cube_version = cube_versions[serie]
791798
HAL_updated = False
792799
CMSIS_updated = False
800+
openamp_updated = False
793801
hal_commit_msg = """system({0}) {3} STM32{0}xx HAL Drivers to v{1}
794802
795803
Included in STM32Cube{0} FW {2}""".format(
@@ -823,8 +831,7 @@ def updateCore():
823831
# Update MD file
824832
updateMDFile(md_HAL_path, serie, cube_HAL_ver)
825833
# Commit all HAL files
826-
commitFiles(core_path, hal_commit_msg)
827-
HAL_updated = True
834+
HAL_updated = commitFiles(core_path, hal_commit_msg)
828835

829836
if version.parse(core_CMSIS_ver) < version.parse(cube_CMSIS_ver):
830837
if upargs.add:
@@ -842,8 +849,7 @@ def updateCore():
842849
# Update MD file
843850
updateMDFile(md_CMSIS_path, serie, cube_CMSIS_ver)
844851
# Commit all CMSIS files
845-
commitFiles(core_path, cmsis_commit_msg)
846-
CMSIS_updated = True
852+
CMSIS_updated = commitFiles(core_path, cmsis_commit_msg)
847853

848854
if upargs.add:
849855
system_commit_msg = (
@@ -867,23 +873,13 @@ def updateCore():
867873
updateStm32Def(serie)
868874
commitFiles(core_path, update_stm32_def_commit_msg)
869875

870-
if HAL_updated or CMSIS_updated:
871-
# Generate all wrapper files
872-
# Assuming the ArduinoModule-CMSIS repo available
873-
# at the same root level than the core
874-
print(f"{'Adding' if upargs.add else 'Updating'} {serie} wrapped files...")
875-
if stm32wrapper.wrap(core_path, None, False) == 0:
876-
commitFiles(core_path, wrapper_commit_msg)
877-
# Apply all related patch if any
878-
applyPatch(serie, HAL_updated, CMSIS_updated, core_path)
879-
880876
if serie == "MP1":
881877
print(f"Updating {serie} OpenAmp Middleware to Cube {cube_version} ...")
882878
updateOpenAmp()
883879
openAmp_commit_msg = (
884-
f"Update OpenAmp Middleware to MP1 Cube version {cube_version}"
880+
f"system(openamp): update middleware to MP1 Cube version {cube_version}"
885881
)
886-
commitFiles(core_path, openAmp_commit_msg)
882+
openamp_updated = commitFiles(core_path, openAmp_commit_msg)
887883
print(
888884
"WARNING: OpenAmp MW has been updated, please check whether Arduino implementation:"
889885
)
@@ -902,6 +898,16 @@ def updateCore():
902898
if serie == "WB":
903899
updateBle()
904900

901+
if HAL_updated or CMSIS_updated or openamp_updated:
902+
# Generate all wrapper files
903+
# Assuming the ArduinoModule-CMSIS repo available
904+
# at the same root level than the core
905+
print(f"{'Adding' if upargs.add else 'Updating'} {serie} wrapped files...")
906+
if stm32wrapper.wrap(core_path, None, False) == 0:
907+
commitFiles(core_path, wrapper_commit_msg)
908+
# Apply all related patch if any
909+
applyPatch(serie, HAL_updated, CMSIS_updated, openamp_updated, core_path)
910+
905911

906912
# Parser
907913
upparser = argparse.ArgumentParser(

0 commit comments

Comments
 (0)