@@ -501,7 +501,7 @@ def commitFiles(repo_path, commit_msg):
501
501
["git" , "-C" , repo_path , "status" , "--untracked-files" , "--short" ], None
502
502
)
503
503
if not status :
504
- return
504
+ return False
505
505
# Staged all files: new, modified and deleted
506
506
execute_cmd (["git" , "-C" , repo_path , "add" , "--all" ], subprocess .DEVNULL )
507
507
# Commit all stage files with signoff and message
@@ -522,10 +522,11 @@ def commitFiles(repo_path, commit_msg):
522
522
["git" , "-C" , repo_path , "rebase" , "--whitespace=fix" , "HEAD~1" ],
523
523
subprocess .DEVNULL ,
524
524
)
525
+ return True
525
526
526
527
527
528
# 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 ):
529
530
# First check if some patch need to be applied
530
531
patch_path = script_path / "patch"
531
532
patch_list = []
@@ -541,6 +542,12 @@ def applyPatch(serie, HAL_updated, CMSIS_updated, repo_path):
541
542
for file in CMSIS_patch_path .iterdir ():
542
543
if file .name .endswith (".patch" ):
543
544
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 )
544
551
545
552
if len (patch_list ):
546
553
patch_failed = []
@@ -790,6 +797,7 @@ def updateCore():
790
797
cube_version = cube_versions [serie ]
791
798
HAL_updated = False
792
799
CMSIS_updated = False
800
+ openamp_updated = False
793
801
hal_commit_msg = """system({0}) {3} STM32{0}xx HAL Drivers to v{1}
794
802
795
803
Included in STM32Cube{0} FW {2}""" .format (
@@ -823,8 +831,7 @@ def updateCore():
823
831
# Update MD file
824
832
updateMDFile (md_HAL_path , serie , cube_HAL_ver )
825
833
# Commit all HAL files
826
- commitFiles (core_path , hal_commit_msg )
827
- HAL_updated = True
834
+ HAL_updated = commitFiles (core_path , hal_commit_msg )
828
835
829
836
if version .parse (core_CMSIS_ver ) < version .parse (cube_CMSIS_ver ):
830
837
if upargs .add :
@@ -842,8 +849,7 @@ def updateCore():
842
849
# Update MD file
843
850
updateMDFile (md_CMSIS_path , serie , cube_CMSIS_ver )
844
851
# Commit all CMSIS files
845
- commitFiles (core_path , cmsis_commit_msg )
846
- CMSIS_updated = True
852
+ CMSIS_updated = commitFiles (core_path , cmsis_commit_msg )
847
853
848
854
if upargs .add :
849
855
system_commit_msg = (
@@ -867,23 +873,13 @@ def updateCore():
867
873
updateStm32Def (serie )
868
874
commitFiles (core_path , update_stm32_def_commit_msg )
869
875
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
-
880
876
if serie == "MP1" :
881
877
print (f"Updating { serie } OpenAmp Middleware to Cube { cube_version } ..." )
882
878
updateOpenAmp ()
883
879
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 } "
885
881
)
886
- commitFiles (core_path , openAmp_commit_msg )
882
+ openamp_updated = commitFiles (core_path , openAmp_commit_msg )
887
883
print (
888
884
"WARNING: OpenAmp MW has been updated, please check whether Arduino implementation:"
889
885
)
@@ -902,6 +898,16 @@ def updateCore():
902
898
if serie == "WB" :
903
899
updateBle ()
904
900
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
+
905
911
906
912
# Parser
907
913
upparser = argparse .ArgumentParser (
0 commit comments