mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-29 18:08:19 +00:00
fixup! refactor(core): improve conditional compilations based on model
This commit is contained in:
parent
d7d33f41a7
commit
63368b2c92
@ -18,7 +18,7 @@ if TREZOR_MODEL in ('1', ):
|
|||||||
)
|
)
|
||||||
Return()
|
Return()
|
||||||
|
|
||||||
FEATURES_WANTED = ["sdcard"]
|
FEATURES_WANTED = ["sd_card"]
|
||||||
|
|
||||||
CCFLAGS_MOD = ''
|
CCFLAGS_MOD = ''
|
||||||
CPPPATH_MOD = []
|
CPPPATH_MOD = []
|
||||||
|
@ -19,7 +19,7 @@ FEATURE_FLAGS = {
|
|||||||
"SYSTEM_VIEW": False,
|
"SYSTEM_VIEW": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
FEATURES_WANTED = ["input", "sbu", "sdcard", "rgb_led"]
|
FEATURES_WANTED = ["input", "sbu", "sd_card", "rgb_led"]
|
||||||
|
|
||||||
CCFLAGS_MOD = ''
|
CCFLAGS_MOD = ''
|
||||||
CPPPATH_MOD = []
|
CPPPATH_MOD = []
|
||||||
|
@ -6,7 +6,7 @@ import tools
|
|||||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||||
|
|
||||||
FEATURES_WANTED = ["input", "sbu", "sdcard", "rdb_led"]
|
FEATURES_WANTED = ["input", "sbu", "sd_card", "rdb_led"]
|
||||||
|
|
||||||
CCFLAGS_MOD = ''
|
CCFLAGS_MOD = ''
|
||||||
CPPPATH_MOD = []
|
CPPPATH_MOD = []
|
||||||
|
@ -6,7 +6,7 @@ import tools
|
|||||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||||
|
|
||||||
FEATURES_WANTED = ["input", "sdcard"]
|
FEATURES_WANTED = ["input", "sd_card"]
|
||||||
|
|
||||||
CCFLAGS_MOD = ''
|
CCFLAGS_MOD = ''
|
||||||
CPPPATH_MOD = []
|
CPPPATH_MOD = []
|
||||||
|
@ -686,13 +686,11 @@ def cargo_build():
|
|||||||
if DMA2D:
|
if DMA2D:
|
||||||
features.append('dma2d')
|
features.append('dma2d')
|
||||||
|
|
||||||
if TREZOR_MODEL in ('T',) :
|
if TREZOR_MODEL in ('T',):
|
||||||
features.append('touch')
|
features.append('touch')
|
||||||
if TREZOR_MODEL in ('R') :
|
features.append('sd_card')
|
||||||
features.append('buttons')
|
if TREZOR_MODEL in ('R', '1'):
|
||||||
if TREZOR_MODEL in ('1') :
|
features.append('button')
|
||||||
features.append('buttons')
|
|
||||||
|
|
||||||
|
|
||||||
env.get('ENV')['TREZOR_MODEL'] = TREZOR_MODEL
|
env.get('ENV')['TREZOR_MODEL'] = TREZOR_MODEL
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@ dma2d = []
|
|||||||
ui_debug = []
|
ui_debug = []
|
||||||
ui_bounds = []
|
ui_bounds = []
|
||||||
bootloader = []
|
bootloader = []
|
||||||
buttons = []
|
button = []
|
||||||
touch = []
|
touch = []
|
||||||
clippy = []
|
clippy = []
|
||||||
jpeg = []
|
jpeg = []
|
||||||
debug = ["ui_debug"]
|
debug = ["ui_debug"]
|
||||||
sbu = []
|
sbu = []
|
||||||
sdcard = []
|
sd_card = []
|
||||||
rgb_led = []
|
rgb_led = []
|
||||||
test = ["cc", "glob", "micropython", "protobuf", "ui", "ui_debug", "dma2d", "touch"]
|
test = ["cc", "glob", "micropython", "protobuf", "ui", "ui_debug", "dma2d", "touch"]
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::ffi;
|
use super::ffi;
|
||||||
|
|
||||||
#[cfg(feature = "buttons")]
|
#[cfg(feature = "button")]
|
||||||
pub use super::ffi::{BTN_EVT_DOWN, BTN_EVT_UP, BTN_LEFT, BTN_RIGHT};
|
pub use super::ffi::{BTN_EVT_DOWN, BTN_EVT_UP, BTN_LEFT, BTN_RIGHT};
|
||||||
|
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
@ -8,7 +8,7 @@ pub fn io_touch_read() -> u32 {
|
|||||||
unsafe { ffi::touch_read() }
|
unsafe { ffi::touch_read() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "buttons")]
|
#[cfg(feature = "button")]
|
||||||
pub fn io_button_read() -> u32 {
|
pub fn io_button_read() -> u32 {
|
||||||
unsafe { ffi::button_read() }
|
unsafe { ffi::button_read() }
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "buttons")]
|
#[cfg(feature = "button")]
|
||||||
use crate::ui::event::ButtonEvent;
|
use crate::ui::event::ButtonEvent;
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
use crate::ui::event::TouchEvent;
|
use crate::ui::event::TouchEvent;
|
||||||
@ -347,7 +347,7 @@ where
|
|||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum Event<'a> {
|
pub enum Event<'a> {
|
||||||
#[cfg(feature = "buttons")]
|
#[cfg(feature = "button")]
|
||||||
Button(ButtonEvent),
|
Button(ButtonEvent),
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
Touch(TouchEvent),
|
Touch(TouchEvent),
|
||||||
|
@ -23,7 +23,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "buttons")]
|
#[cfg(feature = "button")]
|
||||||
use crate::ui::event::ButtonEvent;
|
use crate::ui::event::ButtonEvent;
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
use crate::ui::event::TouchEvent;
|
use crate::ui::event::TouchEvent;
|
||||||
@ -400,7 +400,7 @@ extern "C" fn ui_layout_touch_event(_n_args: usize, _args: *const Obj) -> Obj {
|
|||||||
Obj::const_none()
|
Obj::const_none()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "buttons")]
|
#[cfg(feature = "button")]
|
||||||
extern "C" fn ui_layout_button_event(n_args: usize, args: *const Obj) -> Obj {
|
extern "C" fn ui_layout_button_event(n_args: usize, args: *const Obj) -> Obj {
|
||||||
let block = |args: &[Obj], _kwargs: &Map| {
|
let block = |args: &[Obj], _kwargs: &Map| {
|
||||||
if args.len() != 3 {
|
if args.len() != 3 {
|
||||||
@ -414,7 +414,7 @@ extern "C" fn ui_layout_button_event(n_args: usize, args: *const Obj) -> Obj {
|
|||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, &Map::EMPTY, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, &Map::EMPTY, block) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "buttons"))]
|
#[cfg(not(feature = "button"))]
|
||||||
extern "C" fn ui_layout_button_event(_n_args: usize, _args: *const Obj) -> Obj {
|
extern "C" fn ui_layout_button_event(_n_args: usize, _args: *const Obj) -> Obj {
|
||||||
Obj::const_none()
|
Obj::const_none()
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#ifdef TREZOR_MODEL_T
|
#ifdef TREZOR_MODEL_T
|
||||||
#define USE_TOUCH 1
|
#define USE_TOUCH 1
|
||||||
#define USE_SD_CARD 1
|
#define USE_SDCARD 1
|
||||||
#define USE_SBU 1
|
#define USE_SBU 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ def configure(env, features_wanted, defines, sources):
|
|||||||
|
|
||||||
if "input" in features_wanted:
|
if "input" in features_wanted:
|
||||||
sources += ['embed/trezorhal/button.c']
|
sources += ['embed/trezorhal/button.c']
|
||||||
features_available.append("buttons")
|
features_available.append("button")
|
||||||
|
|
||||||
env.get('ENV')['TREZOR_BOARD'] = board
|
env.get('ENV')['TREZOR_BOARD'] = board
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ def configure(env, features_wanted, defines, sources):
|
|||||||
|
|
||||||
if "input" in features_wanted:
|
if "input" in features_wanted:
|
||||||
sources += ['embed/trezorhal/button.c']
|
sources += ['embed/trezorhal/button.c']
|
||||||
features_available.append("buttons")
|
features_available.append("button")
|
||||||
|
|
||||||
if "rgb_led" in features_wanted:
|
if "rgb_led" in features_wanted:
|
||||||
sources += ['embed/trezorhal/rgb_led.c']
|
sources += ['embed/trezorhal/rgb_led.c']
|
||||||
|
@ -15,7 +15,7 @@ def configure(env, features_wanted, defines, sources):
|
|||||||
|
|
||||||
if "input" in features_wanted:
|
if "input" in features_wanted:
|
||||||
sources += ['embed/trezorhal/button.c']
|
sources += ['embed/trezorhal/button.c']
|
||||||
features_available.append("buttons")
|
features_available.append("button")
|
||||||
|
|
||||||
if "sbu" in features_wanted:
|
if "sbu" in features_wanted:
|
||||||
sources += ['embed/trezorhal/sbu.c', ]
|
sources += ['embed/trezorhal/sbu.c', ]
|
||||||
|
@ -19,11 +19,11 @@ def configure(env, features_wanted, defines, sources):
|
|||||||
sources += ['embed/trezorhal/touch/ft6x36.c', ]
|
sources += ['embed/trezorhal/touch/ft6x36.c', ]
|
||||||
features_available.append("touch")
|
features_available.append("touch")
|
||||||
|
|
||||||
if "sdcard" in features_wanted:
|
if "sd_card" in features_wanted:
|
||||||
sources += ['embed/trezorhal/sdcard.c', ]
|
sources += ['embed/trezorhal/sdcard.c', ]
|
||||||
sources += ['embed/extmod/modtrezorio/ff.c', ]
|
sources += ['embed/extmod/modtrezorio/ff.c', ]
|
||||||
sources += ['embed/extmod/modtrezorio/ffunicode.c', ]
|
sources += ['embed/extmod/modtrezorio/ffunicode.c', ]
|
||||||
features_available.append("sdcard")
|
features_available.append("sd_card")
|
||||||
|
|
||||||
if "sbu" in features_wanted:
|
if "sbu" in features_wanted:
|
||||||
sources += ['embed/trezorhal/sbu.c', ]
|
sources += ['embed/trezorhal/sbu.c', ]
|
||||||
|
Loading…
Reference in New Issue
Block a user