This is an automated email from Gerrit. Freddie Chopin ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/860
-- gerrit commit bab5952a70597e1d9aee5f0c1ee4a5aea4fa14e7 Author: Freddie Chopin <[email protected]> Date: Fri Sep 28 20:43:14 2012 +0200 Fix serious bug in LPC2xxx/LPC17xx flash algorithm. Flash algorithm for LPC17xx/LPC2xxx was trying to "reuse" previously allocated working area on next flashing which is not possible - working areas are freed automatically on reset. This caused all but first flashing attempts to fail. Change-Id: I939946325ff9eecc4861c0f51ab0f73871a3d7b9 Signed-off-by: Freddie Chopin <[email protected]> diff --git a/src/flash/nor/lpc2000.c b/src/flash/nor/lpc2000.c index 7b247f8..e3e4065 100644 --- a/src/flash/nor/lpc2000.c +++ b/src/flash/nor/lpc2000.c @@ -276,42 +276,38 @@ static int lpc2000_iap_call(struct flash_bank *bank, struct armv7m_algorithm armv7m_info; /* for LPC1700 */ uint32_t status_code; uint32_t iap_entry_point = 0; /* to make compiler happier */ + uint8_t jump_gate[8]; - /* regrab previously allocated working_area, or allocate a new one */ - if (!lpc2000_info->iap_working_area) { - uint8_t jump_gate[8]; - - /* make sure we have a working area */ - if (target_alloc_working_area(target, 180, - &lpc2000_info->iap_working_area) != ERROR_OK) { - LOG_ERROR("no working area specified, can't write LPC2000 internal flash"); - return ERROR_FLASH_OPERATION_FAILED; - } + /* make sure we have a working area */ + if (target_alloc_working_area(target, 180, + &lpc2000_info->iap_working_area) != ERROR_OK) { + LOG_ERROR("no working area specified, can't write LPC2000 internal flash"); + return ERROR_FLASH_OPERATION_FAILED; + } - /* write IAP code to working area */ - switch (lpc2000_info->variant) { - case lpc1700: - target_buffer_set_u32(target, jump_gate, ARMV4_5_T_BX(12)); - target_buffer_set_u32(target, jump_gate + 4, ARMV5_T_BKPT(0)); - break; - case lpc2000_v1: - case lpc2000_v2: - target_buffer_set_u32(target, jump_gate, ARMV4_5_BX(12)); - target_buffer_set_u32(target, jump_gate + 4, ARMV4_5_B(0xfffffe, 0)); - break; - default: - LOG_ERROR("BUG: unknown lpc2000_info->variant encountered"); - exit(-1); - } + /* write IAP code to working area */ + switch (lpc2000_info->variant) { + case lpc1700: + target_buffer_set_u32(target, jump_gate, ARMV4_5_T_BX(12)); + target_buffer_set_u32(target, jump_gate + 4, ARMV5_T_BKPT(0)); + break; + case lpc2000_v1: + case lpc2000_v2: + target_buffer_set_u32(target, jump_gate, ARMV4_5_BX(12)); + target_buffer_set_u32(target, jump_gate + 4, ARMV4_5_B(0xfffffe, 0)); + break; + default: + LOG_ERROR("BUG: unknown lpc2000_info->variant encountered"); + exit(-1); + } - retval = target_write_memory(target, - lpc2000_info->iap_working_area->address, 4, 2, jump_gate); - if (retval != ERROR_OK) { - LOG_ERROR( - "Write memory at address 0x%8.8" PRIx32 " failed (check work_area definition)", - lpc2000_info->iap_working_area->address); - return retval; - } + retval = target_write_memory(target, + lpc2000_info->iap_working_area->address, 4, 2, jump_gate); + if (retval != ERROR_OK) { + LOG_ERROR( + "Write memory at address 0x%8.8" PRIx32 " failed (check work_area definition)", + lpc2000_info->iap_working_area->address); + return retval; } switch (lpc2000_info->variant) { -- ------------------------------------------------------------------------------ Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
