Skip to contentSkip to conversation

ARM omap: Add null console

RFC In review Sanjeev Premi 3 participants 8 messages Jan 11, 2012 – Jan 13, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/2 ARM omap: Add null console

When using barebox as both 1st and 2nd stage bootloader, same banner gets printed - date being the only difference.

For the first stage bootloader, prints are definitely required during initial debug and development phases, but after that, they can easily be avoided.

And if we don't need prints, then we can do without the serial driver as well.

With this background, this patch introduces concept of NULL console. Most Kconfig changes are quite simple.

Separate file console_null.c was created only for ease of review and maintaining console_simple.c as-is.

In final version, appropriate #ifdefs in console_simple.c should be used.

Visually, the prompt from barebox.bin comes up is about a second - and appears to be much faster.

Here is comparison of the size:

   text    data     bss     dec     hex filename
  45801    3300    4024   53125    cf85 barebox  (Before)
  44221    3196    4020   51437    c8ed barebox  (After)

Tested on OMAP3EVM with xload configuration derived from omap3530_beagle_xload_defconfig.

Cc Sascha Hauer <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>

---

Although I have marked the change to be specific to ARM+OMAP, it could be generally applicable.

 arch/arm/mach-omap/Kconfig |    4 +-
 common/Kconfig             |   11 +++-
 common/Makefile            |    1 +
 common/console_null.c      |  135 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/serial/Kconfig     |    1 +
 5 files changed, 149 insertions(+), 3 deletions(-)
 create mode 100644 common/console_null.c
arch/arm/mach-omap/Kconfig +2 -2
index 72c6850..9edb4a9 100644
@@ -171,13 +171,13 @@ if MACH_OMAP3EVM
 
 	config OMAP3EVM_UART1
 		bool "Use UART1"
-		depends on MACH_OMAP3EVM
+		depends on MACH_OMAP3EVM && !CONSOLE_NULL
 		help
 		  Say Y here if you would like to use UART1 as console.
 
 	config OMAP3EVM_UART3
 		bool "Use UART3"
-		depends on MACH_OMAP3EVM
+		depends on MACH_OMAP3EVM && !CONSOLE_NULL
 		help
 		  Say Y here if you would like to use UART3 as console.
 	endchoice
common/Kconfig +10 -1
index ca4f099..a664624 100644
@@ -377,10 +377,19 @@ config CONSOLE_FULL
 	  This option enables full console support capable of
 	  handling multiple consoles.
 
+config CONSOLE_NULL
+	bool
+	depends on !CONSOLE_FULL
+	prompt "Enable null console"
+	help
+	  This option enables null console i.e. there is no real
+	  read/ write operation.
+
 config CONSOLE_SIMPLE
 	bool
 	default y
-	depends on !CONSOLE_FULL
+	depends on !CONSOLE_FULL && !CONSOLE_NULL
+
 
 config CONSOLE_ACTIVATE_FIRST
 	depends on CONSOLE_FULL
common/Makefile +1 -0
index d1132c3..6705257 100644
@@ -20,6 +20,7 @@ obj-y += clock.o
 obj-y += version.o
 obj-$(CONFIG_COMMAND_SUPPORT) += command.o
 obj-$(CONFIG_CONSOLE_FULL) += console.o
+obj-$(CONFIG_CONSOLE_NULL) += console_null.o
 obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
 obj-$(CONFIG_DIGEST) += digest.o
 obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o
common/console_null.c new file +135 -0

135 lines not on this page · raw message

drivers/serial/Kconfig +1 -0
index 186b596..cc0e583 100644
@@ -56,6 +56,7 @@ config DRIVER_SERIAL_ALTERA_JTAG
 config DRIVER_SERIAL_NS16550
 	default n
 	bool "NS16550 serial driver"
+	depends on !CONSOLE_NULL
 	help
 	  Enable this to get support for NS16550 based serial devices
 
