mirror of
git://git.code.sf.net/p/openocd/code
synced 2025-08-16 18:57:55 +10:00
jtag/drivers: dmem: fix build on Linux 32 bits
On 32 bits machine both 'uintptr_t' and pointers are 32 bit. The cast (volatile uint32_t *)((uintptr_t)dmem_emu_virt_base_addr + addr) fails with error error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] in lines 100 and 109 because: - 'addr' is a 'uint64_t'; - adding 'uintptr_t' and 'uint64_t' returns a 64 bit value; - cast the 64 bit to 'uint32_t *' is an error. In the code the value passed to 'addr' is always 32 bit wide, so there is no need to pass it as 'uint64_t'. Change the type of 'addr' to 'uint32_t'. Fix also some format string to fit both 32 and 64 bits machines. Change-Id: I90ff7cd3731cb24a0fc91fe7b69c532b5c698ba0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8974 Reviewed-by: Nishanth Menon <nm@ti.com> Tested-by: jenkins Reviewed-by: R. Diez <rdiez-2006@rd10.de>
This commit is contained in:
parent
ff274122dc
commit
7f1f18399c
@ -93,14 +93,14 @@ static bool dmem_is_emulated_ap(struct adiv5_ap *ap, unsigned int *idx)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void dmem_emu_set_ap_reg(uint64_t addr, uint32_t val)
|
||||
static void dmem_emu_set_ap_reg(uint32_t addr, uint32_t val)
|
||||
{
|
||||
addr &= ~ARM_APB_PADDR31;
|
||||
|
||||
*(volatile uint32_t *)((uintptr_t)dmem_emu_virt_base_addr + addr) = val;
|
||||
}
|
||||
|
||||
static uint32_t dmem_emu_get_ap_reg(uint64_t addr)
|
||||
static uint32_t dmem_emu_get_ap_reg(uint32_t addr)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
@ -113,7 +113,7 @@ static uint32_t dmem_emu_get_ap_reg(uint64_t addr)
|
||||
|
||||
static int dmem_emu_ap_q_read(unsigned int ap_idx, unsigned int reg, uint32_t *data)
|
||||
{
|
||||
uint64_t addr;
|
||||
uint32_t addr;
|
||||
int ret = ERROR_OK;
|
||||
struct dmem_emu_ap_info *ap_info = &dmem_emu_ap_list[ap_idx];
|
||||
|
||||
@ -164,7 +164,7 @@ static int dmem_emu_ap_q_read(unsigned int ap_idx, unsigned int reg, uint32_t *d
|
||||
|
||||
static int dmem_emu_ap_q_write(unsigned int ap_idx, unsigned int reg, uint32_t data)
|
||||
{
|
||||
uint64_t addr;
|
||||
uint32_t addr;
|
||||
int ret = ERROR_OK;
|
||||
struct dmem_emu_ap_info *ap_info = &dmem_emu_ap_list[ap_idx];
|
||||
|
||||
@ -519,7 +519,7 @@ static int dmem_dap_init(void)
|
||||
MAP_SHARED, dmem_fd,
|
||||
dmem_mapped_start);
|
||||
if (dmem_map_base == MAP_FAILED) {
|
||||
LOG_ERROR("Mapping address 0x%lx for 0x%lx bytes failed!",
|
||||
LOG_ERROR("Mapping address 0x%zx for 0x%zx bytes failed!",
|
||||
dmem_mapped_start, dmem_mapped_size);
|
||||
goto error_fail;
|
||||
}
|
||||
@ -543,7 +543,7 @@ static int dmem_dap_init(void)
|
||||
MAP_SHARED, dmem_fd,
|
||||
dmem_mapped_start);
|
||||
if (dmem_emu_map_base == MAP_FAILED) {
|
||||
LOG_ERROR("Mapping EMU address 0x%lx for 0x%lx bytes failed!",
|
||||
LOG_ERROR("Mapping EMU address 0x%" PRIx64 " for 0x%" PRIx64 " bytes failed!",
|
||||
dmem_emu_base_address, dmem_emu_size);
|
||||
goto error_fail;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user