Skip to contentSkip to conversation

debug_ll.h: add PUTS_LL() function

PATCH Applied Antony Pavlov 4 participants 10 messages Jul 18, 2011 – Jul 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 debug_ll.h: add PUTS_LL() function

---
 include/debug_ll.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/debug_ll.h +13 -0
index e99ae7d..6b1b174 100644
@@ -35,9 +35,22 @@
 			     ch = ((v >> (i*4)) & 0xf);\
 			     ch += (ch >= 10) ? 'a' - 10 : '0';\
 			     PUTC_LL (ch); }})
+
+static __inline__ void PUTS_LL(char * str)
+{
+	while (*str) {
+		if (*str == '\n') {
+			PUTC_LL('\r');
+		}
+		PUTC_LL(*str);
+		str++;
+	}
+}
+
 #else
 # define PUTC_LL(c) do {} while (0)
 # define PUTHEX_LL(v) do {} while (0)
+# define PUTS_LL(c) do {} while (0)
 
 #endif
 
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 2/2 startup.c: make DEBUG_LL output more useful

---
 common/startup.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
common/startup.c +5 -1
index 00bc9a0..2e28cb2 100644
@@ -134,13 +134,17 @@ void start_barebox (void)
 
 	for (initcall = __barebox_initcalls_start;
 			initcall < __barebox_initcalls_end; initcall++) {
+		PUTS_LL("<<");
 		PUTHEX_LL(*initcall);
-		PUTC_LL('\n');
 		result = (*initcall)();
+		PUTC_LL('>');
 		if (result)
 			hang();
+		PUTS_LL(">\n");
 	}
 
+	PUTS_LL("initcalls done\n");
+
 	display_meminfo();
 
 #ifdef CONFIG_ENV_HANDLING
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
In reply to Antony Pavlov

2011/7/18 Antony Pavlov <[email protected]>

Quoted 36 lines
---
 include/debug_ll.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/debug_ll.h +13 -1
index e99ae7d..6b1b174 100644
@@ -35,9 +35,22 @@
                            ch = ((v >> (i*4)) & 0xf);\
                            ch += (ch >= 10) ? 'a' - 10 : '0';\
                            PUTC_LL (ch); }})
+
+static __inline__ void PUTS_LL(char * str)
+{
+       while (*str) {
+               if (*str == '\n') {
+                       PUTC_LL('\r');
+               }
+               PUTC_LL(*str);
+               str++;
+       }
+}
+
 #else
 # define PUTC_LL(c) do {} while (0)
 # define PUTHEX_LL(v) do {} while (0)
+# define PUTS_LL(c) do {} while (0)
 
 #endif
 
--

1.7.5.4

Quoted 4 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Hello,

Could we add an entry for CONFIG_DEBUG_LL in the debugging menu (common/Kconfig) ?
This file makes barebox not compile if we are not on arm arch due to the <mach/debug_ll.h> inclusion.

I know it's not related to your patch :)

Franck.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw
In reply to Franck JULLIEN
Quoted 4 lines · Franck JULLIEN

2011/7/18 Antony Pavlov <[email protected]>

Quoted 8 lines

Hello,

Could we add an entry for CONFIG_DEBUG_LL in the debugging menu (common/Kconfig) ?
This file makes barebox not compile if we are not on arm arch due to the <mach/debug_ll.h> inclusion.

I know it's not related to your patch :)

Patches that make the lowlevel debug stuff more generally useful are very welcome. It's not nice to have to modify the code to make it work, but I couldn't find the energy to do something about it.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#6 lore raw
In reply to Antony Pavlov
Quoted 1 line · Antony Pavlov

Applied both to next.

Thanks
Sascha

Quoted 40 lines
---
 include/debug_ll.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/debug_ll.h +13 -0
index e99ae7d..6b1b174 100644
@@ -35,9 +35,22 @@
 			     ch = ((v >> (i*4)) & 0xf);\
 			     ch += (ch >= 10) ? 'a' - 10 : '0';\
 			     PUTC_LL (ch); }})
+
+static __inline__ void PUTS_LL(char * str)
+{
+	while (*str) {
+		if (*str == '\n') {
+			PUTC_LL('\r');
+		}
+		PUTC_LL(*str);
+		str++;
+	}
+}
+
 #else
 # define PUTC_LL(c) do {} while (0)
 # define PUTHEX_LL(v) do {} while (0)
+# define PUTS_LL(c) do {} while (0)
 
 #endif
 
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

2011/7/18 Sascha Hauer <[email protected]>:

Quoted 37 lines · Antony Pavlov
Quoted 1 line

Applied both to next.

Thanks
 Sascha

Quoted 29 lines

---
 include/debug_ll.h |   13 +++++++++++++

 1 files changed, 13 insertions(+), 0 deletions(-)
