From: Spencer O. <nt...@us...> - 2010-03-10 21:38:14
|
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 f10ed95a5ce6be416bcb2ec20826c6e508e4b622 (commit) via d0a57c0f0c3be172195b12e27b668919488f5d00 (commit) via 6344f2ab98cf1fd1f92403de46b6e36b3b122ad5 (commit) via 2946c895a175e586a7f79797e2168c9fd0eddbbe (commit) from 17d437a7a193e783e8daeb0837e6dad5e6811213 (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 f10ed95a5ce6be416bcb2ec20826c6e508e4b622 Author: Spencer Oliver <nt...@us...> Date: Mon Mar 8 20:32:11 2010 +0000 STM32: flash loader cleanup - make algorithm array static const. Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c index ebdcde7..845d589 100644 --- a/src/flash/nor/stm32x.c +++ b/src/flash/nor/stm32x.c @@ -362,9 +362,11 @@ static int stm32x_protect(struct flash_bank *bank, int set, int first, int last) return ERROR_TARGET_NOT_HALTED; } - if ((first && (first % stm32x_info->ppage_size)) || ((last + 1) && (last + 1) % stm32x_info->ppage_size)) + if ((first && (first % stm32x_info->ppage_size)) || ((last + 1) && + (last + 1) % stm32x_info->ppage_size)) { - LOG_WARNING("Error: start and end sectors must be on a %d sector boundary", stm32x_info->ppage_size); + LOG_WARNING("Error: start and end sectors must be on a %d sector boundary", + stm32x_info->ppage_size); return ERROR_FLASH_SECTOR_INVALID; } @@ -432,7 +434,8 @@ static int stm32x_protect(struct flash_bank *bank, int set, int first, int last) return stm32x_write_options(bank); } -static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, + uint32_t offset, uint32_t count) { struct stm32x_flash_bank *stm32x_info = bank->driver_priv; struct target *target = bank->target; @@ -443,7 +446,7 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t struct armv7m_algorithm armv7m_info; int retval = ERROR_OK; - uint8_t stm32x_flash_write_code[] = { + static const uint8_t stm32x_flash_write_code[] = { /* write: */ 0xDF, 0xF8, 0x24, 0x40, /* ldr r4, STM32_FLASH_CR */ 0x09, 0x4D, /* ldr r5, STM32_FLASH_SR */ @@ -465,13 +468,16 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t }; /* flash write code */ - if (target_alloc_working_area(target, sizeof(stm32x_flash_write_code), &stm32x_info->write_algorithm) != ERROR_OK) + if (target_alloc_working_area(target, sizeof(stm32x_flash_write_code), + &stm32x_info->write_algorithm) != ERROR_OK) { LOG_WARNING("no working area available, can't do block memory writes"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - if ((retval = target_write_buffer(target, stm32x_info->write_algorithm->address, sizeof(stm32x_flash_write_code), stm32x_flash_write_code)) != ERROR_OK) + if ((retval = target_write_buffer(target, stm32x_info->write_algorithm->address, + sizeof(stm32x_flash_write_code), + (uint8_t*)stm32x_flash_write_code)) != ERROR_OK) return retval; /* memory buffer */ @@ -480,7 +486,8 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t buffer_size /= 2; if (buffer_size <= 256) { - /* if we already allocated the writing code, but failed to get a buffer, free the algorithm */ + /* if we already allocated the writing code, but failed to get a + * buffer, free the algorithm */ if (stm32x_info->write_algorithm) target_free_working_area(target, stm32x_info->write_algorithm); @@ -499,17 +506,21 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t while (count > 0) { - uint32_t thisrun_count = (count > (buffer_size / 2)) ? (buffer_size / 2) : count; + uint32_t thisrun_count = (count > (buffer_size / 2)) ? + (buffer_size / 2) : count; - if ((retval = target_write_buffer(target, source->address, thisrun_count * 2, buffer)) != ERROR_OK) + if ((retval = target_write_buffer(target, source->address, + thisrun_count * 2, buffer)) != ERROR_OK) break; buf_set_u32(reg_params[0].value, 0, 32, source->address); buf_set_u32(reg_params[1].value, 0, 32, address); buf_set_u32(reg_params[2].value, 0, 32, thisrun_count); - if ((retval = target_run_algorithm(target, 0, NULL, 4, reg_params, stm32x_info->write_algorithm->address, \ - stm32x_info->write_algorithm->address + (sizeof(stm32x_flash_write_code) - 10), 10000, &armv7m_info)) != ERROR_OK) + if ((retval = target_run_algorithm(target, 0, NULL, 4, reg_params, + stm32x_info->write_algorithm->address, + stm32x_info->write_algorithm->address + (sizeof(stm32x_flash_write_code) - 10), + 10000, &armv7m_info)) != ERROR_OK) { LOG_ERROR("error executing stm32x flash write algorithm"); retval = ERROR_FLASH_OPERATION_FAILED; @@ -550,7 +561,8 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t return retval; } -static int stm32x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int stm32x_write(struct flash_bank *bank, uint8_t *buffer, + uint32_t offset, uint32_t count) { struct target *target = bank->target; uint32_t words_remaining = (count / 2); @@ -1269,6 +1281,7 @@ static const struct command_registration stm32x_exec_command_handlers[] = { }, COMMAND_REGISTRATION_DONE }; + static const struct command_registration stm32x_command_handlers[] = { { .name = "stm32x", commit d0a57c0f0c3be172195b12e27b668919488f5d00 Author: Spencer Oliver <nt...@us...> Date: Mon Mar 8 20:31:50 2010 +0000 STR7: flash loader cleanup - make algorithm array static const. - increase algorithm buffer size to 32k. Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index 3bf07c9..fa1744c 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -316,18 +316,19 @@ static int str7x_protect(struct flash_bank *bank, int set, int first, int last) return ERROR_OK; } -static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static 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; struct target *target = bank->target; - uint32_t buffer_size = 8192; + uint32_t buffer_size = 32768; struct working_area *source; uint32_t address = bank->base + offset; struct reg_param reg_params[6]; struct arm_algorithm armv4_5_info; int retval = ERROR_OK; - uint32_t str7x_flash_write_code[] = { + static const uint32_t str7x_flash_write_code[] = { /* write: */ 0xe3a04201, /* mov r4, #0x10000000 */ 0xe5824000, /* str r4, [r2, #0x0] */ @@ -354,13 +355,16 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t }; /* flash write code */ - if (target_alloc_working_area(target, 4 * 20, &str7x_info->write_algorithm) != ERROR_OK) + if (target_alloc_working_area(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; }; - target_write_buffer(target, str7x_info->write_algorithm->address, 20 * 4, (uint8_t*)str7x_flash_write_code); + target_write_buffer(target, str7x_info->write_algorithm->address, + sizeof(str7x_flash_write_code), + (uint8_t*)str7x_flash_write_code); /* memory buffer */ while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) @@ -368,7 +372,8 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t buffer_size /= 2; if (buffer_size <= 256) { - /* if we already allocated the writing code, but failed to get a buffer, free the algorithm */ + /* if we already allocated the writing code, but failed to get a + * buffer, free the algorithm */ if (str7x_info->write_algorithm) target_free_working_area(target, str7x_info->write_algorithm); @@ -400,7 +405,10 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t buf_set_u32(reg_params[3].value, 0, 32, thisrun_count); buf_set_u32(reg_params[5].value, 0, 32, str7x_info->busy_bits); - if ((retval = target_run_algorithm(target, 0, NULL, 6, reg_params, str7x_info->write_algorithm->address, str7x_info->write_algorithm->address + (19 * 4), 10000, &armv4_5_info)) != ERROR_OK) + if ((retval = target_run_algorithm(target, 0, NULL, 6, reg_params, + str7x_info->write_algorithm->address, + 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; @@ -431,7 +439,8 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t return retval; } -static int str7x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +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; @@ -482,7 +491,8 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset if (dwords_remaining > 0) { /* try using a block write */ - if ((retval = str7x_write_block(bank, buffer, offset, dwords_remaining)) != ERROR_OK) + if ((retval = str7x_write_block(bank, buffer, offset, + dwords_remaining)) != ERROR_OK) { if (retval == ERROR_TARGET_RESOURCE_NOT_AVAILABLE) { @@ -517,11 +527,13 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), address); /* data word 1 */ - target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR0), 4, 1, buffer + bytes_written); + target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR0), + 4, 1, buffer + bytes_written); bytes_written += 4; /* data word 2 */ - target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR1), 4, 1, buffer + bytes_written); + target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR1), + 4, 1, buffer + bytes_written); bytes_written += 4; /* start programming cycle */ @@ -564,11 +576,13 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), address); /* data word 1 */ - target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR0), 4, 1, last_dword); + target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR0), + 4, 1, last_dword); bytes_written += 4; /* data word 2 */ - target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR1), 4, 1, last_dword + 4); + target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR1), + 4, 1, last_dword + 4); bytes_written += 4; /* start programming cycle */ @@ -677,7 +691,8 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command) flash_cmd = FLASH_SPR; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), 0x4010DFBC); - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), ~(1 << (15 + ProtectionLevel))); + target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), + ~(1 << (15 + ProtectionLevel))); flash_cmd = FLASH_SPR | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); } @@ -694,6 +709,7 @@ static const struct command_registration str7x_exec_command_handlers[] = { }, COMMAND_REGISTRATION_DONE }; + static const struct command_registration str7x_command_handlers[] = { { .name = "str7x", commit 6344f2ab98cf1fd1f92403de46b6e36b3b122ad5 Author: Spencer Oliver <nt...@us...> Date: Mon Mar 8 20:31:25 2010 +0000 STR9: flash loader cleanup - make algorithm array static const. - increase algorithm buffer size to 32k. Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c index 0875851..3d8b84b 100644 --- a/src/flash/nor/str9x.c +++ b/src/flash/nor/str9x.c @@ -340,14 +340,14 @@ static int str9x_write_block(struct flash_bank *bank, { struct str9x_flash_bank *str9x_info = bank->driver_priv; struct target *target = bank->target; - uint32_t buffer_size = 8192; + uint32_t buffer_size = 32768; struct working_area *source; uint32_t address = bank->base + offset; struct reg_param reg_params[4]; struct arm_algorithm armv4_5_info; int retval = ERROR_OK; - uint32_t str9x_flash_write_code[] = { + static const uint32_t str9x_flash_write_code[] = { /* write: */ 0xe3c14003, /* bic r4, r1, #3 */ 0xe3a03040, /* mov r3, #0x40 */ @@ -373,13 +373,16 @@ static int str9x_write_block(struct flash_bank *bank, }; /* flash write code */ - if (target_alloc_working_area(target, 4 * 19, &str9x_info->write_algorithm) != ERROR_OK) + if (target_alloc_working_area(target, sizeof(str9x_flash_write_code), + &str9x_info->write_algorithm) != ERROR_OK) { LOG_WARNING("no working area available, can't do block memory writes"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - target_write_buffer(target, str9x_info->write_algorithm->address, 19 * 4, (uint8_t*)str9x_flash_write_code); + target_write_buffer(target, str9x_info->write_algorithm->address, + sizeof(str9x_flash_write_code), + (uint8_t*)str9x_flash_write_code); /* memory buffer */ while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) @@ -387,7 +390,8 @@ static int str9x_write_block(struct flash_bank *bank, buffer_size /= 2; if (buffer_size <= 256) { - /* if we already allocated the writing code, but failed to get a buffer, free the algorithm */ + /* if we already allocated the writing code, but failed to get a + * buffer, free the algorithm */ if (str9x_info->write_algorithm) target_free_working_area(target, str9x_info->write_algorithm); @@ -415,7 +419,10 @@ static int str9x_write_block(struct flash_bank *bank, buf_set_u32(reg_params[1].value, 0, 32, address); buf_set_u32(reg_params[2].value, 0, 32, thisrun_count); - if ((retval = target_run_algorithm(target, 0, NULL, 4, reg_params, str9x_info->write_algorithm->address, str9x_info->write_algorithm->address + (18 * 4), 10000, &armv4_5_info)) != ERROR_OK) + if ((retval = target_run_algorithm(target, 0, NULL, 4, reg_params, + str9x_info->write_algorithm->address, + str9x_info->write_algorithm->address + (sizeof(str9x_flash_write_code) - 4), + 10000, &armv4_5_info)) != ERROR_OK) { LOG_ERROR("error executing str9x flash write algorithm"); retval = ERROR_FLASH_OPERATION_FAILED; @@ -676,6 +683,7 @@ static const struct command_registration str9x_config_command_handlers[] = { }, COMMAND_REGISTRATION_DONE }; + static const struct command_registration str9x_command_handlers[] = { { .name = "str9x", diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c index b6d24f5..35fe806 100644 --- a/src/flash/nor/str9xpec.c +++ b/src/flash/nor/str9xpec.c @@ -551,7 +551,8 @@ static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector) return ERROR_OK; } -static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, + uint32_t offset, uint32_t count) { struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv; uint32_t dwords_remaining = (count / 8); @@ -619,7 +620,8 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t off { str9xpec_set_address(bank, str9xpec_info->sector_bits[i]); - dwords_remaining = dwords_remaining < (bank->sectors[i].size/8) ? dwords_remaining : (bank->sectors[i].size/8); + dwords_remaining = dwords_remaining < (bank->sectors[i].size/8) + ? dwords_remaining : (bank->sectors[i].size/8); while (dwords_remaining > 0) { @@ -1226,6 +1228,7 @@ static const struct command_registration str9xpec_config_command_handlers[] = { }, COMMAND_REGISTRATION_DONE }; + static const struct command_registration str9xpec_command_handlers[] = { { .name = "str9xpec", commit 2946c895a175e586a7f79797e2168c9fd0eddbbe Author: Spencer Oliver <nt...@us...> Date: Mon Mar 8 20:30:53 2010 +0000 ADUC702x: flash loader cleanup - make algorithm array static const. Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/aduc702x.c b/src/flash/nor/aduc702x.c index 7e81b32..88072b9 100644 --- a/src/flash/nor/aduc702x.c +++ b/src/flash/nor/aduc702x.c @@ -188,7 +188,7 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32 r6 - set to 2, used to write flash command */ - uint32_t aduc702x_flash_write_code[] = { + static const uint32_t aduc702x_flash_write_code[] = { //<_start>: 0xe3a05008, // mov r5, #8 ; 0x8 0xe5845004, // str r5, [r4, #4] ----------------------------------------------------------------------- Summary of changes: src/flash/nor/aduc702x.c | 2 +- src/flash/nor/stm32x.c | 37 +++++++++++++++++++++++++------------ src/flash/nor/str7x.c | 44 ++++++++++++++++++++++++++++++-------------- src/flash/nor/str9x.c | 20 ++++++++++++++------ src/flash/nor/str9xpec.c | 7 +++++-- 5 files changed, 75 insertions(+), 35 deletions(-) hooks/post-receive -- Main OpenOCD repository |