Signature · 7 lines
1.7.0.4


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

RFC 2/2 ARM omap: Add CONFIG_SILENT

Don't display any verbose message on the console.

Cc Sascha Hauer <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>

---

This config option is kept separate, as user may want console features, but avoid initial messages.

Although I have marked the change to be specific to ARM+OMAP, it is generally applicable. Will change the subject in actual based on review comments to this RFC.

 common/Kconfig   |    4 ++++
 common/startup.c |    2 ++
 common/version.c |    3 ++-
 3 files changed, 8 insertions(+), 1 deletions(-)
common/Kconfig +4 -0
index a664624..cf09034 100644
@@ -369,6 +369,10 @@ config TIMESTAMP
 	  commands like bootm or iminfo. This option is
 	  automatically enabled when you select CFG_CMD_DATE .
 
+config SILENT
+	bool
+	prompt "Don't display any messages on console"
+
 config CONSOLE_FULL
 	bool
 	default y
common/startup.c +2 -0
index 180fdc3..976c0d3 100644
@@ -52,6 +52,7 @@ static void display_meminfo(void)
 
 	debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext);
 	debug("bss segment:  0x%p -> 0x%p\n", __bss_start, __bss_stop);
+#ifndef CONFIG_SILENT
 	printf("Malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
 		mstart, mend, size_human_readable(msize));
 #ifdef CONFIG_ARM
@@ -59,6 +60,7 @@ static void display_meminfo(void)
 		STACK_BASE, STACK_BASE + STACK_SIZE,
 		size_human_readable(STACK_SIZE));
 #endif
+#endif /* CONFIG_SILENT */
 }
 
 #ifdef CONFIG_DEFAULT_ENVIRONMENT
common/version.c +2 -1
index 0af8ec1..6d26ef8 100644
@@ -6,7 +6,8 @@ const char version_string[] =
 
 void barebox_banner (void)
 {
+#ifndef CONFIG_SILENT
 	printf("\n\n%s\n\n", version_string);
 	printf("Board: " CONFIG_BOARDINFO "\n");
+#endif
 }
-
Signature · 7 lines
1.7.0.4


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

Re: [RFC 2/2] ARM omap: Add CONFIG_SILENT

Quoted 1 line · Sanjeev Premi

Don't display any verbose message on the console.

We already have pr_info and friends which right now all fall back to printf. Instead of adding an ifdef for each conditional printf how about making pr_* configurable? Something like this:

#if (CONFIG_LOGLEVEL > 6)
#define pr_info(fmt, arg...) printf(fmt, ##arg)
#else
#define pr_info(fmt, arg...) do {} while(0)
#endif
#if (CONFIG_LOGLEVEL > 5)
#define pr_notice(fmt, arg...) printf(fmt, ##arg)
#else
#define pr_notice(fmt, arg...) do {} while(0)
#endif

BTW you seem to be very concerned about the codesize in the xloader environments, which I can understand. How about giving my thumb2 patches a try?

panda_xload_defconfig:
-rwxr-xr-x 1 sha ptx 41272 Jan 12 10:25 barebox.bin

panda_xload_defconfig in thumb2 mode:
-rwxr-xr-x 1 sha ptx 30348 Jan 12 10:25 barebox.bin

To merge these I'm currently waiting for Jean-Christophes OK on

ARM: move exception vectors away from start of binary

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
#3 lore raw

Re: [RFC 2/2] ARM omap: Add CONFIG_SILENT

Quoted 25 lines · Sascha Hauer
Quoted 1 line · Sanjeev Premi

Don't display any verbose message on the console.

We already have pr_info and friends which right now all fall back to printf. Instead of adding an ifdef for each conditional printf how about making pr_* configurable? Something like this:

