Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: serie_update: integration of changes in Git submodules of HAL & CMSIS Device drivers #184

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scripts/ble_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def build_patch_from_current_zephyr_version(

temp_source_lib_path = Path(temp_source_path / "lib")

# reset the STM32Cube repo to this current version
# Checkout the current Zephyr version of the STM32Cube repo
os_cmd(
("git", "reset", "--hard", version),
("git", "checkout", "-f", "--recurse-submodules", version),
cwd=src_repo_path,
)

Expand Down Expand Up @@ -218,9 +218,9 @@ def update(
build_patch_from_current_zephyr_version(
src_repo_path, temp_source_path, dest_lib_path, current_version
)
# reset the STM32Cube repo to this update version
# Checkout the latest version of the STM32Cube repo
os_cmd(
("git", "reset", "--hard", update_version),
("git", "checkout", "-f", "--recurse-submodules", update_version),
cwd=src_repo_path,
)
copy_hci_files(src_repo_path, dest_lib_path)
Expand Down
33 changes: 24 additions & 9 deletions scripts/serie_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(

# ##### 3 root directories to work with ########
# 1: STM32Cube repo Default $HOME/STM32Cube_repo
# 2 : zephyr stm32 path : ex: .../zephyr_project/module/hal/stm32
# 2: zephyr stm32 path : ex: .../zephyr_project/module/hal/stm32
# 3: Temporary directory to construct the update
# (within STM32Cube repo dir)
self.stm32cube_repo_path = stm32cube_repo_path
Expand Down Expand Up @@ -192,14 +192,26 @@ def clone_cube_repo(self):
# if already exists, then just clean and fetch
self.os_cmd(("git", "clean", "-fdx"), cwd=self.stm32cube_serie_path)
self.os_cmd(("git", "fetch"), cwd=self.stm32cube_serie_path)
# this is useful when HAL/CMSIS Device drivers submodules are not
# already present locally, otherwise "git fetch" is sufficient
self.os_cmd(("git", "submodule", "update", "--init"),
cwd=self.stm32cube_serie_path)
branch = self.major_branch()
# "Using --recurse-submodules will update the content of all active
# submodules according to the commit recorded in the superproject.
# If local modifications in a submodule would be overwritten the
# checkout will fail unless -f is used."
# https://git-scm.com/docs/git-checkout
self.os_cmd(
("git", "reset", "--hard", branch),
("git", "checkout", "-f", "--recurse-submodules", branch),
cwd=self.stm32cube_serie_path,
)
else:
# HAL & CMSIS Device drivers are now included as git submodules in
# upstream STM32Cube GitHub repositories
# So to get them too, --recursive or --recurse-submodules is needed
self.os_cmd(
("git", "clone", repo_name),
("git", "clone", "--recursive", repo_name),
cwd=self.stm32cube_repo_path,
)
branch = self.major_branch()
Expand Down Expand Up @@ -260,6 +272,7 @@ def extract_source(self):
# for CMSIS files
temp_cmsis_soc_path = self.stm32cube_temp_serie / "soc"
Path.mkdir(temp_cmsis_soc_path, parents=True)

stm32cube_cmsis_include_path = (
self.stm32cube_serie_path
/ "Drivers"
Expand Down Expand Up @@ -290,6 +303,7 @@ def extract_source(self):
# for hal and ll drivers
temp_drivers_include_path = self.stm32cube_temp_serie / "drivers" / "include"
temp_drivers_include_path.parent.mkdir(parents=True)

stm32cube_driver_inc = (
self.stm32cube_serie_path
/ "Drivers"
Expand Down Expand Up @@ -320,9 +334,9 @@ def build_from_current_cube_version(self):
"""Build a commit in temporary dir with STM32Cube version
corresponding to zephyr current hal version
"""
# reset the STM32Cube repo to this current version
# Checkout the current Zephyr version of the STM32Cube repo
self.os_cmd(
("git", "reset", "--hard", self.current_version),
("git", "checkout", "-f", "--recurse-submodules", self.current_version),
cwd=self.stm32cube_serie_path,
)

Expand Down Expand Up @@ -565,9 +579,9 @@ def build_from_version_update(self):
"""Build a commit in temporary dir with STM32Cube version
corresponding to zephyr latest hal version
"""
# reset the STM32Cube repo to this latest version
# Checkout the latest version of the upstream STM32Cube repo
self.os_cmd(
("git", "reset", "--hard", self.version_update),
("git", "checkout", "-f", "--recurse-submodules", self.version_update),
cwd=self.stm32cube_serie_path,
)

Expand Down Expand Up @@ -693,7 +707,8 @@ def reject(self):

def cleanup_stm32cube_repo(self):
"""clean the STM32Cube repo"""
self.os_cmd(("git", "reset", "--hard", "HEAD"), cwd=self.stm32cube_serie_path)
self.os_cmd(("git", "checkout", "-f", "--recurse-submodules", "HEAD"),
cwd=self.stm32cube_serie_path)

def clean_files(self):
"""Clean repo file if required"""
Expand All @@ -709,7 +724,7 @@ def clean_files(self):
)
else:
self.os_cmd(
("git", "reset", "--hard", "HEAD"),
("git", "checkout", "-f", "--recurse-submodules", "HEAD"),
cwd=self.stm32cube_serie_path,
)

Expand Down
Loading