Skip to contentSkip to conversation

arm: printf() is not available in some SPL configurations

PATCH Superseded Christian Riesch 3 participants 4 messages Nov 22, 2011 Arm (32-bit)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 arm: printf() is not available in some SPL configurations

This patch avoids build breakage for SPLs that do not support printf.

---
Changes for v3:
- Removed extra white space
- Separated patch from patchset [1]

[1] http://lists.denx.de/pipermail/u-boot/2011-November/110635.html

 arch/arm/lib/eabi_compat.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/lib/eabi_compat.c +2 -0
index eb3e26d..e1b87be 100644
@@ -13,7 +13,9 @@
 
 int raise (int signum)
 {
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
 	printf("raise: Signal # %d caught\n", signum);
+#endif
 	return 0;
 }
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v3 1/1 arm: printf() is not available in some SPL configurations

Dear Christian,

sorry I haven't followed the discussion so far. I have a little pointer too.

Am 22.11.2011 09:26, schrieb Christian Riesch:

Quoted 21 lines

This patch avoids build breakage for SPLs that do not support printf.

---
Changes for v3:
- Removed extra white space
- Separated patch from patchset [1]

[1] http://lists.denx.de/pipermail/u-boot/2011-November/110635.html

 arch/arm/lib/eabi_compat.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/lib/eabi_compat.c +0 -0
index eb3e26d..e1b87be 100644

arch/arm/lib/eabi_compat.c line 18

Quoted 6 lines
arch/arm/lib/eabi_compat.c +2 -0
@@ -13,7 +13,9 @@
 
 int raise (int signum)
 {
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
 	printf("raise: Signal # %d caught\n", signum);
+#endif

Well, you can do it that way but I guess there are several places where printf() will be needed by some drivers in SPL. Therefore I think it is better to provide printf() for SPL than to ifdef out all the printf's.

So how about providing an empty

#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) #define printf(x)
#endif

somewhere in the SPL code?

best regards

Andreas Bie?mann

#2 lore raw

PATCH v3 1/1 arm: printf() is not available in some SPL configurations

Hi Andreas,
Thank you for your comments!

Quoted 37 lines · Andreas Bie?mann

Dear Christian,

sorry I haven't followed the discussion so far. I have a little pointer too.

Am 22.11.2011 09:26, schrieb Christian Riesch:

Quoted 21 lines

This patch avoids build breakage for SPLs that do not support printf.

---
Changes for v3:
- Removed extra white space
- Separated patch from patchset [1]

[1] http://lists.denx.de/pipermail/u-boot/2011-November/110635.html

?arch/arm/lib/eabi_compat.c | ? ?2 ++
?1 files changed, 2 insertions(+), 0 deletions(-)

arch/arm/lib/eabi_compat.c +0 -0
index eb3e26d..e1b87be 100644

arch/arm/lib/eabi_compat.c line 18

Quoted 6 lines
arch/arm/lib/eabi_compat.c +2 -0
@@ -13,7 +13,9 @@
 
 ?int raise (int signum)
 ?{
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
 ? ? ? printf("raise: Signal # %d caught\n", signum);
+#endif

Well, you can do it that way but I guess there are several places where printf() will be needed by some drivers in SPL. Therefore I think it is better to provide printf() for SPL than to ifdef out all the printf's.

Quoted 7 lines

So how about providing an empty

#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) #define printf(x)
#endif

somewhere in the SPL code?

If others agree I will do something like this. But I don't like this approach. I can imagine that this could be a real PITA when you are debugging an SPL, see a printf in the code, expect an output on console, but this output never appears because printf has been replaced globally in some obscure header file.

Regards, Christian

#3 lore raw

PATCH v3 1/1 arm: printf() is not available in some SPL configurations

In reply to Andreas Bießmann
Quoted 11 lines · Andreas Bie?mann

Well, you can do it that way but I guess there are several places where printf() will be needed by some drivers in SPL. Therefore I think it is better to provide printf() for SPL than to ifdef out all the printf's.

So how about providing an empty

#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) #define printf(x)
#endif

somewhere in the SPL code?

Use an inline function instead so the arguments are consumed and it doesn't cause unused-variable warnings.

-Scott