#if (CONFIG_LOGLEVEL > 6)
#define pr_info(fmt, arg...) printf(fmt, ##arg)
#else
#define pr_info(fmt, arg...) do {} while(0)
#endif
#if (CONFIG_LOGLEVEL > 5)
#define pr_notice(fmt, arg...) printf(fmt, ##arg)
#else
#define pr_notice(fmt, arg...) do {} while(0)
#endif

BTW you seem to be very concerned about the codesize in the xloader environments, which I can understand. How about giving my thumb2 patches a try?

panda_xload_defconfig:
-rwxr-xr-x 1 sha ptx 41272 Jan 12 10:25 barebox.bin

Quoted 6 lines

panda_xload_defconfig in thumb2 mode:
-rwxr-xr-x 1 sha ptx 30348 Jan 12 10:25 barebox.bin

To merge these I'm currently waiting for Jean-Christophes OK on

ARM: move exception vectors away from start of binary

does not work on at91 yet

I'm working on the modification to make it work

I'll send a first version of the at91 bootstrap soon without this modifcation and then fix it

Best Regards,
J.

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

#4 lore raw

RE: [RFC 2/2] ARM omap: Add CONFIG_SILENT

In reply to Sascha Hauer
Quoted 25 lines

-----Original Message-----
From: Sascha Hauer [mailto:[email protected]]
Sent: Thursday, January 12, 2012 2:59 PM
To: Premi, Sanjeev
Cc: [email protected]; Jean-Christophe PLAGNIOL-VILLARD
Subject: Re: [RFC 2/2] ARM omap: Add CONFIG_SILENT

Quoted 1 line · Sanjeev Premi

Don't display any verbose message on the console.

We already have pr_info and friends which right now all fall back to printf. Instead of adding an ifdef for each conditional printf how about making pr_* configurable? Something like this:

#if (CONFIG_LOGLEVEL > 6)
#define pr_info(fmt, arg...) printf(fmt, ##arg)
#else
#define pr_info(fmt, arg...) do {} while(0)
#endif
#if (CONFIG_LOGLEVEL > 5)
#define pr_notice(fmt, arg...) printf(fmt, ##arg)
#else
#define pr_notice(fmt, arg...) do {} while(0)
#endif

Quoted 1 line

BTW you seem to be very concerned about the codesize in the xloader

Yes. Esp. what makes the code "big" when compared to the original x-loader for omap3. Idea was to identify portions of code that isn't getting used - at all (or most of the time).

Quoted 3 lines

environments, which I can understand. How about giving my thumb2 patches
a try?

I will. Just located the patches in my mailbox.

I return to OMAP3 and barebox in my free time - which isn't too often; but I should be able to try these patches by end of this week.

In fact, the code changes for this RFC were done in NOV - just couldn't post because I couldn't write detailed changelong explaining the motivation.

~sanjeev

Quoted 4 lines

panda_xload_defconfig:
-rwxr-xr-x 1 sha ptx 41272 Jan 12 10:25 barebox.bin

Quoted 19 lines

panda_xload_defconfig in thumb2 mode:
-rwxr-xr-x 1 sha ptx 30348 Jan 12 10:25 barebox.bin

To merge these I'm currently waiting for Jean-Christophes OK on

ARM: move exception vectors away from start of binary

Sascha

Signature · 8 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

#5 lore raw

RE: [RFC 2/2] ARM omap: Add CONFIG_SILENT

In reply to Sascha Hauer
Quoted 7 lines

-----Original Message-----
From: Sascha Hauer [mailto:[email protected]]
Sent: Thursday, January 12, 2012 2:59 PM
To: Premi, Sanjeev
Cc: [email protected]; Jean-Christophe PLAGNIOL-VILLARD
Subject: Re: [RFC 2/2] ARM omap: Add CONFIG_SILENT

[snip]

Quoted 4 lines

BTW you seem to be very concerned about the codesize in the xloader environments, which I can understand. How about giving my thumb2 patches
a try?

I tried pulling these patches on the latest master, but git am failed. Manual patching reports previously applied patches. (I was able to find few patches in the series already in master)

