Skip to content

Commit 818835a

Browse files
committed
Merge branch 'feat/simulator-be-nova'
2 parents 99d8eb3 + d5db2a1 commit 818835a

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ customers cannot upgrade their bootloader, its changes are recorded separately.
1111
- Unlock is now faster after password/passphrase entry (shorter unlock animation)
1212
- Remove option to restore from 18 recovery words
1313
- simulator: enable Test Merchant for payment requests
14+
- simulator: simulate a Nova device
1415

1516
### 9.23.1
1617
- EVM: add HyperEVM (HYPE) and SONIC (S) to known networks

test/hardware-fakes/include/fake_memory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <flags.h>
2222

2323
void fake_memory_factoryreset(void);
24+
bool fake_memory_nova(void);
2425
bool memory_write_to_address_fake(uint32_t base, uint32_t addr, const uint8_t* chunk);
2526
bool memory_write_chunk_fake(uint32_t chunk_num, const uint8_t* chunk);
2627
void memory_read_chunk_fake(uint32_t chunk_num, uint8_t* chunk_out);

test/hardware-fakes/src/fake_memory.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <fake_memory.h>
1616
#include <flags.h>
1717
#include <memory/memory.h>
18+
#include <memory/memory_shared.h>
1819
#include <stdio.h>
1920
#include <string.h>
2021

@@ -28,6 +29,25 @@ void fake_memory_factoryreset(void)
2829
memset(_memory_app_data, 0xff, sizeof(_memory_app_data));
2930
memset(_memory_smarteeprom, 0xff, sizeof(_memory_smarteeprom));
3031
}
32+
#define ALLOWED_HASH \
33+
"\x1e\x4a\xa8\x36\x4e\x93\x5c\x07\x85\xe4\xf8\x91\x20\x83\x07\xd8\x32\xf7\x88\x17\x2e\x4b\xf6" \
34+
"\x16\x21\xde\x6d\xf9\xec\x3c\x21\x5f"
35+
36+
bool fake_memory_nova(void)
37+
{
38+
chunk_shared_t* shared_ptr = (chunk_shared_t*)&_memory_shared_data[0];
39+
shared_ptr->fields.platform = MEMORY_PLATFORM_BITBOX02_PLUS;
40+
41+
memory_ble_metadata_t ble_metadata = {0};
42+
memcpy(ble_metadata.allowed_firmware_hash, ALLOWED_HASH, sizeof(ALLOWED_HASH) - 1);
43+
if (!memory_set_ble_metadata(&ble_metadata)) {
44+
return false;
45+
}
46+
if (!memory_ble_enable(false)) {
47+
return false;
48+
}
49+
return true;
50+
}
3151

3252
static uint8_t* _get_memory(uint32_t base)
3353
{

test/simulator/simulator.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <fake_memory.h>
2020
#include <fcntl.h>
2121
#include <memory/memory.h>
22+
#include <memory/memory_shared.h>
2223
#include <queue.h>
2324
#include <random.h>
2425
#include <rust/rust.h>
@@ -128,6 +129,10 @@ int main(int argc, char* argv[])
128129
perror("ERROR, memory setup failed");
129130
return 1;
130131
}
132+
if (!fake_memory_nova()) {
133+
printf("fake_memory_nova failed");
134+
return 1;
135+
}
131136

132137
smarteeprom_bb02_config();
133138
bitbox02_smarteeprom_init();

0 commit comments

Comments
 (0)