1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

storage: add norcow_config.h, reorganize storage sources in SConscript files

This commit is contained in:
Pavol Rusnak 2019-01-24 16:17:37 +01:00
parent 0309e9e520
commit 434a9c2084
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 62 additions and 7 deletions

View File

@ -10,10 +10,14 @@ SOURCE_MOD = []
PYOPT = '1'
# modtrezorconfig
CPPPATH_MOD += [
'embed/extmod/modtrezorconfig',
'vendor/trezor-storage',
]
SOURCE_MOD += [
'embed/extmod/modtrezorconfig/modtrezorconfig.c',
'vendor/trezor-storage/c/norcow.c',
'vendor/trezor-storage/c/storage.c',
'vendor/trezor-storage/norcow.c',
'vendor/trezor-storage/storage.c',
]
# modtrezorcrypto
@ -275,8 +279,8 @@ SOURCE_TREZORHAL = [
'embed/trezorhal/usbd_core.c',
'embed/trezorhal/usbd_ctlreq.c',
'embed/trezorhal/usbd_ioreq.c',
'embed/trezorhal/utils.c',
'embed/trezorhal/util.s',
'embed/trezorhal/utils.c',
'embed/trezorhal/vectortable.s',
]
@ -327,7 +331,6 @@ env.Replace(
'embed/firmware',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'vendor/trezor-storage/c',
'vendor/micropython',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc',
'vendor/micropython/lib/stm32lib/CMSIS/STM32F4xx/Include',

View File

@ -9,10 +9,14 @@ SOURCE_MOD = []
LIBS_MOD = []
# modtrezorconfig
CPPPATH_MOD += [
'embed/extmod/modtrezorconfig',
'vendor/trezor-storage',
]
SOURCE_MOD += [
'embed/extmod/modtrezorconfig/modtrezorconfig.c',
'vendor/trezor-storage/c/norcow.c',
'vendor/trezor-storage/c/storage.c',
'vendor/trezor-storage/norcow.c',
'vendor/trezor-storage/storage.c',
]
# modtrezorcrypto
@ -296,7 +300,6 @@ env.Replace(
'.',
'embed/unix',
'embed/extmod/modtrezorui',
'vendor/trezor-storage/c',
'vendor/micropython',
'vendor/micropython/ports/unix',
'vendor/micropython/lib/mp-readline',

View File

@ -0,0 +1,49 @@
/*
* 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 __NORCOW_CONFIG_H__
#define __NORCOW_CONFIG_H__
#include "flash.h"
#define NORCOW_HEADER_LEN 0
#define NORCOW_SECTOR_COUNT 2
#if TREZOR_MODEL == T
#define NORCOW_SECTOR_SIZE (64*1024)
#define NORCOW_SECTORS {FLASH_SECTOR_STORAGE_1, FLASH_SECTOR_STORAGE_2}
#elif TREZOR_MODEL == 1
#define NORCOW_SECTOR_SIZE (16*1024)
#define NORCOW_SECTORS {2, 3}
#else
#error Unknown TREZOR Model
#endif
/*
* Current storage version.
*/
#define NORCOW_VERSION ((uint32_t)0x00000001)
#endif