@@ -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
795803Included 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
907913upparser = argparse .ArgumentParser (
0 commit comments