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

refactor(core): rename TRANSLATIONS_AREA to ASSETS_AREA

[no changelog]
This commit is contained in:
tychovrahe 2024-09-26 16:35:59 +02:00 committed by TychoVrahe
parent d361c23224
commit 775780cc8b
5 changed files with 12 additions and 12 deletions

View File

@ -91,7 +91,7 @@ secbool erase_device(flash_progress_callback_t progress_cb) {
static const flash_area_ref_t areas[] = {
{.area = &STORAGE_AREAS[0], .mpu_mode = MPU_MODE_STORAGE},
{.area = &STORAGE_AREAS[1], .mpu_mode = MPU_MODE_STORAGE},
{.area = &TRANSLATIONS_AREA, .mpu_mode = MPU_MODE_ASSETS},
{.area = &ASSETS_AREA, .mpu_mode = MPU_MODE_ASSETS},
#if defined(BOARDLOADER) || defined(BOOTLOADER)
{.area = &FIRMWARE_AREA, .mpu_mode = MPU_MODE_DEFAULT},
#endif

View File

@ -19,8 +19,8 @@ bool translations_write(const uint8_t* data, uint32_t offset, uint32_t len) {
ensure(flash_unlock_write(), "translations_write unlock");
// todo consider alignment
ensure(flash_area_write_data_padded(&TRANSLATIONS_AREA, offset, data, len,
0xFF, FLASH_ALIGN(len)),
ensure(flash_area_write_data_padded(&ASSETS_AREA, offset, data, len, 0xFF,
FLASH_ALIGN(len)),
"translations_write write");
ensure(flash_lock_write(), "translations_write lock");
@ -30,21 +30,21 @@ bool translations_write(const uint8_t* data, uint32_t offset, uint32_t len) {
}
const uint8_t* translations_read(uint32_t* len, uint32_t offset) {
// TODO: _Static_assert was not happy with TRANSLATIONS_AREA.num_subareas == 1
// TODO: _Static_assert was not happy with ASSETS_AREA.num_subareas == 1
// error: expression in static assertion is not constant
assert(TRANSLATIONS_AREA.num_subareas == 1);
*len = flash_area_get_size(&TRANSLATIONS_AREA) - offset;
return flash_area_get_address(&TRANSLATIONS_AREA, offset, 0);
assert(ASSETS_AREA.num_subareas == 1);
*len = flash_area_get_size(&ASSETS_AREA) - offset;
return flash_area_get_address(&ASSETS_AREA, offset, 0);
}
void translations_erase(void) {
mpu_mode_t mpu_mode = mpu_reconfig(MPU_MODE_ASSETS);
ensure(flash_area_erase(&TRANSLATIONS_AREA, NULL), "translations erase");
ensure(flash_area_erase(&ASSETS_AREA, NULL), "translations erase");
mpu_restore(mpu_mode);
}
uint32_t translations_area_bytesize(void) {
return flash_area_get_size(&TRANSLATIONS_AREA);
return flash_area_get_size(&ASSETS_AREA);
}
#endif // KERNEL_MODE

View File

@ -28,7 +28,7 @@ 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 ASSETS_AREA;
extern const flash_area_t BOOTLOADER_AREA;
extern const flash_area_t FIRMWARE_AREA;
extern const flash_area_t UNUSED_AREA;

View File

@ -78,7 +78,7 @@ const flash_area_t SECRET_AREA = {
};
#endif
const flash_area_t TRANSLATIONS_AREA = {
const flash_area_t ASSETS_AREA = {
.num_subareas = 1,
.subarea[0] =
{

View File

@ -68,7 +68,7 @@ const flash_area_t BHK_AREA = {
},
};
const flash_area_t TRANSLATIONS_AREA = {
const flash_area_t ASSETS_AREA = {
.num_subareas = 1,
.subarea[0] =
{