X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fkinetis.c;h=1d63352823e91961c4ee9a03efe96bb18cac336c;hp=9b2c014ca928e8fe585c010c225bb907a93d3f52;hb=bb1c7ae4ae23a507175e751c705ad543ea2e9953;hpb=04354fbc59b0dcf83c8d1ecd9659252dfc66cbb4 diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c index 9b2c014ca9..1d63352823 100644 --- a/src/flash/nor/kinetis.c +++ b/src/flash/nor/kinetis.c @@ -1443,6 +1443,8 @@ static int kinetis_fill_fcf(struct flash_bank *bank, uint8_t *fcf) kinetis_auto_probe(bank_iter); + assert(bank_iter->prot_blocks); + if (k_bank->flash_class == FC_PFLASH) { for (i = 0; i < bank_iter->num_prot_blocks; i++) { if (bank_iter->prot_blocks[i].is_protected == 1) @@ -2624,7 +2626,10 @@ static int kinetis_probe(struct flash_bank *bank) unsigned num_blocks, first_nvm_bank; uint32_t size_k; struct kinetis_flash_bank *k_bank = bank->driver_priv; - struct kinetis_chip *k_chip = k_bank->k_chip; + struct kinetis_chip *k_chip; + + assert(k_bank); + k_chip = k_bank->k_chip; k_bank->probed = false; @@ -2895,7 +2900,7 @@ COMMAND_HANDLER(kinetis_nvm_partition) flex_nvm_partition_code = (uint8_t)((sim_fcfg1 >> 8) & 0x0f); switch (flex_nvm_partition_code) { case 0: - command_print(CMD_CTX, "No EEPROM backup, data flash only"); + command_print(CMD, "No EEPROM backup, data flash only"); break; case 1: case 2: @@ -2903,10 +2908,10 @@ COMMAND_HANDLER(kinetis_nvm_partition) case 4: case 5: case 6: - command_print(CMD_CTX, "EEPROM backup %d KB", 4 << flex_nvm_partition_code); + command_print(CMD, "EEPROM backup %d KB", 4 << flex_nvm_partition_code); break; case 8: - command_print(CMD_CTX, "No data flash, EEPROM backup only"); + command_print(CMD, "No data flash, EEPROM backup only"); break; case 0x9: case 0xA: @@ -2914,13 +2919,13 @@ COMMAND_HANDLER(kinetis_nvm_partition) case 0xC: case 0xD: case 0xE: - command_print(CMD_CTX, "data flash %d KB", 4 << (flex_nvm_partition_code & 7)); + command_print(CMD, "data flash %d KB", 4 << (flex_nvm_partition_code & 7)); break; case 0xf: - command_print(CMD_CTX, "No EEPROM backup, data flash only (DEPART not set)"); + command_print(CMD, "No EEPROM backup, data flash only (DEPART not set)"); break; default: - command_print(CMD_CTX, "Unsupported EEPROM backup size code 0x%02" PRIx8, flex_nvm_partition_code); + command_print(CMD, "Unsupported EEPROM backup size code 0x%02" PRIx8, flex_nvm_partition_code); } return ERROR_OK; @@ -2986,7 +2991,7 @@ COMMAND_HANDLER(kinetis_nvm_partition) if (result != ERROR_OK) return result; - command_print(CMD_CTX, "FlexNVM partition set. Please reset MCU."); + command_print(CMD, "FlexNVM partition set. Please reset MCU."); if (k_chip) { first_nvm_bank = k_chip->num_pflash_blocks; @@ -2996,7 +3001,7 @@ COMMAND_HANDLER(kinetis_nvm_partition) k_chip->probed = false; } - command_print(CMD_CTX, "FlexNVM banks will be re-probed to set new data flash size."); + command_print(CMD, "FlexNVM banks will be re-probed to set new data flash size."); return ERROR_OK; } @@ -3015,12 +3020,12 @@ COMMAND_HANDLER(kinetis_fcf_source_handler) } if (allow_fcf_writes) { - command_print(CMD_CTX, "Arbitrary Flash Configuration Field writes enabled."); - command_print(CMD_CTX, "Protection info writes to FCF disabled."); + command_print(CMD, "Arbitrary Flash Configuration Field writes enabled."); + command_print(CMD, "Protection info writes to FCF disabled."); LOG_WARNING("BEWARE: incorrect flash configuration may permanently lock the device."); } else { - command_print(CMD_CTX, "Protection info writes to Flash Configuration Field enabled."); - command_print(CMD_CTX, "Arbitrary FCF writes disabled. Mode safe from unwanted locking of the device."); + command_print(CMD, "Protection info writes to Flash Configuration Field enabled."); + command_print(CMD, "Arbitrary FCF writes disabled. Mode safe from unwanted locking of the device."); } return ERROR_OK; @@ -3035,7 +3040,7 @@ COMMAND_HANDLER(kinetis_fopt_handler) fcf_fopt = (uint8_t)strtoul(CMD_ARGV[0], NULL, 0); fcf_fopt_configured = true; } else { - command_print(CMD_CTX, "FCF_FOPT 0x%02" PRIx8, fcf_fopt); + command_print(CMD, "FCF_FOPT 0x%02" PRIx8, fcf_fopt); } return ERROR_OK; @@ -3127,6 +3132,7 @@ static const struct command_registration kinetis_exec_command_handlers[] = { .mode = COMMAND_CONFIG, .help = "Driver creates additional banks if device with two/four flash blocks is probed", .handler = kinetis_create_banks_handler, + .usage = "", }, COMMAND_REGISTRATION_DONE };