Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/target/lpc17xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ static bool lpc17xx_mass_erase(target_s *const target, platform_timeout_s *const
iap_result_s result;

if (lpc17xx_iap_call(target, &result, print_progess, IAP_CMD_PREPARE, 0, FLASH_NUM_SECTOR - 1U)) {
DEBUG_ERROR("lpc17xx_cmd_erase: prepare failed %" PRIu32 "\n", result.return_code);
DEBUG_ERROR("%s: prepare failed %" PRIu32 "\n", __func__, result.return_code);
return false;
}

if (lpc17xx_iap_call(target, &result, print_progess, IAP_CMD_ERASE, 0, FLASH_NUM_SECTOR - 1U, CPU_CLK_KHZ)) {
DEBUG_ERROR("lpc17xx_cmd_erase: erase failed %" PRIu32 "\n", result.return_code);
DEBUG_ERROR("%s: erase failed %" PRIu32 "\n", __func__, result.return_code);
return false;
}

if (lpc17xx_iap_call(target, &result, print_progess, IAP_CMD_BLANKCHECK, 0, FLASH_NUM_SECTOR - 1U)) {
DEBUG_ERROR("lpc17xx_cmd_erase: blankcheck failed %" PRIu32 "\n", result.return_code);
DEBUG_ERROR("%s: blankcheck failed %" PRIu32 "\n", __func__, result.return_code);
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/target/lpc40xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,17 @@ static bool lpc40xx_mass_erase(target_s *const target, platform_timeout_s *const
iap_result_s result;

if (lpc40xx_iap_call(target, &result, print_progess, IAP_CMD_PREPARE, 0, FLASH_NUM_SECTOR - 1U)) {
DEBUG_ERROR("lpc40xx_cmd_erase: prepare failed %" PRIu32 "\n", result.return_code);
DEBUG_ERROR("%s: prepare failed %" PRIu32 "\n", __func__, result.return_code);
return false;
}

if (lpc40xx_iap_call(target, &result, print_progess, IAP_CMD_ERASE, 0, FLASH_NUM_SECTOR - 1U, CPU_CLK_KHZ)) {
DEBUG_ERROR("lpc40xx_cmd_erase: erase failed %" PRIu32 "\n", result.return_code);
DEBUG_ERROR("%s: erase failed %" PRIu32 "\n", __func__, result.return_code);
return false;
}

if (lpc40xx_iap_call(target, &result, print_progess, IAP_CMD_BLANKCHECK, 0, FLASH_NUM_SECTOR - 1U)) {
DEBUG_ERROR("lpc40xx_cmd_erase: blankcheck failed %" PRIu32 "\n", result.return_code);
DEBUG_ERROR("%s: blankcheck failed %" PRIu32 "\n", __func__, result.return_code);
return false;
}

Expand Down
25 changes: 18 additions & 7 deletions src/target/lpc55xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ typedef enum lpc55xx_iap_cmd {
IAP_CMD_FFR_GET_UUID,
} lpc55xx_iap_cmd_e;

#ifndef DEBUG_ERROR_IS_NOOP
/* Reflection strings for enum above */
static const char *const lpc55xx_iap_cmd_descr[] = {
"FLASH_INIT",
"FLASH_ERASE",
"FLASH_PROGRAM",
"FFR_INIT",
"FFR_GET_UUID",
};
#endif

/* The possible IAP errors are documented here for easy reference */
typedef enum lpc55xx_iap_status {
IAP_STATUS_FLASH_SUCCESS = 0,
Expand Down Expand Up @@ -341,7 +352,7 @@ static bool lpc55xx_flash_init(target_s *target, lpc55xx_flash_config_s *config)

const lpc55xx_iap_status_e status = iap_call_raw(target, IAP_CMD_FLASH_INIT, 0, 0, 0);
if (status != IAP_STATUS_FLASH_SUCCESS) {
DEBUG_ERROR("LPC55xx: IAP error: FLASH_INIT (%d)\n", status);
DEBUG_ERROR("LPC55xx: IAP error: %s (%d)\n", lpc55xx_iap_cmd_descr[IAP_CMD_FLASH_INIT], status);
goto exit;
}

Expand Down Expand Up @@ -370,19 +381,19 @@ static bool lpc55xx_get_uuid(target_s *target, uint8_t *uuid)

lpc55xx_iap_status_e status = iap_call_raw(target, IAP_CMD_FLASH_INIT, 0, 0, 0);
if (status != IAP_STATUS_FLASH_SUCCESS) {
DEBUG_ERROR("LPC55xx: IAP error: FLASH_INIT (%d)\n", status);
DEBUG_ERROR("LPC55xx: IAP error: %s (%d)\n", lpc55xx_iap_cmd_descr[IAP_CMD_FLASH_INIT], status);
goto exit;
}

status = iap_call_raw(target, IAP_CMD_FFR_INIT, 0, 0, 0);
if (status != IAP_STATUS_FLASH_SUCCESS) {
DEBUG_ERROR("LPC55xx: IAP error: FFR_INIT (%d)\n", status);
DEBUG_ERROR("LPC55xx: IAP error: %s (%d)\n", lpc55xx_iap_cmd_descr[IAP_CMD_FFR_INIT], status);
goto exit;
}

status = iap_call_raw(target, IAP_CMD_FFR_GET_UUID, LPC55xx_UUID_ADDRESS, 0, 0);
if (status != IAP_STATUS_FLASH_SUCCESS) {
DEBUG_ERROR("LPC55xx: IAP error: FFR_GET_UUID (%d)\n", status);
DEBUG_ERROR("LPC55xx: IAP error: %s (%d)\n", lpc55xx_iap_cmd_descr[IAP_CMD_FFR_GET_UUID], status);
goto exit;
}

Expand Down Expand Up @@ -430,7 +441,7 @@ static bool lpc55xx_flash_prepare(target_flash_s *flash)

const lpc55xx_iap_status_e status = iap_call_raw(flash->t, IAP_CMD_FLASH_INIT, 0, 0, 0);
if (status != IAP_STATUS_FLASH_SUCCESS)
DEBUG_ERROR("LPC55xx: IAP error: FLASH_INIT (%d)\n", status);
DEBUG_ERROR("LPC55xx: IAP error: %s (%d)\n", lpc55xx_iap_cmd_descr[IAP_CMD_FLASH_INIT], status);
return status == IAP_STATUS_FLASH_SUCCESS;
}

Expand All @@ -439,7 +450,7 @@ static bool lpc55xx_flash_erase(target_flash_s *flash, target_addr_t addr, size_
const lpc55xx_iap_status_e status =
iap_call_raw(flash->t, IAP_CMD_FLASH_ERASE, addr, (uint32_t)len, LPC55xx_ERASE_KEY);
if (status != IAP_STATUS_FLASH_SUCCESS)
DEBUG_ERROR("LPC55xx: IAP error: FLASH_ERASE (%d)\n", status);
DEBUG_ERROR("LPC55xx: IAP error: %s (%d)\n", lpc55xx_iap_cmd_descr[IAP_CMD_FLASH_ERASE], status);
return status == IAP_STATUS_FLASH_SUCCESS;
}

Expand All @@ -450,7 +461,7 @@ static bool lpc55xx_flash_write(target_flash_s *flash, target_addr_t dest, const
const lpc55xx_iap_status_e status =
iap_call_raw(flash->t, IAP_CMD_FLASH_PROGRAM, dest, LPC55xx_WRITE_BUFFER_ADDRESS, (uint32_t)len);
if (status != IAP_STATUS_FLASH_SUCCESS)
DEBUG_ERROR("LPC55xx: IAP error: FLASH_PROGRAM (%d)\n", status);
DEBUG_ERROR("LPC55xx: IAP error: %s (%d)\n", lpc55xx_iap_cmd_descr[IAP_CMD_FLASH_PROGRAM], status);
return status == IAP_STATUS_FLASH_SUCCESS;
}

Expand Down
15 changes: 6 additions & 9 deletions src/target/renesas_ra.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,24 +458,21 @@ bool renesas_ra_probe(target_s *const target)
*/

if (renesas_pnr_read(target, RENESAS_FIXED2_PNR, pnr)) {
DEBUG_WARN("Found renesas chip (%.*s) with pnr location RENESAS_FIXED2_PNR and unsupported Part ID %x "
"please report it\n",
(int)sizeof(pnr), pnr, target->part_id);
DEBUG_WARN("Found renesas chip (%.*s) with %s and unsupported Part ID 0x%x, please report it\n",
(int)sizeof(pnr), pnr, "pnr location RENESAS_FIXED2_PNR", target->part_id);
break;
}

if (renesas_pnr_read(target, RENESAS_FIXED1_PNR, pnr)) {
DEBUG_WARN("Found renesas chip (%.*s) with pnr location RENESAS_FIXED1_PNR and unsupported Part ID 0x%x "
"please report it\n",
(int)sizeof(pnr), pnr, target->part_id);
DEBUG_WARN("Found renesas chip (%.*s) with %s and unsupported Part ID 0x%x, please report it\n",
(int)sizeof(pnr), pnr, "pnr location RENESAS_FIXED1_PNR", target->part_id);
break;
}

flash_root_table = renesas_fmifrt_read(target);
if (renesas_pnr_read(target, RENESAS_FMIFRT_PNR(flash_root_table), pnr)) {
DEBUG_WARN("Found renesas chip (%.*s) with Flash Root Table and unsupported Part ID 0x%x "
"please report it\n",
(int)sizeof(pnr), pnr, target->part_id);
DEBUG_WARN("Found renesas chip (%.*s) with %s and unsupported Part ID 0x%x, please report it\n",
(int)sizeof(pnr), pnr, "Flash Root Table", target->part_id);
break;
}

Expand Down
2 changes: 0 additions & 2 deletions src/target/stm32h7.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ static uint32_t stm32h7_flash_cr(uint32_t sector_size, const uint32_t ctrl, cons
/* H74x, H72x IP: 128 KiB and has PSIZE */
if (sector_size == FLASH_SECTOR_SIZE) {
command |= sector_number << STM32H7_FLASH_CTRL_SECTOR_NUM_SHIFT;
DEBUG_TARGET("%s: patching FLASH_CR from 0x%08" PRIx32 " to 0x%08" PRIx32 "\n", __func__, ctrl, command);
return command;
}

Expand All @@ -513,7 +512,6 @@ static uint32_t stm32h7_flash_cr(uint32_t sector_size, const uint32_t ctrl, cons
command |= temp_fw_start >> 2U;
/* SNB offset is different, too */
command |= sector_number << STM32H7BX_FLASH_CTRL_SECTOR_NUM_SHIFT;
DEBUG_TARGET("%s: patching FLASH_CR from 0x%08" PRIx32 " to 0x%08" PRIx32 "\n", __func__, ctrl, command);
return command;
}

Expand Down
2 changes: 1 addition & 1 deletion src/target/target_probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/* Probe launch macro used by the CPU-generic layers to then call CPU-specific routines safely */
#define PROBE(x) \
do { \
DEBUG_TARGET("Calling " STRINGIFY(x) "\n"); \
DEBUG_TARGET("Calling %s\n", STRINGIFY(x)); \
if ((x)(target)) \
return true; \
target_check_error(target); \
Expand Down
Loading