fix(rk3399): m0: Makefile: fix outside array bounds warning
Both GCC and clang actually complain about:
"""
In file included from src/dram.c:12:
src/dram.c: In function 'm0_main':
include/rk3399_mcu.h:15:34: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=]
15 | (*(volatile unsigned int *)(c)); __v; })
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32'
16 | #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v))
| ^
src/dram.c:67:23: note: in expansion of macro 'mmio_read_32'
67 | mmio_read_32(PARAM_ADDR + PARAM_FREQ_SELECT));
| ^~~~~~~~~~~~
cc1: note: source object is likely at address zero
In function 'ddr_set_pll',
inlined from 'm0_main' at src/dram.c:71:2:
include/rk3399_mcu.h:14:40: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=]
14 | #define mmio_read_32(c) ({unsigned int __v = \
| ^~~
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32'
16 | #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v))
| ^
src/dram.c:47:23: note: in expansion of macro 'mmio_read_32'
47 | mmio_read_32(PARAM_ADDR + PARAM_DPLL_CON0));
| ^~~~~~~~~~~~
In function 'm0_main':
cc1: note: source object is likely at address zero
In function 'ddr_set_pll',
inlined from 'm0_main' at src/dram.c:71:2:
include/rk3399_mcu.h:14:40: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=]
14 | #define mmio_read_32(c) ({unsigned int __v = \
| ^~~
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32'
16 | #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v))
| ^
src/dram.c:49:23: note: in expansion of macro 'mmio_read_32'
49 | mmio_read_32(PARAM_ADDR + PARAM_DPLL_CON1));
| ^~~~~~~~~~~~
In function 'm0_main':
cc1: note: source object is likely at address zero
include/rk3399_mcu.h:16:35: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=]
16 | #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/dram.c:80:9: note: in expansion of macro 'mmio_write_32'
80 | mmio_write_32(PARAM_ADDR + PARAM_M0_DONE, M0_DONE_FLAG);
| ^~~~~~~~~~~~~
cc1: note: source object is likely at address zero
"""
The global Makefile defines --param=min-pagesize=0 already, so let's
just apply the same fix for the m0 part of the RK3399 binary.
Suggested-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Change-Id: I4f29a579b9e4b01aa2540746ef46e2a382f0012e
diff --git a/plat/rockchip/rk3399/drivers/m0/Makefile b/plat/rockchip/rk3399/drivers/m0/Makefile
index 0ccce83..652ff08 100644
--- a/plat/rockchip/rk3399/drivers/m0/Makefile
+++ b/plat/rockchip/rk3399/drivers/m0/Makefile
@@ -5,6 +5,7 @@
#
include ../../../../../make_helpers/common.mk
+include ../../../../../make_helpers/build_macros.mk
include ../../../../../make_helpers/toolchain.mk
# Cross Compile
@@ -31,6 +32,8 @@
# Flags definition
COMMON_FLAGS := -g -mcpu=cortex-m0 -mthumb -Wall -O3 -nostdlib -mfloat-abi=soft
CFLAGS := -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-common
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
+CFLAGS += $(call cc_option, --param=min-pagesize=0)
ASFLAGS := -Wa,--gdwarf-2
LDFLAGS := -Wl,--gc-sections -Wl,--build-id=none