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

add uuid and tag registers #30

Merged
merged 3 commits into from
Jul 24, 2024
Merged

add uuid and tag registers #30

merged 3 commits into from
Jul 24, 2024

Conversation

Poofjunior
Copy link
Collaborator

@Poofjunior Poofjunior commented Jul 23, 2024

R_UUID and R_TAG are now implemented.

If PICO_RP2040 is defined (default for the pico-sdk), then the lower 8 bytes (bytes 8-15) will be populated with the 8-byte sequence from the QSPI flash upon instantiation of a HarpCore. This 64-bit value is unique per flash chip instance, making it a good default value to stuff into this register.

For the R_TAG register, an 8 byte sequence must be added into the constructor.
For folks using CMake (most-likely true if you're using this project), you can stuff it with a string representation of the 7-byte short Git hash by adding the following to your CMakeLists.txt:

find_package(Git REQUIRED)
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD OUTPUT_VARIABLE COMMIT_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Computed Git Hash: ${COMMIT_ID}")
add_definitions(-DGIT_HASH="${COMMIT_ID}") # Usable in source code.

After that, you can simply use GIT_HASH in your source code.

References:

Implements harp-tech/protocol#38 and harp-tech/protocol#39

@Poofjunior
Copy link
Collaborator Author

Worth considering: should we remove the tag from the constructor and just expose it through a setter function?

@Poofjunior Poofjunior merged commit ebe4ea2 into main Jul 24, 2024
@Poofjunior Poofjunior deleted the dev/uuid_and_tag branch July 24, 2024 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant