修訂 | 248d426abdbbbf4f73835ce45017d62ca8ddddc3 (tree) |
---|---|
時間 | 2016-04-17 18:04:10 |
作者 | Yoshinori Sato <ysato@user...> |
Commiter | Yoshinori Sato |
spl: disable serial output for !CONFIG_SPL_SERIAL
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
@@ -267,7 +267,7 @@ static inline void console_doenv(int file, struct stdio_dev *dev) | ||
267 | 267 | #endif /* defined(CONFIG_CONSOLE_MUX) */ |
268 | 268 | |
269 | 269 | /** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/ |
270 | - | |
270 | +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_SERIAL_SUPPORT) | |
271 | 271 | int serial_printf(const char *fmt, ...) |
272 | 272 | { |
273 | 273 | va_list args; |
@@ -285,6 +285,12 @@ int serial_printf(const char *fmt, ...) | ||
285 | 285 | serial_puts(printbuffer); |
286 | 286 | return i; |
287 | 287 | } |
288 | +#else | |
289 | +int serial_printf(const char *fmt, ...) | |
290 | +{ | |
291 | + return 0; | |
292 | +} | |
293 | +#endif | |
288 | 294 | |
289 | 295 | int fgetc(int file) |
290 | 296 | { |
@@ -495,9 +501,11 @@ void putc(const char c) | ||
495 | 501 | /* Send to the standard output */ |
496 | 502 | fputc(stdout, c); |
497 | 503 | } else { |
504 | +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_SERIAL_SUPPORT) | |
498 | 505 | /* Send directly to the handler */ |
499 | 506 | pre_console_putc(c); |
500 | 507 | serial_putc(c); |
508 | +#endif | |
501 | 509 | } |
502 | 510 | } |
503 | 511 |
@@ -540,9 +548,11 @@ void puts(const char *s) | ||
540 | 548 | /* Send to the standard output */ |
541 | 549 | fputs(stdout, s); |
542 | 550 | } else { |
551 | +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_SERIAL_SUPPORT) | |
543 | 552 | /* Send directly to the handler */ |
544 | 553 | pre_console_puts(s); |
545 | 554 | serial_puts(s); |
555 | +#endif | |
546 | 556 | } |
547 | 557 | } |
548 | 558 |
@@ -740,13 +750,14 @@ int console_init_r(void) | ||
740 | 750 | int iomux_err = 0; |
741 | 751 | #endif |
742 | 752 | |
753 | +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_SERIAL_SUPPORT) | |
743 | 754 | /* set default handlers at first */ |
744 | 755 | gd->jt->getc = serial_getc; |
745 | 756 | gd->jt->tstc = serial_tstc; |
746 | 757 | gd->jt->putc = serial_putc; |
747 | 758 | gd->jt->puts = serial_puts; |
748 | 759 | gd->jt->printf = serial_printf; |
749 | - | |
760 | +#endif | |
750 | 761 | /* stdin stdout and stderr are in environment */ |
751 | 762 | /* scan for it */ |
752 | 763 | stdinname = getenv("stdin"); |
@@ -32,8 +32,10 @@ DECLARE_GLOBAL_DATA_PTR; | ||
32 | 32 | u32 *boot_params_ptr = NULL; |
33 | 33 | struct spl_image_info spl_image; |
34 | 34 | |
35 | +#ifdef CONFIG_SPL_SERIAL_SUPPORT | |
35 | 36 | /* Define board data structure */ |
36 | 37 | static bd_t bdata __attribute__ ((section(".data"))); |
38 | +#endif | |
37 | 39 | |
38 | 40 | /* |
39 | 41 | * Default function to determine if u-boot or the OS should |
@@ -408,6 +410,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) | ||
408 | 410 | jump_to_image_no_args(&spl_image); |
409 | 411 | } |
410 | 412 | |
413 | +#ifdef CONFIG_SPL_SERIAL_SUPPORT | |
411 | 414 | /* |
412 | 415 | * This requires UART clocks to be enabled. In order for this to work the |
413 | 416 | * caller must ensure that the gd pointer is valid. |
@@ -475,3 +478,4 @@ ulong spl_relocate_stack_gd(void) | ||
475 | 478 | return 0; |
476 | 479 | #endif |
477 | 480 | } |
481 | +#endif |
@@ -92,7 +92,7 @@ extern int cmd_get_data_size(char* arg, int default_size); | ||
92 | 92 | #ifdef CONFIG_CMD_BOOTD |
93 | 93 | extern int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); |
94 | 94 | #endif |
95 | -#ifdef CONFIG_CMD_BOOTM | |
95 | +#if defined(CONFIG_CMD_BOOTM) && !defined(CONFIG_SPL_BUILD) | |
96 | 96 | extern int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); |
97 | 97 | extern int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd); |
98 | 98 | #else |
@@ -856,15 +856,13 @@ int tstc(void); | ||
856 | 856 | #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SERIAL_SUPPORT) |
857 | 857 | #define putc(...) do { } while (0) |
858 | 858 | #define puts(...) do { } while (0) |
859 | -#define printf(...) do { } while (0) | |
860 | -#define vprintf(...) do { } while (0) | |
861 | 859 | #else |
862 | 860 | void putc(const char c); |
863 | 861 | void puts(const char *s); |
862 | +#endif | |
864 | 863 | int printf(const char *fmt, ...) |
865 | 864 | __attribute__ ((format (__printf__, 1, 2))); |
866 | 865 | int vprintf(const char *fmt, va_list args); |
867 | -#endif | |
868 | 866 | |
869 | 867 | /* stderr */ |
870 | 868 | #define eputc(c) fputc(stderr, c) |
@@ -11,11 +11,13 @@ struct spi_slave; | ||
11 | 11 | |
12 | 12 | /* These are declarations of exported functions available in C code */ |
13 | 13 | unsigned long get_version(void); |
14 | +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_SERIAL_SUPPORT) | |
14 | 15 | int getc(void); |
15 | 16 | int tstc(void); |
16 | 17 | void putc(const char); |
17 | 18 | void puts(const char*); |
18 | 19 | int printf(const char* fmt, ...); |
20 | +#endif | |
19 | 21 | void install_hdlr(int, interrupt_handler_t, void*); |
20 | 22 | void free_hdlr(int); |
21 | 23 | void *malloc(size_t); |
@@ -24,7 +26,9 @@ void free(void*); | ||
24 | 26 | #endif |
25 | 27 | void __udelay(unsigned long); |
26 | 28 | unsigned long get_timer(unsigned long); |
29 | +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_SERIAL_SUPPORT) | |
27 | 30 | int vprintf(const char *, va_list); |
31 | +#endif | |
28 | 32 | unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base); |
29 | 33 | int strict_strtoul(const char *cp, unsigned int base, unsigned long *res); |
30 | 34 | char *getenv (const char *name); |
@@ -83,9 +83,9 @@ obj-$(CONFIG_LIB_RAND) += rand.o | ||
83 | 83 | ifdef CONFIG_SPL_BUILD |
84 | 84 | # SPL U-Boot may use full-printf, tiny-printf or none at all |
85 | 85 | ifdef CONFIG_USE_TINY_PRINTF |
86 | -obj-$(CONFIG_SPL_SERIAL_SUPPORT) += tiny-printf.o panic.o strto.o | |
86 | +obj-y += tiny-printf.o panic.o strto.o | |
87 | 87 | else |
88 | -obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o panic.o strto.o | |
88 | +obj-y += vsprintf.o panic.o strto.o | |
89 | 89 | endif |
90 | 90 | else |
91 | 91 | # Main U-Boot always uses the full printf support |