X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstellaris.c;h=7665ab38a9611479d720091d9b18fa2276dd9544;hb=b9cb2027b327461030321020af54956c03716b6d;hp=0c4169c7f9f5f9860a5742b2cc9bfc722ffdc98b;hpb=90cee3569611faabea6c9697836b4a75c7288832;p=openocd.git diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index 0c4169c7f9..7665ab38a9 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -18,7 +18,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ /*************************************************************************** @@ -29,6 +29,7 @@ #include "config.h" #endif +#include "jtag/interface.h" #include "imp.h" #include #include @@ -123,8 +124,8 @@ struct stellaris_flash_bank { }; /* Autogenerated by contrib/gen-stellaris-part-header.pl */ -/* From Stellaris Firmware Development Package revision 8049 */ -static struct { +/* From Stellaris Firmware Development Package revision 9453 */ +static const struct { uint8_t class; uint8_t partno; const char *partname; @@ -188,7 +189,6 @@ static struct { {0x04, 0xC9, "LM3S1R26"}, {0x04, 0x30, "LM3S1W16"}, {0x04, 0x2F, "LM3S1Z16"}, - {0x01, 0xD4, "LM3S2016"}, {0x01, 0x51, "LM3S2110"}, {0x01, 0x84, "LM3S2139"}, {0x03, 0x39, "LM3S2276"}, @@ -300,9 +300,7 @@ static struct { {0x01, 0x8B, "LM3S6637"}, {0x01, 0xA3, "LM3S6730"}, {0x01, 0x77, "LM3S6753"}, - {0x01, 0xD1, "LM3S6816"}, {0x01, 0xE9, "LM3S6911"}, - {0x01, 0xD3, "LM3S6916"}, {0x01, 0xE8, "LM3S6918"}, {0x01, 0x89, "LM3S6938"}, {0x01, 0x72, "LM3S6950"}, @@ -349,11 +347,9 @@ static struct { {0x04, 0x1E, "LM3S9BN5"}, {0x04, 0x1F, "LM3S9BN6"}, {0x06, 0x70, "LM3S9C97"}, - {0x06, 0x7A, "LM3S9CN5"}, {0x06, 0xA9, "LM3S9D81"}, {0x06, 0x7E, "LM3S9D90"}, {0x06, 0x92, "LM3S9D92"}, - {0x06, 0xC8, "LM3S9D95"}, {0x06, 0x9D, "LM3S9D96"}, {0x06, 0x7B, "LM3S9DN5"}, {0x06, 0x7C, "LM3S9DN6"}, @@ -364,7 +360,6 @@ static struct { {0x06, 0xA8, "LM3S9U81"}, {0x06, 0x7D, "LM3S9U90"}, {0x06, 0x90, "LM3S9U92"}, - {0x06, 0xB7, "LM3S9U95"}, {0x06, 0x9B, "LM3S9U96"}, {0x05, 0x18, "LM4F110B2QR"}, {0x05, 0x19, "LM4F110C4QR"}, @@ -400,6 +395,13 @@ static struct { {0x05, 0x60, "LM4F132E5QC"}, {0x05, 0x61, "LM4F132H5QC"}, {0x05, 0x65, "LM4F132H5QD"}, + {0x05, 0x70, "LM4F210E5QR"}, + {0x05, 0x73, "LM4F210H5QR"}, + {0x05, 0x80, "LM4F211E5QR"}, + {0x05, 0x83, "LM4F211H5QR"}, + {0x05, 0xE9, "LM4F212H5BB"}, + {0x05, 0xC4, "LM4F212H5QC"}, + {0x05, 0xC6, "LM4F212H5QD"}, {0x05, 0xA0, "LM4F230E5QR"}, {0x05, 0xA1, "LM4F230H5QR"}, {0x05, 0xB0, "LM4F231E5QR"}, @@ -409,12 +411,13 @@ static struct { {0x05, 0xC1, "LM4F232H5QC"}, {0x05, 0xC5, "LM4F232H5QD"}, {0x05, 0xE5, "LM4FS1AH5BB"}, + {0x05, 0xEA, "LM4FS1GH5BB"}, {0x05, 0xE4, "LM4FS99H5BB"}, - {0x05, 0xE0, "LM4FSXAH5BB"}, + {0x05, 0xE1, "LM4FSXLH5BB"}, {0xFF, 0x00, "Unknown Part"} }; -static char *StellarisClassname[7] = { +static const char *StellarisClassname[7] = { "Sandstorm", "Fury", "Unknown", @@ -994,7 +997,7 @@ static const uint8_t stellaris_write_code[] = { 0x01, 0x00, 0x42, 0xA4 /* .word 0xA4420001 */ }; static int stellaris_write_block(struct flash_bank *bank, - uint8_t *buffer, uint32_t offset, uint32_t wcount) + const uint8_t *buffer, uint32_t offset, uint32_t wcount) { struct target *target = bank->target; uint32_t buffer_size = 16384; @@ -1030,20 +1033,19 @@ static int stellaris_write_block(struct flash_bank *bank, while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= buf_min) { - if (write_algorithm) - target_free_working_area(target, write_algorithm); + target_free_working_area(target, write_algorithm); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)", target_name(target), (unsigned) buffer_size); }; - retval = target_write_buffer(target, write_algorithm->address, + target_write_buffer(target, write_algorithm->address, sizeof(stellaris_write_code), - (uint8_t *) stellaris_write_code); + stellaris_write_code); armv7m_info.common_magic = ARMV7M_COMMON_MAGIC; - armv7m_info.core_mode = ARMV7M_MODE_ANY; + armv7m_info.core_mode = ARM_MODE_THREAD; init_reg_param(®_params[0], "r0", 32, PARAM_OUT); init_reg_param(®_params[1], "r1", 32, PARAM_OUT); @@ -1076,7 +1078,7 @@ static int stellaris_write_block(struct flash_bank *bank, return retval; } -static int stellaris_write(struct flash_bank *bank, uint8_t *buffer, +static int stellaris_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { struct stellaris_flash_bank *stellaris_info = bank->driver_priv; @@ -1330,7 +1332,7 @@ COMMAND_HANDLER(stellaris_handle_recover_command) LOG_ERROR("Can't recover Stellaris flash without SRST"); return ERROR_FAIL; } - jtag_add_reset(0, 1); + adapter_assert_reset(); for (int i = 0; i < 5; i++) { retval = dap_to_swd(bank->target); @@ -1343,7 +1345,7 @@ COMMAND_HANDLER(stellaris_handle_recover_command) } /* de-assert SRST */ - jtag_add_reset(0, 0); + adapter_deassert_reset(); retval = jtag_execute_queue(); /* wait 400+ msec ... OK, "1+ second" is simpler */ @@ -1397,7 +1399,7 @@ struct flash_driver stellaris_flash = { .read = default_flash_read, .probe = stellaris_probe, .auto_probe = stellaris_probe, - .erase_check = default_flash_mem_blank_check, + .erase_check = default_flash_blank_check, .protect_check = stellaris_protect_check, .info = get_stellaris_info, };