parent
16a5858544
commit
efc5ccdaf0
@ -0,0 +1,67 @@
|
||||
/* TREZORv1 firmware linker script */
|
||||
|
||||
ENTRY(reset_handler)
|
||||
|
||||
MEMORY {
|
||||
FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 1024K - 64K
|
||||
SRAM (wal) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
}
|
||||
|
||||
main_stack_base = ORIGIN(SRAM) + LENGTH(SRAM); /* 8-byte aligned full descending stack */
|
||||
_estack = main_stack_base;
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
/* we have no CCMRAM, so erase the first word of SRAM as hack */
|
||||
ccmram_start = ORIGIN(SRAM);
|
||||
ccmram_end = ORIGIN(SRAM) + 4;
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
sram_start = ORIGIN(SRAM);
|
||||
sram_end = ORIGIN(SRAM) + LENGTH(SRAM);
|
||||
_ram_start = sram_start;
|
||||
_ram_end = sram_end;
|
||||
|
||||
_codelen = SIZEOF(.flash) + SIZEOF(.data);
|
||||
_flash_start = ORIGIN(FLASH);
|
||||
_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
|
||||
_heap_start = ADDR(.heap);
|
||||
_heap_end = ADDR(.heap) + SIZEOF(.heap);
|
||||
|
||||
SECTIONS {
|
||||
.header : ALIGN(4) {
|
||||
KEEP(*(.header));
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.flash : ALIGN(512) {
|
||||
KEEP(*(.vector_table));
|
||||
. = ALIGN(4);
|
||||
*(.text*);
|
||||
. = ALIGN(4);
|
||||
*(.rodata*);
|
||||
. = ALIGN(512);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.data : ALIGN(4) {
|
||||
*(.data*);
|
||||
. = ALIGN(512);
|
||||
} >SRAM AT>FLASH
|
||||
|
||||
.bss : ALIGN(4) {
|
||||
*(.bss*);
|
||||
. = ALIGN(4);
|
||||
} >SRAM
|
||||
|
||||
.heap : ALIGN(4) {
|
||||
. = 37K; /* this acts as a build time assertion that at least this much memory is available for heap use */
|
||||
. = ABSOLUTE(sram_end - 16K); /* this explicitly sets the end of the heap effectively giving the stack at most 16K */
|
||||
} >SRAM
|
||||
|
||||
.stack : ALIGN(8) {
|
||||
. = 4K; /* this acts as a build time assertion that at least this much memory is available for stack use */
|
||||
} >SRAM
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
import usb
|
||||
|
||||
usb.bus.open()
|
||||
|
||||
import trezorio as io
|
||||
from trezorui import Display
|
||||
import storage
|
||||
import storage.resident_credentials
|
||||
from trezor import config
|
||||
|
||||
config.init(False)
|
||||
salt = None
|
||||
config.unlock(1, salt)
|
||||
storage.init_unlocked()
|
||||
storage.cache.start_session()
|
||||
print("is_initialized: ", storage.device.is_initialized())
|
||||
print("version: ", storage.device.is_version_stored())
|
||||
print("version: ", storage.device.get_version())
|
||||
print("needs backup: ", storage.device.needs_backup())
|
||||
storage.device.set_backed_up()
|
||||
print("needs backup: ", storage.device.needs_backup())
|
||||
flags = storage.device.get_flags()
|
||||
print("flags", flags)
|
||||
storage.device.set_flags(0x200)
|
||||
print("flags", storage.device.get_flags())
|
||||
|
||||
secret = "0"*32
|
||||
backup_type = 0
|
||||
storage.device.store_mnemonic_secret(
|
||||
secret,
|
||||
backup_type,
|
||||
needs_backup=True,
|
||||
no_backup=True,
|
||||
)
|
||||
|
||||
|
||||
storage.device.set_unfinished_backup(False)
|
||||
print("unfinished backup: ", storage.device.unfinished_backup())
|
||||
storage.device.set_unfinished_backup(True)
|
||||
print("unfinished backup: ", storage.device.unfinished_backup())
|
||||
|
||||
key54 = storage.common.get(0x1, 54, public=True)
|
||||
print("App key 54:", key54)
|
||||
storage.common.set(0x1, 54, b"asdZ", public=True)
|
||||
key54 = storage.common.get(0x1, 54, public=True)
|
||||
print("App key 54 (2):", key54)
|
||||
key54 = storage.common.delete(0x1, 54, public=True)
|
||||
key54 = storage.common.get(0x1, 54, public=True)
|
||||
print("App key 54 (3):", key54)
|
||||
delay = storage.device.get_autolock_delay_ms()
|
||||
print("delay", delay)
|
||||
storage.device.set_autolock_delay_ms(150000)
|
||||
delay = storage.device.get_autolock_delay_ms()
|
||||
print("delay", delay)
|
||||
|
||||
cache_seed = storage.cache.get(storage.cache.APP_COMMON_SEED)
|
||||
print("cache seed", cache_seed)
|
||||
storage.cache.set(storage.cache.APP_COMMON_SEED, 1234)
|
||||
cache_seed = storage.cache.get(storage.cache.APP_COMMON_SEED)
|
||||
print("cache seed", cache_seed)
|
||||
|
||||
res1 = storage.resident_credentials.get(1)
|
||||
print("Res credential 1", res1)
|
||||
res1 = storage.resident_credentials.set(1, b"0"*31 + b"F")
|
||||
res1 = storage.resident_credentials.get(1)
|
||||
print("Res credential 1", res1)
|
||||
|
||||
i = 0
|
||||
|
||||
d = Display()
|
||||
d.clear()
|
||||
d.backlight(255)
|
||||
|
||||
while True:
|
||||
d.clear()
|
||||
d.text(0, 20, "Hamburgefont %d" % i, Display.FONT_NORMAL, 0xFFFF, 0x0000)
|
||||
d.text(0, 40, "Hamburgefont %d" % i, Display.FONT_BOLD, 0xFFFF, 0x0000)
|
||||
d.text(0, 60, "Hamburgefont %d" % i, Display.FONT_MONO, 0xFFFF, 0x0000)
|
||||
i += 1
|
||||
r = [0, 0]
|
||||
if io.poll([io.TOUCH], r, 1000000):
|
||||
print("TOUCH", r)
|
||||
else:
|
||||
print("NOTOUCH")
|
||||
d.refresh()
|
@ -1 +0,0 @@
|
||||
../../src/storage/__init__.py
|
@ -1 +0,0 @@
|
||||
../../src/storage/cache.py
|
@ -1 +0,0 @@
|
||||
../../src/storage/common.py
|
@ -1 +0,0 @@
|
||||
../../src/storage/device.py
|
@ -1 +0,0 @@
|
||||
../../src/storage/resident_credentials.py
|
@ -1 +0,0 @@
|
||||
../../src/trezor/__init__.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/__init__.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/base32.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/base58.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/bech32.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/cashaddr.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/curve.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/der.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/hashlib.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/hmac.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/rlp.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/scripts.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/crypto/slip39.py
|
@ -1 +0,0 @@
|
||||
../../src/trezor/log.py
|
@ -1 +0,0 @@
|
||||
../../../src/trezor/messages/BackupType.py
|
@ -1 +0,0 @@
|
||||
../../src/trezor/utils.py
|
@ -1,29 +0,0 @@
|
||||
import trezorio as io
|
||||
|
||||
iface_wire = io.WebUSB(
|
||||
iface_num=0,
|
||||
ep_in=0x81,
|
||||
ep_out=0x01,
|
||||
)
|
||||
|
||||
iface_vcp = io.VCP(
|
||||
iface_num=2,
|
||||
data_iface_num=3,
|
||||
ep_in=0x83,
|
||||
ep_out=0x03,
|
||||
ep_cmd=0x84,
|
||||
)
|
||||
|
||||
bus = io.USB(
|
||||
vendor_id=0x1209,
|
||||
product_id=0x53C1,
|
||||
release_num=0x0100,
|
||||
manufacturer="SatoshiLabs",
|
||||
product="TREZOR",
|
||||
interface="TREZOR Interface",
|
||||
serial_number="1234",
|
||||
usb21_landing=False,
|
||||
)
|
||||
|
||||
bus.add(iface_wire)
|
||||
bus.add(iface_vcp)
|
Loading…
Reference in new issue