mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-19 05:58:09 +00:00
refactor(core): use common layout.c file
[no changelog]
This commit is contained in:
parent
21c1359ac6
commit
d412ce987e
@ -1 +0,0 @@
|
||||
../T2T1/model_T2T1_layout.c
|
@ -1,102 +0,0 @@
|
||||
#include "flash.h"
|
||||
#include "model.h"
|
||||
|
||||
const flash_area_t STORAGE_AREAS[STORAGE_AREAS_COUNT] = {
|
||||
{
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = STORAGE_1_SECTOR_START,
|
||||
.num_sectors =
|
||||
STORAGE_1_SECTOR_END - STORAGE_1_SECTOR_START + 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = STORAGE_2_SECTOR_START,
|
||||
.num_sectors =
|
||||
STORAGE_2_SECTOR_END - STORAGE_2_SECTOR_START + 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOARDLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = BOARDLOADER_SECTOR_START,
|
||||
.num_sectors =
|
||||
BOARDLOADER_SECTOR_END - BOARDLOADER_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t TRANSLATIONS_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = ASSETS_SECTOR_START,
|
||||
.num_sectors = ASSETS_SECTOR_END - ASSETS_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOOTLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = BOOTLOADER_SECTOR_START,
|
||||
.num_sectors = BOOTLOADER_SECTOR_END - BOOTLOADER_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t FIRMWARE_AREA = {
|
||||
.num_subareas = 2,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = FIRMWARE_P1_SECTOR_START,
|
||||
.num_sectors =
|
||||
FIRMWARE_P1_SECTOR_END - FIRMWARE_P1_SECTOR_START + 1,
|
||||
},
|
||||
.subarea[1] =
|
||||
{
|
||||
.first_sector = FIRMWARE_P2_SECTOR_START,
|
||||
.num_sectors =
|
||||
FIRMWARE_P2_SECTOR_END - FIRMWARE_P2_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef SECRET_SECTOR_START
|
||||
const flash_area_t SECRET_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = SECRET_SECTOR_START,
|
||||
.num_sectors = SECRET_SECTOR_END - SECRET_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
#else
|
||||
const flash_area_t SECRET_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = 0,
|
||||
.num_sectors = 0,
|
||||
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
const flash_area_t UNUSED_AREA = {
|
||||
.num_subareas = 2,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = UNUSED_1_SECTOR_START,
|
||||
.num_sectors = UNUSED_1_SECTOR_END - UNUSED_1_SECTOR_START + 1,
|
||||
},
|
||||
.subarea[1] =
|
||||
{
|
||||
.first_sector = UNUSED_2_SECTOR_START,
|
||||
.num_sectors = UNUSED_2_SECTOR_END - UNUSED_2_SECTOR_START + 1,
|
||||
},
|
||||
};
|
@ -1,82 +0,0 @@
|
||||
#include "flash.h"
|
||||
#include "model.h"
|
||||
|
||||
const flash_area_t STORAGE_AREAS[STORAGE_AREAS_COUNT] = {
|
||||
{
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = STORAGE_1_SECTOR_START,
|
||||
.num_sectors =
|
||||
STORAGE_1_SECTOR_END - STORAGE_1_SECTOR_START + 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = STORAGE_2_SECTOR_START,
|
||||
.num_sectors =
|
||||
STORAGE_2_SECTOR_END - STORAGE_2_SECTOR_START + 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOARDLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = BOARDLOADER_SECTOR_START,
|
||||
.num_sectors =
|
||||
BOARDLOADER_SECTOR_END - BOARDLOADER_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOOTLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = BOOTLOADER_SECTOR_START,
|
||||
.num_sectors = BOOTLOADER_SECTOR_END - BOOTLOADER_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t FIRMWARE_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = FIRMWARE_SECTOR_START,
|
||||
.num_sectors = FIRMWARE_SECTOR_END - FIRMWARE_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t SECRET_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = SECRET_SECTOR_START,
|
||||
.num_sectors = SECRET_SECTOR_END - SECRET_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BHK_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = BHK_SECTOR_START,
|
||||
.num_sectors = BHK_SECTOR_END - BHK_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t TRANSLATIONS_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = ASSETS_SECTOR_START,
|
||||
.num_sectors = ASSETS_SECTOR_END - ASSETS_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t UNUSED_AREA = {
|
||||
.num_subareas = 0,
|
||||
};
|
@ -1,82 +0,0 @@
|
||||
#include "flash.h"
|
||||
#include "model.h"
|
||||
|
||||
const flash_area_t STORAGE_AREAS[STORAGE_AREAS_COUNT] = {
|
||||
{
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = STORAGE_1_SECTOR_START,
|
||||
.num_sectors =
|
||||
STORAGE_1_SECTOR_END - STORAGE_1_SECTOR_START + 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = STORAGE_2_SECTOR_START,
|
||||
.num_sectors =
|
||||
STORAGE_2_SECTOR_END - STORAGE_2_SECTOR_START + 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOARDLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = BOARDLOADER_SECTOR_START,
|
||||
.num_sectors =
|
||||
BOARDLOADER_SECTOR_END - BOARDLOADER_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOOTLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = BOOTLOADER_SECTOR_START,
|
||||
.num_sectors = BOOTLOADER_SECTOR_END - BOOTLOADER_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t FIRMWARE_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = FIRMWARE_SECTOR_START,
|
||||
.num_sectors = FIRMWARE_SECTOR_END - FIRMWARE_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t SECRET_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = SECRET_SECTOR_START,
|
||||
.num_sectors = SECRET_SECTOR_END - SECRET_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BHK_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = BHK_SECTOR_START,
|
||||
.num_sectors = BHK_SECTOR_END - BHK_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t TRANSLATIONS_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = ASSETS_SECTOR_START,
|
||||
.num_sectors = ASSETS_SECTOR_END - ASSETS_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t UNUSED_AREA = {
|
||||
.num_subareas = 0,
|
||||
};
|
@ -11,15 +11,4 @@
|
||||
#define FLASH_OTP_BLOCK_DEVICE_VARIANT 4
|
||||
#define FLASH_OTP_BLOCK_FIRMWARE_VERSION 5
|
||||
|
||||
#define STORAGE_AREAS_COUNT (2)
|
||||
|
||||
extern const flash_area_t STORAGE_AREAS[STORAGE_AREAS_COUNT];
|
||||
extern const flash_area_t BOARDLOADER_AREA;
|
||||
extern const flash_area_t SECRET_AREA;
|
||||
extern const flash_area_t BHK_AREA;
|
||||
extern const flash_area_t TRANSLATIONS_AREA;
|
||||
extern const flash_area_t BOOTLOADER_AREA;
|
||||
extern const flash_area_t FIRMWARE_AREA;
|
||||
extern const flash_area_t UNUSED_AREA;
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef MODELS_MODEL_H_
|
||||
#define MODELS_MODEL_H_
|
||||
|
||||
#include "layout.h"
|
||||
#include "layout_common.h"
|
||||
|
||||
#if defined TREZOR_MODEL_T
|
||||
|
36
core/embed/trezorhal/layout.h
Normal file
36
core/embed/trezorhal/layout.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TREZORHAL_LAYOUT_H_
|
||||
#define TREZORHAL_LAYOUT_H_
|
||||
|
||||
#include "flash_area.h"
|
||||
|
||||
#define STORAGE_AREAS_COUNT (2)
|
||||
|
||||
extern const flash_area_t STORAGE_AREAS[STORAGE_AREAS_COUNT];
|
||||
extern const flash_area_t BOARDLOADER_AREA;
|
||||
extern const flash_area_t SECRET_AREA;
|
||||
extern const flash_area_t BHK_AREA;
|
||||
extern const flash_area_t TRANSLATIONS_AREA;
|
||||
extern const flash_area_t BOOTLOADER_AREA;
|
||||
extern const flash_area_t FIRMWARE_AREA;
|
||||
extern const flash_area_t UNUSED_AREA;
|
||||
|
||||
#endif // TREZORHAL_LAYOUT_H_
|
@ -32,15 +32,6 @@ const flash_area_t BOARDLOADER_AREA = {
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t TRANSLATIONS_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = ASSETS_SECTOR_START,
|
||||
.num_sectors = ASSETS_SECTOR_END - ASSETS_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOOTLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
@ -87,6 +78,15 @@ const flash_area_t SECRET_AREA = {
|
||||
};
|
||||
#endif
|
||||
|
||||
const flash_area_t TRANSLATIONS_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = ASSETS_SECTOR_START,
|
||||
.num_sectors = ASSETS_SECTOR_END - ASSETS_SECTOR_START + 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t UNUSED_AREA = {
|
||||
.num_subareas = 2,
|
||||
.subarea[0] =
|
@ -33,9 +33,6 @@ def configure(
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/D001/model_D001_layout.c",
|
||||
]
|
||||
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += [
|
||||
|
@ -40,9 +40,6 @@ def configure(
|
||||
defines += [
|
||||
f"HW_REVISION={hw_revision}",
|
||||
]
|
||||
sources += [
|
||||
"embed/models/D002/model_D002_layout.c",
|
||||
]
|
||||
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += [
|
||||
|
@ -44,6 +44,6 @@ def configure(
|
||||
sources += ["embed/trezorhal/unix/button.c"]
|
||||
features_available.append("button")
|
||||
|
||||
sources += ["embed/models/T2B1/model_T2B1_layout.c"]
|
||||
sources += ["embed/trezorhal/stm32f4/layout.c"]
|
||||
|
||||
return features_available
|
||||
|
@ -38,9 +38,6 @@ def configure(
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/T2B1/model_T2B1_layout.c",
|
||||
]
|
||||
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += ["embed/trezorhal/xdisplay_legacy.c"]
|
||||
|
@ -38,9 +38,6 @@ def configure(
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/T2B1/model_T2B1_layout.c",
|
||||
]
|
||||
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += ["embed/trezorhal/xdisplay_legacy.c"]
|
||||
|
@ -38,9 +38,6 @@ def configure(
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/T2B1/model_T2B1_layout.c",
|
||||
]
|
||||
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += ["embed/trezorhal/xdisplay_legacy.c"]
|
||||
|
@ -38,9 +38,6 @@ def configure(
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/T2B1/model_T2B1_layout.c",
|
||||
]
|
||||
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += ["embed/trezorhal/xdisplay_legacy.c"]
|
||||
|
@ -56,6 +56,6 @@ def configure(
|
||||
|
||||
features_available.append("backlight")
|
||||
|
||||
sources += ["embed/models/T2T1/model_T2T1_layout.c"]
|
||||
sources += ["embed/trezorhal/stm32f4/layout.c"]
|
||||
|
||||
return features_available
|
||||
|
@ -39,7 +39,6 @@ def configure(
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/T2T1/model_T2T1_layout.c",
|
||||
"embed/models/T2T1/compat_settings.c",
|
||||
]
|
||||
|
||||
|
@ -44,6 +44,6 @@ def configure(
|
||||
sources += ["embed/trezorhal/unix/button.c"]
|
||||
features_available.append("button")
|
||||
|
||||
sources += ["embed/models/T3B1/model_T3B1_layout.c"]
|
||||
sources += ["embed/trezorhal/stm32u5/layout.c"]
|
||||
|
||||
return features_available
|
||||
|
@ -39,9 +39,6 @@ def configure(
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={ord(hw_revision)}"]
|
||||
sources += [
|
||||
"embed/models/T3B1/model_T3B1_layout.c",
|
||||
]
|
||||
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += ["embed/trezorhal/xdisplay_legacy.c"]
|
||||
|
@ -65,6 +65,6 @@ def configure(
|
||||
|
||||
features_available.append("backlight")
|
||||
|
||||
sources += ["embed/models/T3T1/model_T3T1_layout.c"]
|
||||
sources += ["embed/trezorhal/stm32u5/layout.c"]
|
||||
|
||||
return features_available
|
||||
|
@ -43,9 +43,6 @@ def configure(
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/T3T1/model_T3T1_layout.c",
|
||||
]
|
||||
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += ["embed/trezorhal/xdisplay_legacy.c"]
|
||||
|
@ -43,9 +43,6 @@ def configure(
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/T3T1/model_T3T1_layout.c",
|
||||
]
|
||||
sources += [
|
||||
f"embed/trezorhal/stm32u5/displays/{display}",
|
||||
]
|
||||
|
@ -48,6 +48,7 @@ def stm32f4_common_files(env, defines, sources, paths):
|
||||
"embed/trezorhal/stm32f4/flash.c",
|
||||
"embed/trezorhal/stm32f4/flash_otp.c",
|
||||
"embed/trezorhal/stm32f4/fwutils.c",
|
||||
"embed/trezorhal/stm32f4/layout.c",
|
||||
"embed/trezorhal/stm32f4/lowlevel.c",
|
||||
"embed/trezorhal/stm32f4/monoctr.c",
|
||||
"embed/trezorhal/stm32f4/mpu.c",
|
||||
|
@ -57,6 +57,7 @@ def stm32u5_common_files(env, defines, sources, paths):
|
||||
"embed/trezorhal/stm32u5/flash.c",
|
||||
"embed/trezorhal/stm32u5/flash_otp.c",
|
||||
"embed/trezorhal/stm32u5/fwutils.c",
|
||||
"embed/trezorhal/stm32u5/layout.c",
|
||||
"embed/trezorhal/stm32u5/lowlevel.c",
|
||||
"embed/trezorhal/stm32u5/hash_processor.c",
|
||||
"embed/trezorhal/stm32u5/monoctr.c",
|
||||
|
Loading…
Reference in New Issue
Block a user