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

DP-9127 fw update client integration #747

Merged
merged 5 commits into from
Aug 28, 2024
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 .github/workflows/tiiuae-pixhawk-and-saluki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ permissions:

env:
saluki_fpga_repo: "ghcr.io/tiiuae/saluki-fpga"
saluki_pi_fpga_version: "4.14.0"
saluki_v2_fpga_version: "4.14.0"
saluki_v3_fpga_version: "4.14.0"
saluki_fmu2_fpga_version: "4.14.0"
saluki_pi_fpga_version: "4.15.0"
saluki_v2_fpga_version: "4.15.0"
saluki_v3_fpga_version: "4.15.0"
saluki_fmu2_fpga_version: "4.15.0"

jobs:
fc_matrix:
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@
[submodule "Tools/simulation/gz/plugins/px4-gzsim-plugins"]
path = Tools/simulation/gz/plugins/px4-gzsim-plugins
url = https://github.com/tiiuae/px4-gzsim-plugins.git
[submodule "src/modules/px4_fw_update_client"]
path = src/modules/px4_fw_update_client
url = git@github.com:tiiuae/px4-fw-update-client.git
[submodule "src/lib/secure_udp"]
path = src/lib/secure_udp
url = git@github.com:tiiuae/px4-lib-secure-udp.git
5 changes: 5 additions & 0 deletions Tools/generate_basic_build_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ if [ -z "${1:-}" ]; then
fi

repo=$(basename `git rev-parse --show-toplevel`)
# short sha for compatibility
sha=$(git rev-parse --short HEAD)
# separate px4_sha for long sha
px4_sha=$(git rev-parse HEAD)

# github variables are set only in github
if [ -z "${GITHUB_SERVER_URL:-}" ] || [ -z "${GITHUB_REPOSITORY:-}" ] || [ -z "${GITHUB_RUN_ID:-}" ]; then
build_url="undefined"
Expand All @@ -28,6 +32,7 @@ fi
declare -A build_info
build_info["reponame"]=${repo}
build_info["sha"]=${sha}
build_info["px4_firmware_sha"]=${px4_sha}
build_info["build_url"]=${build_url}

# loop thru associative array and print key value pairs
Expand Down
4 changes: 4 additions & 0 deletions Tools/px_uploader.entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function generate_metadata() {
saluki_file_info=$(cat ${SALUKI_FILE_INFO_JSON} |
jq -c '.files[] | select (.filename | contains("'${px4_filename}'")) |
.filename = "'${px4_bin_filename}'" |
.px4_firmware_sha = "'${px4_sha}'" |
.type = "px4-bin"')
echo ${saluki_file_info} > ${validation_file}

Expand Down Expand Up @@ -75,6 +76,9 @@ if [ -n "$PX4_EXPORT_DIR" ]; then
rm ${TEMP_JSON}
fi

# px4 sha from the original json file
px4_sha=$(cat ${SALUKI_FILE_INFO_JSON} | jq -r '.px4_firmware_sha')

# find all px4 files in the firmware directory
for px4_file in /firmware/*.px4; do
extract_bin_from_px4 $px4_file $PX4_EXPORT_DIR
Expand Down
2 changes: 1 addition & 1 deletion boards/ssrc/common
2 changes: 1 addition & 1 deletion boards/ssrc/saluki-v3
2 changes: 2 additions & 0 deletions clone_public.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ do
[[ "${repo}" == *pfsoc_crypto ]] || \
[[ "${repo}" == *pfsoc_keystore ]] || \
[[ "${repo}" == *pf_crypto ]] || \
[[ "${repo}" == *px4_fw_update_client ]] || \
[[ "${repo}" == *secure_udp ]] || \
[[ "${repo}" == *process ]] && continue
git submodule update --init --recursive "${repo}"
done <<< "$(git submodule status | awk '{print $2}')"
3 changes: 3 additions & 0 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ add_subdirectory(version EXCLUDE_FROM_ALL)
add_subdirectory(weather_vane EXCLUDE_FROM_ALL)
add_subdirectory(wind_estimator EXCLUDE_FROM_ALL)
add_subdirectory(world_magnetic_model EXCLUDE_FROM_ALL)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/secure_udp/CMakeLists.txt")
add_subdirectory(secure_udp EXCLUDE_FROM_ALL)
endif()
1 change: 1 addition & 0 deletions src/lib/secure_udp
Submodule secure_udp added at 6a12f0
11 changes: 11 additions & 0 deletions src/lib/version/px_update_git_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@
if not tag_or_branch.startswith('release-'):
tag_or_branch = 'master'

# count commits since last tag
# git log --oneline $(git describe --tags --abbrev=0)..HEAD | wc -l
# this has to be ran with shell=True because if uses $() subshell
try:
git_tag_top = subprocess.check_output('git log --oneline $(git describe --tags --abbrev=0)..HEAD | wc -l',
shell=True,
stderr=subprocess.STDOUT).decode('utf-8').strip()
except:
git_tag_top = 0

# build timestamp in epoch format
build_timestamp = subprocess.check_output('date -u +%s'.split(),
stderr=subprocess.STDOUT).decode('utf-8').strip()
Expand All @@ -119,6 +129,7 @@
#define PX4_GIT_OEM_VERSION_STR "{oem_tag}"

#define PX4_GIT_TAG_OR_BRANCH_NAME "{tag_or_branch}" // special variable: git tag, release or master branch
#define PX4_GIT_VERSION_TOP {git_tag_top}
#define PX4_BUILD_TIME {build_timestamp}
"""

Expand Down
5 changes: 5 additions & 0 deletions src/lib/version/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ uint32_t px4_firmware_vendor_version(void)
return version_tag_to_vendor_version_number(PX4_GIT_TAG_STR);
}

uint32_t px4_firmware_git_top_number(void)
{
return PX4_GIT_VERSION_TOP;
}

const char *px4_firmware_git_branch(void)
{
return PX4_GIT_BRANCH_NAME;
Expand Down
6 changes: 6 additions & 0 deletions src/lib/version/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ __EXPORT uint32_t version_tag_to_vendor_version_number(const char *tag);
*/
__EXPORT uint32_t px4_firmware_vendor_version(void);

/**
* get the PX4 Firmware vendor version git tag top number
* @return number of git commits after git tag
*/
__EXPORT uint32_t px4_firmware_git_top_number(void);

/**
* get the board version (last 8 bytes should be silicon ID, if any)
*/
Expand Down
1 change: 1 addition & 0 deletions src/modules/px4_fw_update_client
Submodule px4_fw_update_client added at ae71ae