-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from pmnxis/dev/i40_fingerprint_elf
#40 Generate fingerprint on ELF section, for MPtool
- Loading branch information
Showing
6 changed files
with
87 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,15 @@ authors = ["Jinwoo Park <[email protected]>"] | |
license = "MIT OR Apache-2.0" | ||
description = "application side of billmock hardware, powered by rust-embedded" | ||
|
||
# feature name starting with "hw_" is reserved for mass production config generator | ||
[features] | ||
default = ["billmock_default"] | ||
hw_bug_host_inhibit_floating = [] # #19 bug (https://github.com/pmnxis/billmock-app-rs/issues/19) | ||
hotfix_hwbug_host_inhibit_floating = [] # #19 bug (https://github.com/pmnxis/billmock-app-rs/issues/19) | ||
billmock_default = ["hw_mini_0v5"] # To use rust-analzyer utilizing noDefaultFeatures on vscode | ||
eeprom = [] | ||
svc_button = [] # SVC button | ||
hw_0v2 = ["hw_bug_host_inhibit_floating"] | ||
hw_0v3 = ["hw_bug_host_inhibit_floating"] | ||
hw_0v2 = ["hotfix_hwbug_host_inhibit_floating"] | ||
hw_0v3 = ["hotfix_hwbug_host_inhibit_floating"] | ||
hw_0v4 = ["eeprom"] | ||
hw_mini_0v4 = ["eeprom"] | ||
hw_mini_0v5 = ["eeprom", "svc_button"] | ||
|
@@ -41,7 +42,7 @@ num_enum = { version = "0.7.0", default-features = false } # Application specifi | |
bit_field = "0.10" | ||
nonmax = { version = "0.5.3", default-features = false, features = [] } # to use common NonMax | ||
static_assertions = "1.1.0" | ||
env_to_array = { version = "0.3.1", features = ["hex"] } | ||
env_to_array = { git = "https://github.com/pmnxis/env-to-array.git", branch = "dynamic_array_patch", features = ["hex"] } | ||
zeroable = "0.2.0" | ||
const-zero = "0.1.1" | ||
|
||
|
@@ -64,6 +65,8 @@ billmock-otp-dev-info = { git = "https://github.com/pmnxis/billmock-mptool.git" | |
[build-dependencies] | ||
git2 = "0.18" # Git library for Rust | ||
cargo_metadata = "0.18" | ||
mp-fingerprint-type = { git = "https://github.com/pmnxis/billmock-mptool.git" } | ||
hex = "0.4" | ||
|
||
[profile.release] | ||
# or "z" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
mod application; | ||
mod boards; | ||
mod components; | ||
mod mp_fingerprint; | ||
mod semi_layer; | ||
mod types; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected]) | ||
* | ||
* SPDX-License-Identifier: MIT OR Apache-2.0 | ||
*/ | ||
|
||
//! This code is not reflected on program binrary or actual memory. | ||
//! .mp_fingerprint section is `NOLOAD` and `READONLY` section that | ||
//! virtually existed in ELF header. | ||
//! The contents of .mp_fingerprint would be used for billmock-mptool | ||
//! to determine what kind of board, feature, version, git hash based | ||
//! from ELF binary. | ||
|
||
//! DO NOT USE `&str` or any other slice type | ||
//! ```rs | ||
//! #[allow(unused, dead_code)] | ||
//! #[no_mangle] | ||
//! #[link_section = ".mp_fingerprint"] | ||
//! static TEST_FINGER: [u8; 14] = *b"SOME TOML HERE"; | ||
|
||
use env_to_array::patch_linker_section_from_hex_env; | ||
|
||
patch_linker_section_from_hex_env!(".mp_fingerprint", "MP_INFO_TOML", "MP_FINGERPRINT_TOML_HEX"); |