def updateOpenAmp(): print("Updating OpenAmp Middleware") repo_path = repo_local_path / repo_core_name if upargs.local: cube_path = local_cube_path else: cube_name = f"{repo_generic_name}MP1" cube_path = repo_local_path / cube_name OpenAmp_cube_path = cube_path / "Middlewares" / "Third_Party" / "OpenAMP" OpenAmp_core_path = repo_path / "system" / "Middlewares" / "OpenAMP" # First delete old HAL version deleteFolder(OpenAmp_core_path) # Copy new one copyFolder(OpenAmp_cube_path, OpenAmp_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()