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

pull/25/head
Pavol Rusnak 5 years ago
parent 0309e9e520
commit 434a9c2084
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -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',

@ -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',

@ -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
Loading…
Cancel
Save