return retval;
}
-static int kinetis_protect(struct flash_bank *bank, int set, int first, int last)
+static int kinetis_protect(struct flash_bank *bank, int set, unsigned int first,
+ unsigned int last)
{
if (allow_fcf_writes) {
LOG_ERROR("Protection setting is possible with 'kinetis fcf_source protection' only!");
return ERROR_FLASH_BANK_INVALID;
}
- for (int i = first; i < bank->num_prot_blocks && i <= last; i++)
+ for (unsigned int i = first; i < bank->num_prot_blocks && i <= last; i++)
bank->prot_blocks[i].is_protected = set;
LOG_INFO("Protection bits will be written at the next FCF sector erase or write.");
}
b = k_bank->protection_block;
- for (int i = 0; i < bank->num_prot_blocks; i++) {
+ for (unsigned int i = 0; i < bank->num_prot_blocks; i++) {
if ((fprot >> b) & 1)
bank->prot_blocks[i].is_protected = 0;
else
assert(bank_iter->prot_blocks);
if (k_bank->flash_class == FC_PFLASH) {
- for (int i = 0; i < bank_iter->num_prot_blocks; i++) {
+ for (unsigned int i = 0; i < bank_iter->num_prot_blocks; i++) {
if (bank_iter->prot_blocks[i].is_protected == 1)
fprot &= ~pflash_bit;
}
} else if (k_bank->flash_class == FC_FLEX_NVM) {
- for (int i = 0; i < bank_iter->num_prot_blocks; i++) {
+ for (unsigned int i = 0; i < bank_iter->num_prot_blocks; i++) {
if (bank_iter->prot_blocks[i].is_protected == 1)
fdprot &= ~dflash_bit;
}
-static int kinetis_erase(struct flash_bank *bank, int first, int last)
+static int kinetis_erase(struct flash_bank *bank, unsigned int first,
+ unsigned int last)
{
int result;
struct kinetis_flash_bank *k_bank = bank->driver_priv;
* requested erase is PFlash or NVM and encompasses the entire
* block. Should be quicker.
*/
- for (int i = first; i <= last; i++) {
+ for (unsigned int i = first; i <= last; i++) {
/* set command and sector address */
result = kinetis_ftfx_command(bank->target, FTFx_CMD_SECTERASE, k_bank->prog_base + bank->sectors[i].offset,
0, 0, 0, 0, 0, 0, 0, 0, NULL);
if (result != ERROR_OK) {
- LOG_WARNING("erase sector %d failed", i);
+ LOG_WARNING("erase sector %u failed", i);
return ERROR_FLASH_OPERATION_FAILED;
}
if (bank->size > limit) {
bank->size = limit;
- LOG_DEBUG("FlexNVM bank %d limited to 0x%08" PRIx32 " due to active EEPROM backup",
+ LOG_DEBUG("FlexNVM bank %u limited to 0x%08" PRIx32 " due to active EEPROM backup",
k_bank->bank_number, limit);
}
k_bank->bank_number, size_k, k_bank->prog_base, k_bank->sector_size);
} else {
- LOG_ERROR("Cannot determine parameters for bank %d, only %d banks on device",
+ LOG_ERROR("Cannot determine parameters for bank %u, only %u banks on device",
k_bank->bank_number, num_blocks);
return ERROR_FLASH_BANK_INVALID;
}
}
if (k_bank->sector_size == 0) {
- LOG_ERROR("Unknown sector size for bank %d", bank->bank_number);
+ LOG_ERROR("Unknown sector size for bank %u", bank->bank_number);
return ERROR_FLASH_BANK_INVALID;
}
if (block_dirty) {
/* the whole bank is not erased, check sector-by-sector */
- for (int i = 0; i < bank->num_sectors; i++) {
+ for (unsigned int i = 0; i < bank->num_sectors; i++) {
/* normal margin */
result = kinetis_ftfx_command(bank->target, FTFx_CMD_SECTSTAT,
k_bank->prog_base + bank->sectors[i].offset,
}
} else {
/* the whole bank is erased, update all sectors */
- for (int i = 0; i < bank->num_sectors; i++)
+ for (unsigned int i = 0; i < bank->num_sectors; i++)
bank->sectors[i].is_erased = 1;
}
} else {