Skip to content

Commit

Permalink
feat: Supported to print firmware source
Browse files Browse the repository at this point in the history
  • Loading branch information
ustccw committed Dec 17, 2024
1 parent 967d88b commit 83c40fe
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_template_esp32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ jobs:
cd -
- name: Install ESP-IDF environment variables
run: |
echo "ESP_AT_FIRMWARE_FROM=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" >> "$GITHUB_ENV"
./build.py install
- name: Compile
run: |
printf '%s\n' "$ESP_AT_FIRMWARE_FROM"
./build.py build
- name: Upload artifacts
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_template_esp32c2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
./build.py install
- name: Compile
run: |
./build.py build
./build.py build -DESP_AT_FIRMWARE_FROM="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
- name: Upload artifacts
uses: actions/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_template_esp32c3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
./build.py install
- name: Compile
run: |
./build.py build
./build.py build -D ESP_AT_FIRMWARE_FROM=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: Upload artifacts
uses: actions/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_template_esp32c5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
./build.py install
- name: Compile
run: |
export ESP_AT_FIRMWARE_FROM=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
./build.py build
- name: Upload artifacts
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_template_esp32c6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
./build.py install
- name: Compile
run: |
./build.py build
./build.py build -D ESP_AT_FIRMWARE_FROM="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
- name: Upload artifacts
uses: actions/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_template_esp32s2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
./build.py install
- name: Compile
run: |
export ESP_AT_FIRMWARE_FROM=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
./build.py build
- name: Upload artifacts
uses: actions/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ workflow:
# global variables
variables:
GIT_STRATEGY: clone
AT_FIRMWARE_FROM: gitlab

default:
retry:
Expand Down
1 change: 1 addition & 0 deletions .gitlab/ci/build_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
.setup_env_variables: &setup_env_variables
- export HAS_IDF_PREREQUISITES=1
- export ESP_AT_PROJECT_BRANCH=${CI_COMMIT_REF_NAME}
- export ESP_AT_FIRMWARE_FROM=${AT_FIRMWARE_FROM}

.clone_repo_and_components: &clone_repo_and_components
- *speedup_repo_clone
Expand Down
2 changes: 2 additions & 0 deletions .glab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ variables: &global-variables
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
ESPCI_TOKEN: $GITLAB_KEY
ESP_AT_FIRMWARE_FROM: glab

.esp_at_build_template:
stage: build
Expand Down Expand Up @@ -62,4 +63,5 @@ customer_at_build:
- esp-idf/tools/idf_tools.py export

- export ESP_AT_PROJECT_BRANCH=${CI_COMMIT_REF_NAME}
- export ESP_AT_FIRMWARE_FROM=${ESP_AT_FIRMWARE_FROM}
- ./build.py build
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ execute_process(COMMAND git rev-parse --short HEAD

add_compile_options("-DESP_AT_PROJECT_COMMIT_ID=\"${ESP_AT_PROJECT_COMMIT_ID}\"")

# set the firmware source
if (DEFINED ENV{ESP_AT_FIRMWARE_FROM})
set(ESP_AT_FIRMWARE_FROM $ENV{ESP_AT_FIRMWARE_FROM})
add_compile_options("-DESP_AT_FIRMWARE_FROM=\"${ESP_AT_FIRMWARE_FROM}\"")
endif()

# get branch name and set docs version
if(NOT DEFINED ENV{ESP_AT_PROJECT_BRANCH})
Expand Down
7 changes: 6 additions & 1 deletion components/at/src/at_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ static void at_module_init(void)
"compile time(%s):%s %s\r\n", ESP_AT_PROJECT_COMMIT_ID, __DATE__, __TIME__);

#ifdef CONFIG_ESP_AT_FW_VERSION
printf("%s\r\n", CONFIG_ESP_AT_FW_VERSION);
#ifdef ESP_AT_FIRMWARE_FROM
printf("%s (%s)\r\n", CONFIG_ESP_AT_FW_VERSION, ESP_AT_FIRMWARE_FROM);
#else
printf("%s (unknown)\r\n", CONFIG_ESP_AT_FW_VERSION);
#endif

ret = snprintf((char *)version + ret, AT_TEMP_BUFFER_SIZE - ret,
"Bin version:%s(%s)\r\n", CONFIG_ESP_AT_FW_VERSION, esp_at_get_current_module_name());
#endif
Expand Down

0 comments on commit 83c40fe

Please sign in to comment.