The Scrutiny instrumentation library is hosted on Github and uses CMake as build system.
Scrutiny is intended to work on embedded baremetal platforms, which may have uncommon architecture. For that reason, no prebuilt release of the instrumentation library is provided. As a developer, you will be required to build scrutiny-embedded yourself.
Scrutiny has some build options to enable/disables features.
The list of possible configurations are provided below
- SCRUTINY_SUPPORT_64BITS (default 1)
-
When enabled, Scrutiny will be able to handle 64 bits types as RPV and as datalogging operand.
Disabling that feature will not prevent memory inspection as they happen with raw memory dumps.
Disabling 64 bits support is mainly useful to reduce the memory footprint of the library on small microcontrollers. - SCRUTINY_ENABLE_DATALOGGING (default 1)
- When enabled, embedded graphs will be possible. The datalogging feature requires a non-negligible ROM footprint which can be an issue on code size limited devices.
- SCRUTINY_DATALOGGING_MAX_SIGNAL (default 32)
- Maximum number of signal that can be simultaneously logged by the embedded datalogger.
- SCRUTINY_DATALOGGING_BUFFER_32BITS (default 0)
- Allow a datalogging buffer bigger than 65536 bytes.
- SCRUTINY_REQUEST_MAX_PROCESS_TIME_US (default 100000)
- Maximum time allowed to internally process a request (us). This value has an effect on messages that needs to wait for a response from a LoopHandler (in a different thread). This delay may need to be extended if datalogging is enabled in a very slow thread/task.
- SCRUTINY_COMM_RX_TIMEOUT_US (default 50000)
- Maximum time between the reception of 2 consecutive bytes (us). This represent the minimum wait time to send a new request to the device if the previous request was incomplete. After that delay, the communication state machine goes back to IDLE and a new command is awaited.
- SCRUTINY_COMM_HEARTBEAT_TIMEOUT_US (default 5000000)
- Maximum amount of time between the reception of 2 heartbeat messages. If this delay is exceeded, the device will close the session with the server and will stop all communication. A new CONNECT message will be required to reenable the communication.
In-tree build
A simple in-tree build is possible by adding the scrutiny-embedded folder to your project.
git clone https://github.com/scrutinydebugger/scrutiny-embedded
#CMakeLists.txt
project(MyProject)
add_subdirectory(scrutiny-embedded/lib)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} scrutiny-embedded)
Automating in-tree builds
It is possible to automate the process of fetching and configuring scrutiny using CMake FetchContent module. This method is the recommended one.
cmake_minimum_required(VERSION 3.14)
project(CMakeDemoProject)
include(FetchContent)
set(SCRUTINY_ENABLE_DATALOGGING 1)
set(SCRUTINY_SUPPORT_64BITS 0)
# More options possible
FetchContent_Declare(
scrutiny-embedded
GIT_REPOSITORY https://github.com/scrutinydebugger/scrutiny-embedded.git
GIT_TAG v0.1
)
FetchContent_MakeAvailable(scrutiny-embedded)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE
scrutiny-embedded
)
add_compile_options( -Os -Wall -Wextra -Werror -gdwarf-4) # These options also applies to scrutiny-embedded
Building out of tree
Another option would be to build the library as a standalone project, then adding the build byproduct to your project.
git clone https://github.com/scrutinydebugger/scrutiny-embedded
./scrutiny-embedded/scripts/build.sh
The static library and the include files will be located in scrutiny-embedded/build-dev/install
. You can then copy the install folder
content to your project, say in 3rdparty/scrutiny
and link to the library like below, assuming the correct toolchain file is set
for your device.
#CMakeLists.txt
project(MyProject)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} 3rdparty/scrutiny/scrutiny-embedded.a)
target_include_directories(${PROJECT_NAME} PRIVATE 3rdparty/scrutiny/inc)
It is possible to enable/disable features when building as so SCRUTINY_SUPPORT_64BITS=0 ./scrutiny-embedded/scripts/build.sh
.