From: OpenOCD-Gerrit <ope...@us...> - 2020-03-24 21:35:04
|
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 a708b6d25ec72c6de57ff42bdc6c0b4d52a69388 (commit) from 85dc63011378c0a8112f99e3a02fa971f96bbc05 (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 a708b6d25ec72c6de57ff42bdc6c0b4d52a69388 Author: Lars Poeschel <poe...@ma...> Date: Tue Nov 5 16:37:43 2019 +0100 avrf.c: Use extended addressing for flash > 0x20000 The current method used for flash addressing uses 16 bit. Every access to flash is 16 bit wide. With 16 address bits one can address 0x10000 unique locations á 16 bits thats 0x20000 bytes. For flashes bigger than that avrs have an extended addressing with more than 16 address bits. This is now implemented and used for flashs larger than 0x20000 bytes. Change-Id: Id8b6337dde3830fb3c56b9042872e040bb67c12d Signed-off-by: Lars Pöschel <poe...@ma...> Reviewed-on: http://openocd.zylin.com/5502 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/flash/nor/avrf.c b/src/flash/nor/avrf.c index 178567e6b..aa8645909 100644 --- a/src/flash/nor/avrf.c +++ b/src/flash/nor/avrf.c @@ -142,6 +142,7 @@ static int avr_jtagprg_chiperase(struct avr_common *avr) } static int avr_jtagprg_writeflashpage(struct avr_common *avr, + const bool ext_addressing, const uint8_t *page_buf, uint32_t buf_size, uint32_t addr, @@ -152,6 +153,13 @@ static int avr_jtagprg_writeflashpage(struct avr_common *avr, avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2310, AVR_JTAG_REG_ProgrammingCommand_Len); + /* load extended high byte */ + if (ext_addressing) + avr_jtag_senddat(avr->jtag_info.tap, + NULL, + 0x0b00 | ((addr >> 17) & 0xFF), + AVR_JTAG_REG_ProgrammingCommand_Len); + /* load addr high byte */ avr_jtag_senddat(avr->jtag_info.tap, NULL, @@ -238,6 +246,7 @@ static int avrf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t o struct target *target = bank->target; struct avr_common *avr = target->arch_info; uint32_t cur_size, cur_buffer_size, page_size; + bool ext_addressing; if (bank->target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); @@ -258,6 +267,11 @@ static int avrf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t o if (ERROR_OK != avr_jtagprg_enterprogmode(avr)) return ERROR_FAIL; + if (bank->size > 0x20000) + ext_addressing = true; + else + ext_addressing = false; + cur_size = 0; while (count > 0) { if (count > page_size) @@ -265,6 +279,7 @@ static int avrf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t o else cur_buffer_size = count; avr_jtagprg_writeflashpage(avr, + ext_addressing, buffer + cur_size, cur_buffer_size, offset + cur_size, ----------------------------------------------------------------------- Summary of changes: src/flash/nor/avrf.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) hooks/post-receive -- Main OpenOCD repository |