Kconfig: Add an option for debugging OpenSBI
RFC PATCH 1/1 Kconfig: Add an option for debugging OpenSBI
Add a new Kconfig option CONFIG_OPENSBI_DEBUG to prevent compiler optimizations using -O2.
---
Kconfig | 7 +++++++ Makefile | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Kconfig +7 -0
@@ -23,3 +23,10 @@ source "$(OPENSBI_SRC_DIR)/lib/sbi/Kconfig" source "$(OPENSBI_SRC_DIR)/lib/utils/Kconfig" source "$(OPENSBI_SRC_DIR)/firmware/Kconfig" + +menu "General Setup" + +config OPENSBI_DEBUG + bool "Disable compiler optimizations for debugging" + +endmenu
Makefile +6 -1
@@ -331,7 +331,12 @@ GENFLAGS += $(libsbiutils-genflags-y) GENFLAGS += $(platform-genflags-y) GENFLAGS += $(firmware-genflags-y) -CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing -O2 +CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing +ifeq ($(CONFIG_OPENSBI_DEBUG),y) +CFLAGS += -O0 +else +CFLAGS += -O2 +endif CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls -mstrict-align # enable -m(no-)save-restore option by CC_SUPPORT_SAVE_RESTORE ifeq ($(CC_SUPPORT_SAVE_RESTORE),y)
Signature · 1 line
2.25.1
RFC PATCH 1/1 Kconfig: Add an option for debugging OpenSBI
Quoted 16 lines · Bin Meng
Add a new
KconfigoptionCONFIG_OPENSBI_DEBUGto prevent compiler optimizations using -O2.Signed-off-by Bin Meng <[email protected]>---
Kconfig | 7 +++++++ Makefile | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-)Kconfig +0
-0
Kconfig source "$(OPENSBI_SRC_DIR)/lib/sbi/Kconfig" · line 32
Quoted 10 lines
Kconfig +7
-0@@ -23,3 +23,10 @@ source "$(OPENSBI_SRC_DIR)/lib/sbi/Kconfig" source "$(OPENSBI_SRC_DIR)/lib/utils/Kconfig" source "$(OPENSBI_SRC_DIR)/firmware/Kconfig" + +menu "General Setup" + +config OPENSBI_DEBUG + bool "Disable compiler optimizations for debugging" + +endmenu\
Rather than adding a Kconfig option, I would suggest having a simple make command-line option. For example, "make DEBUG=1"
Regards,
Anup
Quoted 21 lines
Makefile +6
-2@@ -331,7 +331,12 @@ GENFLAGS += $(libsbiutils-genflags-y) GENFLAGS += $(platform-genflags-y) GENFLAGS += $(firmware-genflags-y) -CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing -O2 +CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing +ifeq ($(CONFIG_OPENSBI_DEBUG),y) +CFLAGS += -O0 +else +CFLAGS += -O2 +endif CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls -mstrict-align # enable -m(no-)save-restore option by CC_SUPPORT_SAVE_RESTORE ifeq ($(CC_SUPPORT_SAVE_RESTORE),y) --2.25.1
RFC PATCH 1/1 Kconfig: Add an option for debugging OpenSBI
? 2023-02-24???? 10:19 +0530?Anup Patel???
Quoted 19 lines · Bin Meng
Quoted 18 lines
Add a new
KconfigoptionCONFIG_OPENSBI_DEBUGto prevent compiler optimizations using -O2.Signed-off-by Bin Meng <[email protected]>---
?Kconfig? | 7 +++++++
?Makefile | 7 ++++++-
?2 files changed, 13 insertions(+), 1 deletion(-)Kconfig +0
-0@@ -23,3 +23,10 @@ source "$(OPENSBI_SRC_DIR)/lib/sbi/Kconfig"?source "$(OPENSBI_SRC_DIR)/lib/utils/Kconfig"
Quoted 12 lines
Kconfig source "$(OPENSBI_SRC_DIR)/lib/sbi/Kconfig"
Quoted 8 lines
?source "$(OPENSBI_SRC_DIR)/firmware/Kconfig"
Kconfig +7
-0+ +menu "General Setup" + +config OPENSBI_DEBUG +?????? bool "Disable compiler optimizations for debugging" + +endmenu\Rather than adding a
Kconfigoption, I would suggest having a simple make command-line option. For example, "make DEBUG=1"
Agree to add a command line option so that don't need to re-run make menuconfig when finally generate the release firmware
Regards,
Xiang W
Quoted 25 lines
Regards,
AnupQuoted 21 lines
Makefile +6
-1@@ -331,7 +331,12 @@ GENFLAGS?? +=????? $(libsbiutils-genflags-y) ?GENFLAGS?????? +=????? $(platform-genflags-y) ?GENFLAGS?????? +=????? $(firmware-genflags-y) -CFLAGS???????? =?????? -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing -O2 +CFLAGS???????? =?????? -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing +ifeq ($(CONFIG_OPENSBI_DEBUG),y) +CFLAGS???????? +=????? -O0 +else +CFLAGS???????? +=????? -O2 +endif?CFLAGS???????? +=????? -fno-omit-frame-pointer -fno-optimize-sibling-calls -mstrict-align ?# enable -m(no-)save-restore option by
CC_SUPPORT_SAVE_RESTORE
?ifeq ($(CC_SUPPORT_SAVE_RESTORE),y)
--
2.25.1