def updateCore(): for serie in stm32_list: cube_name = repo_generic_name + serie cube_path = repo_local_path / cube_name core_path = repo_local_path / repo_core_name core_HAL_version = core_HAL_versions[serie] cube_HAL_version = cube_HAL_versions[serie] core_CMSIS_version = core_CMSIS_versions[serie] cube_CMSIS_version = cube_CMSIS_versions[serie] cube_version = cube_versions[serie] HAL_updated = False CMSIS_updated = False hal_commit_msg = """system: {0}: {3} STM32{0}xx HAL Drivers to v{1} Included in STM32Cube{0} FW {2}""".format( serie, cube_HAL_version, cube_version, "add" if upargs.add else "update" ) cmsis_commit_msg = """system: {0}: {3} STM32{0}xx CMSIS Drivers to v{1} Included in STM32Cube{0} FW {2}""".format( serie, cube_CMSIS_version, cube_version, "add" if upargs.add else "update" ) wrapper_commit_msg = "core: {}: {} wrapped files".format( serie, "add" if upargs.add else "update" ) # Update HAL part if needed if version.parse(core_HAL_version) < version.parse(cube_HAL_version): if upargs.add: print("Adding {} HAL version {}...".format(serie, cube_HAL_version)) else: print( "Updating {} HAL from version {} to {}...".format( serie, core_HAL_version, cube_HAL_version ) ) # First delete old HAL version HAL_serie_core_path = hal_dest_path / "STM32{}xx_HAL_Driver".format(serie) deleteFolder(HAL_serie_core_path) # Copy new one HAL_serie_cube_path = ( cube_path / hal_src_path / "STM32{}xx_HAL_Driver".format(serie) ) copyFolder(HAL_serie_cube_path, HAL_serie_core_path, {"*.chm"}) # Update MD file updateMDFile(md_HAL_path, serie, cube_HAL_version) # Commit all HAL files commitFiles(core_path, hal_commit_msg) HAL_updated = True if version.parse(core_CMSIS_version) < version.parse(cube_CMSIS_version): if upargs.add: print("Adding {} CMSIS version {}...".format(serie, cube_CMSIS_version)) else: print( "Updating {} CMSIS from version {} to {}...".format( serie, core_CMSIS_version, cube_CMSIS_version ) ) # First delete CMSIS folder CMSIS_serie_dest_path = cmsis_dest_path / "STM32{}xx".format(serie) deleteFolder(CMSIS_serie_dest_path) # Copy new one CMSIS_serie_cube_path = ( cube_path / cmsis_src_path / "STM32{}xx".format(serie) ) copyFolder(CMSIS_serie_cube_path, CMSIS_serie_dest_path, {"iar", "arm"}) # Update MD file updateMDFile(md_CMSIS_path, serie, cube_CMSIS_version) # Commit all CMSIS files commitFiles(core_path, cmsis_commit_msg) CMSIS_updated = True if upargs.add: system_commit_msg = ( "system: {0}: add STM32{0}xx system source files".format(serie) ) update_hal_conf_commit_msg = ( "system: {0}: update STM32{0}xx hal default config".format(serie) ) update_stm32_def_commit_msg = "core: {0}: add top HAL include".format(serie) # Create system files createSystemFiles(serie) # Commit all system files commitFiles(core_path, system_commit_msg) # Update default HAL configuration updateHalConfDefault(serie) commitFiles(core_path, update_hal_conf_commit_msg) print("\tPlease, review carefully all the system files added!") print("\tAdd #ifndef/#endif to all definitions which should be") print( "\tredefinable in the stm32{}xx_hal_conf_default.h".format( serie.lower() ) ) # Update stm32_def to add top HAL include updateStm32Def(serie) commitFiles(core_path, update_stm32_def_commit_msg) if HAL_updated or CMSIS_updated: # Generate all wrapper files # Assuming the ArduinoModule-CMSIS repo available # at the same root level than the core print( "{} {} wrapped files...".format( "Adding" if upargs.add else "Updating", serie ) ) if stm32wrapper.wrap(core_path, None, False) == 0: commitFiles(core_path, wrapper_commit_msg) # Apply all related patch if any applyPatch(serie, HAL_updated, CMSIS_updated, core_path)
def updateCore(): for serie in stm32_list: if upargs.local: cube_path = local_cube_path else: cube_name = f"{repo_generic_name}{serie}" cube_path = repo_local_path / cube_name core_path = repo_local_path / repo_core_name core_HAL_ver = core_HAL_versions[serie] cube_HAL_ver = cube_HAL_versions[serie] core_CMSIS_ver = core_CMSIS_versions[serie] cube_CMSIS_ver = cube_CMSIS_versions[serie] cube_version = cube_versions[serie] HAL_updated = False CMSIS_updated = False hal_commit_msg = """system({0}) {3} STM32{0}xx HAL Drivers to v{1} Included in STM32Cube{0} FW {2}""".format(serie, cube_HAL_ver, cube_version, "add" if upargs.add else "update") cmsis_commit_msg = """system({0}): {3} STM32{0}xx CMSIS Drivers to v{1} Included in STM32Cube{0} FW {2}""".format(serie, cube_CMSIS_ver, cube_version, "add" if upargs.add else "update") wrapper_commit_msg = ( f"core({serie}): {'add' if upargs.add else 'update'} wrapped files" ) # Update HAL part if needed if version.parse(core_HAL_ver) < version.parse(cube_HAL_ver): if upargs.add: print(f"Adding {serie} HAL version {cube_HAL_ver}...") else: print( f"Updating {serie} HAL from version {core_HAL_ver} to {cube_HAL_ver}..." ) # First delete old HAL version HAL_serie_core_path = hal_dest_path / f"STM32{serie}xx_HAL_Driver" deleteFolder(HAL_serie_core_path) # Copy new one HAL_serie_cube_path = (cube_path / hal_src_path / f"STM32{serie}xx_HAL_Driver") copyFolder(HAL_serie_cube_path, HAL_serie_core_path, {"*.chm"}) # Update MD file updateMDFile(md_HAL_path, serie, cube_HAL_ver) # Commit all HAL files commitFiles(core_path, hal_commit_msg) HAL_updated = True if version.parse(core_CMSIS_ver) < version.parse(cube_CMSIS_ver): if upargs.add: print(f"Adding {serie} CMSIS version {cube_CMSIS_ver}...") else: print( f"Updating {serie} CMSIS from version {core_CMSIS_ver} to {cube_CMSIS_ver}..." ) # First delete CMSIS folder CMSIS_serie_dest_path = cmsis_dest_path / f"STM32{serie}xx" deleteFolder(CMSIS_serie_dest_path) # Copy new one CMSIS_serie_cube_path = cube_path / cmsis_src_path / f"STM32{serie}xx" copyFolder(CMSIS_serie_cube_path, CMSIS_serie_dest_path, {"iar", "arm"}) # Update MD file updateMDFile(md_CMSIS_path, serie, cube_CMSIS_ver) # Commit all CMSIS files commitFiles(core_path, cmsis_commit_msg) CMSIS_updated = True if upargs.add: system_commit_msg = ( f"system({serie}): add STM32{serie}xx system source files") update_hal_conf_commit_msg = ( f"system({serie}): update STM32{serie}xx hal default config") update_stm32_def_commit_msg = f"core({serie}): add top HAL include" # Create system files createSystemFiles(serie) # Commit all system files commitFiles(core_path, system_commit_msg) # Update default HAL configuration updateHalConfDefault(serie) commitFiles(core_path, update_hal_conf_commit_msg) print("\tPlease, review carefully all the system files added!") print("\tAdd #ifndef/#endif to all definitions which should be") print( f"\tredefinable in the stm32{serie.lower()}xx_hal_conf_default.h" ) # Update stm32_def to add top HAL include updateStm32Def(serie) commitFiles(core_path, update_stm32_def_commit_msg) if HAL_updated or CMSIS_updated: # Generate all wrapper files # Assuming the ArduinoModule-CMSIS repo available # at the same root level than the core print( f"{'Adding' if upargs.add else 'Updating'} {serie} wrapped files..." ) if stm32wrapper.wrap(core_path, None, False) == 0: commitFiles(core_path, wrapper_commit_msg) # Apply all related patch if any applyPatch(serie, HAL_updated, CMSIS_updated, core_path) if serie == "MP1": print( f"Updating {serie} OpenAmp Middleware to Cube {cube_version} ..." ) updateOpenAmp() openAmp_commit_msg = ( f"Update OpenAmp Middleware to MP1 Cube version {cube_version}" ) commitFiles(core_path, openAmp_commit_msg) print( "WARNING: OpenAmp MW has been updated, please check whether Arduino implementation:" ) print(" * cores/arduino/stm32/OpenAMP/mbox_ipcc.h") print(" * cores/arduino/stm32/OpenAMP/mbox_ipcc.c") print(" * cores/arduino/stm32/OpenAMP/rsc_table.h") print(" * cores/arduino/stm32/OpenAMP/rsc_table.c") print(" * cores/arduino/stm32/OpenAMP/openamp.h") print(" * cores/arduino/stm32/OpenAMP/openamp.c") print(" * cores/arduino/stm32/OpenAMP/openamp_conf.h") print(" should be updated from Cube project:") print( " --> Projects/STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo" ) if serie == "WB": updateBle()
def updateCore(): for serie in stm32_list: cube_name = repo_generic_name + serie cube_path = os.path.join(repo_local_path, cube_name) core_path = os.path.join(repo_local_path, repo_core_name) core_HAL_version = core_HAL_versions[serie] cube_HAL_version = cube_HAL_versions[serie] core_CMSIS_version = core_CMSIS_versions[serie] cube_CMSIS_version = cube_CMSIS_versions[serie] cube_version = cube_versions[serie] regexmd = re.compile(rf"(STM32{serie}:\s+)\d+.\d+.\d+") HAL_updated = False CMSIS_updated = False hal_commit_msg = """[{0}] Update STM32{0}xx HAL Drivers to v{1} Included in STM32Cube{0} FW {2}""".format(serie, cube_HAL_version, cube_version) cmsis_commit_msg = """[{0}] Update STM32{0}xx CMSIS Drivers to v{1} Included in STM32Cube{0} FW {2}""".format(serie, cube_CMSIS_version, cube_version) wrapper_commit_msg = "[{}] Update wrapped files".format(serie) # Update HAL part if needed if version.parse(core_HAL_version) < version.parse(cube_HAL_version): print("Update " + serie + " HAL from version " + core_HAL_version + " to " + cube_HAL_version) # First delete old HAL version HAL_serie_core_path = os.path.join( core_path, hal_dest_path, "STM32{}xx_HAL_Driver".format(serie)) deleteFolder(HAL_serie_core_path) # Copy new one HAL_serie_cube_path = os.path.join( cube_path, hal_src_path, "STM32{}xx_HAL_Driver".format(serie)) copyFolder(HAL_serie_cube_path, HAL_serie_core_path, {"*.chm"}) # Update MD file for line in fileinput.input(md_HAL_path, inplace=True): line = regexmd.sub(rf"\g<1>{cube_HAL_version}", line) print(line, end="") # Commit all HAL files commitFiles(core_path, hal_commit_msg) HAL_updated = True if version.parse(core_CMSIS_version) < version.parse( cube_CMSIS_version): print("Update " + serie + " CMSIS from version " + core_CMSIS_version + " to " + cube_CMSIS_version) # First delete CMSIS folder CMSIS_serie_dest_path = os.path.join( core_path, cmsis_dest_path, "STM32{}xx".format(serie.upper())) deleteFolder(CMSIS_serie_dest_path) # Copy new one CMSIS_serie_cube_path = os.path.join( cube_path, cmsis_src_path, "STM32{}xx".format(serie.upper())) copyFolder(CMSIS_serie_cube_path, CMSIS_serie_dest_path, {"iar", "arm"}) # Update MD file for line in fileinput.input(md_CMSIS_path, inplace=True): line = regexmd.sub(rf"\g<1>{cube_CMSIS_version}", line) print(line, end="") # Commit all CMSIS files commitFiles(core_path, cmsis_commit_msg) CMSIS_updated = True if HAL_updated or CMSIS_updated: # Generate all wrapper files # Assuming the ArduinoModule-CMSIS repo available # at the same root level than the core print("Update {} wrapped files".format(serie)) if stm32wrapper.wrap(core_path, None, False) == 0: commitFiles(core_path, wrapper_commit_msg) # Apply all related patch if any applyPatch(serie, HAL_updated, CMSIS_updated, core_path)