You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(37) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Øyvind H. <go...@us...> - 2010-05-16 13:42:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 76b81682eeea804518cf69c4d916ccc78c2f3093 (commit) via 602685e66f163f26179f41215cf302b0a894803e (commit) via bc8be110ff314cab0e09792a05b6871672c18302 (commit) via 24ebfffff54f5201f1503256df56717900e65e2d (commit) via feb95fbb7b1af02bf62a7b06ce2fcfb972d41040 (commit) via ebdd3a1670b8561e238f5c16245cefefd56b6f71 (commit) via 34f70956ed31c2739d34bae23fa6ca620e5299f8 (commit) via a69cbf0f74015993d749bdfe1a80f4b5a8bb6dc3 (commit) via 61bb0d3d235c659eb407a7032aa9ec70a914dc03 (commit) via 89747f81f22084b255f35d92f709facd3b4553a1 (commit) via c7b269ace1bbe07d5db7a562bb9242f4be32be67 (commit) from b8c54b362b395e50baf749366f6ec9e29fcba27e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 76b81682eeea804518cf69c4d916ccc78c2f3093 Author: Antonio Borneo <bor...@gm...> Date: Tue May 11 11:48:09 2010 +0800 NOR/CFI: minor code cleanup Remove few LOG_DEBUG() messages, together with code and variables required to build such messages. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 72c95dd..b19b945 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -805,8 +805,6 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_intel_pri_ext *pri_ext = cfi_info->pri_ext; - struct target *target = bank->target; /* FIXME: to be removed */ - uint8_t command[CFI_MAX_BUS_WIDTH]; /* FIXME: to be removed */ int retry = 0; int i; @@ -820,16 +818,12 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la for (i = first; i <= last; i++) { - cfi_command(bank, 0x60, command); /* FIXME: to be removed */ - LOG_DEBUG("address: 0x%4.4" PRIx32 ", command: 0x%4.4" PRIx32, flash_address(bank, i, 0x0), target_buffer_get_u32(target, command)); if ((retval = cfi_send_command(bank, 0x60, flash_address(bank, i, 0x0))) != ERROR_OK) { return retval; } if (set) { - cfi_command(bank, 0x01, command); /* FIXME: to be removed */ - LOG_DEBUG("address: 0x%4.4" PRIx32 ", command: 0x%4.4" PRIx32 , flash_address(bank, i, 0x0), target_buffer_get_u32(target, command)); if ((retval = cfi_send_command(bank, 0x01, flash_address(bank, i, 0x0))) != ERROR_OK) { return retval; @@ -838,8 +832,6 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la } else { - cfi_command(bank, 0xd0, command); /* FIXME: to be removed */ - LOG_DEBUG("address: 0x%4.4" PRIx32 ", command: 0x%4.4" PRIx32, flash_address(bank, i, 0x0), target_buffer_get_u32(target, command)); if ((retval = cfi_send_command(bank, 0xd0, flash_address(bank, i, 0x0))) != ERROR_OK) { return retval; commit 602685e66f163f26179f41215cf302b0a894803e Author: Antonio Borneo <bor...@gm...> Date: Tue May 11 11:35:28 2010 +0800 NOR/CFI: add cfi_read() implementation Final step to force bus_width size during CFI flash read. Added CFI specific implementation cfi_read() that uses only accesses at bus_width size. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 1b080ac..72c95dd 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -4,6 +4,7 @@ * Copyright (C) 2009 Michael Schwingen * * mi...@sc... * * Copyright (C) 2010 Ãyvind Harboe <oyv...@zy...> * + * Copyright (C) 2010 by Antonio Borneo <bor...@gm...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -1799,6 +1800,76 @@ static int cfi_write_words(struct flash_bank *bank, uint8_t *word, uint32_t word return ERROR_FLASH_OPERATION_FAILED; } +static int cfi_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +{ + struct cfi_flash_bank *cfi_info = bank->driver_priv; + struct target *target = bank->target; + uint32_t address = bank->base + offset; + uint32_t read_p; + int align; /* number of unaligned bytes */ + uint8_t current_word[CFI_MAX_BUS_WIDTH]; + int i; + int retval; + + LOG_DEBUG("reading buffer of %i byte at 0x%8.8x", + (int)count, (unsigned)offset); + + if (bank->target->state != TARGET_HALTED) + { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + if (offset + count > bank->size) + return ERROR_FLASH_DST_OUT_OF_BANK; + + if (cfi_info->qry[0] != 'Q') + return ERROR_FLASH_BANK_NOT_PROBED; + + /* start at the first byte of the first word (bus_width size) */ + read_p = address & ~(bank->bus_width - 1); + if ((align = address - read_p) != 0) + { + LOG_INFO("Fixup %d unaligned read head bytes", align); + + /* read a complete word from flash */ + if ((retval = target_read_memory(target, read_p, bank->bus_width, 1, current_word)) != ERROR_OK) + return retval; + + /* take only bytes we need */ + for (i = align; (i < bank->bus_width) && (count > 0); i++, count--) + *buffer++ = current_word[i]; + + read_p += bank->bus_width; + } + + align = count / bank->bus_width; + if (align) + { + if ((retval = target_read_memory(target, read_p, bank->bus_width, align, buffer)) != ERROR_OK) + return retval; + + read_p += align * bank->bus_width; + buffer += align * bank->bus_width; + count -= align * bank->bus_width; + } + + if (count) + { + LOG_INFO("Fixup %d unaligned read tail bytes", count); + + /* read a complete word from flash */ + if ((retval = target_read_memory(target, read_p, bank->bus_width, 1, current_word)) != ERROR_OK) + return retval; + + /* take only bytes we need */ + for (i = 0; (i < bank->bus_width) && (count > 0); i++, count--) + *buffer++ = current_word[i]; + } + + return ERROR_OK; +} + static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -2467,8 +2538,7 @@ struct flash_driver cfi_flash = { .erase = cfi_erase, .protect = cfi_protect, .write = cfi_write, - /* FIXME: access flash at bus_width size */ - .read = default_flash_read, + .read = cfi_read, .probe = cfi_probe, .auto_probe = cfi_auto_probe, /* FIXME: access flash at bus_width size */ commit bc8be110ff314cab0e09792a05b6871672c18302 Author: Antonio Borneo <bor...@gm...> Date: Tue May 11 11:16:33 2010 +0800 NOR: add read() callback to struct flash_driver Final target is to force bus_width size during CFI flash read. In this first step I need to replace default flash read with flash specific implementation. This patch introduces: - flash_driver_read() layer; - default_flash_read(), backward compatible; - read() callback in struct flash_driver; - proper initialization in every flash_driver instance. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/aduc702x.c b/src/flash/nor/aduc702x.c index 82ea2bc..40ee321 100644 --- a/src/flash/nor/aduc702x.c +++ b/src/flash/nor/aduc702x.c @@ -417,6 +417,7 @@ struct flash_driver aduc702x_flash = { .erase = aduc702x_erase, .protect = aduc702x_protect, .write = aduc702x_write, + .read = default_flash_read, .probe = aduc702x_probe, .auto_probe = aduc702x_probe, .erase_check = default_flash_blank_check, diff --git a/src/flash/nor/at91sam3.c b/src/flash/nor/at91sam3.c index 5f013ed..06b84cd 100644 --- a/src/flash/nor/at91sam3.c +++ b/src/flash/nor/at91sam3.c @@ -2505,6 +2505,7 @@ struct flash_driver at91sam3_flash = { .erase = sam3_erase, .protect = sam3_protect, .write = sam3_write, + .read = default_flash_read, .probe = sam3_probe, .auto_probe = sam3_auto_probe, .erase_check = sam3_erase_check, diff --git a/src/flash/nor/at91sam7.c b/src/flash/nor/at91sam7.c index cca0cf2..606cc32 100644 --- a/src/flash/nor/at91sam7.c +++ b/src/flash/nor/at91sam7.c @@ -1207,6 +1207,7 @@ struct flash_driver at91sam7_flash = { .erase = at91sam7_erase, .protect = at91sam7_protect, .write = at91sam7_write, + .read = default_flash_read, .probe = at91sam7_probe, .auto_probe = at91sam7_probe, .erase_check = at91sam7_erase_check, diff --git a/src/flash/nor/avrf.c b/src/flash/nor/avrf.c index 15b8b27..7cdab51 100644 --- a/src/flash/nor/avrf.c +++ b/src/flash/nor/avrf.c @@ -497,6 +497,7 @@ struct flash_driver avr_flash = { .erase = avrf_erase, .protect = avrf_protect, .write = avrf_write, + .read = default_flash_read, .probe = avrf_probe, .auto_probe = avrf_auto_probe, .erase_check = default_flash_mem_blank_check, diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 94ff7b9..1b080ac 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -2467,6 +2467,8 @@ struct flash_driver cfi_flash = { .erase = cfi_erase, .protect = cfi_protect, .write = cfi_write, + /* FIXME: access flash at bus_width size */ + .read = default_flash_read, .probe = cfi_probe, .auto_probe = cfi_auto_probe, /* FIXME: access flash at bus_width size */ diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 936f07c..00f73f2 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -3,6 +3,7 @@ * Copyright (C) 2007-2010 Ãyvind Harboe <oyv...@zy...> * * Copyright (C) 2008 by Spencer Oliver <sp...@sp...> * * Copyright (C) 2009 Zachary T Welch <zw...@su...> * + * Copyright (C) 2010 by Antonio Borneo <bor...@gm...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -100,6 +101,29 @@ int flash_driver_write(struct flash_bank *bank, return retval; } +int flash_driver_read(struct flash_bank *bank, + uint8_t *buffer, uint32_t offset, uint32_t count) +{ + int retval; + + LOG_DEBUG("call flash_driver_read()"); + + retval = bank->driver->read(bank, buffer, offset, count); + if (retval != ERROR_OK) + { + LOG_ERROR("error reading to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)", + bank->base, offset, retval); + } + + return retval; +} + +int default_flash_read(struct flash_bank *bank, + uint8_t *buffer, uint32_t offset, uint32_t count) +{ + return target_read_buffer(bank->target, offset + bank->base, count, buffer); +} + void flash_bank_add(struct flash_bank *bank) { /* put flash bank in linked list */ diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h index 1dfd721..a35f64f 100644 --- a/src/flash/nor/core.h +++ b/src/flash/nor/core.h @@ -3,6 +3,7 @@ * Copyright (C) 2007,2008 Ãyvind Harboe <oyv...@zy...> * * Copyright (C) 2008 by Spencer Oliver <sp...@sp...> * * Copyright (C) 2009 Zachary T Welch <zw...@su...> * + * Copyright (C) 2010 by Antonio Borneo <bor...@gm...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -136,6 +137,16 @@ void flash_set_dirty(void); /// @returns The number of flash banks currently defined. int flash_get_bank_count(void); /** + * Provides default read implementation for flash memory. + * @param bank The bank to read. + * @param buffer The data bytes read. + * @param offset The offset into the chip to read. + * @param count The number of bytes to read. + * @returns ERROR_OK if successful; otherwise, an error code. + */ +int default_flash_read(struct flash_bank *bank, + uint8_t *buffer, uint32_t offset, uint32_t count); +/** * Provides default erased-bank check handling. Checks to see if * the flash driver knows they are erased; if things look uncertain, * this routine will call default_flash_mem_blank_check() to confirm. diff --git a/src/flash/nor/driver.h b/src/flash/nor/driver.h index 0e77132..3757442 100644 --- a/src/flash/nor/driver.h +++ b/src/flash/nor/driver.h @@ -3,6 +3,7 @@ * Copyright (C) 2007,2008 Ãyvind Harboe <oyv...@zy...> * * Copyright (C) 2008 by Spencer Oliver <sp...@sp...> * * Copyright (C) 2009 Zachary T Welch <zw...@su...> * + * Copyright (C) 2010 by Antonio Borneo <bor...@gm...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -131,6 +132,20 @@ struct flash_driver uint8_t *buffer, uint32_t offset, uint32_t count); /** + * Read data from the flash. Note CPU address will be + * "bank->base + offset", while the physical address is + * dependent upon current target MMU mappings. + * + * @param bank The bank to read. + * @param buffer The data bytes read. + * @param offset The offset into the chip to read. + * @param count The number of bytes to read. + * @returns ERROR_OK if successful; otherwise, an error code. + */ + int (*read)(struct flash_bank *bank, + uint8_t *buffer, uint32_t offset, uint32_t count); + + /** * Probe to determine what kind of flash is present. * This is invoked by the "probe" script command. * diff --git a/src/flash/nor/ecos.c b/src/flash/nor/ecos.c index 783a40c..f9c3285 100644 --- a/src/flash/nor/ecos.c +++ b/src/flash/nor/ecos.c @@ -436,6 +436,7 @@ struct flash_driver ecosflash_flash = { .erase = ecosflash_erase, .protect = ecosflash_protect, .write = ecosflash_write, + .read = default_flash_read, .probe = ecosflash_probe, .auto_probe = ecosflash_probe, .erase_check = default_flash_blank_check, diff --git a/src/flash/nor/faux.c b/src/flash/nor/faux.c index e1e77ea..92851ed 100644 --- a/src/flash/nor/faux.c +++ b/src/flash/nor/faux.c @@ -141,6 +141,7 @@ struct flash_driver faux_flash = { .erase = faux_erase, .protect = faux_protect, .write = faux_write, + .read = default_flash_read, .probe = faux_probe, .auto_probe = faux_probe, .erase_check = default_flash_blank_check, diff --git a/src/flash/nor/imp.h b/src/flash/nor/imp.h index 34ccbe4..de1bc9e 100644 --- a/src/flash/nor/imp.h +++ b/src/flash/nor/imp.h @@ -40,6 +40,8 @@ int flash_driver_erase(struct flash_bank *bank, int first, int last); int flash_driver_protect(struct flash_bank *bank, int set, int first, int last); int flash_driver_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count); +int flash_driver_read(struct flash_bank *bank, + uint8_t *buffer, uint32_t offset, uint32_t count); /* write (optional verify) an image to flash memory of the given target */ int flash_write_unlock(struct target *target, struct image *image, diff --git a/src/flash/nor/lpc2000.c b/src/flash/nor/lpc2000.c index 438ab54..154248c 100644 --- a/src/flash/nor/lpc2000.c +++ b/src/flash/nor/lpc2000.c @@ -814,6 +814,7 @@ struct flash_driver lpc2000_flash = { .erase = lpc2000_erase, .protect = lpc2000_protect, .write = lpc2000_write, + .read = default_flash_read, .probe = lpc2000_probe, .auto_probe = lpc2000_probe, .erase_check = lpc2000_erase_check, diff --git a/src/flash/nor/lpc288x.c b/src/flash/nor/lpc288x.c index 5ab4e9c..b6d207e 100644 --- a/src/flash/nor/lpc288x.c +++ b/src/flash/nor/lpc288x.c @@ -478,6 +478,7 @@ struct flash_driver lpc288x_flash = { .erase = lpc288x_erase, .protect = lpc288x_protect, .write = lpc288x_write, + .read = default_flash_read, .probe = lpc288x_probe, .auto_probe = lpc288x_probe, .erase_check = lpc288x_erase_check, diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c index 5b00495..3ae7bb4 100644 --- a/src/flash/nor/lpc2900.c +++ b/src/flash/nor/lpc2900.c @@ -1830,6 +1830,7 @@ struct flash_driver lpc2900_flash = .erase = lpc2900_erase, .protect = lpc2900_protect, .write = lpc2900_write, + .read = default_flash_read, .probe = lpc2900_probe, .auto_probe = lpc2900_probe, .erase_check = lpc2900_erase_check, diff --git a/src/flash/nor/ocl.c b/src/flash/nor/ocl.c index 5d93724..9a295eb 100644 --- a/src/flash/nor/ocl.c +++ b/src/flash/nor/ocl.c @@ -353,6 +353,7 @@ struct flash_driver ocl_flash = { .erase = ocl_erase, .protect = ocl_protect, .write = ocl_write, + .read = default_flash_read, .probe = ocl_probe, .erase_check = ocl_erase_check, .protect_check = ocl_protect_check, diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index 4ebd256..58009ae 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -766,6 +766,7 @@ struct flash_driver pic32mx_flash = { .erase = pic32mx_erase, .protect = pic32mx_protect, .write = pic32mx_write, + .read = default_flash_read, .probe = pic32mx_probe, .auto_probe = pic32mx_auto_probe, .erase_check = default_flash_mem_blank_check, diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index cce5f37..38374ff 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -1261,6 +1261,7 @@ struct flash_driver stellaris_flash = { .erase = stellaris_erase, .protect = stellaris_protect, .write = stellaris_write, + .read = default_flash_read, .probe = stellaris_probe, .auto_probe = stellaris_probe, .erase_check = default_flash_mem_blank_check, diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c index 7afd959..d11a8ed 100644 --- a/src/flash/nor/stm32x.c +++ b/src/flash/nor/stm32x.c @@ -1293,6 +1293,7 @@ struct flash_driver stm32x_flash = { .erase = stm32x_erase, .protect = stm32x_protect, .write = stm32x_write, + .read = default_flash_read, .probe = stm32x_probe, .auto_probe = stm32x_auto_probe, .erase_check = default_flash_mem_blank_check, diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index 3d52341..46510ed 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -790,6 +790,7 @@ struct flash_driver str7x_flash = { .erase = str7x_erase, .protect = str7x_protect, .write = str7x_write, + .read = default_flash_read, .probe = str7x_probe, .auto_probe = str7x_probe, .erase_check = default_flash_blank_check, diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c index 2208fe3..e8e942e 100644 --- a/src/flash/nor/str9x.c +++ b/src/flash/nor/str9x.c @@ -701,6 +701,7 @@ struct flash_driver str9x_flash = { .erase = str9x_erase, .protect = str9x_protect, .write = str9x_write, + .read = default_flash_read, .probe = str9x_probe, .auto_probe = str9x_probe, .erase_check = default_flash_blank_check, diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c index 861d70b..073dfe1 100644 --- a/src/flash/nor/str9xpec.c +++ b/src/flash/nor/str9xpec.c @@ -1247,6 +1247,7 @@ struct flash_driver str9xpec_flash = { .erase = str9xpec_erase, .protect = str9xpec_protect, .write = str9xpec_write, + .read = default_flash_read, .probe = str9xpec_probe, .auto_probe = str9xpec_probe, .erase_check = str9xpec_erase_check, diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index ad21812..af655c6 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -559,7 +559,7 @@ COMMAND_HANDLER(handle_flash_fill_command) goto done; } - err = target_read_buffer(target, address + wrote, cur_size, readback); + err = flash_driver_read(bank, readback, address - bank->base + wrote, cur_size); if (err != ERROR_OK) { retval = err; diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c index edb43af..c1681f1 100644 --- a/src/flash/nor/tms470.c +++ b/src/flash/nor/tms470.c @@ -1264,6 +1264,7 @@ struct flash_driver tms470_flash = { .erase = tms470_erase, .protect = tms470_protect, .write = tms470_write, + .read = default_flash_read, .probe = tms470_probe, .auto_probe = tms470_auto_probe, .erase_check = tms470_erase_check, commit 24ebfffff54f5201f1503256df56717900e65e2d Author: Antonio Borneo <bor...@gm...> Date: Mon May 10 17:07:28 2010 +0800 NOR/TCL: fix typo in error message Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index a6e942e..ad21812 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -571,7 +571,7 @@ COMMAND_HANDLER(handle_flash_fill_command) { if (readback[i]!=chunk[i]) { - LOG_ERROR("Verfication error address 0x%08" PRIx32 ", read back 0x%02x, expected 0x%02x", + LOG_ERROR("Verification error address 0x%08" PRIx32 ", read back 0x%02x, expected 0x%02x", address + wrote + i, readback[i], chunk[i]); retval = ERROR_FAIL; goto done; commit feb95fbb7b1af02bf62a7b06ce2fcfb972d41040 Author: Antonio Borneo <bor...@gm...> Date: Fri May 7 17:04:32 2010 +0800 NOR: fix comment for Doxygen Either bus_width and chip_width are in bytes. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/driver.h b/src/flash/nor/driver.h index de71a39..0e77132 100644 --- a/src/flash/nor/driver.h +++ b/src/flash/nor/driver.h @@ -75,11 +75,12 @@ struct flash_driver * CMD_ARGV[2] = baseaddress * CMD_ARGV[3] = lengthbytes * CMD_ARGV[4] = chip_width_in bytes - * CMD_ARGV[5] = bus_width_bytes + * CMD_ARGV[5] = bus_width_in_bytes * CMD_ARGV[6] = driver-specific parameters * @endcode * - * For example, CMD_ARGV[4] = 16 bit flash, CMD_ARGV[5] = 32bit bus. + * For example, CMD_ARGV[4] = 2 (for 16 bit flash), + * CMD_ARGV[5] = 4 (for 32 bit bus). * * If extra arguments are provided (@a CMD_ARGC > 6), they will * start in @a CMD_ARGV[6]. These can be used to implement commit ebdd3a1670b8561e238f5c16245cefefd56b6f71 Author: Antonio Borneo <bor...@gm...> Date: Fri May 7 14:03:39 2010 +0800 NOR/CFI: remove use of cfi_add_byte() Remove the function cfi_add_byte() and rewrite the only instance of it. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index b2d184d..94ff7b9 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -953,40 +953,6 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last) } } -/* FIXME Replace this by a simple memcpy() - still unsure about sideeffects */ -static void cfi_add_byte(struct flash_bank *bank, uint8_t *word, uint8_t byte) -{ - /* struct target *target = bank->target; */ - - int i; - - /* NOTE: - * The data to flash must not be changed in endian! We write a bytestrem in - * target byte order already. Only the control and status byte lane of the flash - * WSM is interpreted by the CPU in different ways, when read a uint16_t or uint32_t - * word (data seems to be in the upper or lower byte lane for uint16_t accesses). - */ - -#if 0 - if (target->endianness == TARGET_LITTLE_ENDIAN) - { -#endif - /* shift bytes */ - for (i = 0; i < bank->bus_width - 1; i++) - word[i] = word[i + 1]; - word[bank->bus_width - 1] = byte; -#if 0 - } - else - { - /* shift bytes */ - for (i = bank->bus_width - 1; i > 0; i--) - word[i] = word[i - 1]; - word[0] = byte; - } -#endif -} - /* Convert code image to target endian */ /* FIXME create general block conversion fcts in target.c?) */ static void cfi_fix_code_endian(struct target *target, uint8_t *dest, const uint32_t *src, uint32_t count) @@ -1936,12 +1902,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, if (fallback) { for (i = 0; i < bank->bus_width; i++) - current_word[i] = 0; - - for (i = 0; i < bank->bus_width; i++) - { - cfi_add_byte(bank, current_word, *buffer++); - } + current_word[i] = *buffer++; retval = cfi_write_word(bank, current_word, write_p); if (retval != ERROR_OK) commit 34f70956ed31c2739d34bae23fa6ca620e5299f8 Author: Antonio Borneo <bor...@gm...> Date: Fri May 7 13:50:42 2010 +0800 NOR/CFI: use bus_width for memory access in cfi_write() During cfi_write(), head and tail of destination area could be not aligned to bus_width. Since write operation must be at bus_width size, source buffer size is extended and buffer padded with current values read from flash. Force using bus_width to read current value from flash. Do not use cfi_add_byte() anymore, to allow removing this function later on. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index a6165c6..b2d184d 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -1838,7 +1838,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, struct cfi_flash_bank *cfi_info = bank->driver_priv; struct target *target = bank->target; uint32_t address = bank->base + offset; /* address of first byte to be programmed */ - uint32_t write_p, copy_p; + uint32_t write_p; int align; /* number of unaligned bytes */ int blk_count; /* number of bus_width bytes for block copy */ uint8_t current_word[CFI_MAX_BUS_WIDTH * 4]; /* word (bus_width size) currently being programmed */ @@ -1863,46 +1863,18 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, { LOG_INFO("Fixup %d unaligned head bytes", align); - for (i = 0; i < bank->bus_width; i++) - current_word[i] = 0; - copy_p = write_p; - - /* copy bytes before the first write address */ - for (i = 0; i < align; ++i, ++copy_p) - { - uint8_t byte; - /* FIXME: access flash at bus_width size */ - if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK) - { - return retval; - } - cfi_add_byte(bank, current_word, byte); - } - - /* add bytes from the buffer */ - for (; (i < bank->bus_width) && (count > 0); i++) - { - cfi_add_byte(bank, current_word, *buffer++); - count--; - copy_p++; - } + /* read a complete word from flash */ + if ((retval = target_read_memory(target, write_p, bank->bus_width, 1, current_word)) != ERROR_OK) + return retval; - /* if the buffer is already finished, copy bytes after the last write address */ - for (; (count == 0) && (i < bank->bus_width); ++i, ++copy_p) - { - uint8_t byte; - /* FIXME: access flash at bus_width size */ - if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK) - { - return retval; - } - cfi_add_byte(bank, current_word, byte); - } + /* replace only bytes that must be written */ + for (i = align; (i < bank->bus_width) && (count > 0); i++, count--) + current_word[i] = *buffer++; retval = cfi_write_word(bank, current_word, write_p); if (retval != ERROR_OK) return retval; - write_p = copy_p; + write_p += bank->bus_width; } /* handle blocks of bus_size aligned bytes */ @@ -1995,25 +1967,14 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, { LOG_INFO("Fixup %" PRId32 " unaligned tail bytes", count); - copy_p = write_p; - for (i = 0; i < bank->bus_width; i++) - current_word[i] = 0; + /* read a complete word from flash */ + if ((retval = target_read_memory(target, write_p, bank->bus_width, 1, current_word)) != ERROR_OK) + return retval; + + /* replace only bytes that must be written */ + for (i = 0; (i < bank->bus_width) && (count > 0); i++, count--) + current_word[i] = *buffer++; - for (i = 0; (i < bank->bus_width) && (count > 0); ++i, ++copy_p) - { - cfi_add_byte(bank, current_word, *buffer++); - count--; - } - for (; i < bank->bus_width; ++i, ++copy_p) - { - uint8_t byte; - /* FIXME: access flash at bus_width size */ - if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK) - { - return retval; - } - cfi_add_byte(bank, current_word, byte); - } retval = cfi_write_word(bank, current_word, write_p); if (retval != ERROR_OK) return retval; commit a69cbf0f74015993d749bdfe1a80f4b5a8bb6dc3 Author: Antonio Borneo <bor...@gm...> Date: Fri Apr 23 12:07:53 2010 +0800 NOR/CFI: use bus_width for memory access on flash ID. NOR flash structure requires each access to be bus_width wide. Fix read of flash ID accordingly to rule above. Add case (chip_width == 4), allowed by CFI spec and coherent with current value of CFI_MAX_CHIP_WIDTH but currently not used by any target. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index ca2fb0b..a6165c6 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -2105,6 +2105,7 @@ static int cfi_probe(struct flash_bank *bank) uint32_t unlock1 = 0x555; uint32_t unlock2 = 0x2aa; int retval; + uint8_t value_buf0[CFI_MAX_BUS_WIDTH], value_buf1[CFI_MAX_BUS_WIDTH]; if (bank->target->state != TARGET_HALTED) { @@ -2137,34 +2138,30 @@ static int cfi_probe(struct flash_bank *bank) return retval; } - if (bank->chip_width == 1) + if ((retval = target_read_memory(target, flash_address(bank, 0, 0x00), bank->bus_width, 1, value_buf0)) != ERROR_OK) { - uint8_t manufacturer, device_id; - /* FIXME: access flash at bus_width size */ - if ((retval = target_read_u8(target, flash_address(bank, 0, 0x00), &manufacturer)) != ERROR_OK) - { - return retval; - } - /* FIXME: access flash at bus_width size */ - if ((retval = target_read_u8(target, flash_address(bank, 0, 0x01), &device_id)) != ERROR_OK) - { - return retval; - } - cfi_info->manufacturer = manufacturer; - cfi_info->device_id = device_id; + return retval; } - else if (bank->chip_width == 2) + if ((retval = target_read_memory(target, flash_address(bank, 0, 0x01), bank->bus_width, 1, value_buf1)) != ERROR_OK) { - /* FIXME: access flash at bus_width size */ - if ((retval = target_read_u16(target, flash_address(bank, 0, 0x00), &cfi_info->manufacturer)) != ERROR_OK) - { - return retval; - } - /* FIXME: access flash at bus_width size */ - if ((retval = target_read_u16(target, flash_address(bank, 0, 0x01), &cfi_info->device_id)) != ERROR_OK) - { - return retval; - } + return retval; + } + switch (bank->chip_width) { + case 1: + cfi_info->manufacturer = *value_buf0; + cfi_info->device_id = *value_buf1; + break; + case 2: + cfi_info->manufacturer = target_buffer_get_u16(target, value_buf0); + cfi_info->device_id = target_buffer_get_u16(target, value_buf1); + break; + case 4: + cfi_info->manufacturer = target_buffer_get_u32(target, value_buf0); + cfi_info->device_id = target_buffer_get_u32(target, value_buf1); + break; + default: + LOG_ERROR("Unsupported bank chipwidth %d, can't probe memory", bank->chip_width); + return ERROR_FLASH_OPERATION_FAILED; } LOG_INFO("Flash Manufacturer/Device: 0x%04x 0x%04x", cfi_info->manufacturer, cfi_info->device_id); commit 61bb0d3d235c659eb407a7032aa9ec70a914dc03 Author: Antonio Borneo <bor...@gm...> Date: Tue Apr 20 12:15:49 2010 +0800 NOR/CFI: identify memory accesses not using "bus_width". Since NOR flash devices does not handle "byte enable lanes", each read/write access involves the whole "chip_width". When multiple devices are in parallel, usually all chips are enabled during each access. All such cases are compatible with flash accesses at "bus_width" size. Access at "bus_width" size is mandatory for write access to avoid transferring of garbage values to flash. During read access the flash controller should take care, and discard unneeded bytes. Anyway, it is good practice to use "bus_width" size also for read. Every memory access that does not respect "bus_width" size is marked with a "FIXME" comment. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index f2ea947..ca2fb0b 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -1871,6 +1871,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, for (i = 0; i < align; ++i, ++copy_p) { uint8_t byte; + /* FIXME: access flash at bus_width size */ if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK) { return retval; @@ -1890,6 +1891,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, for (; (count == 0) && (i < bank->bus_width); ++i, ++copy_p) { uint8_t byte; + /* FIXME: access flash at bus_width size */ if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK) { return retval; @@ -2005,6 +2007,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, for (; i < bank->bus_width; ++i, ++copy_p) { uint8_t byte; + /* FIXME: access flash at bus_width size */ if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK) { return retval; @@ -2137,10 +2140,12 @@ static int cfi_probe(struct flash_bank *bank) if (bank->chip_width == 1) { uint8_t manufacturer, device_id; + /* FIXME: access flash at bus_width size */ if ((retval = target_read_u8(target, flash_address(bank, 0, 0x00), &manufacturer)) != ERROR_OK) { return retval; } + /* FIXME: access flash at bus_width size */ if ((retval = target_read_u8(target, flash_address(bank, 0, 0x01), &device_id)) != ERROR_OK) { return retval; @@ -2150,10 +2155,12 @@ static int cfi_probe(struct flash_bank *bank) } else if (bank->chip_width == 2) { + /* FIXME: access flash at bus_width size */ if ((retval = target_read_u16(target, flash_address(bank, 0, 0x00), &cfi_info->manufacturer)) != ERROR_OK) { return retval; } + /* FIXME: access flash at bus_width size */ if ((retval = target_read_u16(target, flash_address(bank, 0, 0x01), &cfi_info->device_id)) != ERROR_OK) { return retval; @@ -2543,6 +2550,7 @@ struct flash_driver cfi_flash = { .write = cfi_write, .probe = cfi_probe, .auto_probe = cfi_auto_probe, + /* FIXME: access flash at bus_width size */ .erase_check = default_flash_blank_check, .protect_check = cfi_protect_check, .info = cfi_info, commit 89747f81f22084b255f35d92f709facd3b4553a1 Author: Antonio Borneo <bor...@gm...> Date: Mon Apr 19 16:40:08 2010 +0800 NOR/CFI: simplify bufferwsize computation Review and simplify computation of bufferwsize. Add comments about variables' meaning. The same code is present 3 times in the file. Current patch updates all the 3 instances. Step 1) Replace "switch(bank->chip_width) {...}". Illegal values of bank->chip_width are already dropped. For legal values, the code is equivalent to: bufferwsize = buffersize / bank->chip_width; Step 2) The above code replacement plus the following line: bufferwsize /= (bank->bus_width / bank->chip_width); is merged in a single formula: bufferwsize = (buffersize / bank->chip_width) / (bank->bus_width / bank->chip_width); and simplified as: bufferwsize = buffersize / bank->bus_width; Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index ba2d909..f2ea947 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -1604,9 +1604,11 @@ static int cfi_intel_write_words(struct flash_bank *bank, uint8_t *word, uint32_ struct target *target = bank->target; /* Calculate buffer size and boundary mask */ + /* buffersize is (buffer size per chip) * (number of chips) */ + /* bufferwsize is buffersize in words */ uint32_t buffersize = (1UL << cfi_info->max_buf_write_size) * (bank->bus_width / bank->chip_width); uint32_t buffermask = buffersize-1; - uint32_t bufferwsize; + uint32_t bufferwsize = buffersize / bank->bus_width; /* Check for valid range */ if (address & buffermask) @@ -1615,18 +1617,6 @@ static int cfi_intel_write_words(struct flash_bank *bank, uint8_t *word, uint32_ bank->base, address, cfi_info->max_buf_write_size); return ERROR_FLASH_OPERATION_FAILED; } - switch (bank->chip_width) - { - case 4 : bufferwsize = buffersize / 4; break; - case 2 : bufferwsize = buffersize / 2; break; - case 1 : bufferwsize = buffersize; break; - default: - LOG_ERROR("Unsupported chip width %d", bank->chip_width); - return ERROR_FLASH_OPERATION_FAILED; - } - - bufferwsize/=(bank->bus_width / bank->chip_width); - /* Check for valid size */ if (wordcount > bufferwsize) @@ -1733,9 +1723,11 @@ static int cfi_spansion_write_words(struct flash_bank *bank, uint8_t *word, uint struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext; /* Calculate buffer size and boundary mask */ + /* buffersize is (buffer size per chip) * (number of chips) */ + /* bufferwsize is buffersize in words */ uint32_t buffersize = (1UL << cfi_info->max_buf_write_size) * (bank->bus_width / bank->chip_width); uint32_t buffermask = buffersize-1; - uint32_t bufferwsize; + uint32_t bufferwsize = buffersize / bank->bus_width; /* Check for valid range */ if (address & buffermask) @@ -1743,17 +1735,6 @@ static int cfi_spansion_write_words(struct flash_bank *bank, uint8_t *word, uint LOG_ERROR("Write address at base 0x%" PRIx32 ", address %" PRIx32 " not aligned to 2^%d boundary", bank->base, address, cfi_info->max_buf_write_size); return ERROR_FLASH_OPERATION_FAILED; } - switch (bank->chip_width) - { - case 4 : bufferwsize = buffersize / 4; break; - case 2 : bufferwsize = buffersize / 2; break; - case 1 : bufferwsize = buffersize; break; - default: - LOG_ERROR("Unsupported chip width %d", bank->chip_width); - return ERROR_FLASH_OPERATION_FAILED; - } - - bufferwsize/=(bank->bus_width / bank->chip_width); /* Check for valid size */ if (wordcount > bufferwsize) @@ -1950,22 +1931,12 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, { if (retval == ERROR_TARGET_RESOURCE_NOT_AVAILABLE) { - //adjust buffersize for chip width + /* Calculate buffer size and boundary mask */ + /* buffersize is (buffer size per chip) * (number of chips) */ + /* bufferwsize is buffersize in words */ uint32_t buffersize = (1UL << cfi_info->max_buf_write_size) * (bank->bus_width / bank->chip_width); uint32_t buffermask = buffersize-1; - uint32_t bufferwsize; - - switch (bank->chip_width) - { - case 4 : bufferwsize = buffersize / 4; break; - case 2 : bufferwsize = buffersize / 2; break; - case 1 : bufferwsize = buffersize; break; - default: - LOG_ERROR("Unsupported chip width %d", bank->chip_width); - return ERROR_FLASH_OPERATION_FAILED; - } - - bufferwsize/=(bank->bus_width / bank->chip_width); + uint32_t bufferwsize = buffersize / bank->bus_width; /* fall back to memory writes */ while (count >= (uint32_t)bank->bus_width) commit c7b269ace1bbe07d5db7a562bb9242f4be32be67 Author: Antonio Borneo <bor...@gm...> Date: Fri Apr 16 01:17:01 2010 +0800 NOR/CFI: check "flash bank" command arguments Arguments chip_width and bus_width of command "flash bank" are not fully checked. While bus_width is later on redundantly checked in several other parts (e.g. in cfi_command_val()) and generates run-time error, chip_width is never checked, nor related to actual bus_width value. Added check to avoid: - (chip_width == 0), that would mean no memory chip at all, avoiding also division by zero e.g. in cfi_get_u8(); - (bus_width == 0), that would mean no bus at all; - unsupported cases of chip_width or bus_width value not power of 2; - unsupported case of chip width wider than bus. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 2235c85..ba2d909 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -624,8 +624,18 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) return ERROR_FLASH_BANK_INVALID; } + /* both widths must: + * - not exceed max value; + * - not be null; + * - be equal to a power of 2. + * bus must be wide enought to hold one chip */ if ((bank->chip_width > CFI_MAX_CHIP_WIDTH) - || (bank->bus_width > CFI_MAX_BUS_WIDTH)) + || (bank->bus_width > CFI_MAX_BUS_WIDTH) + || (bank->chip_width == 0) + || (bank->bus_width == 0) + || (bank->chip_width & (bank->chip_width - 1)) + || (bank->bus_width & (bank->bus_width - 1)) + || (bank->chip_width > bank->bus_width)) { LOG_ERROR("chip and bus width have to specified in bytes"); return ERROR_FLASH_BANK_INVALID; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/aduc702x.c | 1 + src/flash/nor/at91sam3.c | 1 + src/flash/nor/at91sam7.c | 1 + src/flash/nor/avrf.c | 1 + src/flash/nor/cfi.c | 292 ++++++++++++++++++++------------------------- src/flash/nor/core.c | 24 ++++ src/flash/nor/core.h | 11 ++ src/flash/nor/driver.h | 20 +++- src/flash/nor/ecos.c | 1 + src/flash/nor/faux.c | 1 + src/flash/nor/imp.h | 2 + src/flash/nor/lpc2000.c | 1 + src/flash/nor/lpc288x.c | 1 + src/flash/nor/lpc2900.c | 1 + src/flash/nor/ocl.c | 1 + src/flash/nor/pic32mx.c | 1 + src/flash/nor/stellaris.c | 1 + src/flash/nor/stm32x.c | 1 + src/flash/nor/str7x.c | 1 + src/flash/nor/str9x.c | 1 + src/flash/nor/str9xpec.c | 1 + src/flash/nor/tcl.c | 4 +- src/flash/nor/tms470.c | 1 + 23 files changed, 206 insertions(+), 164 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-15 10:08:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via b8c54b362b395e50baf749366f6ec9e29fcba27e (commit) from 9597dcefaaf1282aa6721349e5b7472114b8bb54 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b8c54b362b395e50baf749366f6ec9e29fcba27e Author: Jun Ma <syn...@gm...> Date: Fri May 14 21:43:11 2010 +0800 comments on doc/manual/primer/jtag.txt 1. fix some errors in jtag.txt(in my personal opinion, please review). 2. remove a broken link Signed-off-by: Jun Ma <syn...@gm...> Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/doc/manual/primer/jtag.txt b/doc/manual/primer/jtag.txt index 0c67528..997f53b 100644 --- a/doc/manual/primer/jtag.txt +++ b/doc/manual/primer/jtag.txt @@ -29,7 +29,7 @@ TMS which will select different shift registers. The first thing you need to do is reset the state machine, because when you connect to a chip you do not know what state the controller is in,you need -to clock TMS as 1, at least 7 times. This will put you into "Test Logic +to clock TMS as 1, at least 5 times. This will put you into "Test Logic Reset" State. Knowing this, you can, once reset, then track what each transition on TMS will do, and hence know what state the JTAG state machine is in. @@ -45,9 +45,9 @@ instruction register. For example, one of the data registers will be known as "bypass" this is (usually) a single bit which has no function and is used to bypass the -chip. Assume we have 3 identical chips, wired up like the picture -and each has a 3 bit instruction register, and there are 2 known -instructions (110 = bypass, 010 = some other function) if we want to use +chip. Assume we have 3 identical chips, wired up like the picture(wikipedia) +and each has a 3 bits instruction register, and there are 2 known +instructions (110 = bypass, 010 = "some other function") if we want to use "some other function", on the second chip in the line, and not change the other chips we would do the following transitions. @@ -66,13 +66,13 @@ each chip [110] [010] [110] The order is reversed, because we shift out the least significant bit first. Then we transition TMS: - 1 1 1 1 0 0 + 1 1 1 0 0 which puts us in the "Shift DR state". Now when we clock data onto TDI (again while holding TMS to 0) , the data shifts through the data registers, and because of the instruction -registers we selected (some other function has 8 bits in its data +registers we selected ("some other function" has 8 bits in its data register), our total data register in the chain looks like this: 0 00000000 0 @@ -107,10 +107,6 @@ gets interesting. But in and of itself, JTAG is actually very simple. @section primerjtag More Reading -The following link goes to an HTML (or PDF) introduction to JTAG, -written by one of the original members of the JTAG committee: @par -http://www.asset-intertech.com/products/boundscan.htm - A separate primer contains information about @subpage primerjtagbs for developers that want to extend OpenOCD for such purposes. ----------------------------------------------------------------------- Summary of changes: doc/manual/primer/jtag.txt | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-14 15:25:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 9597dcefaaf1282aa6721349e5b7472114b8bb54 (commit) from dcca0b7694d23dbee6f1554dfbc4bffc4bedb4f2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9597dcefaaf1282aa6721349e5b7472114b8bb54 Author: Jun Ma <syn...@gm...> Date: Fri May 14 21:04:14 2010 +0800 missing pointer's declaration when enable macro -D_DEBUG_GDB_IO_. reproducable when "./configure --enable-maintainer-mode CFLAGS=-D_DEBUG_GDB_IO_" Signed-off-by: Jun Ma <syn...@gm...> Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 275d414..5b4fb7a 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -171,6 +171,9 @@ static int gdb_get_char_inner(struct connection *connection, int* next_char) struct gdb_connection *gdb_con = connection->priv; int retval = ERROR_OK; +#ifdef _DEBUG_GDB_IO_ + char *debug_buffer; +#endif for (;;) { if (connection->service->type == CONNECTION_PIPE) ----------------------------------------------------------------------- Summary of changes: src/server/gdb_server.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-14 13:27:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via dcca0b7694d23dbee6f1554dfbc4bffc4bedb4f2 (commit) via 0eb7fb59a0afe9c82f1f3d3f88fb88e3f04d706a (commit) from 215a5f7442773693045613cff9e3ce3c7f7e9678 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dcca0b7694d23dbee6f1554dfbc4bffc4bedb4f2 Author: Jon Povey <jon...@ra...> Date: Thu May 13 18:31:42 2010 +0900 NAND: fix first and last handling in nand_build_bbt Last block was being skipped, fix by changing the loop test from "<" to "<=" First block argument was ignored, always started from block 0 (and counted the wrong blocks as bad if first was nonzero). Now we use it. Signed-off-by: Jon Povey <jon...@ra...> Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nand/core.c b/src/flash/nand/core.c index e763491..44b13ce 100644 --- a/src/flash/nand/core.c +++ b/src/flash/nand/core.c @@ -222,8 +222,9 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index, int nand_build_bbt(struct nand_device *nand, int first, int last) { - uint32_t page = 0x0; + uint32_t page; int i; + int pages_per_block = (nand->erase_size / nand->page_size); uint8_t oob[6]; if ((first < 0) || (first >= nand->num_blocks)) @@ -232,7 +233,8 @@ int nand_build_bbt(struct nand_device *nand, int first, int last) if ((last >= nand->num_blocks) || (last == -1)) last = nand->num_blocks - 1; - for (i = first; i < last; i++) + page = first * pages_per_block; + for (i = first; i <= last; i++) { nand_read_page(nand, page, NULL, 0, oob, 6); @@ -248,7 +250,7 @@ int nand_build_bbt(struct nand_device *nand, int first, int last) nand->blocks[i].is_bad = 0; } - page += (nand->erase_size / nand->page_size); + page += pages_per_block; } return ERROR_OK; commit 0eb7fb59a0afe9c82f1f3d3f88fb88e3f04d706a Author: Jon Povey <jon...@ra...> Date: Thu May 13 18:31:41 2010 +0900 NAND: fix off-by-one error in erase command argument range The last_block argument to nand_erase() is checked against nand->num_blocks, but the highest valid block number is (total - 1), the test for invalid should be ">=" rather than ">". Signed-off-by: Jon Povey <jon...@ra...> Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nand/core.c b/src/flash/nand/core.c index 9013812..e763491 100644 --- a/src/flash/nand/core.c +++ b/src/flash/nand/core.c @@ -528,7 +528,7 @@ int nand_erase(struct nand_device *nand, int first_block, int last_block) if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; - if ((first_block < 0) || (last_block > nand->num_blocks)) + if ((first_block < 0) || (last_block >= nand->num_blocks)) return ERROR_INVALID_ARGUMENTS; /* make sure we know if a block is bad before erasing it */ ----------------------------------------------------------------------- Summary of changes: src/flash/nand/core.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Spencer O. <nt...@us...> - 2010-05-13 21:48:26
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 215a5f7442773693045613cff9e3ce3c7f7e9678 (commit) via a7fb60dc7b23a78be0ad5876b0e76a0e76875d5c (commit) via 7b36d2a229ecde1a497773233ee1850bb10d80a7 (commit) from 7b76da57f471e77a24519c10927aab79890783a9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 215a5f7442773693045613cff9e3ce3c7f7e9678 Author: Spencer Oliver <nt...@us...> Date: Wed May 12 23:04:57 2010 +0100 scripts: update flash bank names As the flash bank name is now unique update the scripts to suit. Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/tcl/board/hitex_str9-comstick.cfg b/tcl/board/hitex_str9-comstick.cfg index 4d1bb2e..c85681b 100644 --- a/tcl/board/hitex_str9-comstick.cfg +++ b/tcl/board/hitex_str9-comstick.cfg @@ -73,7 +73,7 @@ $_TARGETNAME configure -event reset-init { $_TARGETNAME configure -work-area-phys 0x50000000 -work-area-size 16384 -work-area-backup 0 #flash bank <driver> <base> <size> <chip_width> <bus_width> -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME str9x 0x00000000 0x00080000 0 0 0 -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME str9x 0x00080000 0x00008000 0 0 0 diff --git a/tcl/board/lubbock.cfg b/tcl/board/lubbock.cfg index 095c60a..b58ad5a 100644 --- a/tcl/board/lubbock.cfg +++ b/tcl/board/lubbock.cfg @@ -12,9 +12,9 @@ jtag_ntrst_delay 250 # CS0, CS1 -- two banks of CFI flash, 32 MBytes each # each bank is 32-bits wide, two 16-bit chips in parallel -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME cfi 0x00000000 0x02000000 2 4 $_TARGETNAME -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME cfi 0x04000000 0x02000000 2 4 $_TARGETNAME # CS2 low -- FPGA registers diff --git a/tcl/board/str910-eval.cfg b/tcl/board/str910-eval.cfg index a2772a8..9e3f881 100644 --- a/tcl/board/str910-eval.cfg +++ b/tcl/board/str910-eval.cfg @@ -58,9 +58,9 @@ $_TARGETNAME configure -event reset-init { } #flash bank str9x <base> <size> 0 0 <target#> <variant> -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME str9x 0x00000000 0x00080000 0 0 0 -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME str9x 0x00080000 0x00008000 0 0 0 # For more information about the configuration files, take a look at: diff --git a/tcl/target/at91sam3u4c.cfg b/tcl/target/at91sam3u4c.cfg index e281287..5cacbcb 100644 --- a/tcl/target/at91sam3u4c.cfg +++ b/tcl/target/at91sam3u4c.cfg @@ -2,10 +2,10 @@ source [find target/at91sam3uxx.cfg] # size is automatically "calculated" by probing -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME at91sam3 0x000080000 0 1 1 $_TARGETNAME # This is a 256K chip, it has the 2nd bank -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME at91sam3 0x000100000 0 1 1 $_TARGETNAME diff --git a/tcl/target/at91sam3u4e.cfg b/tcl/target/at91sam3u4e.cfg index e549185..6f6e0d8 100644 --- a/tcl/target/at91sam3u4e.cfg +++ b/tcl/target/at91sam3u4e.cfg @@ -2,10 +2,10 @@ source [find target/at91sam3uXX.cfg] # size is automatically "calculated" by probing -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME at91sam3 0x000080000 0 1 1 $_TARGETNAME # This is a 256K chip - it has the 2nd bank -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME at91sam3 0x000100000 0 1 1 $_TARGETNAME diff --git a/tcl/target/pic32mx.cfg b/tcl/target/pic32mx.cfg index 673d254..0b99cdb 100644 --- a/tcl/target/pic32mx.cfg +++ b/tcl/target/pic32mx.cfg @@ -67,9 +67,9 @@ $_TARGETNAME configure -event reset-init { mww 0xbf882030 $_PIC32MX_PROGSIZE } -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME pic32mx 0x1fc00000 0 0 0 $_TARGETNAME -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME pic32mx 0x1d000000 0 0 0 $_TARGETNAME # For more information about the configuration files, take a look at: diff --git a/tcl/target/str710.cfg b/tcl/target/str710.cfg index 4d68586..a5955b6 100644 --- a/tcl/target/str710.cfg +++ b/tcl/target/str710.cfg @@ -47,9 +47,9 @@ $_TARGETNAME configure -event gdb-flash-erase-start { $_TARGETNAME configure -work-area-phys 0x2000C000 -work-area-size 0x4000 -work-area-backup 0 #flash bank str7x <base> <size> 0 0 <target#> <variant> -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME str7x 0x40000000 0x00040000 0 0 $_TARGETNAME STR71x -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME str7x 0x400C0000 0x00004000 0 0 $_TARGETNAME STR71x # For more information about the configuration files, take a look at: diff --git a/tcl/target/str750.cfg b/tcl/target/str750.cfg index 8a64226..7d9f034 100644 --- a/tcl/target/str750.cfg +++ b/tcl/target/str750.cfg @@ -53,8 +53,8 @@ $_TARGETNAME configure -event gdb-flash-erase-start { $_TARGETNAME configure -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 0 #flash bank <driver> <base> <size> <chip_width> <bus_width> -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME str7x 0x20000000 0x00040000 0 0 $_TARGETNAME STR75x -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME str7x 0x200C0000 0x00004000 0 0 $_TARGETNAME STR75x diff --git a/tcl/target/str912.cfg b/tcl/target/str912.cfg index 6f2981a..a16c83a 100644 --- a/tcl/target/str912.cfg +++ b/tcl/target/str912.cfg @@ -63,9 +63,9 @@ $_TARGETNAME configure -event reset-init { $_TARGETNAME configure -work-area-phys 0x50000000 -work-area-size 16384 -work-area-backup 0 #flash bank str9x <base> <size> 0 0 <target#> <variant> -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash0 flash bank $_FLASHNAME str9x 0x00000000 0x00080000 0 0 $_TARGETNAME -set _FLASHNAME $_CHIPNAME.flash +set _FLASHNAME $_CHIPNAME.flash1 flash bank $_FLASHNAME str9x 0x00080000 0x00008000 0 0 $_TARGETNAME # For more information about the configuration files, take a look at: commit a7fb60dc7b23a78be0ad5876b0e76a0e76875d5c Author: Spencer Oliver <nt...@us...> Date: Wed May 12 22:42:26 2010 +0100 flash: require unique flash bank name Make sure the flash bank name is unique Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index a3efd80..a6e942e 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -795,6 +795,14 @@ COMMAND_HANDLER(handle_flash_bank_command) return ERROR_FAIL; } + /* check the flash bank name is unique */ + if (get_flash_bank_by_name(bank_name) != NULL) + { + /* flash bank name already exists */ + LOG_ERROR("flash bank name '%s' already exists", bank_name); + return ERROR_FAIL; + } + /* register flash specific commands */ if (NULL != driver->commands) { commit 7b36d2a229ecde1a497773233ee1850bb10d80a7 Author: Spencer Oliver <nt...@us...> Date: Wed May 12 22:40:19 2010 +0100 flash: add flash bank name support flash cmds can now be passed either the bank name or the bank number. For example. flash info stm32.flash flash info 0 Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 17c6e91..a3efd80 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -49,21 +49,18 @@ COMMAND_HELPER(flash_command_get_bank, unsigned name_index, COMMAND_HANDLER(handle_flash_info_command) { struct flash_bank *p; - uint32_t i = 0; int j = 0; int retval; if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; - unsigned bank_nr; - COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], bank_nr); + retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p); + if (retval != ERROR_OK) + return retval; - for (p = flash_bank_list(); p; p = p->next, i++) + if (p != NULL) { - if (i != bank_nr) - continue; - char buf[1024]; /* attempt auto probe */ @@ -76,8 +73,8 @@ COMMAND_HANDLER(handle_flash_info_command) return retval; command_print(CMD_CTX, - "#%" PRIi32 " : %s at 0x%8.8" PRIx32 ", size 0x%8.8" PRIx32 ", buswidth %i, chipwidth %i", - i, + "#%" PRIu32 " : %s at 0x%8.8" PRIx32 ", size 0x%8.8" PRIx32 ", buswidth %i, chipwidth %i", + p->bank_number, p->driver->name, p->base, p->size, @@ -115,6 +112,7 @@ COMMAND_HANDLER(handle_flash_info_command) COMMAND_HANDLER(handle_flash_probe_command) { + struct flash_bank *p; int retval; if (CMD_ARGC != 1) @@ -122,9 +120,10 @@ COMMAND_HANDLER(handle_flash_probe_command) return ERROR_COMMAND_SYNTAX_ERROR; } - unsigned bank_nr; - COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], bank_nr); - struct flash_bank *p = get_flash_bank_by_num_noprobe(bank_nr); + retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p); + if (retval != ERROR_OK) + return retval; + if (p) { if ((retval = p->driver->probe(p)) == ERROR_OK) @@ -294,15 +293,13 @@ COMMAND_HANDLER(handle_flash_erase_command) if (CMD_ARGC != 3) return ERROR_COMMAND_SYNTAX_ERROR; - uint32_t bank_nr; uint32_t first; uint32_t last; - COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr); - struct flash_bank *p; int retval; - retval = get_flash_bank_by_num(bank_nr, &p); + + retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p); if (retval != ERROR_OK) return retval; @@ -325,7 +322,7 @@ COMMAND_HANDLER(handle_flash_erase_command) { command_print(CMD_CTX, "erased sectors %" PRIu32 " " "through %" PRIu32" on flash bank %" PRIu32 " " - "in %fs", first, last, bank_nr, duration_elapsed(&bench)); + "in %fs", first, last, p->bank_number, duration_elapsed(&bench)); } return ERROR_OK; @@ -336,13 +333,13 @@ COMMAND_HANDLER(handle_flash_protect_command) if (CMD_ARGC != 4) return ERROR_COMMAND_SYNTAX_ERROR; - uint32_t bank_nr; uint32_t first; uint32_t last; - COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr); struct flash_bank *p; - int retval = get_flash_bank_by_num(bank_nr, &p); + int retval; + + retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p); if (retval != ERROR_OK) return retval; @@ -362,9 +359,9 @@ COMMAND_HANDLER(handle_flash_protect_command) retval = flash_driver_protect(p, set, first, last); if (retval == ERROR_OK) { command_print(CMD_CTX, "%s protection for sectors %i " - "through %i on flash bank %i", + "through %i on flash bank %" PRIu32 "", (set) ? "set" : "cleared", (int) first, - (int) last, (int) bank_nr); + (int) last, p->bank_number); } return ERROR_OK; @@ -847,8 +844,8 @@ COMMAND_HANDLER(handle_flash_banks_command) unsigned n = 0; for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++) { - LOG_USER("#%u: %s at 0x%8.8" PRIx32 ", size 0x%8.8" PRIx32 ", " - "buswidth %u, chipwidth %u", n, + LOG_USER("#%" PRIu32 " : %s at 0x%8.8" PRIx32 ", size 0x%8.8" PRIx32 ", " + "buswidth %u, chipwidth %u", p->bank_number, p->driver->name, p->base, p->size, p->bus_width, p->chip_width); } ----------------------------------------------------------------------- Summary of changes: src/flash/nor/tcl.c | 53 ++++++++++++++++++++---------------- tcl/board/hitex_str9-comstick.cfg | 4 +- tcl/board/lubbock.cfg | 4 +- tcl/board/str910-eval.cfg | 4 +- tcl/target/at91sam3u4c.cfg | 4 +- tcl/target/at91sam3u4e.cfg | 4 +- tcl/target/pic32mx.cfg | 4 +- tcl/target/str710.cfg | 4 +- tcl/target/str750.cfg | 4 +- tcl/target/str912.cfg | 4 +- 10 files changed, 47 insertions(+), 42 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-12 13:49:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 7b76da57f471e77a24519c10927aab79890783a9 (commit) via b05f8171c965bc3875df82f4469f952a13e2c504 (commit) from 6f03e92959008708ac6808df679f5729f6683166 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7b76da57f471e77a24519c10927aab79890783a9 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed May 12 13:45:04 2010 +0200 zy1000.cfg: gdb connect will fail first time without gdb-attach gdb-attach does a reset init to make sure that the CFI probe will succeed upon first gdb connect. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/tcl/board/zy1000.cfg b/tcl/board/zy1000.cfg index ee7afcd..d2561e9 100644 --- a/tcl/board/zy1000.cfg +++ b/tcl/board/zy1000.cfg @@ -63,6 +63,11 @@ $_TARGETNAME configure -event reset-init { mww 0x08020004 0 } +$_TARGETNAME configure -event gdb-attach { + # Without this gdb-attach will first time as probe will fail + reset init +} + # required for usable performance. Used for lots of # other things than flash programming. $_TARGETNAME configure -work-area-phys 0x00020000 -work-area-size 0x20000 -work-area-backup 0 commit b05f8171c965bc3875df82f4469f952a13e2c504 Author: Jun Ma <jm...@hf...> Date: Mon May 10 22:54:25 2010 +0800 fix instruction refilling bug when using software breakpoints on a big-endian arm926ej-s system Signed-off-by: Jun Ma <syn...@gm...> Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 9f1bb2e..ac18b37 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -377,6 +377,7 @@ static int arm7_9_unset_breakpoint(struct target *target, struct breakpoint *bre { return retval; } + current_instr = target_buffer_get_u32(target, (uint8_t *)¤t_instr); if (current_instr == arm7_9->arm_bkpt) if ((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) { ----------------------------------------------------------------------- Summary of changes: src/target/arm7_9_common.c | 1 + tcl/board/zy1000.cfg | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-11 20:17:43
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 6f03e92959008708ac6808df679f5729f6683166 (commit) from 4e022886d63bc05502ae51264ce9ba85e8c188c1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6f03e92959008708ac6808df679f5729f6683166 Author: Karl Kurbjun <kku...@gm...> Date: Mon May 10 22:18:24 2010 -0600 Fujitsu MBM29SL800TE flash support Hi, This is my first post to the list. First, I would like to thank everyone for their work on OpenOCD, it is a great tool to work with. I have been using it to debug code on hardware for the Rockbox project (www.rockbox.org). The target that I primarily work with has a Spansion/Fujitsu NOR flash (MBM29SL800TE). I attached a patch that adds support for this flash. I hope it can be included in the main repository. If there is something that needs to be changed with the patch before inclusion please let me know. -Karl Kurbjun diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index aa4540a..2235c85 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -57,6 +57,7 @@ static const struct cfi_fixup cfi_0002_fixups[] = { {CFI_MFR_SST, 0x00D7, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_5555_2AAA]}, {CFI_MFR_SST, 0x2780, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_5555_2AAA]}, {CFI_MFR_ATMEL, 0x00C8, cfi_fixup_atmel_reversed_erase_regions, NULL}, + {CFI_MFR_FUJITSU, 0x22ea, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_555_2AA]}, {CFI_MFR_FUJITSU, 0x226b, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_5555_2AAA]}, {CFI_MFR_AMIC, 0xb31a, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_555_2AA]}, {CFI_MFR_MX, 0x225b, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_555_2AA]}, diff --git a/src/flash/nor/non_cfi.c b/src/flash/nor/non_cfi.c index b49e441..e0ea568 100644 --- a/src/flash/nor/non_cfi.c +++ b/src/flash/nor/non_cfi.c @@ -280,6 +280,23 @@ static struct non_cfi non_cfi_flashes[] = { ERASE_REGION(15, 64*KB) } }, + { + .mfr = CFI_MFR_FUJITSU, + .id = 0x22ea, /* MBM29SL800TE */ + .pri_id = 0x02, + .dev_size = 1*MB, + .interface_desc = 0x2, /* x8 or x16 device with nBYTE */ + .max_buf_write_size = 0x0, + .status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7, + .num_erase_regions = 4, + .erase_region_info = + { + ERASE_REGION(15, 64*KB), + ERASE_REGION(1, 32*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 16*KB) + } + }, { .mfr = CFI_MFR_FUJITSU, .id = 0xba, /* 29LV400BC */ ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 1 + src/flash/nor/non_cfi.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-11 20:01:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 4e022886d63bc05502ae51264ce9ba85e8c188c1 (commit) via 4cf13101e5a75ffa0a84070133c2a5f764315d53 (commit) from 3650981de7e5854b5023fddeb1a4656794a0aae0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4e022886d63bc05502ae51264ce9ba85e8c188c1 Author: Marc Pignat <mar...@he...> Date: Tue May 11 07:59:22 2010 +0200 Documentation: consistency in GDB command name Always use the complete name of the GDB command, not an abbreviation. diff --git a/doc/openocd.texi b/doc/openocd.texi index 5e703f1..c95803a 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -537,7 +537,7 @@ command interpreter today is a mixture of (newer) JIM-Tcl commands, and (older) the orginal command interpreter. @item @b{Commands} -@* At the OpenOCD telnet command line (or via the GDB mon command) one +@* At the OpenOCD telnet command line (or via the GDB monitor command) one can type a Tcl for() loop, set variables, etc. Some of the commands documented in this guide are implemented as Tcl scripts, from a @file{startup.tcl} file internal to the server. commit 4cf13101e5a75ffa0a84070133c2a5f764315d53 Author: Marc Pignat <mar...@he...> Date: Tue May 11 07:58:57 2010 +0200 Documentation : arm920t implements armv4 There is a small typo in the cpu list, arm920t is armv4. diff --git a/doc/openocd.texi b/doc/openocd.texi index a4c4de2..5e703f1 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3432,7 +3432,7 @@ At this writing, the supported CPU types and variants are: @item @code{arm11} -- this is a generation of ARMv6 cores @item @code{arm720t} -- this is an ARMv4 core with an MMU @item @code{arm7tdmi} -- this is an ARMv4 core -@item @code{arm920t} -- this is an ARMv5 core with an MMU +@item @code{arm920t} -- this is an ARMv4 core with an MMU @item @code{arm926ejs} -- this is an ARMv5 core with an MMU @item @code{arm966e} -- this is an ARMv5 core @item @code{arm9tdmi} -- this is an ARMv4 core ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Spencer O. <nt...@us...> - 2010-05-11 13:49:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 3650981de7e5854b5023fddeb1a4656794a0aae0 (commit) via 2ae192699f5aaa911a874b85669fc803e4a29804 (commit) via bbc8f4e6cec361a34028dad4b5000c136f4f48b2 (commit) from cf811d8e6b7228348658f9211e0628fb725c5466 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3650981de7e5854b5023fddeb1a4656794a0aae0 Author: Spencer Oliver <nt...@us...> Date: Mon May 10 14:15:12 2010 +0100 mips32: 20 second timeout/megabyte for CRC check There was a fixed 20 second timeout which is too little for large, slow timeout checks. Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/target/mips32.c b/src/target/mips32.c index de8253f..0923a79 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -662,8 +662,10 @@ int mips32_checksum_memory(struct target *target, uint32_t address, init_reg_param(®_params[1], "a1", 32, PARAM_OUT); buf_set_u32(reg_params[1].value, 0, 32, count); + int timeout = 20000 * (1 + (count / (1024 * 1024))); + if ((retval = target_run_algorithm(target, 0, NULL, 2, reg_params, - crc_algorithm->address, crc_algorithm->address + (sizeof(mips_crc_code)-4), 10000, + crc_algorithm->address, crc_algorithm->address + (sizeof(mips_crc_code)-4), timeout, &mips32_info)) != ERROR_OK) { destroy_reg_param(®_params[0]); commit 2ae192699f5aaa911a874b85669fc803e4a29804 Author: Spencer Oliver <nt...@us...> Date: Mon May 10 14:14:57 2010 +0100 armv7m: 20 second timeout/megabyte for CRC check There was a fixed 20 second timeout which is too little for large, slow timeout checks. Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 83335a5..bd5aa14 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -615,8 +615,10 @@ int armv7m_checksum_memory(struct target *target, buf_set_u32(reg_params[0].value, 0, 32, address); buf_set_u32(reg_params[1].value, 0, 32, count); + int timeout = 20000 * (1 + (count / (1024 * 1024))); + if ((retval = target_run_algorithm(target, 0, NULL, 2, reg_params, - crc_algorithm->address, crc_algorithm->address + (sizeof(cortex_m3_crc_code)-6), 20000, &armv7m_info)) != ERROR_OK) + crc_algorithm->address, crc_algorithm->address + (sizeof(cortex_m3_crc_code)-6), timeout, &armv7m_info)) != ERROR_OK) { LOG_ERROR("error executing cortex_m3 crc algorithm"); destroy_reg_param(®_params[0]); commit bbc8f4e6cec361a34028dad4b5000c136f4f48b2 Author: Spencer Oliver <nt...@us...> Date: Mon May 10 12:23:41 2010 +0100 cfi: add Numonyx M29W128G reset workaround The ST/Numonix M29W128G has an issue when a 0xff cmd is sent, it cause an internal undefined state. The workaround according to the Numonyx is to send another 0xf0 reset cmd Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 4ef41b9..aa4540a 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -104,7 +104,6 @@ static __inline__ uint32_t flash_address(struct flash_bank *bank, int sector, ui } return bank->base + bank->sectors[sector].offset + offset * bank->bus_width; } - } static void cfi_command(struct flash_bank *bank, uint8_t cmd, uint8_t *cmd_buf) @@ -232,6 +231,35 @@ static uint32_t cfi_query_u32(struct flash_bank *bank, int sector, uint32_t offs data[(3 * bank->bus_width) - 1] << 16 | data[(4 * bank->bus_width) - 1] << 24; } +static int cfi_reset(struct flash_bank *bank) +{ + struct cfi_flash_bank *cfi_info = bank->driver_priv; + int retval = ERROR_OK; + + if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x0))) != ERROR_OK) + { + return retval; + } + + if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK) + { + return retval; + } + + if (cfi_info->manufacturer == 0x20 && + (cfi_info->device_id == 0x227E || cfi_info->device_id == 0x7E)) + { + /* Numonix M29W128G is cmd 0xFF intolerant - causes internal undefined state + * so we send an extra 0xF0 reset to fix the bug */ + if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x00))) != ERROR_OK) + { + return retval; + } + } + + return retval; +} + static void cfi_intel_clear_status_register(struct flash_bank *bank) { struct target *target = bank->target; @@ -335,11 +363,7 @@ static int cfi_read_intel_pri_ext(struct flash_bank *bank) if ((pri_ext->pri[0] != 'P') || (pri_ext->pri[1] != 'R') || (pri_ext->pri[2] != 'I')) { - if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x0))) != ERROR_OK) - { - return retval; - } - if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK) + if ((retval = cfi_reset(bank)) != ERROR_OK) { return retval; } @@ -1977,11 +2001,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, } /* return to read array mode, so we can read from flash again for padding */ - if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x0))) != ERROR_OK) - { - return retval; - } - if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK) + if ((retval = cfi_reset(bank)) != ERROR_OK) { return retval; } @@ -2015,11 +2035,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, } /* return to read array mode */ - if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x0))) != ERROR_OK) - { - return retval; - } - return cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0)); + return cfi_reset(bank); } static void cfi_fixup_atmel_reversed_erase_regions(struct flash_bank *bank, void *param) @@ -2083,11 +2099,7 @@ static int cfi_query_string(struct flash_bank *bank, int address) if ((cfi_info->qry[0] != 'Q') || (cfi_info->qry[1] != 'R') || (cfi_info->qry[2] != 'Y')) { - if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x0))) != ERROR_OK) - { - return retval; - } - if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK) + if ((retval = cfi_reset(bank)) != ERROR_OK) { return retval; } @@ -2168,11 +2180,7 @@ static int cfi_probe(struct flash_bank *bank) LOG_INFO("Flash Manufacturer/Device: 0x%04x 0x%04x", cfi_info->manufacturer, cfi_info->device_id); /* switch back to read array mode */ - if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x00))) != ERROR_OK) - { - return retval; - } - if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x00))) != ERROR_OK) + if ((retval = cfi_reset(bank)) != ERROR_OK) { return retval; } @@ -2289,11 +2297,7 @@ static int cfi_probe(struct flash_bank *bank) /* return to read array mode * we use both reset commands, as some Intel flashes fail to recognize the 0xF0 command */ - if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x0))) != ERROR_OK) - { - return retval; - } - if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK) + if ((retval = cfi_reset(bank)) != ERROR_OK) { return retval; } @@ -2377,7 +2381,6 @@ static int cfi_auto_probe(struct flash_bank *bank) return cfi_probe(bank); } - static int cfi_intel_protect_check(struct flash_bank *bank) { int retval; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 67 ++++++++++++++++++++++++++------------------------ src/target/armv7m.c | 4 ++- src/target/mips32.c | 4 ++- 3 files changed, 41 insertions(+), 34 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Spencer O. <nt...@us...> - 2010-05-07 18:02:55
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via cf811d8e6b7228348658f9211e0628fb725c5466 (commit) from f32492c74f29f7efd0d73f8118d0b988bc24f56a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cf811d8e6b7228348658f9211e0628fb725c5466 Author: Spencer Oliver <nt...@us...> Date: Fri May 7 14:24:13 2010 +0100 cfg: add stm32eval board configs Increase working area for stm3210e_eval.cfg. Add new configs for the following boards: STM321000B-EVAL, STM32100C-EVAL, STM32100B-EVAL Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/tcl/board/stm32100b_eval.cfg b/tcl/board/stm32100b_eval.cfg new file mode 100644 index 0000000..ba9058c --- /dev/null +++ b/tcl/board/stm32100b_eval.cfg @@ -0,0 +1,7 @@ +# This is an STM32 eval board with a single STM32F100VB chip on it. +# http://www.st.com/mcu/contentid-100-110-STM32100B_EVAL.html + +# we only have 8k sram +set WORKAREASIZE 8192 + +source [find target/stm32.cfg] diff --git a/tcl/board/stm3210b_eval.cfg b/tcl/board/stm3210b_eval.cfg new file mode 100644 index 0000000..5e0a5ea --- /dev/null +++ b/tcl/board/stm3210b_eval.cfg @@ -0,0 +1,8 @@ +# This is an STM32 eval board with a single STM32F100VBT6 chip on it. +# http://www.st.com/mcu/contentid-100-110-STM3210B_EVAL.html + +# increase working area for faster flash programming + +set WORKAREASIZE 32768 + +source [find target/stm32.cfg] diff --git a/tcl/board/stm3210c_eval.cfg b/tcl/board/stm3210c_eval.cfg new file mode 100644 index 0000000..fad8737 --- /dev/null +++ b/tcl/board/stm3210c_eval.cfg @@ -0,0 +1,8 @@ +# This is an STM32 eval board with a single STM32F107VCT chip on it. +# http://www.st.com/mcu/contentid-100-110-STM3210C_EVAL.html + +# increase working area for faster flash programming + +set WORKAREASIZE 32768 + +source [find target/stm32.cfg] diff --git a/tcl/board/stm3210e_eval.cfg b/tcl/board/stm3210e_eval.cfg index ab2f64f..83ce488 100644 --- a/tcl/board/stm3210e_eval.cfg +++ b/tcl/board/stm3210e_eval.cfg @@ -1,3 +1,8 @@ -# This is an STM32 eval board with a single STM32F103ZET6 chip on it. +# This is an STM32 eval board with a single STM32F103ZE chip on it. +# http://www.st.com/mcu/contentid-100-110-STM3210E_EVAL.html + +# increase working area for faster flash programming + +set WORKAREASIZE 32768 source [find target/stm32.cfg] ----------------------------------------------------------------------- Summary of changes: tcl/board/stm32100b_eval.cfg | 7 +++++++ tcl/board/stm3210b_eval.cfg | 8 ++++++++ tcl/board/stm3210c_eval.cfg | 8 ++++++++ tcl/board/stm3210e_eval.cfg | 7 ++++++- 4 files changed, 29 insertions(+), 1 deletions(-) create mode 100644 tcl/board/stm32100b_eval.cfg create mode 100644 tcl/board/stm3210b_eval.cfg create mode 100644 tcl/board/stm3210c_eval.cfg hooks/post-receive -- Main OpenOCD repository |
From: Spencer O. <nt...@us...> - 2010-05-06 23:52:59
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via f32492c74f29f7efd0d73f8118d0b988bc24f56a (commit) from 737c9b6258c6e68714ae264ff36126eb5d382d6a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f32492c74f29f7efd0d73f8118d0b988bc24f56a Author: Spencer Oliver <nt...@us...> Date: Thu May 6 22:51:20 2010 +0100 server: incorrectly display socket port number c->sin.sin_port does not contain a valid port number so just use service->port as this is always correct. Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/server/server.c b/src/server/server.c index 7e57228..57c4016 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -78,7 +78,7 @@ static int add_connection(struct service *service, struct command_context *cmd_c (char *)&flag, /* the cast is historical cruft */ sizeof(int)); /* length of option value */ - LOG_INFO("accepting '%s' connection from %i", service->name, c->sin.sin_port); + LOG_INFO("accepting '%s' connection from %i", service->name, service->port); if ((retval = service->new_connection(c)) != ERROR_OK) { close_socket(c->fd); ----------------------------------------------------------------------- Summary of changes: src/server/server.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-06 07:43:41
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 737c9b6258c6e68714ae264ff36126eb5d382d6a (commit) from f7e0f3c285e9b1578184da886792e02d253ea687 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 737c9b6258c6e68714ae264ff36126eb5d382d6a Author: Ãyvind Harboe <oyv...@zy...> Date: Wed May 5 15:08:34 2010 +0200 flash: stop caching protection state There are a million reasons why cached protection state might be stale: power cycling of target, reset, code executing on the target, etc. The "flash protect_check" command is now gone. This is *always* executed when running a "flash info". As a bonus for more a more robust approach, lots of code could be deleted. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/doc/openocd.texi b/doc/openocd.texi index d311c8e..a4c4de2 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -4129,9 +4129,8 @@ The @var{num} parameter is a value shown by @command{flash banks}. @deffn Command {flash info} num Print info about flash bank @var{num} The @var{num} parameter is a value shown by @command{flash banks}. -The information includes per-sector protect status, which may be -incorrect (outdated) unless you first issue a -@command{flash protect_check num} command. +This command will first query the hardware, it does not print cached +and possibly stale information. @end deffn @anchor{flash protect} @@ -4144,14 +4143,6 @@ specifies "to the end of the flash bank". The @var{num} parameter is a value shown by @command{flash banks}. @end deffn -@deffn Command {flash protect_check} num -Check protection state of sectors in flash bank @var{num}. -The @var{num} parameter is a value shown by @command{flash banks}. -@comment @option{flash erase_sector} using the same syntax. -This updates the protection information displayed by @option{flash info}. -(Code execution may have invalidated any state records kept by OpenOCD.) -@end deffn - @anchor{Flash Driver List} @section Flash Driver List As noted above, the @command{flash bank} command requires a driver name, diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 92b553b..4ef41b9 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -852,6 +852,17 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la */ if ((!set) && (!(pri_ext->feature_support & 0x20))) { + /* FIX!!! this code path is broken!!! + * + * The correct approach is: + * + * 1. read out current protection status + * + * 2. override read out protection status w/unprotected. + * + * 3. re-protect what should be protected. + * + */ for (i = 0; i < bank->num_sectors; i++) { if (bank->sectors[i].is_protected == 1) diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index e07ca1f..936f07c 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -54,74 +54,27 @@ int flash_driver_erase(struct flash_bank *bank, int first, int last) int flash_driver_protect(struct flash_bank *bank, int set, int first, int last) { int retval; - bool updated = false; - - /* NOTE: "first == last" means (un?)protect just that sector. - code including Lower level ddrivers may rely on this "first <= last" - * invariant. - */ /* callers may not supply illegal parameters ... */ if (first < 0 || first > last || last >= bank->num_sectors) + { + LOG_ERROR("illegal sector range"); return ERROR_FAIL; + } /* force "set" to 0/1 */ set = !!set; - /* - * Filter out what trivial nonsense we can, so drivers don't have to. + /* DANGER! * - * Don't tell drivers to change to the current state... it's needless, - * and reducing the amount of work to be done (potentially to nothing) - * speeds at least some things up. - */ -scan: - for (int i = first; i <= last; i++) { - struct flash_sector *sector = bank->sectors + i; - - /* Only filter requests to protect the already-protected, or - * to unprotect the already-unprotected. Changing from the - * unknown state (-1) to a known one is unwise but allowed; - * protection status is best checked first. - */ - if (sector->is_protected != set) - continue; - - /* Shrink this range of sectors from the start; don't overrun - * the end. Also shrink from the end; don't overun the start. - * - * REVISIT we could handle discontiguous regions by issuing - * more than one driver request. How much would that matter? - */ - if (i == first && i != last) { - updated = true; - first++; - } else if (i == last && i != first) { - updated = true; - last--; - } - } - - /* updating the range affects the tests in the scan loop above; so - * re-scan, to make sure we didn't miss anything. - */ - if (updated) { - updated = false; - goto scan; - } - - /* Single sector, already protected? Nothing to do! - * We may have trimmed our parameters into this degenerate case. + * We must not use any cached information about protection state!!!! * - * FIXME repeating the "is_protected==set" test is a giveaway that - * this fast-exit belongs earlier, in the trim-it-down loop; mve. - * */ - if (first == last && bank->sectors[first].is_protected == set) - return ERROR_OK; - - - /* Note that we don't pass illegal parameters to drivers; any - * trimming just turns one valid range into another one. + * There are a million things that could change the protect state: + * + * the target could have reset, power cycled, been hot plugged, + * the application could have run, etc. + * + * Drivers only receive valid sector range. */ retval = bank->driver->protect(bank, set, first, last); if (retval != ERROR_OK) @@ -754,34 +707,3 @@ int flash_write(struct target *target, struct image *image, { return flash_write_unlock(target, image, written, erase, false); } - -/** - * Invalidates cached flash state which a target can change as it runs. - * - * @param target The target being resumed - * - * OpenOCD caches some flash state for brief periods. For example, a sector - * that is protected must be unprotected before OpenOCD tries to write it, - * Also, a sector that's not erased must be erased before it's written. - * - * As a rule, OpenOCD and target firmware can both modify the flash, so when - * a target starts running, OpenOCD needs to invalidate its cached state. - */ -void nor_resume(struct target *target) -{ - struct flash_bank *bank; - - for (bank = flash_banks; bank; bank = bank->next) { - int i; - - if (bank->target != target) - continue; - - for (i = 0; i < bank->num_sectors; i++) { - struct flash_sector *sector = bank->sectors + i; - - sector->is_erased = -1; - sector->is_protected = -1; - } - } -} diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h index b152677..1dfd721 100644 --- a/src/flash/nor/core.h +++ b/src/flash/nor/core.h @@ -53,6 +53,10 @@ struct flash_sector * Indication of protection status: 0 = unprotected/unlocked, * 1 = protected/locked, other = unknown. Set by * @c flash_driver_s::protect_check. + * + * This information must be considered stale immediately. + * A million things could make it stale: power cycle, + * reset of target, code running on target, etc. */ int is_protected; }; @@ -124,9 +128,6 @@ int flash_unlock_address_range(struct target *target, uint32_t addr, int flash_write(struct target *target, struct image *image, uint32_t *written, int erase); -/* invalidate cached state (targets may modify their own flash) */ -void nor_resume(struct target *target); - /** * Forces targets to re-examine their erase/protection state. * This routine must be called when the system may modify the status. diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 947fd04..17c6e91 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -70,6 +70,11 @@ COMMAND_HANDLER(handle_flash_info_command) if ((retval = p->driver->auto_probe(p)) != ERROR_OK) return retval; + /* We must query the hardware to avoid printing stale information! */ + retval = p->driver->protect_check(p); + if (retval != ERROR_OK) + return retval; + command_print(CMD_CTX, "#%" PRIi32 " : %s at 0x%8.8" PRIx32 ", size 0x%8.8" PRIx32 ", buswidth %i, chipwidth %i", i, @@ -266,32 +271,6 @@ COMMAND_HANDLER(handle_flash_erase_address_command) return retval; } -COMMAND_HANDLER(handle_flash_protect_check_command) -{ - if (CMD_ARGC != 1) - return ERROR_COMMAND_SYNTAX_ERROR; - - struct flash_bank *p; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p); - if (ERROR_OK != retval) - return retval; - - if ((retval = p->driver->protect_check(p)) == ERROR_OK) - { - command_print(CMD_CTX, "successfully checked protect state"); - } - else if (retval == ERROR_FLASH_OPERATION_FAILED) - { - command_print(CMD_CTX, "checking protection state failed (possibly unsupported) by flash #%s at 0x%8.8" PRIx32, CMD_ARGV[0], p->base); - } - else - { - command_print(CMD_CTX, "unknown error when checking protection state of flash bank '#%s' at 0x%8.8" PRIx32, CMD_ARGV[0], p->base); - } - - return ERROR_OK; -} - static int flash_check_sector_parameters(struct command_context *cmd_ctx, uint32_t first, uint32_t last, uint32_t num_sectors) { @@ -707,14 +686,6 @@ static const struct command_registration flash_exec_command_handlers[] = { "flash bank.", }, { - .name = "protect_check", - .handler = handle_flash_protect_check_command, - .mode = COMMAND_EXEC, - .usage = "bank_id", - .help = "Check protection state of all blocks in a " - "flash bank.", - }, - { .name = "erase_sector", .handler = handle_flash_erase_command, .mode = COMMAND_EXEC, diff --git a/src/target/target.c b/src/target/target.c index d17bb74..37e515a 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -474,19 +474,6 @@ int target_resume(struct target *target, int current, uint32_t address, int hand if ((retval = target->type->resume(target, current, address, handle_breakpoints, debug_execution)) != ERROR_OK) return retval; - /* Invalidate any cached protect/erase/... flash status, since - * almost all targets will now be able modify the flash by - * themselves. We want flash drivers and infrastructure to - * be able to rely on (non-invalidated) cached state. - * - * For now we require that algorithms provided by OpenOCD are - * used only by code which properly maintains that cached state. - * state - * - * REVISIT do the same for NAND ; maybe other flash flavors too... - */ - if (!target->running_alg) - nor_resume(target); return retval; } ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 13 +----- src/flash/nor/cfi.c | 11 +++++ src/flash/nor/core.c | 100 +++++-------------------------------------------- src/flash/nor/core.h | 7 ++- src/flash/nor/tcl.c | 39 ++----------------- src/target/target.c | 13 ------ 6 files changed, 33 insertions(+), 150 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-06 07:42:42
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via f7e0f3c285e9b1578184da886792e02d253ea687 (commit) from 3077f5845f197c5e21fc4ed917722297c74ef754 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f7e0f3c285e9b1578184da886792e02d253ea687 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed May 5 09:32:43 2010 +0200 flash: erase_address now has an unlock option Quite useful to be able to unlock the flash, just like in the flash write_image cmd. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 49df159..d311c8e 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -21,7 +21,7 @@ of the Open On-Chip Debugger (OpenOCD). @itemize @bullet @item Copyright @copyright{} 2008 The OpenOCD Project @item Copyright @copyright{} 2007-2008 Spencer Oliver @email{spen@@spen-soft.co.uk} -@item Copyright @copyright{} 2008 Oyvind Harboe @email{oyvind.harboe@@zylin.com} +@item Copyright @copyright{} 2008-2010 Oyvind Harboe @email{oyvind.harboe@@zylin.com} @item Copyright @copyright{} 2008 Duane Ellis @email{openocd@@duaneellis.com} @item Copyright @copyright{} 2009-2010 David Brownell @end itemize @@ -4043,7 +4043,7 @@ specifies "to the end of the flash bank". The @var{num} parameter is a value shown by @command{flash banks}. @end deffn -@deffn Command {flash erase_address} [@option{pad}] address length +@deffn Command {flash erase_address} [@option{pad}] [@option{unlock}] address length Erase sectors starting at @var{address} for @var{length} bytes. Unless @option{pad} is specified, @math{address} must begin a flash sector, and @math{address + length - 1} must end a sector. @@ -4053,6 +4053,8 @@ The flash bank to use is inferred from the @var{address}, and the specified length must stay within that bank. As a special case, when @var{length} is zero and @var{address} is the start of the bank, the whole flash is erased. +If @option{unlock} is specified, then the flash is unprotected +before erase starts. @end deffn @deffn Command {flash fillw} address word length diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 232d503..e07ca1f 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -502,7 +502,7 @@ static int flash_driver_unprotect(struct flash_bank *bank, int first, int last) return flash_driver_protect(bank, 0, first, last); } -static int flash_unlock_address_range(struct target *target, uint32_t addr, uint32_t length) +int flash_unlock_address_range(struct target *target, uint32_t addr, uint32_t length) { /* By default, pad to sector boundaries ... the real issue here * is that our (only) caller *permanently* removes protection, diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h index 797cf68..b152677 100644 --- a/src/flash/nor/core.h +++ b/src/flash/nor/core.h @@ -108,6 +108,9 @@ int flash_register_commands(struct command_context *cmd_ctx); int flash_erase_address_range(struct target *target, bool pad, uint32_t addr, uint32_t length); +int flash_unlock_address_range(struct target *target, uint32_t addr, + uint32_t length); + /** * Writes @a image into the @a target flash. The @a written parameter * will contain the diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 66b8ac3..947fd04 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -194,32 +194,40 @@ COMMAND_HANDLER(handle_flash_erase_check_command) COMMAND_HANDLER(handle_flash_erase_address_command) { struct flash_bank *p; - int retval; + int retval = ERROR_OK; int address; int length; bool do_pad = false; + bool do_unlock = false; struct target *target = get_current_target(CMD_CTX); - switch (CMD_ARGC) { - case 3: + while (CMD_ARGC >= 3) + { /* Optionally pad out the address range to block/sector * boundaries. We can't know if there's data in that part * of the flash; only do padding if we're told to. */ - if (strcmp("pad", CMD_ARGV[0]) != 0) + if (strcmp("pad", CMD_ARGV[0]) == 0) + { + do_pad = true; + } else if (strcmp("unlock", CMD_ARGV[0]) == 0) + { + do_unlock = true; + } else + { return ERROR_COMMAND_SYNTAX_ERROR; - do_pad = true; + } CMD_ARGC--; CMD_ARGV++; - /* FALL THROUGH */ - case 2: - COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], address); - COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], length); - break; - default: + } + if (CMD_ARGC != 2) + { return ERROR_COMMAND_SYNTAX_ERROR; } + COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], address); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], length); + if (length <= 0) { command_print(CMD_CTX, "Length must be >0"); @@ -238,7 +246,15 @@ COMMAND_HANDLER(handle_flash_erase_address_command) struct duration bench; duration_start(&bench); - retval = flash_erase_address_range(target, do_pad, address, length); + if (do_unlock) + { + retval = flash_unlock_address_range(target, address, length); + } + + if (retval == ERROR_OK) + { + retval = flash_erase_address_range(target, do_pad, address, length); + } if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) { @@ -709,12 +725,15 @@ static const struct command_registration flash_exec_command_handlers[] = { .name = "erase_address", .handler = handle_flash_erase_address_command, .mode = COMMAND_EXEC, - .usage = "['pad'] address length", + .usage = "['pad'] ['unlock'] address length", .help = "Erase flash sectors starting at address and " "continuing for length bytes. If 'pad' is specified, " "data outside that range may also be erased: the start " "address may be decreased, and length increased, so " - "that all of the first and last sectors are erased.", + "that all of the first and last sectors are erased. " + "If 'unlock' is specified, then the flash is unprotected " + "before erasing.", + }, { .name = "fillw", ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 6 ++++-- src/flash/nor/core.c | 2 +- src/flash/nor/core.h | 3 +++ src/flash/nor/tcl.c | 47 +++++++++++++++++++++++++++++++++-------------- 4 files changed, 41 insertions(+), 17 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-06 07:42:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 3077f5845f197c5e21fc4ed917722297c74ef754 (commit) from 2fba796e27fe37076380f90aa4df986db2b06685 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3077f5845f197c5e21fc4ed917722297c74ef754 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed May 5 09:32:03 2010 +0200 cfi: fix error handling for protect fn No error was propagated. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 9967652..92b553b 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -3,6 +3,7 @@ * Dom...@gm... * * Copyright (C) 2009 Michael Schwingen * * mi...@sc... * + * Copyright (C) 2010 Ãyvind Harboe <oyv...@zy...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -887,6 +888,7 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last) if ((first < 0) || (last < first) || (last >= bank->num_sectors)) { + LOG_ERROR("Invalid sector range"); return ERROR_FLASH_SECTOR_INVALID; } @@ -897,14 +899,12 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last) { case 1: case 3: - cfi_intel_protect(bank, set, first, last); + return cfi_intel_protect(bank, set, first, last); break; default: LOG_ERROR("protect: cfi primary command set %i unsupported", cfi_info->pri_id); - break; + return ERROR_FAIL; } - - return ERROR_OK; } /* FIXME Replace this by a simple memcpy() - still unsure about sideeffects */ ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-06 07:41:41
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 2fba796e27fe37076380f90aa4df986db2b06685 (commit) from 82ea640830fe13f9ab8ef33c65a76480b697f856 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2fba796e27fe37076380f90aa4df986db2b06685 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed May 5 08:19:40 2010 +0200 zy1000: fix tcl command to read power dropout status Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 2fac176..b3f94e5 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -434,10 +434,9 @@ zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp, return JIM_ERR; } - uint32_t status; - ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, status); + bool dropout = readPowerDropout(); - Jim_SetResult(interp, Jim_NewIntObj(interp, (status&0x80) != 0)); + Jim_SetResult(interp, Jim_NewIntObj(interp, dropout)); return JIM_OK; } ----------------------------------------------------------------------- Summary of changes: src/jtag/zy1000/zy1000.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-06 07:41:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 82ea640830fe13f9ab8ef33c65a76480b697f856 (commit) from 812e21ac396247767da0144748b5f52ad11b3e17 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 82ea640830fe13f9ab8ef33c65a76480b697f856 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue May 4 13:26:52 2010 +0200 gdb: connect will now fail if flash autoprobe fails This stops GDB from launching with an empty memory map, making gdb load w/flashing fail for no obvious reason. The error message points in the direction of the gdb-attach event that can be set up to issue a halt or "reset init" which will put GDB in a well defined stated upon attach and thus have a robust flash autoprobe. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index e6c0eeb..232d503 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -220,22 +220,25 @@ struct flash_bank *get_flash_bank_by_name(const char *name) return NULL; } -struct flash_bank *get_flash_bank_by_num(int num) +int get_flash_bank_by_num(int num, struct flash_bank **bank) { struct flash_bank *p = get_flash_bank_by_num_noprobe(num); int retval; if (p == NULL) - return NULL; + { + return ERROR_FAIL; + } retval = p->driver->auto_probe(p); if (retval != ERROR_OK) { LOG_ERROR("auto_probe failed %d\n", retval); - return NULL; + return retval; } - return p; + *bank = p; + return ERROR_OK; } /* lookup flash bank by address */ diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h index 68220af..797cf68 100644 --- a/src/flash/nor/core.h +++ b/src/flash/nor/core.h @@ -157,9 +157,10 @@ struct flash_bank *get_flash_bank_by_name(const char *name); /** * Returns a flash bank by the specified flash_bank_s bank_number, @a num. * @param num The flash bank number. - * @returns A struct flash_bank for flash bank @a num, or NULL + * @param bank returned bank if fn returns ERROR_OK + * @returns ERROR_OK if successful */ -struct flash_bank *get_flash_bank_by_num(int num); +int get_flash_bank_by_num(int num, struct flash_bank **bank); /** * Retreives @a bank from a command argument, reporting errors parsing * the bank identifier or retreiving the specified bank. The bank diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index aed55c0..66b8ac3 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -42,13 +42,7 @@ COMMAND_HELPER(flash_command_get_bank, unsigned name_index, unsigned bank_num; COMMAND_PARSE_NUMBER(uint, name, bank_num); - *bank = get_flash_bank_by_num(bank_num); - if (!*bank) - { - command_print(CMD_CTX, "flash bank '%s' not found", name); - return ERROR_INVALID_ARGUMENTS; - } - return ERROR_OK; + return get_flash_bank_by_num(bank_num, bank); } @@ -310,9 +304,12 @@ COMMAND_HANDLER(handle_flash_erase_command) uint32_t last; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr); - struct flash_bank *p = get_flash_bank_by_num(bank_nr); - if (!p) - return ERROR_OK; + + struct flash_bank *p; + int retval; + retval = get_flash_bank_by_num(bank_nr, &p); + if (retval != ERROR_OK) + return retval; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], first); if (strcmp(CMD_ARGV[2], "last") == 0) @@ -320,7 +317,6 @@ COMMAND_HANDLER(handle_flash_erase_command) else COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last); - int retval; if ((retval = flash_check_sector_parameters(CMD_CTX, first, last, p->num_sectors)) != ERROR_OK) return retval; @@ -350,9 +346,10 @@ COMMAND_HANDLER(handle_flash_protect_command) uint32_t last; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr); - struct flash_bank *p = get_flash_bank_by_num(bank_nr); - if (!p) - return ERROR_OK; + struct flash_bank *p; + int retval = get_flash_bank_by_num(bank_nr, &p); + if (retval != ERROR_OK) + return retval; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], first); if (strcmp(CMD_ARGV[2], "last") == 0) @@ -363,7 +360,6 @@ COMMAND_HANDLER(handle_flash_protect_command) bool set; COMMAND_PARSE_ON_OFF(CMD_ARGV[3], set); - int retval; if ((retval = flash_check_sector_parameters(CMD_CTX, first, last, p->num_sectors)) != ERROR_OK) return retval; diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index f46980e..275d414 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -855,6 +855,26 @@ static int gdb_new_connection(struct connection *connection) gdb_putback_char(connection, initial_ack); target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_ATTACH); + if (gdb_use_memory_map) + { + /* Connect must fail if the memory map can't be set up correctly. + * + * This will cause an auto_probe to be invoked, which is either + * a no-op or it will fail when the target isn't ready(e.g. not halted). + */ + int i; + for (i = 0; i < flash_get_bank_count(); i++) + { + struct flash_bank *p; + retval = get_flash_bank_by_num(i, &p); + if (retval != ERROR_OK) + { + LOG_ERROR("Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect."); + return retval; + } + } + } + gdb_actual_connections++; LOG_DEBUG("New GDB Connection: %d, Target %s, state: %s", gdb_actual_connections, @@ -1692,10 +1712,10 @@ static int gdb_memory_map(struct connection *connection, banks = malloc(sizeof(struct flash_bank *)*flash_get_bank_count()); for (i = 0; i < flash_get_bank_count(); i++) { - p = get_flash_bank_by_num(i); - if (p == NULL) { + retval = get_flash_bank_by_num(i, &p); + if (retval != ERROR_OK) + { free(banks); - retval = ERROR_FAIL; gdb_send_error(connection, retval); return retval; } ----------------------------------------------------------------------- Summary of changes: src/flash/nor/core.c | 11 +++++++---- src/flash/nor/core.h | 5 +++-- src/flash/nor/tcl.c | 26 +++++++++++--------------- src/server/gdb_server.c | 26 +++++++++++++++++++++++--- 4 files changed, 44 insertions(+), 24 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-06 07:40:51
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 812e21ac396247767da0144748b5f52ad11b3e17 (commit) from 31b050108a1cd740b326dddfa7a2f1322ee8c186 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 812e21ac396247767da0144748b5f52ad11b3e17 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue May 4 12:28:05 2010 +0200 zy1000: fix keep_alive() bug introduced in latest commit. Should have held off merging that commit. Sigh.... Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 092e3cd..2fac176 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -205,6 +205,8 @@ void zy1000_reset(int trst, int srst) total = timeval_ms() - start; + keep_alive(); + if (total > 5000) { LOG_ERROR("SRST took too long to deassert: %dms", (int)total); ----------------------------------------------------------------------- Summary of changes: src/jtag/zy1000/zy1000.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-05 15:42:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 31b050108a1cd740b326dddfa7a2f1322ee8c186 (commit) via 91b9f3de0b8e3277ab5c584c6076ddfe491ffc86 (commit) via 7e33f87b3d25331f3ac366c88e0b0ebb196422ec (commit) via 0d8f60e28f0f6e2bf65c674154b129fffae9eca8 (commit) from ca0f6a5c58fb94d590362d9a7d99543919fbbf43 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 31b050108a1cd740b326dddfa7a2f1322ee8c186 Author: Matthias Bode <pap...@go...> Date: Mon May 3 22:35:38 2010 +0200 Fixed bug in tcl-server No segmentationfault when sending commands to tcl-server. modified: src/server/server.c modified: src/server/tcl_server.c modified: src/server/tcl_server.h diff --git a/src/server/server.c b/src/server/server.c index 0d3273b..7e57228 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -513,7 +513,7 @@ int server_preinit(void) int server_init(struct command_context *cmd_ctx) { - int ret = tcl_init(cmd_ctx); + int ret = tcl_init(); if (ERROR_OK != ret) return ret; diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c index a88c436..7c8e130 100644 --- a/src/server/tcl_server.c +++ b/src/server/tcl_server.c @@ -81,7 +81,7 @@ static int tcl_new_connection(struct connection *connection) static int tcl_input(struct connection *connection) { - Jim_Interp *interp = (Jim_Interp *)connection->priv; + Jim_Interp *interp = (Jim_Interp *)connection->cmd_ctx->interp; int retval; int i; ssize_t rlen; @@ -157,7 +157,7 @@ static int tcl_closed(struct connection *connection) return ERROR_OK; } -int tcl_init(struct command_context *cmd_ctx) +int tcl_init(void) { int retval; @@ -169,7 +169,7 @@ int tcl_init(struct command_context *cmd_ctx) retval = add_service("tcl", CONNECTION_TCP, tcl_port, 1, &tcl_new_connection, &tcl_input, - &tcl_closed, cmd_ctx->interp); + &tcl_closed, NULL); return retval; } diff --git a/src/server/tcl_server.h b/src/server/tcl_server.h index 68ad821..8035a04 100644 --- a/src/server/tcl_server.h +++ b/src/server/tcl_server.h @@ -22,7 +22,7 @@ #include <server/server.h> -int tcl_init(struct command_context *cmd_ctx); +int tcl_init(void); int tcl_register_commands(struct command_context *cmd_ctx); #endif /* _TCL_SERVER_H_ */ commit 91b9f3de0b8e3277ab5c584c6076ddfe491ffc86 Author: Ãyvind Harboe <oyv...@zy...> Date: Mon May 3 17:01:53 2010 +0200 command context: fix errors when running certain commands on startup Various commands, e.g. "arm mcr xxxx" would fail if invoked upon startup since it there was no command context defined for the jim interpreter in that case. A Jim interpreter is now associated with a command context(telnet, gdb server's) or the default global command context. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/helper/command.c b/src/helper/command.c index 3625508..be262f2 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -167,14 +167,18 @@ static const char **script_command_args_alloc( return words; } -static struct command_context *current_command_context(Jim_Interp *interp) +struct command_context *current_command_context(Jim_Interp *interp) { /* grab the command context from the associated data */ struct command_context *cmd_ctx = Jim_GetAssocData(interp, "context"); if (NULL == cmd_ctx) { /* Tcl can invoke commands directly instead of via command_run_line(). This would - * happen when the Jim Tcl interpreter is provided by eCos. + * happen when the Jim Tcl interpreter is provided by eCos or if we are running + * commands in a startup script. + * + * A telnet or gdb server would provide a non-default command context to + * handle piping of error output, have a separate current target, etc. */ cmd_ctx = global_cmd_ctx; } diff --git a/src/helper/command.h b/src/helper/command.h index 8a418d3..2c19241 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -311,6 +311,10 @@ void command_set_output_handler(struct command_context* context, int command_context_mode(struct command_context *context, enum command_mode mode); +/* Return the current command context associated with the Jim interpreter or + * alternatively the global default command interpreter + */ +struct command_context *current_command_context(Jim_Interp *interp); /** * Creates a new command context using the startup TCL provided and * the existing Jim interpreter, if any. If interp == NULL, then command_init diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 579ca9e..ea6d07e 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -684,7 +684,7 @@ static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv) Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); return JIM_ERR; } - struct command_context *context = Jim_GetAssocData(interp, "context"); + struct command_context *context = current_command_context(interp); int e = jtag_init_inner(context); if (e != ERROR_OK) { Jim_SetResult_sprintf(goi.interp, "error: %d", e); @@ -701,7 +701,7 @@ static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); return JIM_ERR; } - struct command_context *context = Jim_GetAssocData(interp, "context"); + struct command_context *context = current_command_context(interp); int e = jtag_init_reset(context); if (e != ERROR_OK) { Jim_SetResult_sprintf(goi.interp, "error: %d", e); diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index eeb6694..1a84a5f 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -820,11 +820,9 @@ static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv) struct arm *arm; int retval; - context = Jim_GetAssocData(interp, "context"); - if (context == NULL) { - LOG_ERROR("%s: no command context", __func__); - return JIM_ERR; - } + context = current_command_context(interp); + assert( context != NULL); + target = get_current_target(context); if (target == NULL) { LOG_ERROR("%s: no current target", __func__); diff --git a/src/target/target.c b/src/target/target.c index a3a1b0a..d17bb74 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -3236,12 +3236,9 @@ static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv) struct command_context *context; struct target *target; - context = Jim_GetAssocData(interp, "context"); - if (context == NULL) - { - LOG_ERROR("mem2array: no command context"); - return JIM_ERR; - } + context = current_command_context(interp); + assert (context != NULL); + target = get_current_target(context); if (target == NULL) { @@ -3432,11 +3429,9 @@ static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv) struct command_context *context; struct target *target; - context = Jim_GetAssocData(interp, "context"); - if (context == NULL) { - LOG_ERROR("array2mem: no command context"); - return JIM_ERR; - } + context = current_command_context(interp); + assert (context != NULL); + target = get_current_target(context); if (target == NULL) { LOG_ERROR("array2mem: no current target"); @@ -4318,7 +4313,9 @@ static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *a */ static int jim_target_event_list(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - struct command_context *cmd_ctx = Jim_GetAssocData(interp, "context"); + struct command_context *cmd_ctx = current_command_context(interp); + assert (cmd_ctx != NULL); + struct target *target = Jim_CmdPrivData(interp); struct target_event_action *teap = target->event_action; command_print(cmd_ctx, "Event actions for target (%d) %s\n", @@ -4512,7 +4509,9 @@ static int target_create(Jim_GetOptInfo *goi) struct target *target; struct command_context *cmd_ctx; - cmd_ctx = Jim_GetAssocData(goi->interp, "context"); + cmd_ctx = current_command_context(goi->interp); + assert (cmd_ctx != NULL); + if (goi->argc < 3) { Jim_WrongNumArgs(goi->interp, 1, goi->argv, "?name? ?type? ..options..."); return JIM_ERR; @@ -4686,7 +4685,9 @@ static int jim_target_current(Jim_Interp *interp, int argc, Jim_Obj *const *argv Jim_WrongNumArgs(interp, 1, argv, "Too many parameters"); return JIM_ERR; } - struct command_context *cmd_ctx = Jim_GetAssocData(interp, "context"); + struct command_context *cmd_ctx = current_command_context(interp); + assert (cmd_ctx != NULL); + Jim_SetResultString(interp, get_current_target(cmd_ctx)->cmd_name, -1); return JIM_OK; } commit 7e33f87b3d25331f3ac366c88e0b0ebb196422ec Author: Ãyvind Harboe <oyv...@zy...> Date: Tue May 4 07:29:40 2010 +0200 flash: more flash write_image bugfixes Remove/fix lots of bugs in handling of non-contigious sections and out of order sections. Fix a gaffe introduced in previous commit to src/flash/nor/core.c Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 9a77353..e6c0eeb 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -602,15 +602,12 @@ int flash_write_unlock(struct target *target, struct image *image, while ((run_address + run_size - 1 < c->base + c->size - 1) && (section_last + 1 < image->num_sections)) { - if (sections[section_last + 1]->base_address < (run_address + run_size)) + /* sections are sorted */ + assert(sections[section_last + 1]->base_address >= c->base); + if (sections[section_last + 1]->base_address >= (c->base + c->size)) { - LOG_DEBUG("section %d out of order " - "(surprising, but supported)", - section_last + 1); - /* REVISIT this can break with autoerase ... - * clobbering data after it's written. - */ - break; + /* Done with this bank */ + break; } /* FIXME This needlessly touches sectors BETWEEN the @@ -631,8 +628,6 @@ int flash_write_unlock(struct target *target, struct image *image, * flash programming could fail due to alignment issues * attempt to rebuild a consecutive buffer for the flash loader */ pad_bytes = (sections[section_last + 1]->base_address) - (run_address + run_size); - if ((run_address + run_size + pad_bytes) > (c->base + c->size)) - break; padding[section_last] = pad_bytes; run_size += sections[++section_last]->size; run_size += pad_bytes; @@ -641,16 +636,7 @@ int flash_write_unlock(struct target *target, struct image *image, LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes); } - /* fit the run into bank constraints */ - if (run_address + run_size - 1 > c->base + c->size - 1) - { - /* REVISIT isn't this superfluous, given the while() - * loop conditions above?? - */ - LOG_WARNING("writing %d bytes only - as image section is %d bytes and bank is only %d bytes", \ - (int)(c->base + c->size - run_address), (int)(run_size), (int)(c->size)); - run_size = c->base + c->size - run_address; - } + assert (run_address + run_size - 1 <= c->base + c->size - 1); /* If we're applying any sector automagic, then pad this * (maybe-combined) segment to the end of its last sector. @@ -691,8 +677,12 @@ int flash_write_unlock(struct target *target, struct image *image, * #¤%#"%¤% we have to figure out the section # from the sorted * list of pointers to sections to invoke image_read_section()... */ - int t_section_num = (sections[section] - image->sections) / sizeof(struct imageection); + intptr_t diff = (intptr_t)sections[section] - (intptr_t)image->sections; + int t_section_num = diff / sizeof(struct imageection); + LOG_DEBUG("image_read_section: section = %d, t_section_num = %d, section_offset = %d, buffer_size = %d, size_read = %d", + (int)section, +(int)t_section_num, (int)section_offset, (int)buffer_size, (int)size_read); if ((retval = image_read_section(image, t_section_num, section_offset, size_read, buffer + buffer_size, &size_read)) != ERROR_OK || size_read == 0) { commit 0d8f60e28f0f6e2bf65c674154b129fffae9eca8 Author: Ãyvind Harboe <oyv...@zy...> Date: Mon May 3 15:25:35 2010 +0200 str7x: improve error handling clean up error handling a bit. No change in behavior. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index adabad7..3d52341 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -5,6 +5,9 @@ * Copyright (C) 2008 by Spencer Oliver * * sp...@sp... * * * + * Copyright (C) 2010 Ãyvind Harboe * + * oyv...@zy... * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -162,22 +165,88 @@ FLASH_BANK_COMMAND_HANDLER(str7x_flash_bank_command) return ERROR_OK; } -static uint32_t str7x_status(struct flash_bank *bank) +/* wait for flash to become idle or report errors. + + FIX!!! what's the maximum timeout??? The documentation doesn't + state any maximum time.... by inspection it seems > 1000ms is to be + expected. + + 10000ms is long enough that it should cover anything, yet not + quite be equivalent to an infinite loop. + + */ +static int str7x_waitbusy(struct flash_bank *bank) { + int err; + int i; struct target *target = bank->target; - uint32_t retval; + struct str7x_flash_bank *str7x_info = bank->driver_priv; - target_read_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), &retval); + for (i = 0 ; i < 10000; i++) + { + uint32_t retval; + err = target_read_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), &retval); + if (err != ERROR_OK) + return err; - return retval; + if ((retval & str7x_info->busy_bits) == 0) + return ERROR_OK; + + alive_sleep(1); + } + LOG_ERROR("Timed out waiting for str7x flash"); + return ERROR_FAIL; } -static uint32_t str7x_result(struct flash_bank *bank) + +static int str7x_result(struct flash_bank *bank) { struct target *target = bank->target; uint32_t retval; - target_read_u32(target, str7x_get_flash_adr(bank, FLASH_ER), &retval); + int err; + err = target_read_u32(target, str7x_get_flash_adr(bank, FLASH_ER), &retval); + if (err != ERROR_OK) + return err; + + if (retval & FLASH_WPF) + { + LOG_ERROR("str7x hw write protection set"); + err = ERROR_FAIL; + } + if (retval & FLASH_RESER) + { + LOG_ERROR("str7x suspended program erase not resumed"); + err = ERROR_FAIL; + } + if (retval & FLASH_10ER) + { + LOG_ERROR("str7x trying to set bit to 1 when it is already 0"); + err = ERROR_FAIL; + } + if (retval & FLASH_PGER) + { + LOG_ERROR("str7x program error"); + err = ERROR_FAIL; + } + if (retval & FLASH_ERER) + { + LOG_ERROR("str7x erase error"); + err = ERROR_FAIL; + } + if (err == ERROR_OK) + { + if (retval & FLASH_ERR) + { + /* this should always be set if one of the others are set... */ + LOG_ERROR("str7x write operation failed / bad setup"); + err = ERROR_FAIL; + } + } + if (err != ERROR_OK) + { + LOG_ERROR("FLASH_ER register contents: 0x%" PRIx32, retval); + } return retval; } @@ -216,8 +285,8 @@ static int str7x_erase(struct flash_bank *bank, int first, int last) int i; uint32_t cmd; - uint32_t retval; uint32_t sectors = 0; + int err; if (bank->target->state != TARGET_HALTED) { @@ -233,28 +302,32 @@ static int str7x_erase(struct flash_bank *bank, int first, int last) LOG_DEBUG("sectors: 0x%" PRIx32 "", sectors); /* clear FLASH_ER register */ - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_ER), 0x0); + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_ER), 0x0); + if (err != ERROR_OK) + return err; cmd = FLASH_SER; - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); + if (err != ERROR_OK) + return err; cmd = sectors; - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR1), cmd); + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR1), cmd); + if (err != ERROR_OK) + return err; cmd = FLASH_SER | FLASH_WMS; - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); + if (err != ERROR_OK) + return err; - while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) { - alive_sleep(1); - } + err = str7x_waitbusy(bank); + if (err != ERROR_OK) + return err; - retval = str7x_result(bank); - - if (retval) - { - LOG_ERROR("error erasing flash bank, FLASH_ER: 0x%" PRIx32 "", retval); - return ERROR_FLASH_OPERATION_FAILED; - } + err = str7x_result(bank); + if (err != ERROR_OK) + return err; for (i = first; i <= last; i++) bank->sectors[i].is_erased = 1; @@ -268,7 +341,6 @@ static int str7x_protect(struct flash_bank *bank, int set, int first, int last) struct target *target = bank->target; int i; uint32_t cmd; - uint32_t retval; uint32_t protect_blocks; if (bank->target->state != TARGET_HALTED) @@ -286,37 +358,43 @@ static int str7x_protect(struct flash_bank *bank, int set, int first, int last) } /* clear FLASH_ER register */ - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_ER), 0x0); + int err; + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_ER), 0x0); + if (err != ERROR_OK) + return err; cmd = FLASH_SPR; - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); + if (err != ERROR_OK) + return err; cmd = str7x_get_flash_adr(bank, FLASH_NVWPAR); - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), cmd); + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), cmd); + if (err != ERROR_OK) + return err; cmd = protect_blocks; - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), cmd); + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), cmd); + if (err != ERROR_OK) + return err; cmd = FLASH_SPR | FLASH_WMS; - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - - while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) { - alive_sleep(1); - } + err = target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); + if (err != ERROR_OK) + return err; - retval = str7x_result(bank); + err = str7x_waitbusy(bank); + if (err != ERROR_OK) + return err; - LOG_DEBUG("retval: 0x%8.8" PRIx32 "", retval); - - if (retval & FLASH_ERER) - return ERROR_FLASH_SECTOR_NOT_ERASED; - else if (retval & FLASH_WPF) - return ERROR_FLASH_OPERATION_FAILED; + err = str7x_result(bank); + if (err != ERROR_OK) + return err; return ERROR_OK; } -static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, +int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct str7x_flash_bank *str7x_info = bank->driver_priv; @@ -409,14 +487,12 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, str7x_info->write_algorithm->address + (sizeof(str7x_flash_write_code) - 4), 10000, &armv4_5_info)) != ERROR_OK) { - LOG_ERROR("error executing str7x flash write algorithm"); - retval = ERROR_FLASH_OPERATION_FAILED; break; } if (buf_get_u32(reg_params[4].value, 0, 32) != 0x00) { - retval = ERROR_FLASH_OPERATION_FAILED; + retval = str7x_result(bank); break; } @@ -442,7 +518,6 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; - struct str7x_flash_bank *str7x_info = bank->driver_priv; uint32_t dwords_remaining = (count / 8); uint32_t bytes_remaining = (count & 0x00000007); uint32_t address = bank->base + offset; @@ -498,16 +573,7 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, /* if block write failed (no sufficient working area), * we use normal (slow) single dword accesses */ LOG_WARNING("couldn't use block writes, falling back to single memory accesses"); - } - else if (retval == ERROR_FLASH_OPERATION_FAILED) - { - /* if an error occured, we examine the reason, and quit */ - retval = str7x_result(bank); - - LOG_ERROR("flash writing failed with error code: 0x%x", retval); - return ERROR_FLASH_OPERATION_FAILED; - } - else + } else { return retval; } @@ -543,17 +609,14 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, cmd = FLASH_DWPG | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) - { - alive_sleep(1); - } - - retval = str7x_result(bank); + int err; + err = str7x_waitbusy(bank); + if (err != ERROR_OK) + return err; - if (retval & FLASH_PGER) - return ERROR_FLASH_OPERATION_FAILED; - else if (retval & FLASH_WPF) - return ERROR_FLASH_OPERATION_FAILED; + err = str7x_result(bank); + if (err != ERROR_OK) + return err; dwords_remaining--; address += 8; @@ -592,17 +655,14 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, cmd = FLASH_DWPG | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) - { - alive_sleep(1); - } - - retval = str7x_result(bank); + int err; + err = str7x_waitbusy(bank); + if (err != ERROR_OK) + return err; - if (retval & FLASH_PGER) - return ERROR_FLASH_OPERATION_FAILED; - else if (retval & FLASH_WPF) - return ERROR_FLASH_OPERATION_FAILED; + err = str7x_result(bank); + if (err != ERROR_OK) + return err; } return ERROR_OK; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/core.c | 32 +++----- src/flash/nor/str7x.c | 206 ++++++++++++++++++++++++++++++----------------- src/helper/command.c | 8 ++- src/helper/command.h | 4 + src/jtag/tcl.c | 4 +- src/server/server.c | 2 +- src/server/tcl_server.c | 6 +- src/server/tcl_server.h | 2 +- src/target/armv4_5.c | 8 +- src/target/target.c | 29 ++++--- 10 files changed, 179 insertions(+), 122 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-05 11:13:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ca0f6a5c58fb94d590362d9a7d99543919fbbf43 (commit) from 80660288e0ff0f2a1887287e5177e52c54b14347 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ca0f6a5c58fb94d590362d9a7d99543919fbbf43 Author: Marc Pignat <mar...@he...> Date: Wed May 5 10:39:20 2010 +0200 documentation typo Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 7d54247..49df159 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -332,7 +332,7 @@ and one can be used for a UART adapter at the same time the other one is used to provide a debug adapter. Also, some development boards integrate an FT2232 chip to serve as -a built-in low coast debug adapter and usb-to-serial solution. +a built-in low cost debug adapter and usb-to-serial solution. @itemize @bullet @item @b{usbjtag} ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Spencer O. <nt...@us...> - 2010-05-04 16:53:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 909130e16ee70157d3de6cd5c15fdea0f8fe6a6f (commit) from 282e89c878fd43ba90f0a9416adce81c5f596af7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 909130e16ee70157d3de6cd5c15fdea0f8fe6a6f Author: Spencer Oliver <nt...@us...> Date: Tue May 4 15:51:43 2010 +0100 str71x: fix previous commit fix build issue with 70226c221f5879bb6126ff3f2ec9ae64c68d80d6 commit Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index 556dec2..adabad7 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -498,9 +498,6 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, /* if block write failed (no sufficient working area), * we use normal (slow) single dword accesses */ LOG_WARNING("couldn't use block writes, falling back to single memory accesses"); - } else - { - return retval; } else if (retval == ERROR_FLASH_OPERATION_FAILED) { @@ -510,6 +507,10 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, LOG_ERROR("flash writing failed with error code: 0x%x", retval); return ERROR_FLASH_OPERATION_FAILED; } + else + { + return retval; + } } else { ----------------------------------------------------------------------- Summary of changes: src/flash/nor/str7x.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-04 09:19:39
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 282e89c878fd43ba90f0a9416adce81c5f596af7 (commit) via 70226c221f5879bb6126ff3f2ec9ae64c68d80d6 (commit) via 8865209545dae9c2745927758a51c60f922e02ca (commit) from 32e647acf40bc11858a524e5ee73183ce0d9449b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 282e89c878fd43ba90f0a9416adce81c5f596af7 Author: Ãyvind Harboe <oyv...@zy...> Date: Mon May 3 18:11:34 2010 +0200 flash: less bogus errors Removed bogus errors when trying to allocate a large a target memory buffer as possible. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/aduc702x.c b/src/flash/nor/aduc702x.c index 57c591d..82ea2bc 100644 --- a/src/flash/nor/aduc702x.c +++ b/src/flash/nor/aduc702x.c @@ -227,7 +227,7 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32 } /* memory buffer */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= 256) diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index f88f16c..9967652 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -1116,7 +1116,7 @@ static int cfi_intel_write_block(struct flash_bank *bank, uint8_t *buffer, uint3 /* Get a workspace buffer for the data to flash starting with 32k size. Half size until buffer would be smaller 256 Bytem then fail back */ /* FIXME Why 256 bytes, why not 32 bytes (smallest flash write page */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= 256) @@ -1444,7 +1444,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer, ui } /* the following code still assumes target code is fixed 24*4 bytes */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= 256) diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c index 360c14d..5b00495 100644 --- a/src/flash/nor/lpc2900.c +++ b/src/flash/nor/lpc2900.c @@ -1288,7 +1288,7 @@ static int lpc2900_write(struct flash_bank *bank, uint8_t *buffer, reduced size if that fails. */ struct working_area *warea; uint32_t buffer_size = lpc2900_info->max_ram_block - 1 * KiB; - while( (retval = target_alloc_working_area(target, + while( (retval = target_alloc_working_area_try(target, buffer_size + target_code_size, &warea)) != ERROR_OK ) { diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index 2540342..4ebd256 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -322,7 +322,7 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer, return retval; /* memory buffer */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= 256) diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index 0b7c45a..cce5f37 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -846,7 +846,7 @@ static int stellaris_write_block(struct flash_bank *bank, buffer_size = wcount * 4; /* memory buffer */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= buf_min) diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c index 0fdd148..7afd959 100644 --- a/src/flash/nor/stm32x.c +++ b/src/flash/nor/stm32x.c @@ -481,7 +481,7 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, return retval; /* memory buffer */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= 256) diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c index 3d8b84b..2208fe3 100644 --- a/src/flash/nor/str9x.c +++ b/src/flash/nor/str9x.c @@ -385,7 +385,7 @@ static int str9x_write_block(struct flash_bank *bank, (uint8_t*)str9x_flash_write_code); /* memory buffer */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= 256) commit 70226c221f5879bb6126ff3f2ec9ae64c68d80d6 Author: Ãyvind Harboe <oyv...@zy...> Date: Mon May 3 15:50:39 2010 +0200 str7x: fix bogus error messages Remove bogus error messages when trying to allocate a large chunk of target memory and then falling back to a smaller one. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index d5e8e28..556dec2 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -355,10 +355,9 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, }; /* flash write code */ - if (target_alloc_working_area(target, sizeof(str7x_flash_write_code), + if (target_alloc_working_area_try(target, sizeof(str7x_flash_write_code), &str7x_info->write_algorithm) != ERROR_OK) { - LOG_WARNING("no working area available, can't do block memory writes"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; @@ -367,7 +366,7 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, (uint8_t*)str7x_flash_write_code); /* memory buffer */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= 256) @@ -499,6 +498,9 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, /* if block write failed (no sufficient working area), * we use normal (slow) single dword accesses */ LOG_WARNING("couldn't use block writes, falling back to single memory accesses"); + } else + { + return retval; } else if (retval == ERROR_FLASH_OPERATION_FAILED) { commit 8865209545dae9c2745927758a51c60f922e02ca Author: Ãyvind Harboe <oyv...@zy...> Date: Mon May 3 15:49:23 2010 +0200 target: clean up target memory allocation error messages target memory allocation can be implemented not to show bogus error messages. E.g. when trying a big allocation first and then a smaller one if that fails. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/target.c b/src/target/target.c index 73594fb..a3a1b0a 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1111,7 +1111,7 @@ int target_call_timer_callbacks_now(void) return target_call_timer_callbacks_check_time(0); } -int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area) +int target_alloc_working_area_try(struct target *target, uint32_t size, struct working_area **area) { struct working_area *c = target->working_areas; struct working_area *new_wa = NULL; @@ -1189,8 +1189,6 @@ int target_alloc_working_area(struct target *target, uint32_t size, struct worki if (free_size < size) { - LOG_WARNING("not enough working area available(requested %u, free %u)", - (unsigned)(size), (unsigned)(free_size)); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } @@ -1231,6 +1229,19 @@ int target_alloc_working_area(struct target *target, uint32_t size, struct worki return ERROR_OK; } +int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area) +{ + int retval; + + retval = target_alloc_working_area_try(target, size, area); + if (retval == ERROR_TARGET_RESOURCE_NOT_AVAILABLE) + { + LOG_WARNING("not enough working area available(requested %u)", (unsigned)(size)); + } + return retval; + +} + static int target_free_working_area_restore(struct target *target, struct working_area *area, int restore) { if (area->free) diff --git a/src/target/target.h b/src/target/target.h index 0292945..4a48e5a 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -452,6 +452,14 @@ const char *target_state_name( struct target *target ); */ int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area); +/* Same as target_alloc_working_area, except that no error is logged + * when ERROR_TARGET_RESOURCE_NOT_AVAILABLE is returned. + * + * This allows the calling code to *try* to allocate target memory + * and have a fallback to another behavior(slower?). + */ +int target_alloc_working_area_try(struct target *target, + uint32_t size, struct working_area **area); int target_free_working_area(struct target *target, struct working_area *area); void target_free_all_working_areas(struct target *target); ----------------------------------------------------------------------- Summary of changes: src/flash/nor/aduc702x.c | 2 +- src/flash/nor/cfi.c | 4 ++-- src/flash/nor/lpc2900.c | 2 +- src/flash/nor/pic32mx.c | 2 +- src/flash/nor/stellaris.c | 2 +- src/flash/nor/stm32x.c | 2 +- src/flash/nor/str7x.c | 8 +++++--- src/flash/nor/str9x.c | 2 +- src/target/target.c | 17 ++++++++++++++--- src/target/target.h | 8 ++++++++ 10 files changed, 35 insertions(+), 14 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-04 09:16:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 32e647acf40bc11858a524e5ee73183ce0d9449b (commit) from fe60480b7a8f5c94147e3185bae235241c33c9ce (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 32e647acf40bc11858a524e5ee73183ce0d9449b Author: Ãyvind Harboe <oyv...@zy...> Date: Tue May 4 07:36:05 2010 +0200 zy1000: wait for srst to deassert make wait for srst deassert more long latency friendly (JTAG over TCP/IP), print actual time if it was more than 1ms. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 80731aa..092e3cd 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -49,6 +49,7 @@ #include <jtag/minidriver.h> #include <jtag/interface.h> #include <time.h> +#include <helper/time_support.h> #include <netinet/tcp.h> @@ -176,28 +177,41 @@ void zy1000_reset(int trst, int srst) } /* wait for srst to float back up */ - if (!srst) + if ((!srst && ((jtag_get_reset_config() & RESET_TRST_PULLS_SRST) == 0))|| + (!srst && !trst && (jtag_get_reset_config() & RESET_TRST_PULLS_SRST))) { - int i; - for (i = 0; i < 1000; i++) - { + bool first = true; + long long start; + long total = 0; + for (;;) + { // We don't want to sense our own reset, so we clear here. // There is of course a timing hole where we could loose // a "real" reset. if (!readSRST()) + { + if (total > 1) + { + LOG_USER("SRST took %dms to deassert", (int)total); + } break; + } - /* wait 1ms */ - alive_sleep(1); - } + if (first) + { + first = false; + start = timeval_ms(); + } - if (i == 1000) - { - LOG_USER("SRST didn't deassert after %dms", i); - } else if (i > 1) - { - LOG_USER("SRST took %dms to deassert", i); + total = timeval_ms() - start; + + if (total > 5000) + { + LOG_ERROR("SRST took too long to deassert: %dms", (int)total); + break; + } } + } } ----------------------------------------------------------------------- Summary of changes: src/jtag/zy1000/zy1000.c | 40 +++++++++++++++++++++++++++------------- 1 files changed, 27 insertions(+), 13 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-04 09:16:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via fe60480b7a8f5c94147e3185bae235241c33c9ce (commit) from 14f4606dcb0533ab64562406edd157008108e0db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fe60480b7a8f5c94147e3185bae235241c33c9ce Author: Ãyvind Harboe <oyv...@zy...> Date: Tue May 4 07:25:30 2010 +0200 cfi: made som info output debug output E.g. how much target memory that is used during flashing is debug info. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index a64d78f..f88f16c 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -1141,7 +1141,7 @@ static int cfi_intel_write_block(struct flash_bank *bank, uint8_t *buffer, uint3 busy_pattern_val = cfi_command_val(bank, 0x80); error_pattern_val = cfi_command_val(bank, 0x7e); - LOG_INFO("Using target buffer at 0x%08" PRIx32 " and of size 0x%04" PRIx32, source->address, buffer_size); + LOG_DEBUG("Using target buffer at 0x%08" PRIx32 " and of size 0x%04" PRIx32, source->address, buffer_size); /* Programming main loop */ while (count > 0) @@ -1162,7 +1162,7 @@ static int cfi_intel_write_block(struct flash_bank *bank, uint8_t *buffer, uint3 buf_set_u32(reg_params[5].value, 0, 32, busy_pattern_val); buf_set_u32(reg_params[6].value, 0, 32, error_pattern_val); - LOG_INFO("Write 0x%04" PRIx32 " bytes to flash at 0x%08" PRIx32 , thisrun_count, address); + LOG_DEBUG("Write 0x%04" PRIx32 " bytes to flash at 0x%08" PRIx32 , thisrun_count, address); /* Execute algorithm, assume breakpoint for last instruction */ retval = target_run_algorithm(target, 0, NULL, 7, reg_params, ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-05-03 11:58:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 14f4606dcb0533ab64562406edd157008108e0db (commit) from da9f72ca0a3305cf6f961834dc441496a36c85de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 14f4606dcb0533ab64562406edd157008108e0db Author: Tobias Ringström <to...@ri...> Date: Fri Apr 30 14:04:14 2010 +0200 STM32 flash erase timeout fix The current timeout for STM32 flash block erase and flash mass erase is 10 (ms), which is too tight, and fails around 50% of the time for me. The data sheet for STM32F107VC specifies a maximum erase time of 40 ms (for both operations). I'd also consider it a bug that the code does not detect a timeout, but just assumes that the operation has completed. The attached patch does not address this bug. The attached patch increases the timeouts from 10 to 100 ms. Please apply. /Tobias diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c index 818c474..0fdd148 100644 --- a/src/flash/nor/stm32x.c +++ b/src/flash/nor/stm32x.c @@ -331,7 +331,7 @@ static int stm32x_erase(struct flash_bank *bank, int first, int last) target_write_u32(target, STM32_FLASH_AR, bank->base + bank->sectors[i].offset); target_write_u32(target, STM32_FLASH_CR, FLASH_PER | FLASH_STRT); - status = stm32x_wait_status_busy(bank, 10); + status = stm32x_wait_status_busy(bank, 100); if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; @@ -1183,7 +1183,7 @@ static int stm32x_mass_erase(struct flash_bank *bank) target_write_u32(target, STM32_FLASH_CR, FLASH_MER); target_write_u32(target, STM32_FLASH_CR, FLASH_MER | FLASH_STRT); - status = stm32x_wait_status_busy(bank, 10); + status = stm32x_wait_status_busy(bank, 100); target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK); ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32x.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-30 03:03:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via da9f72ca0a3305cf6f961834dc441496a36c85de (commit) via 5e79f999bcc898d94a2d7751831e9f7aee24fbd5 (commit) via 78248f1df67d1b4feefd8ac4e459acd7599d6af2 (commit) from 49b7905cae66ee9e011c71aff758fafba823f87f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit da9f72ca0a3305cf6f961834dc441496a36c85de Author: Ãyvind Harboe <oyv...@zy...> Date: Fri Apr 30 02:51:05 2010 +0200 zy1000: it has a CFI chip, no need for the ecosflash driver The ecosflash driver is no longer used by any of the config scripts. It is more useful to get more testing of CFI. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/tcl/board/zy1000.cfg b/tcl/board/zy1000.cfg index 17594c2..ee7afcd 100644 --- a/tcl/board/zy1000.cfg +++ b/tcl/board/zy1000.cfg @@ -39,7 +39,8 @@ arm7_9 fast_memory_access enable arm7_9 dcc_downloads enable set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME ecosflash 0x01000000 0x200000 2 2 $_TARGETNAME ecos/at91eb40a.elf +flash bank $_FLASHNAME cfi 0x01000000 0x200000 2 2 $_TARGETNAME + $_TARGETNAME configure -event reset-init { # Set up chip selects & timings mww 0xFFE00000 0x0100273D commit 5e79f999bcc898d94a2d7751831e9f7aee24fbd5 Author: Ãyvind Harboe <oyv...@zy...> Date: Thu Apr 29 17:42:47 2010 +0200 flash: write_image would fail for certain images Fix a bug where write_image would fail if the sections in the image were not in ascending order. This has previously been fixed in gdb load. Solved by sorting the image sections before running flash write_image erase unlock foo.elf. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 1ff4193..9a77353 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -509,6 +509,25 @@ static int flash_unlock_address_range(struct target *target, uint32_t addr, uint addr, length, &flash_driver_unprotect); } +static int compare_section (const void * a, const void * b) +{ + struct imageection *b1, *b2; + b1=*((struct imageection **)a); + b2=*((struct imageection **)b); + + if (b1->base_address == b2->base_address) + { + return 0; + } else if (b1->base_address > b2->base_address) + { + return 1; + } else + { + return -1; + } +} + + int flash_write_unlock(struct target *target, struct image *image, uint32_t *written, int erase, bool unlock) { @@ -536,6 +555,19 @@ int flash_write_unlock(struct target *target, struct image *image, /* allocate padding array */ padding = calloc(image->num_sections, sizeof(*padding)); + /* This fn requires all sections to be in ascending order of addresses, + * whereas an image can have sections out of order. */ + struct imageection **sections = malloc(sizeof(struct imageection *) * + image->num_sections); + int i; + for (i = 0; i < image->num_sections; i++) + { + sections[i] = &image->sections[i]; + } + + qsort(sections, image->num_sections, sizeof(struct imageection *), + compare_section); + /* loop until we reach end of the image */ while (section < image->num_sections) { @@ -543,11 +575,11 @@ int flash_write_unlock(struct target *target, struct image *image, uint8_t *buffer; int section_first; int section_last; - uint32_t run_address = image->sections[section].base_address + section_offset; - uint32_t run_size = image->sections[section].size - section_offset; + uint32_t run_address = sections[section]->base_address + section_offset; + uint32_t run_size = sections[section]->size - section_offset; int pad_bytes = 0; - if (image->sections[section].size == 0) + if (sections[section]->size == 0) { LOG_WARNING("empty section %d", section); section++; @@ -570,7 +602,7 @@ int flash_write_unlock(struct target *target, struct image *image, while ((run_address + run_size - 1 < c->base + c->size - 1) && (section_last + 1 < image->num_sections)) { - if (image->sections[section_last + 1].base_address < (run_address + run_size)) + if (sections[section_last + 1]->base_address < (run_address + run_size)) { LOG_DEBUG("section %d out of order " "(surprising, but supported)", @@ -598,11 +630,11 @@ int flash_write_unlock(struct target *target, struct image *image, /* if we have multiple sections within our image, * flash programming could fail due to alignment issues * attempt to rebuild a consecutive buffer for the flash loader */ - pad_bytes = (image->sections[section_last + 1].base_address) - (run_address + run_size); + pad_bytes = (sections[section_last + 1]->base_address) - (run_address + run_size); if ((run_address + run_size + pad_bytes) > (c->base + c->size)) break; padding[section_last] = pad_bytes; - run_size += image->sections[++section_last].size; + run_size += sections[++section_last]->size; run_size += pad_bytes; if (pad_bytes > 0) @@ -651,15 +683,21 @@ int flash_write_unlock(struct target *target, struct image *image, size_t size_read; size_read = run_size - buffer_size; - if (size_read > image->sections[section].size - section_offset) - size_read = image->sections[section].size - section_offset; + if (size_read > sections[section]->size - section_offset) + size_read = sections[section]->size - section_offset; - if ((retval = image_read_section(image, section, section_offset, + /* KLUDGE! + * + * #¤%#"%¤% we have to figure out the section # from the sorted + * list of pointers to sections to invoke image_read_section()... + */ + int t_section_num = (sections[section] - image->sections) / sizeof(struct imageection); + + if ((retval = image_read_section(image, t_section_num, section_offset, size_read, buffer + buffer_size, &size_read)) != ERROR_OK || size_read == 0) { free(buffer); - free(padding); - return retval; + goto done; } /* see if we need to pad the section */ @@ -669,7 +707,7 @@ int flash_write_unlock(struct target *target, struct image *image, buffer_size += size_read; section_offset += size_read; - if (section_offset >= image->sections[section].size) + if (section_offset >= sections[section]->size) { section++; section_offset = 0; @@ -702,14 +740,17 @@ int flash_write_unlock(struct target *target, struct image *image, if (retval != ERROR_OK) { - free(padding); - return retval; /* abort operation */ + /* abort operation */ + goto done; } if (written != NULL) *written += run_size; /* add run size to total written counter */ } + +done: + free(sections); free(padding); return retval; commit 78248f1df67d1b4feefd8ac4e459acd7599d6af2 Author: Ãyvind Harboe <oyv...@zy...> Date: Thu Apr 29 03:49:32 2010 +0200 flash: write_image will now pad erase to nearest sector this is done for unlocking and it is a simple omission that it wasn't done for sectors. The unnerving thing is that nobody has complained about this until now.... Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index b8dda96..1ff4193 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2005 by Dominic Rath <Dom...@gm...> * - * Copyright (C) 2007,2008 Ãyvind Harboe <oyv...@zy...> * + * Copyright (C) 2007-2010 Ãyvind Harboe <oyv...@zy...> * * Copyright (C) 2008 by Spencer Oliver <sp...@sp...> * * Copyright (C) 2009 Zachary T Welch <zw...@su...> * * * @@ -519,12 +519,6 @@ int flash_write_unlock(struct target *target, struct image *image, struct flash_bank *c; int *padding; - /* REVISIT do_pad should perhaps just be another parameter. - * GDB wouldn't ever need it, since it erases separately. - * But "flash write_image" commands might want that option. - */ - bool do_pad = false; - section = 0; section_offset = 0; @@ -694,7 +688,7 @@ int flash_write_unlock(struct target *target, struct image *image, { /* calculate and erase sectors */ retval = flash_erase_address_range(target, - do_pad, run_address, run_size); + true, run_address, run_size); } } ----------------------------------------------------------------------- Summary of changes: src/flash/nor/core.c | 79 ++++++++++++++++++++++++++++++++++++-------------- tcl/board/zy1000.cfg | 3 +- 2 files changed, 59 insertions(+), 23 deletions(-) hooks/post-receive -- Main OpenOCD repository |