arm_adi_v5: fix signed offset in Class 0x1 ROM tables
In both arm ADIv5 and ADIv6 documentation, for both Class 0x1 and Class 0x9 ROM tables, the offset field from ROM tables is supposed to be a signed value: "Negative values of OFFSET are permitted, using two’s complement." The commitac22cdc573
("target/adiv5: Large Physical Address Extension") extends to 64 bits the addresses while managing the ROM tables. The offset is read as unsigned and in the former 32 bits implementation the wrap-around was hiding the need for converting the offset to signed. The new implementation requires the proper cast to the offset. On a STM32F411, without this fix the ROM table dump is incorrectly reporting addresses out of the 32 bit bus range: MEM-AP BASE 0xe00ff003 Valid ROM table present Component base address 0xe00ff000 Peripheral ID 0x00000a0411 Designer is 0x0a0, STMicroelectronics Part is 0x411, Unrecognized Component class is 0x1, ROM table MEMTYPE system memory present on bus ROMTABLE[0x0] = 0xfff0f003 Component base address 0x1e000e000 ^^^^^^^^^^^ Cast the offset before adding it to the base address of the ROM table. Change-Id: I8d31fd2b3d657286cb96f8e22fb00842baa728f7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes:ac22cdc573
("target/adiv5: Large Physical Address Extension") Reviewed-on: http://openocd.zylin.com/6410 Tested-by: jenkins Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
This commit is contained in:
parent
08a0cfdeeb
commit
2f97856c5b
|
@ -1310,8 +1310,8 @@ static int dap_rom_display(struct command_invocation *cmd,
|
|||
command_print(cmd, "\t%sROMTABLE[0x%x] = 0x%" PRIx32 "",
|
||||
tabs, entry_offset, romentry);
|
||||
if (romentry & 0x01) {
|
||||
/* Recurse */
|
||||
retval = dap_rom_display(cmd, ap, base_addr + (romentry & 0xFFFFF000), depth + 1);
|
||||
/* Recurse. "romentry" is signed */
|
||||
retval = dap_rom_display(cmd, ap, base_addr + (int32_t)(romentry & 0xFFFFF000), depth + 1);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
} else if (romentry != 0) {
|
||||
|
|
Loading…
Reference in New Issue