Git Version Control and Project Version - mriksman/esp-idf-homekit GitHub Wiki
- Create a repository on Github. Ensure not to have any files created (README.md and LICENSE)
- In VSCode, add a file called
.gitignore
, and place the following lines in it;
.vscode/
build/
- Click on Source Control in the left-hand navigation bar, and click 'Initialise Repository'
- Add remote repository to project.
- Open Command Palette (
CTRL+SHIFT+P
) and typegit
. Click Git: Add Remote - For Remote Name, put
origin
, as this will then match the examples on the web. - For Remote URL, paste the git URL of the repository;
https://github.com/<username>/<git_project_name>.git
- Open Command Palette (
- Commit first commit.
- Set a message describing the changes
- Click the 'tick' icon. All the files will now be uploaded to the repository. This will be the master branch.
Modify the code. When you want to sync the changes to remote;
- In VSCode, click on Source Control in the left-hand navigation bar, set a message describing the changes, and click the 'tick' icon to Commit the changes.
This commits the changes locally;
git log --pretty=oneline --abbrev-commit
a893840 (HEAD -> master) Updates
156d009 First commit
- Click the Publish Changes icon down the bottom left menu-bar. The changes are published to remote.
git log --pretty=oneline --abbrev-commit
a893840 (HEAD -> master, origin/master) Updates
156d009 First commit
Tagging allows certain milestones to be saved. It is also what is output with git describe
, and can be used for PROJECT_VER
- Open the Command Palette (
Ctrl+Shift+P
) and choose Git: Create Tag. - Name the tag with a version number, like
1.1.0
. - To push the tag to the remote server, open the Command Palette again and choose Git: Push (Follow Tags).
When you go to build, the output in the Terminal will show
Esp8266
Project version: 1.0.0
Esp32
App "projectname" version: 1.0.0
When you make another commit, git describe will show that you are x commits behind;
1.0.0-1-gf48d142
-- App "esp8266_test" version: 1.0.0-1-gf48d142
The DROM segment starts with the esp_app_desc_t structure which carries specific fields describing the application.
secure_version
-
version
-
project_name
is filled fromPROJECT_NAME
-
time and date
- compile time and date. -
idf_ver
- version of ESP-IDF. * -
app_elf_sha256
- contains sha256 for the elf application file.
* - The maximum length is 32 characters, including null-termination character. For example, if the length of PROJECT_NAME
exceeds 32 characters, the excess characters will be disregarded.
This structure is useful for identification of images uploaded OTA because it has a fixed offset of sizeof([esp_image_header_t]) + sizeof([esp_image_segment_header_t])
.
As soon as a device receives the first fragment containing this structure, it has all the information to determine whether the update should be continued or not.
PROJECT_VER
will be retrieved as follows;
- In application
CMakeLists.txt
putset(PROJECT_VER "0.1.0.1")
before including project.cmake. - Else, if the
$PROJECT_PATH/version.txt
exists, its contents will be used asPROJECT_VER
. - Else, if the project is located inside a Git repository, the output of
git describe
will be used. - Otherwise,
PROJECT_VER
will be "1".
I (197) cpu_start: Application information:
I (202) cpu_start: Project name: project_name
I (207) cpu_start: App version: 1.0.0
I (212) cpu_start: Compile time: Mar 20 2020 17:51:56
I (218) cpu_start: ELF file SHA256: 1ee1c302f506be0a...
I (224) cpu_start: ESP-IDF: v4.2-dev-781-g47253a827
Although the ESP8266 now supports this, the data is not being stored in the correct memory address. To work around this issue, move the following lines in components/esp8266/ld/esp8266.project.ld.in
from line 200 to line 168
*(.rodata_desc .rodata_desc.*)
*(.rodata_custom_desc .rodata_custom_desc.*)
Notice both the .text
and the .rodata
is being stored in the iram0_2_seg
section. And .text
is listed first. So we need the esp_app_desc
to be located in .text
so it is in the right memory location at address 0x40200010