Introduce new global header files #4300
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This large PR focuses on cleaning up code structure and organization.
It introduces well-defined global headers that simplify includes, make the code tidier, and establish a system to prevent unnecessary dependencies in API headers.
trezor_types.h
: Defines commonly used types likeuint8_t
,uint32_t
,bool
, andsecbool
. This header is primarily intended for interface headers, consolidating all common types and replacing direct includes ofstdint.h
,stdbool.h
, andsecbool.h
.trezor_rtl.h
: Provides declarations for commonly used functions (e.g.,memset
,memcpy
,strcmp
,strcpy
). It should be included only in implementation files (.c files), replacing direct includes ofassert.h
,stdio.h
,string.h
, anderror_handling.h
. This header should not be included in API headers.trezor_bsp.h
: Contains board-specific definitions (e.g., pin mappings) and STM32 HAL headers, replacing the direct inclusion ofSTM32_HAL_H
andTREZOR_BOARD_H
. It should only be used in platform-specific code (typically withintrezorhal
) and avoided in platform-independent code.trezor_model.h
: Replacesmodel.h
with no current changes.These headers should be included using angle brackets (
#include <...>
) at the beginning of the include block in.c
or.h
files. While this is not technically required, it helps keep the code organized.