include/debug_ll.h +13 -0
index e99ae7d..6b1b174 100644
@@ -35,9 +35,22 @@
                            ch = ((v >> (i*4)) & 0xf);\
                            ch += (ch >= 10) ? 'a' - 10 : '0';\
                            PUTC_LL (ch); }})
+
+static __inline__ void PUTS_LL(char * str)
+{
+     while (*str) {
+             if (*str == '\n') {
+                     PUTC_LL('\r');
+             }
+             PUTC_LL(*str);
+             str++;
+     }
+}
+
  #else
  # define PUTC_LL(c) do {} while (0)
  # define PUTHEX_LL(v) do {} while (0)
+# define PUTS_LL(c) do {} while (0)
 
Quoted 2 lines

include/debug_ll.h line 56

Quoted 2 lines
include/debug_ll.h +0 -0
  #endif
 

Is there any reason for not using vsprintf in a printf_ll function which would use puts_ll / putc_ll ??

Franck.

Quoted 16 lines
Quoted 9 lines

--
1.7.5.4

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

--
Pengutronix e.K.                           |                             | Industrial Linux Solutions                 | http://www.pengutronix.de/  | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    | Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Quoted 5 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#8 lore raw
Quoted 38 lines · Franck JULLIEN

2011/7/18 Sascha Hauer <[email protected]>:

Quoted 37 lines · Antony Pavlov
Quoted 1 line

Applied both to next.

Thanks
 Sascha

Quoted 29 lines

---
 include/debug_ll.h |   13 +++++++++++++

 1 files changed, 13 insertions(+), 0 deletions(-)
include/debug_ll.h +13 -0
index e99ae7d..6b1b174 100644
@@ -35,9 +35,22 @@
                            ch = ((v >> (i*4)) & 0xf);\
                            ch += (ch >= 10) ? 'a' - 10 : '0';\
                            PUTC_LL (ch); }})
+
+static __inline__ void PUTS_LL(char * str)
+{
+     while (*str) {
+             if (*str == '\n') {
+                     PUTC_LL('\r');
+             }
+             PUTC_LL(*str);
+             str++;
+     }
+}
+
  #else
  # define PUTC_LL(c) do {} while (0)
  # define PUTHEX_LL(v) do {} while (0)
+# define PUTS_LL(c) do {} while (0)
 
Quoted 5 lines
Quoted 2 lines

include/debug_ll.h line 56

Quoted 2 lines
include/debug_ll.h +0 -0
  #endif
 

Is there any reason for not using vsprintf in a printf_ll function which would use puts_ll / putc_ll ??

You would at least need a writable string buffer. I'd rather like to keep the ll functions as simple as possible. Otherwise you end up debugging the debug functions while hunting some lowlevel problem.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

2011/7/20 Sascha Hauer <[email protected]>:

Quoted 45 lines · Franck JULLIEN
Quoted 38 lines

2011/7/18 Sascha Hauer <[email protected]>:

Quoted 37 lines · Antony Pavlov
Quoted 1 line

Applied both to next.

Thanks
 Sascha

Quoted 29 lines

---
 include/debug_ll.h |   13 +++++++++++++

 1 files changed, 13 insertions(+), 0 deletions(-)
include/debug_ll.h +13 -0
index e99ae7d..6b1b174 100644
@@ -35,9 +35,22 @@
                            ch = ((v >> (i*4)) & 0xf);\
                            ch += (ch >= 10) ? 'a' - 10 : '0';\
                            PUTC_LL (ch); }})
+
+static __inline__ void PUTS_LL(char * str)
+{
+     while (*str) {
+             if (*str == '\n') {
+                     PUTC_LL('\r');
+             }
+             PUTC_LL(*str);
+             str++;
+     }
+}
+
  #else
  # define PUTC_LL(c) do {} while (0)
  # define PUTHEX_LL(v) do {} while (0)
+# define PUTS_LL(c) do {} while (0)
 
Quoted 5 lines
Quoted 2 lines

include/debug_ll.h line 56

Quoted 2 lines
include/debug_ll.h +0 -0
  #endif
 

Is there any reason for not using vsprintf in a printf_ll function which would use puts_ll / putc_ll ??

Quoted 4 lines

You would at least need a writable string buffer. I'd rather like to keep the ll functions as simple as possible. Otherwise you end up debugging the debug functions while hunting some lowlevel problem.

Ok I see, let's keep it like this. However, that's what I did in nios2/lib/early_printf.c and I never
had any problem using a static 50 bytes buffer.

Quoted 9 lines

Sascha

--
Pengutronix e.K.                           |                             | Industrial Linux Solutions                 | http://www.pengutronix.de/  | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    | Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox