117 #define LPC1110_1 0x0A07102B
118 #define LPC1110_2 0x1A07102B
119 #define LPC1111_002_1 0x0A16D02B
120 #define LPC1111_002_2 0x1A16D02B
121 #define LPC1111_101_1 0x041E502B
122 #define LPC1111_101_2 0x2516D02B
123 #define LPC1111_103_1 0x00010013
124 #define LPC1111_201_1 0x0416502B
125 #define LPC1111_201_2 0x2516902B
126 #define LPC1111_203_1 0x00010012
127 #define LPC1112_101_1 0x042D502B
128 #define LPC1112_101_2 0x2524D02B
129 #define LPC1112_102_1 0x0A24902B
130 #define LPC1112_102_2 0x1A24902B
131 #define LPC1112_103_1 0x00020023
132 #define LPC1112_201_1 0x0425502B
133 #define LPC1112_201_2 0x2524902B
134 #define LPC1112_203_1 0x00020022
135 #define LPC1113_201_1 0x0434502B
136 #define LPC1113_201_2 0x2532902B
137 #define LPC1113_203_1 0x00030032
138 #define LPC1113_301_1 0x0434102B
139 #define LPC1113_301_2 0x2532102B
140 #define LPC1113_303_1 0x00030030
141 #define LPC1114_102_1 0x0A40902B
142 #define LPC1114_102_2 0x1A40902B
143 #define LPC1114_201_1 0x0444502B
144 #define LPC1114_201_2 0x2540902B
145 #define LPC1114_203_1 0x00040042
146 #define LPC1114_301_1 0x0444102B
147 #define LPC1114_301_2 0x2540102B
148 #define LPC1114_303_1 0x00040040
149 #define LPC1114_323_1 0x00040060
150 #define LPC1114_333_1 0x00040070
151 #define LPC1115_303_1 0x00050080
153 #define LPC11A02_1 0x4D4C802B
154 #define LPC11A04_1 0x4D80002B
155 #define LPC11A11_001_1 0x455EC02B
156 #define LPC11A12_101_1 0x4574802B
157 #define LPC11A13_201_1 0x458A402B
158 #define LPC11A14_301_1 0x35A0002B
159 #define LPC11A14_301_2 0x45A0002B
161 #define LPC11C12_301_1 0x1421102B
162 #define LPC11C14_301_1 0x1440102B
163 #define LPC11C22_301_1 0x1431102B
164 #define LPC11C24_301_1 0x1430102B
166 #define LPC11E11_101 0x293E902B
167 #define LPC11E12_201 0x2954502B
168 #define LPC11E13_301 0x296A102B
169 #define LPC11E14_401 0x2980102B
170 #define LPC11E36_501 0x00009C41
171 #define LPC11E37_401 0x00007C45
172 #define LPC11E37_501 0x00007C41
174 #define LPC11U12_201_1 0x095C802B
175 #define LPC11U12_201_2 0x295C802B
176 #define LPC11U13_201_1 0x097A802B
177 #define LPC11U13_201_2 0x297A802B
178 #define LPC11U14_201_1 0x0998802B
179 #define LPC11U14_201_2 0x2998802B
180 #define LPC11U23_301 0x2972402B
181 #define LPC11U24_301 0x2988402B
182 #define LPC11U24_401 0x2980002B
183 #define LPC11U34_311 0x0003D440
184 #define LPC11U34_421 0x0001CC40
185 #define LPC11U35_401 0x0001BC40
186 #define LPC11U35_501 0x0000BC40
187 #define LPC11U36_401 0x00019C40
188 #define LPC11U37_401 0x00017C40
189 #define LPC11U37H_401 0x00007C44
190 #define LPC11U37_501 0x00007C40
192 #define LPC11E66 0x0000DCC1
193 #define LPC11E67 0x0000BC81
194 #define LPC11E68 0x00007C01
196 #define LPC11U66 0x0000DCC8
197 #define LPC11U67_1 0x0000BC88
198 #define LPC11U67_2 0x0000BC80
199 #define LPC11U68_1 0x00007C08
200 #define LPC11U68_2 0x00007C00
202 #define LPC1311 0x2C42502B
203 #define LPC1311_1 0x1816902B
204 #define LPC1313 0x2C40102B
205 #define LPC1313_1 0x1830102B
206 #define LPC1315 0x3A010523
207 #define LPC1316 0x1A018524
208 #define LPC1317 0x1A020525
209 #define LPC1342 0x3D01402B
210 #define LPC1343 0x3D00002B
211 #define LPC1343_1 0x3000002B
212 #define LPC1345 0x28010541
213 #define LPC1346 0x08018542
214 #define LPC1347 0x08020543
216 #define LPC1751_1 0x25001110
217 #define LPC1751_2 0x25001118
218 #define LPC1752 0x25001121
219 #define LPC1754 0x25011722
220 #define LPC1756 0x25011723
221 #define LPC1758 0x25013F37
222 #define LPC1759 0x25113737
223 #define LPC1763 0x26012033
224 #define LPC1764 0x26011922
225 #define LPC1765 0x26013733
226 #define LPC1766 0x26013F33
227 #define LPC1767 0x26012837
228 #define LPC1768 0x26013F37
229 #define LPC1769 0x26113F37
230 #define LPC1774 0x27011132
231 #define LPC1776 0x27191F43
232 #define LPC1777 0x27193747
233 #define LPC1778 0x27193F47
234 #define LPC1785 0x281D1743
235 #define LPC1786 0x281D1F43
236 #define LPC1787 0x281D3747
237 #define LPC1788 0x281D3F47
239 #define LPC4072 0x47011121
240 #define LPC4074 0x47011132
241 #define LPC4076 0x47191F43
242 #define LPC4078 0x47193F47
243 #define LPC4088 0x481D3F47
245 #define LPC810_021 0x00008100
246 #define LPC811_001 0x00008110
247 #define LPC812_101 0x00008120
248 #define LPC812_101_1 0x00008121
249 #define LPC812_101_2 0x00008122
250 #define LPC812_101_3 0x00008123
252 #define LPC822_101 0x00008221
253 #define LPC822_101_1 0x00008222
254 #define LPC824_201 0x00008241
255 #define LPC824_201_1 0x00008242
257 #define LPC8N04 0x00008A04
258 #define NHS3100 0x4e310020
259 #define NHS3152 0x4e315220
260 #define NHS3153 0x4e315320
262 #define LPC844_201 0x00008441
263 #define LPC844_201_1 0x00008442
264 #define LPC844_201_2 0x00008444
266 #define LPC845_301 0x00008451
267 #define LPC845_301_1 0x00008452
268 #define LPC845_301_2 0x00008453
269 #define LPC845_301_3 0x00008454
271 #define IAP_CODE_LEN 0x34
273 #define LPC11XX_REG_SECTORS 24
340 if (
bank->size == 128 * 1024) {
341 bank->num_sectors = 16;
343 for (
int i = 0; i < 16; i++) {
345 bank->sectors[i].size = 8 * 1024;
347 bank->sectors[i].is_erased = -1;
348 bank->sectors[i].is_protected = 1;
350 }
else if (
bank->size == 256 * 1024) {
351 bank->num_sectors = 18;
354 for (
int i = 0; i < 8; i++) {
356 bank->sectors[i].size = 8 * 1024;
358 bank->sectors[i].is_erased = -1;
359 bank->sectors[i].is_protected = 1;
361 for (
int i = 8; i < 10; i++) {
363 bank->sectors[i].size = 64 * 1024;
365 bank->sectors[i].is_erased = -1;
366 bank->sectors[i].is_protected = 1;
368 for (
int i = 10; i < 18; i++) {
370 bank->sectors[i].size = 8 * 1024;
372 bank->sectors[i].is_erased = -1;
373 bank->sectors[i].is_protected = 1;
376 LOG_ERROR(
"BUG: unknown bank->size encountered");
385 switch (
bank->size) {
388 bank->num_sectors = 1;
392 bank->num_sectors = 2;
395 bank->num_sectors = 4;
398 bank->num_sectors = 8;
401 bank->num_sectors = 9;
404 bank->num_sectors = 11;
407 bank->num_sectors = 15;
410 bank->num_sectors = 27;
414 bank->num_sectors = 28;
417 LOG_ERROR(
"BUG: unknown bank->size encountered");
424 for (
unsigned int i = 0; i <
bank->num_sectors; i++) {
427 bank->sectors[i].size = 4 * 1024;
429 bank->sectors[i].is_erased = -1;
430 bank->sectors[i].is_protected = 1;
433 bank->sectors[i].size = 32 * 1024;
435 bank->sectors[i].is_erased = -1;
436 bank->sectors[i].is_protected = 1;
439 bank->sectors[i].size = 4 * 1024;
441 bank->sectors[i].is_erased = -1;
442 bank->sectors[i].is_protected = 1;
450 switch (
bank->size) {
453 bank->num_sectors = 1;
457 bank->num_sectors = 2;
461 bank->num_sectors = 4;
465 bank->num_sectors = 8;
468 bank->num_sectors = 16;
471 bank->num_sectors = 18;
474 bank->num_sectors = 22;
477 bank->num_sectors = 30;
480 LOG_ERROR(
"BUG: unknown bank->size encountered");
486 for (
unsigned int i = 0; i <
bank->num_sectors; i++) {
489 bank->sectors[i].size = (i < 16) ? 4 * 1024 : 32 * 1024;
491 bank->sectors[i].is_erased = -1;
492 bank->sectors[i].is_protected = 1;
499 switch (
bank->size) {
501 bank->num_sectors = 11;
504 bank->num_sectors = 13;
507 bank->num_sectors = 15;
510 LOG_ERROR(
"BUG: unknown bank->size encountered");
516 for (
unsigned int i = 0; i <
bank->num_sectors; i++) {
519 bank->sectors[i].size = (i < 8) ? 8 * 1024 : 64 * 1024;
521 bank->sectors[i].is_erased = -1;
522 bank->sectors[i].is_protected = 1;
531 switch (
bank->size) {
533 bank->num_sectors = 4;
536 bank->num_sectors = 8;
539 bank->num_sectors = 16;
543 bank->num_sectors = 30;
547 bank->num_sectors = 32;
551 bank->num_sectors = 64;
554 LOG_ERROR(
"BUG: unknown bank->size encountered");
560 for (
unsigned int i = 0; i <
bank->num_sectors; i++) {
563 bank->sectors[i].size = 1 * 1024;
565 bank->sectors[i].is_erased = -1;
566 bank->sectors[i].is_protected = 1;
574 if ((
bank->size % (4 * 1024)) != 0) {
575 LOG_ERROR(
"BUG: unknown bank->size encountered,\nLPC1100 flash size must be a multiple of 4096");
579 unsigned int large_sectors = 0;
580 unsigned int normal_sectors =
bank->size / 4096;
587 bank->num_sectors = normal_sectors + large_sectors;
591 for (
unsigned int i = 0; i <
bank->num_sectors; i++) {
595 bank->sectors[i].is_erased = -1;
596 bank->sectors[i].is_protected = 1;
604 switch (
bank->size) {
606 bank->num_sectors = 16;
609 bank->num_sectors = 32;
612 bank->num_sectors = 64;
615 LOG_ERROR(
"BUG: unknown bank->size encountered");
621 for (
unsigned int i = 0; i <
bank->num_sectors; i++) {
624 bank->sectors[i].size = 4 * 1024;
626 bank->sectors[i].is_erased = -1;
627 bank->sectors[i].is_protected = 1;
635 switch (
bank->size) {
637 bank->num_sectors = 8;
640 bank->num_sectors = 16;
643 LOG_ERROR(
"BUG: unknown bank->size encountered");
649 for (
unsigned int i = 0; i <
bank->num_sectors; i++) {
652 bank->sectors[i].size = 32 * 1024;
654 bank->sectors[i].is_erased = -1;
655 bank->sectors[i].is_protected = 1;
659 LOG_ERROR(
"BUG: unknown lpc2000_info->variant encountered");
681 LOG_ERROR(
"no working area specified, can't write LPC2000 internal flash");
685 uint8_t jump_gate[8];
688 switch (lpc2000_info->
variant) {
705 LOG_ERROR(
"BUG: unknown lpc2000_info->variant encountered");
712 (*iap_working_area)->address);
722 uint32_t param_table[5], uint32_t result_table[4])
729 uint32_t iap_entry_point = 0;
731 switch (lpc2000_info->
variant) {
738 iap_entry_point = 0x1fff1ff1;
744 iap_entry_point = 0x03000205;
751 iap_entry_point = 0x7ffffff1;
760 LOG_ERROR(
"BUG: unknown lpc2000->variant encountered");
793 switch (lpc2000_info->
variant) {
826 iap_working_area->
address + 0x4, 10000, &arm_algo);
829 LOG_ERROR(
"BUG: unknown lpc2000->variant encountered");
839 LOG_DEBUG(
"IAP command = %i (0x%8.8" PRIx32
", 0x%8.8" PRIx32
", 0x%8.8" PRIx32
", 0x%8.8" PRIx32
", 0x%8.8" PRIx32
840 ") completed with result = %8.8x",
841 code, param_table[0], param_table[1], param_table[2], param_table[3], param_table[4], status_code);
858 if (last >=
bank->num_sectors)
861 uint32_t param_table[5] = {0};
862 uint32_t result_table[4];
874 for (
unsigned int i = first; i <= last && retval ==
ERROR_OK; i++) {
876 param_table[0] = param_table[1] = i;
879 switch (status_code) {
884 bank->sectors[i].is_erased = 1;
887 bank->sectors[i].is_erased = 0;
890 bank->sectors[i].is_erased = 0;
896 LOG_ERROR(
"BUG: unknown LPC2000 status code %i", status_code);
916 lpc2000_info->
probed =
false;
918 bank->driver_priv = lpc2000_info;
920 if (strcmp(
CMD_ARGV[6],
"lpc2000_v1") == 0) {
922 }
else if (strcmp(
CMD_ARGV[6],
"lpc2000_v2") == 0) {
924 }
else if (strcmp(
CMD_ARGV[6],
"lpc1700") == 0 || strcmp(
CMD_ARGV[6],
"lpc4000") == 0) {
926 }
else if (strcmp(
CMD_ARGV[6],
"lpc1800") == 0 || strcmp(
CMD_ARGV[6],
"lpc4300") == 0) {
928 }
else if (strcmp(
CMD_ARGV[6],
"lpc800") == 0) {
930 }
else if (strcmp(
CMD_ARGV[6],
"lpc1100") == 0) {
932 }
else if (strcmp(
CMD_ARGV[6],
"lpc1500") == 0) {
934 }
else if (strcmp(
CMD_ARGV[6],
"lpc54100") == 0) {
936 }
else if (strcmp(
CMD_ARGV[6],
"auto") == 0) {
954 uint32_t temp_base = 0;
956 if (temp_base >= 0x1B000000)
962 if (strcmp(
CMD_ARGV[8],
"calc_checksum") == 0)
980 uint32_t param_table[5] = {0};
982 param_table[0] = first;
983 param_table[1] = last;
988 param_table[2] = lpc2000_info->
cclk;
990 uint32_t result_table[4];
1004 switch (status_code) {
1014 LOG_WARNING(
"lpc2000 prepare sectors returned %i", status_code);
1021 param_table[2] = lpc2000_info->
cclk;
1026 switch (status_code) {
1036 LOG_WARNING(
"lpc2000 erase sectors returned %i", status_code);
1064 if (
offset % dst_min_alignment) {
1065 LOG_WARNING(
"offset 0x%" PRIx32
" breaks required alignment 0x%" PRIx32,
offset, dst_min_alignment);
1069 int first_sector = 0;
1070 int last_sector = 0;
1072 for (
unsigned int i = 0; i <
bank->num_sectors; i++) {
1079 LOG_DEBUG(
"first_sector: %i, last_sector: %i", first_sector, last_sector);
1084 uint32_t checksum = 0;
1085 for (
int i = 0; i < 8; i++) {
1090 checksum = 0 - checksum;
1091 LOG_DEBUG(
"checksum: 0x%8.8" PRIx32, checksum);
1094 if (original_value != checksum) {
1095 LOG_WARNING(
"Boot verification checksum in image (0x%8.8" PRIx32
") to be written to flash is "
1096 "different from calculated vector checksum (0x%8.8" PRIx32
").", original_value, checksum);
1097 LOG_WARNING(
"OpenOCD will write the correct checksum. To remove this warning modify build tools on developer PC to inject correct LPC vector "
1116 LOG_ERROR(
"no working area specified, can't write LPC2000 internal flash");
1121 uint32_t bytes_remaining =
count;
1122 uint32_t bytes_written = 0;
1123 uint32_t param_table[5] = {0};
1124 uint32_t result_table[4];
1130 while (bytes_remaining > 0) {
1131 uint32_t thisrun_bytes;
1138 param_table[0] = first_sector;
1139 param_table[1] = last_sector;
1144 param_table[2] = lpc2000_info->
cclk;
1147 switch (status_code) {
1157 LOG_WARNING(
"lpc2000 prepare sectors returned %i", status_code);
1166 if (bytes_remaining >= thisrun_bytes) {
1173 uint8_t *last_buffer = malloc(thisrun_bytes);
1174 memcpy(last_buffer,
buffer + bytes_written, bytes_remaining);
1175 memset(last_buffer + bytes_remaining, 0xff, thisrun_bytes - bytes_remaining);
1181 thisrun_bytes,
bank->base +
offset + bytes_written);
1184 param_table[0] =
bank->base +
offset + bytes_written;
1185 param_table[1] = download_area->
address;
1186 param_table[2] = thisrun_bytes;
1187 param_table[3] = lpc2000_info->
cclk;
1189 switch (status_code) {
1208 if (bytes_remaining > thisrun_bytes)
1209 bytes_remaining -= thisrun_bytes;
1211 bytes_remaining = 0;
1212 bytes_written += thisrun_bytes;
1228 uint32_t param_table[5] = {0};
1229 uint32_t result_table[4];
1245 if (result_table[0] == 0)
1248 *part_id = result_table[0];
1273 bank->size = 4 * 1024;
1289 bank->size = 8 * 1024;
1309 bank->size = 16 * 1024;
1324 bank->size = 24 * 1024;
1352 bank->size = 32 * 1024;
1358 bank->size = 32 * 1024;
1363 bank->size = 40 * 1024;
1371 bank->size = 48 * 1024;
1376 bank->size = 56 * 1024;
1387 bank->size = 64 * 1024;
1393 bank->size = 64 * 1024;
1399 bank->size = 96 * 1024;
1412 bank->size = 128 * 1024;
1420 bank->size = 128 * 1024;
1426 bank->size = 256 * 1024;
1438 bank->size = 256 * 1024;
1453 bank->size = 512 * 1024;
1458 bank->size = 4 * 1024;
1463 bank->size = 8 * 1024;
1473 bank->size = 16 * 1024;
1479 bank->size = 32 * 1024;
1487 bank->size = 30 * 1024;
1498 bank->size = 64 * 1024;
1502 LOG_ERROR(
"BUG: unknown Part ID encountered: 0x%" PRIx32, part_id);
1515 if (!lpc2000_info->
probed) {
1523 LOG_INFO(
"If auto-detection fails for this part, please email "
1524 "openocd-devel@lists.sourceforge.net, citing part id 0x%" PRIx32
".\n", part_id);
1528 lpc2000_info->
probed =
true;
1571 if (status_code != 0x0) {
1573 command_print(
CMD,
"no sufficient working area specified, can't access LPC2000 IAP interface");
1585 .handler = lpc2000_handle_part_id_command,
1587 .help =
"print part id of lpc2000 flash bank <num>",
1596 .help =
"lpc2000 flash command group",
1606 .flash_bank_command = lpc2000_flash_bank_command,
void init_reg_param(struct reg_param *param, char *reg_name, uint32_t size, enum param_direction direction)
void destroy_mem_param(struct mem_param *param)
void destroy_reg_param(struct reg_param *param)
void init_mem_param(struct mem_param *param, uint32_t address, uint32_t size, enum param_direction direction)
Macros used to generate various ARM or Thumb opcodes.
#define ARMV7M_COMMON_MAGIC
Support functions to access arbitrary bits in a byte array.
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
void command_print_sameline(struct command_invocation *cmd, const char *format,...)
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CALL_COMMAND_HANDLER(name, extra ...)
Use this to macro to call a command helper (or a nested handler).
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
#define ERROR_FLASH_BANK_INVALID
#define ERROR_FLASH_SECTOR_INVALID
#define ERROR_FLASH_OPERATION_FAILED
#define ERROR_FLASH_DST_BREAKS_ALIGNMENT
#define ERROR_FLASH_DST_OUT_OF_BANK
int default_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default read implementation for flash memory.
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
static int lpc2000_build_sector_list(struct flash_bank *bank)
static int lpc2000_probe(struct flash_bank *bank)
static int lpc2000_auto_probe_flash(struct flash_bank *bank)
FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command)
COMMAND_HANDLER(lpc2000_handle_part_id_command)
const struct flash_driver lpc2000_flash
#define LPC11XX_REG_SECTORS
static int lpc2000_iap_working_area_init(struct flash_bank *bank, struct working_area **iap_working_area)
static int lpc2000_iap_blank_check(struct flash_bank *bank, unsigned int first, unsigned int last)
@ LPC2000_INVALID_COMMAND
@ LPC2000_INVALID_STOP_BIT
@ LPC2000_ADDR_NOT_MAPPED
@ LPC2000_INVALID_BAUD_RATE
@ LPC2000_INVALID_FLASH_UNIT
@ LPC2000_SECTOR_NOT_PREPARED
@ LPC2000_SRC_ADDR_NOT_MAPPED
@ LPC2000_SECTOR_NOT_BLANK
@ LPC2000_DST_ADDR_NOT_MAPPED
@ LPC2000_USER_CODE_CHECKSUM
@ LCP2000_ERROR_SETTING_ACTIVE_PARTITION
static const struct command_registration lpc2000_command_handlers[]
static int lpc2000_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
static const struct command_registration lpc2000_exec_command_handlers[]
static int get_lpc2000_info(struct flash_bank *bank, struct command_invocation *cmd)
static int lpc2000_iap_call(struct flash_bank *bank, struct working_area *iap_working_area, int code, uint32_t param_table[5], uint32_t result_table[4])
static int get_lpc2000_part_id(struct flash_bank *bank, uint32_t *part_id)
static int lpc2000_erase_check(struct flash_bank *bank)
static int lpc2000_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
unsigned int common_magic
enum arm_state core_state
unsigned int common_magic
When run_command is called, a new instance will be created on the stack, filled with the proper value...
Provides details of a flash bank, available either on-chip or through a major interface.
Provides the implementation-independent structure that defines all of the callbacks required by OpenO...
const char * name
Gives a human-readable name of this flash driver, This field is used to select and initialize the dri...
Describes the geometry and status of a single flash sector within a flash bank.
uint32_t cmd51_max_buffer
uint32_t iap_entry_alternative
void target_buffer_set_u32(struct target *target, uint8_t *buffer, uint32_t value)
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int target_run_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_param, target_addr_t entry_point, target_addr_t exit_point, unsigned int timeout_ms, void *arch_info)
Downloads a target-specific native code algorithm to the target, and executes it.
int target_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Write count items of size bytes to the memory of target at the address given.
int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
int target_free_working_area(struct target *target, struct working_area *area)
Free a working area.
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
#define ERROR_TARGET_NOT_HALTED
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.