mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] introduce console none support
@ 2013-01-21 14:48 Jean-Christophe PLAGNIOL-VILLARD
  2013-01-21 18:48 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-21 14:48 UTC (permalink / raw)
  To: barebox

this will allow to have no console support

Use full for bootstrap as we can save 900bytes (barebox.bin) and
500bytes (zbarebox.bin lzo) on at91sam9263 as example.

As on bootstrap we have often very limited size.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/Kconfig        |    6 ++++
 common/Makefile       |    1 +
 common/console_none.c |   85 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 100644 common/console_none.c

diff --git a/common/Kconfig b/common/Kconfig
index 9d26abb..8704a42 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -506,10 +506,16 @@ config CONSOLE_ACTIVATE_NONE
 endchoice
 
 config CONSOLE_SIMPLE
+	prompt "Enable simple console support"
 	bool
 	default y
 	depends on !CONSOLE_FULL
 
+config CONSOLE_NONE
+	bool
+	default y
+	depends on !CONSOLE_FULL && !CONSOLE_SIMPLE
+
 config PARTITION
 	bool
 	prompt "Enable Partitions"
diff --git a/common/Makefile b/common/Makefile
index d82fc99..7206eed 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_MEMINFO) += meminfo.o
 obj-$(CONFIG_COMMAND_SUPPORT) += command.o
 obj-$(CONFIG_CONSOLE_FULL) += console.o
 obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
+obj-$(CONFIG_CONSOLE_NONE) += console_none.o
 obj-$(CONFIG_DIGEST) += digest.o
 obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o
 obj-$(CONFIG_UIMAGE) += image.o
diff --git a/common/console_none.c b/common/console_none.c
new file mode 100644
index 0000000..f8aa1ed
--- /dev/null
+++ b/common/console_none.c
@@ -0,0 +1,85 @@
+#include <config.h>
+#include <common.h>
+#include <fs.h>
+#include <errno.h>
+#include <debug_ll.h>
+
+LIST_HEAD(console_list);
+EXPORT_SYMBOL(console_list);
+
+int printf (const char *fmt, ...)
+{
+	return 0;
+}
+EXPORT_SYMBOL(printf);
+
+int vprintf (const char *fmt, va_list args)
+{
+	return 0;
+}
+EXPORT_SYMBOL(vprintf);
+
+int fprintf(int file, const char *fmt, ...)
+{
+	return 0;
+}
+EXPORT_SYMBOL(fprintf);
+
+int console_puts(unsigned int ch, const char *str)
+{
+	return 0;
+}
+EXPORT_SYMBOL(console_puts);
+
+void console_putc(unsigned int ch, char c)
+{
+}
+EXPORT_SYMBOL(console_putc);
+
+int fputc(int fd, char c)
+{
+	return 0;
+}
+EXPORT_SYMBOL(fputc);
+
+int fputs(int fd, const char *s)
+{
+	return 0;
+}
+EXPORT_SYMBOL(fputs);
+
+int tstc(void)
+{
+	return 0;
+}
+EXPORT_SYMBOL(tstc);
+
+int getc(void)
+{
+	return -EINVAL;
+}
+EXPORT_SYMBOL(getc);
+
+void console_flush(void)
+{
+}
+EXPORT_SYMBOL(console_flush);
+
+#ifndef ARCH_HAS_CTRLC
+/* test if ctrl-c was pressed */
+int ctrlc (void)
+{
+	return 0;
+}
+EXPORT_SYMBOL(ctrlc);
+#endif /* ARCH_HAS_CTRC */
+
+int console_register(struct console_device *newcdev)
+{
+	return 0;
+}
+
+int console_unregister(struct console_device *cdev)
+{
+	return -EBUSY;
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] introduce console none support
  2013-01-21 14:48 [PATCH 1/1] introduce console none support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-21 18:48 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-01-21 18:48 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Mon, Jan 21, 2013 at 03:48:42PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this will allow to have no console support
> 
> Use full for bootstrap as we can save 900bytes (barebox.bin) and
> 500bytes (zbarebox.bin lzo) on at91sam9263 as example.
> 
> As on bootstrap we have often very limited size.
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  common/Kconfig        |    6 ++++
>  common/Makefile       |    1 +
>  common/console_none.c |   85 +++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 92 insertions(+)
>  create mode 100644 common/console_none.c
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index 9d26abb..8704a42 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -506,10 +506,16 @@ config CONSOLE_ACTIVATE_NONE
>  endchoice
>  
>  config CONSOLE_SIMPLE
> +	prompt "Enable simple console support"
>  	bool
>  	default y
>  	depends on !CONSOLE_FULL
>  
> +config CONSOLE_NONE
> +	bool
> +	default y
> +	depends on !CONSOLE_FULL && !CONSOLE_SIMPLE
> +

This is probably a good moment to convert this to a choice.

> +
> +int printf (const char *fmt, ...)
> +{
> +	return 0;
> +}
> +EXPORT_SYMBOL(printf);

Have you tried providing static inline wrappers for these? I would
assume that a lot more space could be saved when gcc is able to optimize
the function calls away.

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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-21 18:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-21 14:48 [PATCH 1/1] introduce console none support Jean-Christophe PLAGNIOL-VILLARD
2013-01-21 18:48 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox