Added a new console command: "system" (#14)
``` KTag> system Usage: system chip-info - Show chip and system information system coredump - Check coredump status system factory-reset - Clear NVS and restart system flash - Show flash information system heap-caps - Show heap by capability system hostname [name]- Show/set hostname system mac - Show MAC addresses system partition - List partition table system RAM - Display heap memory usage system reboot - Reboot the device system reset-reason - Show last reset reason system stats - Combined system statistics system tasks - List FreeRTOS tasks system uptime - Display system uptime system version - Show firmware version ``` Co-authored-by: Joe Kearney <joe@clubk.club> Reviewed-on: #14
This commit is contained in:
parent
3939941315
commit
2c81bdd052
7 changed files with 801 additions and 14 deletions
72
components/Serial_Console/generate_git_versions.cmake
Normal file
72
components/Serial_Console/generate_git_versions.cmake
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# Main repository hashes
|
||||
execute_process(
|
||||
COMMAND git rev-parse --short HEAD
|
||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_HASH_SHORT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_HASH_LONG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Check for uncommitted changes in main repo
|
||||
execute_process(
|
||||
COMMAND git diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
||||
RESULT_VARIABLE GIT_DIRTY
|
||||
)
|
||||
|
||||
if(NOT GIT_DIRTY EQUAL 0)
|
||||
set(GIT_HASH_SHORT "${GIT_HASH_SHORT}+")
|
||||
set(GIT_HASH_LONG "${GIT_HASH_LONG}+")
|
||||
endif()
|
||||
|
||||
# SystemK hashes
|
||||
set(SYSTEMK_PATH "${SOURCE_DIR}/components/SystemK")
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse --short HEAD
|
||||
WORKING_DIRECTORY ${SYSTEMK_PATH}
|
||||
OUTPUT_VARIABLE SYSTEMK_HASH_SHORT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE SYSTEMK_RESULT
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY ${SYSTEMK_PATH}
|
||||
OUTPUT_VARIABLE SYSTEMK_HASH_LONG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Check for uncommitted changes in SystemK.
|
||||
execute_process(
|
||||
COMMAND git diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY ${SYSTEMK_PATH}
|
||||
RESULT_VARIABLE SYSTEMK_DIRTY
|
||||
)
|
||||
|
||||
# Handle the case where SystemK doesn't exist or is not a git repo.
|
||||
if(SYSTEMK_RESULT EQUAL 0)
|
||||
if(NOT SYSTEMK_DIRTY EQUAL 0)
|
||||
set(SYSTEMK_HASH_SHORT "${SYSTEMK_HASH_SHORT}+")
|
||||
set(SYSTEMK_HASH_LONG "${SYSTEMK_HASH_LONG}+")
|
||||
endif()
|
||||
else()
|
||||
set(SYSTEMK_HASH_SHORT "unknown")
|
||||
set(SYSTEMK_HASH_LONG "unknown")
|
||||
endif()
|
||||
|
||||
file(WRITE ${OUTPUT_FILE}
|
||||
"#ifndef GIT_VERSION_H
|
||||
#define GIT_VERSION_H
|
||||
#define GIT_COMMIT_HASH_SHORT \"${GIT_HASH_SHORT}\"
|
||||
#define GIT_COMMIT_HASH_LONG \"${GIT_HASH_LONG}\"
|
||||
#define SYSTEMK_GIT_COMMIT_HASH_SHORT \"${SYSTEMK_HASH_SHORT}\"
|
||||
#define SYSTEMK_GIT_COMMIT_HASH_LONG \"${SYSTEMK_HASH_LONG}\"
|
||||
#endif
|
||||
")
|
||||
Loading…
Add table
Add a link
Reference in a new issue