From: OpenOCD-Gerrit <ope...@us...> - 2020-09-27 16:41: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 051e80812b1b3bb4deabef272c12bb95f10748da (commit) via 35e580373a77438f2832974b1f0dc36863dc3f03 (commit) from 67008e1bea2dd1a89d77802b892d3390e8a55455 (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 051e80812b1b3bb4deabef272c12bb95f10748da Author: Adrian Negreanu <adr...@nx...> Date: Mon Sep 7 22:36:10 2020 +0300 drivers/jlink: fix calculate_swo_prescaler formula a) TPIU_ACPR is defined as: SWO_baudrate = TRACECLKIN/(TPIU_ACPR +1) b) TPIU_ACPR is set by armv7m_trace_tpiu_config() target_write_u32(target, TPIU_ACPR, Prescaler-1), so TPIU_ACPR = Prescaler-1 Replacing TPIU_ACPR in a), we get: SWO_baudrate = TRACECLKIN/Prescaler, so c) Prescaler = TRACECLKIN/SWO_baudrate The Prescaler calculated by calculate_swo_prescaler() is greater by 1: Prescaler = TRACECLKIN/SWO_baudrate + 1 The second problem is that even in situations when an exact baudrate match is possible, the resulting TRACECLKIN/Prescaler already has a 3% deviation. For example, TRACECLKIN=88000000, SWO_baudrate=500000, calculate_swo_prescaler will return Prescaler=171. The correct value should be Prescaler=176 (TPIU_ACPR=175). Might be related to https://sourceforge.net/p/openocd/tickets/263/ Change-Id: Ib4d6df6e34685a9be4c2995cb500b2411c76e39b Signed-off-by: Adrian Negreanu <adr...@nx...> Reviewed-on: http://openocd.zylin.com/5807 Tested-by: jenkins Reviewed-by: Marc Schink <de...@za...> Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c index 57e357b79..910799ce2 100644 --- a/src/jtag/drivers/jlink.c +++ b/src/jtag/drivers/jlink.c @@ -1270,16 +1270,14 @@ static bool calculate_swo_prescaler(unsigned int traceclkin_freq, uint32_t trace_freq, uint16_t *prescaler) { unsigned int presc; - double deviation; - - presc = ((1.0 - SWO_MAX_FREQ_DEV) * traceclkin_freq) / trace_freq + 1; - + presc = DIV_ROUND_UP(traceclkin_freq, trace_freq); if (presc > TPIU_ACPR_MAX_SWOSCALER) return false; - deviation = fabs(1.0 - ((double)trace_freq * presc / traceclkin_freq)); - - if (deviation > SWO_MAX_FREQ_DEV) + /* Probe's UART speed must be within 3% of the TPIU's SWO baud rate. */ + unsigned int max_deviation = (traceclkin_freq * 3) / 100; + if (presc * trace_freq < traceclkin_freq - max_deviation || + presc * trace_freq > traceclkin_freq + max_deviation) return false; *prescaler = presc; commit 35e580373a77438f2832974b1f0dc36863dc3f03 Author: Tarek BOCHKATI <tar...@gm...> Date: Tue Aug 11 12:34:50 2020 +0100 Add support of STM32H72x/73x 1M (0x483) STM32H72x/73x flash is similar to STM32H74x/75x, except STM32H72x/73x devices have only one single flash bank. Change-Id: I3d3422dc60234f8273172924f426200210f388cc Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: http://openocd.zylin.com/5792 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/stm32h7x.c b/src/flash/nor/stm32h7x.c index ac7d75948..52e3e0e87 100644 --- a/src/flash/nor/stm32h7x.c +++ b/src/flash/nor/stm32h7x.c @@ -147,7 +147,11 @@ static const struct stm32h7x_rev stm32_480_revs[] = { { 0x1000, "A"}, }; -static uint32_t stm32x_compute_flash_cr_450(uint32_t cmd, int snb) +static const struct stm32h7x_rev stm32_483_revs[] = { + { 0x1000, "A" }, { 0x1001, "Z" }, +}; + +static uint32_t stm32x_compute_flash_cr_450_483(uint32_t cmd, int snb) { return cmd | (snb << 8); } @@ -177,7 +181,7 @@ static const struct stm32h7x_part_info stm32h7x_parts[] = { .fsize_addr = 0x1FF1E880, .wps_group_size = 1, .wps_mask = 0xFF, - .compute_flash_cr = stm32x_compute_flash_cr_450, + .compute_flash_cr = stm32x_compute_flash_cr_450_483, }, { .id = 0x480, @@ -194,6 +198,21 @@ static const struct stm32h7x_part_info stm32h7x_parts[] = { .wps_mask = 0xFFFFFFFF, .compute_flash_cr = stm32x_compute_flash_cr_480, }, + { + .id = 0x483, + .revs = stm32_483_revs, + .num_revs = ARRAY_SIZE(stm32_483_revs), + .device_str = "STM32H72x/73x", + .page_size_kb = 128, + .block_size = 32, + .max_flash_size_kb = 1024, + .max_bank_size_kb = 1024, + .has_dual_bank = false, + .fsize_addr = 0x1FF1E880, + .wps_group_size = 1, + .wps_mask = 0xFF, + .compute_flash_cr = stm32x_compute_flash_cr_450_483, + }, }; /* flash bank stm32x <base> <size> 0 0 <target#> */ @@ -804,6 +823,8 @@ static int stm32x_probe(struct flash_bank *bank) /* flash size is 2M or 1M */ flash_size_in_kb /= 2; break; + case 0x483: + break; default: LOG_ERROR("unsupported device"); return ERROR_FAIL; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32h7x.c | 25 +++++++++++++++++++++++-- src/jtag/drivers/jlink.c | 12 +++++------- 2 files changed, 28 insertions(+), 9 deletions(-) hooks/post-receive -- Main OpenOCD repository |