Skip to content

Commit

Permalink
device_mmio: use explicit unsigned literals for addresses
Browse files Browse the repository at this point in the history
Add an explicit unsigned literal suffix (U) for addresses obtained from
devicetree, this is to work around a specific warning:

zephyrproject/zephyr/include/zephyr/arch/arm/cortex_a_r/timer.h:40:2:
warning: this decimal constant is unsigned only in ISO C90

When compling

west build -p -b qemu_cortex_a9 -T tests/lib/cpp/cxx/cpp.main.cpp98

Argueably all devicetree addresses and sizes should be unsigned but this
is enough to make CI pass, may look into changing the device.h macro as
a followup.

Signed-off-by: Fabio Baltieri <[email protected]>
  • Loading branch information
fabiobaltieri authored and nashif committed Sep 23, 2024
1 parent e428a52 commit 1a2d74a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/zephyr/sys/device_mmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ struct z_device_mmio_rom {

#define Z_DEVICE_MMIO_ROM_INITIALIZER(node_id) \
{ \
.phys_addr = DT_REG_ADDR(node_id), \
.phys_addr = UINT32_C(DT_REG_ADDR(node_id)), \
.size = DT_REG_SIZE(node_id) \
}

#define Z_DEVICE_MMIO_NAMED_ROM_INITIALIZER(name, node_id) \
{ \
.phys_addr = DT_REG_ADDR_BY_NAME(node_id, name), \
.phys_addr = UINT32_C(DT_REG_ADDR_BY_NAME(node_id, name)), \
.size = DT_REG_SIZE_BY_NAME(node_id, name) \
}

Expand Down

0 comments on commit 1a2d74a

Please sign in to comment.