Some hunks don't apply cleanly. For example:

arch/arm/lib/armlinux.c +2 -0
index bd9b72a..3fafb4b 100644
@@ -253,6 +253,8 @@ void start_linux(void *adr, int swap, struct image_data *data)
 {
 	void (*kernel)(int zero, int arch, void *params) = adr;
 	void *params = NULL;
+	int architecture = armlinux_get_architecture();
+
 #ifdef CONFIG_OFTREE
 	params = of_get_fixed_tree();
 	if (params)

I did quick fix-ups at few places to make compiler happy, but got stuck with this:

AS arch/arm/mach-omap/omap3_core.o
arch/arm/mach-omap/omap3_core.S: Assembler messages:
arch/arm/mach-omap/omap3_core.S:116: Error: shift must be constant -- orr r11,r10,r9,lsl r5' arch/arm/mach-omap/omap3_core.S:117: Error: shift must be constant -- orr r11,r11,r7,lsl r2' make[1]: *** [arch/arm/mach-omap/omap3_core.o] Error 1
make: *** [arch/arm/mach-omap] Error 2

Will look at this later in the week.
Do you have updated patches agaist latest master that I can try?

~sanjeev

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

#6 lore raw

Re: [RFC 2/2] ARM omap: Add CONFIG_SILENT

Quoted 35 lines · Sanjeev
Quoted 7 lines

-----Original Message-----
From: Sascha Hauer [mailto:[email protected]]
Sent: Thursday, January 12, 2012 2:59 PM
To: Premi, Sanjeev
Cc: [email protected]; Jean-Christophe PLAGNIOL-VILLARD
Subject: Re: [RFC 2/2] ARM omap: Add CONFIG_SILENT

[snip]

Quoted 4 lines

BTW you seem to be very concerned about the codesize in the xloader environments, which I can understand. How about giving my thumb2 patches
a try?

I tried pulling these patches on the latest master, but git am failed. Manual patching reports previously applied patches. (I was able to find few patches in the series already in master)

Some hunks don't apply cleanly. For example:

arch/arm/lib/armlinux.c +2 -0
index bd9b72a..3fafb4b 100644
@@ -253,6 +253,8 @@ void start_linux(void *adr, int swap, struct image_data *data)
 {
 	void (*kernel)(int zero, int arch, void *params) = adr;
 	void *params = NULL;
+	int architecture = armlinux_get_architecture();
+
 #ifdef CONFIG_OFTREE
 	params = of_get_fixed_tree();
 	if (params)
Quoted 7 lines

I did quick fix-ups at few places to make compiler happy, but got stuck with this:

AS arch/arm/mach-omap/omap3_core.o
arch/arm/mach-omap/omap3_core.S: Assembler messages:
arch/arm/mach-omap/omap3_core.S:116: Error: shift must be constant -- orr r11,r10,r9,lsl r5' arch/arm/mach-omap/omap3_core.S:117: Error: shift must be constant -- orr r11,r11,r7,lsl r2'

This can be fixed with the following:

ARM( orr r11, r10, r9, lsl r5 ) /* factor way and cache number into r11 */
ARM( orr r11, r11, r7, lsl r2 ) /* factor index number into r11 */
THUMB( lsl r6, r9, r5 )
THUMB( orr r11, r10, r6 ) /* factor way and cache number into r11 */
THUMB( lsl r6, r7, r2 )
THUMB( orr r11, r11, r6 ) /* factor index number into r11 */

Just how it is done in arch/arm/cpu/cache-armv7.S. Anyway, this is only the top of the iceberg. All Assembly code must be carefully reviewed in thumb mode and omap3 has quite a lot of it. I managed to start a second stage barebox (compiled with xloader defconfig + THUMB) in which I commented out arch_init_lowlevel() and board_init_lowlevel().

I see if I can sort some of this stuff out on the weekend.

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
#7 lore raw
In reply to Sanjeev Premi
Quoted 52 lines · Sanjeev Premi

When using barebox as both 1st and 2nd stage bootloader, same banner gets printed - date being the only difference.

For the first stage bootloader, prints are definitely required during initial debug and development phases, but after that, they can easily be avoided.

And if we don't need prints, then we can do without the serial driver as well.

With this background, this patch introduces concept of NULL console. Most Kconfig changes are quite simple.

Separate file console_null.c was created only for ease of review and maintaining console_simple.c as-is.

In final version, appropriate #ifdefs in console_simple.c should be used.

Visually, the prompt from barebox.bin comes up is about a second - and appears to be much faster.

Here is comparison of the size:

   text    data     bss     dec     hex filename
  45801    3300    4024   53125    cf85 barebox  (Before)
  44221    3196    4020   51437    c8ed barebox  (After)

Tested on OMAP3EVM with xload configuration derived from omap3530_beagle_xload_defconfig.

Cc Sascha Hauer <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>

---

Although I have marked the change to be specific to ARM+OMAP, it could be generally applicable.

 arch/arm/mach-omap/Kconfig |    4 +-
 common/Kconfig             |   11 +++-
 common/Makefile            |    1 +
 common/console_null.c      |  135 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/serial/Kconfig     |    1 +
 5 files changed, 149 insertions(+), 3 deletions(-)
 create mode 100644 common/console_null.c
arch/arm/mach-omap/Kconfig +0 -0
index 72c6850..9edb4a9 100644

arch/arm/mach-omap/Kconfig if MACH_OMAP3EVM · line 174

Quoted 5 lines
arch/arm/mach-omap/Kconfig +1 -1
@@ -171,13 +171,13 @@ if MACH_OMAP3EVM
 
 	config OMAP3EVM_UART1
 		bool "Use UART1"
-		depends on MACH_OMAP3EVM
+		depends on MACH_OMAP3EVM && !CONSOLE_NULL

Right now CONFIG_OMAP3EVM_UART1 and CONFIG_OMAP3EVM_UART3 are exclusive options and I see no reason why they should be. To make this a bit simpler we could do this:

#ifndef CONSOLE_NULL
	MUX_VAL(CP(UART1_TX),		(IDIS | PTD | DIS | M0));
	MUX_VAL(CP(UART1_RTS),		(IDIS | PTD | DIS | M0));
	MUX_VAL(CP(UART1_CTS),		(IEN  | PTU | DIS | M0));
	MUX_VAL(CP(UART1_RX),		(IEN  | PTD | DIS | M0));
	MUX_VAL(CP(UART3_CTS_RCTX),	(IEN  | PTD | EN  | M0));
	MUX_VAL(CP(UART3_RTS_SD),	(IDIS | PTD | DIS | M0));
	MUX_VAL(CP(UART3_RX_IRRX),	(IEN  | PTD | DIS | M0));
	MUX_VAL(CP(UART3_TX_IRTX),	(IDIS | PTD | DIS | M0));

#endif

#ifdef CONFIG_OMAP3EVM_UART1
	add_ns16550_device(...)
#endif
#ifdef CONFIG_OMAP3EVM_UART3
	add_ns16550_device(...)

#endif

drivers/serial/Kconfig config DRIVER_SERIAL_ALTERA_JTAG · line 59

Quoted 9 lines
drivers/serial/Kconfig +1 -0
index 186b596..cc0e583 100644
@@ -56,6 +56,7 @@ config DRIVER_SERIAL_ALTERA_JTAG
 config DRIVER_SERIAL_NS16550
 	default n
 	bool "NS16550 serial driver"
+	depends on !CONSOLE_NULL

No, we don't want to add this 'depends on' to every serial driver. Instead we should turn the serial driver menu to a menuconfig depending on !CONSOLE_NULL.

Please split the omap specific part and the generic part into two patches next time you send this.

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