#endif
#include "lpc2000.h"
-
-#include "flash.h"
-#include "target.h"
-#include "log.h"
#include "armv4_5.h"
-#include "algorithm.h"
#include "binarybuffer.h"
-#include <stdlib.h>
-#include <string.h>
/* flash programming support for Philips LPC2xxx devices
* currently supported devices:
/* write IAP code to working area */
target_buffer_set_u32(target, jump_gate, ARMV4_5_BX(12));
target_buffer_set_u32(target, jump_gate + 4, ARMV4_5_B(0xfffffe, 0));
- if((retval = target->type->write_memory(target, lpc2000_info->iap_working_area->address, 4, 2, jump_gate)) != ERROR_OK)
+ if((retval = target_write_memory(target, lpc2000_info->iap_working_area->address, 4, 2, jump_gate)) != ERROR_OK)
{
return retval;
}
init_reg_param(®_params[4], "lr_svc", 32, PARAM_OUT);
buf_set_u32(reg_params[4].value, 0, 32, lpc2000_info->iap_working_area->address + 0x4);
- target->type->run_algorithm(target, 2, mem_params, 5, reg_params, lpc2000_info->iap_working_area->address, lpc2000_info->iap_working_area->address + 0x4, 10000, &armv4_5_info);
+ target_run_algorithm(target, 2, mem_params, 5, reg_params, lpc2000_info->iap_working_area->address, lpc2000_info->iap_working_area->address + 0x4, 10000, &armv4_5_info);
status_code = buf_get_u32(mem_params[1].value, 0, 32);
result_table[0] = target_buffer_get_u32(target, mem_params[1].value);
}
checksum = 0 - checksum;
LOG_DEBUG("checksum: 0x%8.8x", checksum);
+
+ u32 original_value=buf_get_u32(buffer + (5 * 4), 0, 32);
+ if (original_value!=checksum)
+ {
+ LOG_WARNING("Verification will fail since checksum in image(0x%8.8x) written to flash was different from calculated vector checksum(0x%8.8x).",
+ original_value, checksum);
+ LOG_WARNING("To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.");
+ }
+
buf_set_u32(buffer + 0x14, 0, 32, checksum);
}