Skip to content

Commit

Permalink
refactor(core): define model-specific include files in site-scons
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
TychoVrahe committed Jan 15, 2025
1 parent ed2abfc commit e5c278e
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 42 deletions.
22 changes: 2 additions & 20 deletions core/embed/models/model_version.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
#ifndef MODELS_MODEL_H_
#define MODELS_MODEL_H_
#pragma once

#if defined TREZOR_MODEL_T2T1
#include "T2T1/versions.h"
#elif defined TREZOR_MODEL_T2B1
#include "T2B1/versions.h"
#elif defined TREZOR_MODEL_T3T1
#include "T3T1/versions.h"
#elif defined TREZOR_MODEL_T3B1
#include "T3B1/versions.h"
#elif defined TREZOR_MODEL_T3W1
#include "T3W1/versions.h"
#elif defined TREZOR_MODEL_D001
#include "D001/versions.h"
#elif defined TREZOR_MODEL_D002
#include "D002/versions.h"
#else
#error Unknown Trezor model
#endif

#endif
#include VERSIONS_HEADER
24 changes: 2 additions & 22 deletions core/embed/models/trezor_model.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
#ifndef MODELS_MODEL_H_
#define MODELS_MODEL_H_
#pragma once

#include <util/flash_layout.h>
#include "otp_layout.h"

#if defined TREZOR_MODEL_T2T1
#include "T2T1/model_T2T1.h"
#elif defined TREZOR_MODEL_T2B1
#include "T2B1/model_T2B1.h"
#elif defined TREZOR_MODEL_T3T1
#include "T3T1/model_T3T1.h"
#elif defined TREZOR_MODEL_T3B1
#include "T3B1/model_T3B1.h"
#elif defined TREZOR_MODEL_T3W1
#include "T3W1/model_T3W1.h"
#elif defined TREZOR_MODEL_D001
#include "D001/model_D001.h"
#elif defined TREZOR_MODEL_D002
#include "D002/model_D002.h"
#else
#error Unknown Trezor model
#endif

#endif
#include MODEL_HEADER
3 changes: 3 additions & 0 deletions core/site_scons/models/D001/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def configure_board(
sources: list[str],
paths: list[str],
):

defines += ("MODEL_HEADER", '"D001/model_D001.h"')
defines += ("VERSIONS_HEADER", '"D001/versions.h"')
return configure(env, features_wanted, defines, sources, paths)


Expand Down
2 changes: 2 additions & 0 deletions core/site_scons/models/D002/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def configure_board(
sources: list[str],
paths: list[str],
):
defines += (("MODEL_HEADER", '"D002/model_D002.h"'),)
defines += (("VERSIONS_HEADER", '"D002/versions.h"'),)
return configure(env, features_wanted, defines, sources, paths)


Expand Down
3 changes: 3 additions & 0 deletions core/site_scons/models/T2B1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def configure_board(
sources: list[str],
paths: list[str],
):
defines += (("MODEL_HEADER", '"T2B1/model_T2B1.h"'),)
defines += (("VERSIONS_HEADER", '"T2B1/versions.h"'),)

# Set default revision if None
revision = revision or 10

Expand Down
3 changes: 3 additions & 0 deletions core/site_scons/models/T2T1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ def configure_board(
sources: list[str],
paths: list[str],
):
defines += (("MODEL_HEADER", '"T2T1/model_T2T1.h"'),)
defines += (("VERSIONS_HEADER", '"T2T1/versions.h"'),)

if revision == "emulator":
return emul(env, features_wanted, defines, sources, paths)
else:
Expand Down
3 changes: 3 additions & 0 deletions core/site_scons/models/T3B1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def configure_board(
sources: list[str],
paths: list[str],
):
defines += (("MODEL_HEADER", '"T3B1/model_T3B1.h"'),)
defines += (("VERSIONS_HEADER", '"T3B1/versions.h"'),)

# Set default revision if None
revision = revision or "B"

Expand Down
3 changes: 3 additions & 0 deletions core/site_scons/models/T3T1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def configure_board(
sources: list[str],
paths: list[str],
):
defines += (("MODEL_HEADER", '"T3T1/model_T3T1.h"'),)
defines += (("VERSIONS_HEADER", '"T3T1/versions.h"'),)

# Set default revision if None
revision = revision or "E"

Expand Down
3 changes: 3 additions & 0 deletions core/site_scons/models/T3W1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def configure_board(
sources: list[str],
paths: list[str],
):
defines += (("MODEL_HEADER", '"T3W1/model_T3W1.h"'),)
defines += (("VERSIONS_HEADER", '"T3W1/versions.h"'),)

# Set default revision if None
revision = revision or "A"

Expand Down

0 comments on commit e5c278e

Please sign in to comment.