flash: nor: use binary prefixes consistently

When printing memory sizes standard ISO 80000-1 prefixes should be used.
Also a space should be added between any number and its unit according
to papers publication rules.

Change-Id: Id1d35e210766b55c201de4e80ac165d8d0414d0a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6416
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Paul Fertser 2021-08-07 21:55:30 +03:00 committed by Antonio Borneo
parent f77c919cf4
commit 66d6f9a1e7
10 changed files with 27 additions and 27 deletions

View File

@ -1075,8 +1075,8 @@ static int efm32x_probe(struct flash_bank *bank)
LOG_INFO("detected part: %s Gecko, rev %d",
efm32_mcu_info->family_data->name, efm32_mcu_info->prod_rev);
LOG_INFO("flash size = %dkbytes", efm32_mcu_info->flash_sz_kib);
LOG_INFO("flash page size = %dbytes", efm32_mcu_info->page_size);
LOG_INFO("flash size = %d KiB", efm32_mcu_info->flash_sz_kib);
LOG_INFO("flash page size = %d B", efm32_mcu_info->page_size);
assert(efm32_mcu_info->page_size != 0);

View File

@ -709,7 +709,7 @@ static int em357_probe(struct flash_bank *bank)
em357_info->ppage_size = 4;
LOG_INFO("flash size = %dkbytes", num_pages*page_size/1024);
LOG_INFO("flash size = %d KiB", num_pages*page_size/1024);
free(bank->sectors);

View File

@ -2662,12 +2662,12 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
snprintf(k_chip->name, sizeof(k_chip->name), name, flash_marking);
LOG_INFO("Kinetis %s detected: %u flash blocks", k_chip->name, num_blocks);
LOG_INFO("%u PFlash banks: %" PRIu32 "k total", k_chip->num_pflash_blocks, pflash_size_k);
LOG_INFO("%u PFlash banks: %" PRIu32 " KiB total", k_chip->num_pflash_blocks, pflash_size_k);
if (k_chip->num_nvm_blocks) {
nvm_size_k = k_chip->nvm_size / 1024;
dflash_size_k = k_chip->dflash_size / 1024;
LOG_INFO("%u FlexNVM banks: %" PRIu32 "k total, %" PRIu32 "k available as data flash, %" PRIu32 "bytes FlexRAM",
k_chip->num_nvm_blocks, nvm_size_k, dflash_size_k, ee_size);
LOG_INFO("%u FlexNVM banks: %" PRIu32 " KiB total, %" PRIu32 " KiB available as data flash, %"
PRIu32 " bytes FlexRAM", k_chip->num_nvm_blocks, nvm_size_k, dflash_size_k, ee_size);
}
k_chip->probed = true;

View File

@ -759,7 +759,7 @@ static int pic32mx_probe(struct flash_bank *bank)
}
}
LOG_INFO("flash size = %" PRIu32 "kbytes", num_pages / 1024);
LOG_INFO("flash size = %" PRIu32 " KiB", num_pages / 1024);
free(bank->sectors);

View File

@ -774,7 +774,7 @@ static int psoc4_probe(struct flash_bank *bank)
num_macros++;
}
LOG_DEBUG("SPCIF geometry: %" PRIu32 " kb flash, row %" PRIu32 " bytes.",
LOG_DEBUG("SPCIF geometry: %" PRIu32 " KiB flash, row %" PRIu32 " bytes.",
flash_size_in_kb, row_size);
/* if the user sets the size manually then ignore the probed value
@ -788,7 +788,7 @@ static int psoc4_probe(struct flash_bank *bank)
if (num_macros > 1)
snprintf(macros_txt, sizeof(macros_txt), " in %" PRIu32 " macros", num_macros);
LOG_INFO("flash size = %" PRIu32 " kbytes%s", flash_size_in_kb, macros_txt);
LOG_INFO("flash size = %" PRIu32 " KiB%s", flash_size_in_kb, macros_txt);
/* calculate number of pages */
uint32_t num_rows = flash_size_in_kb * 1024 / row_size;

View File

@ -1006,7 +1006,7 @@ static int stm32x_probe(struct flash_bank *bank)
flash_size_in_kb = stm32x_info->user_bank_size / 1024;
}
LOG_INFO("flash size = %dkbytes", flash_size_in_kb);
LOG_INFO("flash size = %d KiB", flash_size_in_kb);
/* did we assign flash size? */
assert(flash_size_in_kb != 0xffff);

