]> git.sur5r.net Git - openocd/blobdiff - src/flash/lpc2000.c
Eliminate MixedCaps symbol from public JTAG TAP API:
[openocd] / src / flash / lpc2000.c
index 1148df3bc076481d7305165d82f3e45d1dc84db1..c3299bcd01e02a0e2ab1a74adcaf9321f7258fc7 100644 (file)
 #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:
@@ -265,7 +258,7 @@ static int lpc2000_iap_call(flash_bank_t *bank, int code, u32 param_table[5], u3
                /* 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;
                }
@@ -305,7 +298,7 @@ static int lpc2000_iap_call(flash_bank_t *bank, int code, u32 param_table[5], u3
        init_reg_param(&reg_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);
@@ -531,6 +524,15 @@ static int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32
                }
                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);
        }