View File

@ -1125,7 +1125,7 @@ static int stm32x_probe(struct flash_bank *bank)
flash_size_in_kb = stm32x_info->user_bank_size / 1024;
}
LOG_INFO("flash size = %" PRIu16 " kbytes", flash_size_in_kb);
LOG_INFO("flash size = %" PRIu16 " KiB", flash_size_in_kb);
/* did we assign flash size? */
assert(flash_size_in_kb != 0xffff);

View File

@ -1816,7 +1816,7 @@ static int stm32l4_probe(struct flash_bank *bank)
flash_size_kb = stm32l4_info->user_bank_size / 1024;
}
LOG_INFO("flash size = %dkbytes", flash_size_kb);
LOG_INFO("flash size = %d KiB", flash_size_kb);
/* did we assign a flash size? */
assert((flash_size_kb != 0xffff) && flash_size_kb);

View File

@ -754,13 +754,13 @@ COMMAND_HANDLER(stmqspi_handle_set)
bank->sectors = sectors;
stmqspi_info->dev.name = stmqspi_info->devname;
if (stmqspi_info->dev.size_in_bytes / 4096)
LOG_INFO("flash \'%s\' id = unknown\nchip size = %" PRIu32 "kbytes,"
" bank size = %" PRIu32 "kbytes", stmqspi_info->dev.name,
LOG_INFO("flash \'%s\' id = unknown\nchip size = %" PRIu32 " KiB,"
" bank size = %" PRIu32 " KiB", stmqspi_info->dev.name,
stmqspi_info->dev.size_in_bytes / 1024,
(stmqspi_info->dev.size_in_bytes / 1024) << dual);
else
LOG_INFO("flash \'%s\' id = unknown\nchip size = %" PRIu32 "bytes,"
" bank size = %" PRIu32 "bytes", stmqspi_info->dev.name,
LOG_INFO("flash \'%s\' id = unknown\nchip size = %" PRIu32 " B,"
" bank size = %" PRIu32 " B", stmqspi_info->dev.name,
stmqspi_info->dev.size_in_bytes,
stmqspi_info->dev.size_in_bytes << dual);
@ -2206,10 +2206,10 @@ static int stmqspi_probe(struct flash_bank *bank)
memcpy(&stmqspi_info->dev, p, sizeof(stmqspi_info->dev));
if (p->size_in_bytes / 4096)
LOG_INFO("flash1 \'%s\' id = 0x%06" PRIx32 " size = %" PRIu32
"kbytes", p->name, id1, p->size_in_bytes / 1024);
" KiB", p->name, id1, p->size_in_bytes / 1024);
else
LOG_INFO("flash1 \'%s\' id = 0x%06" PRIx32 " size = %" PRIu32
"bytes", p->name, id1, p->size_in_bytes);
" B", p->name, id1, p->size_in_bytes);
break;
}
}
@ -2228,7 +2228,7 @@ static int stmqspi_probe(struct flash_bank *bank)
if (retval == ERROR_OK) {
LOG_INFO("flash1 \'%s\' id = 0x%06" PRIx32 " size = %" PRIu32
"kbytes", temp.name, id1, temp.size_in_bytes / 1024);
" KiB", temp.name, id1, temp.size_in_bytes / 1024);
/* save info and retrieved *good* id as spi_sfdp clears all info */
memcpy(&stmqspi_info->dev, &temp, sizeof(stmqspi_info->dev));
stmqspi_info->dev.device_id = id1;
@ -2246,10 +2246,10 @@ static int stmqspi_probe(struct flash_bank *bank)
if (p->device_id == id2) {
if (p->size_in_bytes / 4096)
LOG_INFO("flash2 \'%s\' id = 0x%06" PRIx32 " size = %" PRIu32
"kbytes", p->name, id2, p->size_in_bytes / 1024);
" KiB", p->name, id2, p->size_in_bytes / 1024);
else
LOG_INFO("flash2 \'%s\' id = 0x%06" PRIx32 " size = %" PRIu32
"bytes", p->name, id2, p->size_in_bytes);
" B", p->name, id2, p->size_in_bytes);
if (!id1)
memcpy(&stmqspi_info->dev, p, sizeof(stmqspi_info->dev));
@ -2286,7 +2286,7 @@ static int stmqspi_probe(struct flash_bank *bank)
if (retval == ERROR_OK)
LOG_INFO("flash2 \'%s\' id = 0x%06" PRIx32 " size = %" PRIu32
"kbytes", temp.name, id2, temp.size_in_bytes / 1024);
" KiB", temp.name, id2, temp.size_in_bytes / 1024);
else {
/* even not identified by SFDP, then give up */
LOG_WARNING("Unknown flash2 device id = 0x%06" PRIx32
@ -2392,22 +2392,22 @@ static int get_stmqspi_info(struct flash_bank *bank, struct command_invocation *
}
command_print_sameline(cmd, "flash%s%s \'%s\', device id = 0x%06" PRIx32
", flash size = %" PRIu32 "%sbytes\n(page size = %" PRIu32
", flash size = %" PRIu32 "%s B\n(page size = %" PRIu32
", read = 0x%02" PRIx8 ", qread = 0x%02" PRIx8
", pprog = 0x%02" PRIx8 ", mass_erase = 0x%02" PRIx8
", sector size = %" PRIu32 "%sbytes, sector_erase = 0x%02" PRIx8 ")",
", sector size = %" PRIu32 " %sB, sector_erase = 0x%02" PRIx8 ")",
((stmqspi_info->saved_cr & (BIT(SPI_DUAL_FLASH) |
BIT(SPI_FSEL_FLASH))) != BIT(SPI_FSEL_FLASH)) ? "1" : "",
((stmqspi_info->saved_cr & (BIT(SPI_DUAL_FLASH) |
BIT(SPI_FSEL_FLASH))) != 0) ? "2" : "",
stmqspi_info->dev.name, stmqspi_info->dev.device_id,
bank->size / 4096 ? bank->size / 1024 : bank->size,
bank->size / 4096 ? "k" : "", stmqspi_info->dev.pagesize,
bank->size / 4096 ? "Ki" : "", stmqspi_info->dev.pagesize,
stmqspi_info->dev.read_cmd, stmqspi_info->dev.qread_cmd,
stmqspi_info->dev.pprog_cmd, stmqspi_info->dev.chip_erase_cmd,
stmqspi_info->dev.sectorsize / 4096 ?
stmqspi_info->dev.sectorsize / 1024 : stmqspi_info->dev.sectorsize,
stmqspi_info->dev.sectorsize / 4096 ? "k" : "",
stmqspi_info->dev.sectorsize / 4096 ? "Ki" : "",
stmqspi_info->dev.erase_cmd);
return ERROR_OK;

View File

@ -312,7 +312,7 @@ static int w600_probe(struct flash_bank *bank)
flash_size = 1 << flash_size;
}
LOG_INFO("flash size = %" PRIu32 "kbytes", flash_size / 1024);
LOG_INFO("flash size = %" PRIu32 " KiB", flash_size / 1024);
/* calculate numbers of pages */
size_t num_pages = flash_size / W600_FLASH_SECSIZE;