[U-Boot] [PATCH 3/5] Add h8300 architecture part3 - misc
Yoshinori Sato
ysato at users.sourceforge.jp
Wed Mar 2 08:40:06 CET 2011
This part h8300 cpu support (3/3)
Signed-off-by: Yoshinori Sato <ysato at users.sourceforge.jp>
---
common/cmd_bdinfo.c | 20 ++++++++++++++++++++
common/cmd_bootm.c | 2 ++
examples/standalone/Makefile | 3 +--
examples/standalone/stubs.c | 20 ++++++++++++++++++--
include/image.h | 5 +++++
5 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index bba7374..4c8494d 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -410,6 +410,26 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+#elif defined(CONFIG_H8300)
+
+int do_bdinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ bd_t *bd = gd->bd;
+ print_num ("mem start ", (ulong)bd->bi_memstart);
+ print_lnum ("mem size ", (u64)bd->bi_memsize);
+#if !defined(CONFIG_SYS_NO_FLASH)
+ print_num ("flash start ", (ulong)bd->bi_flashstart);
+ print_num ("flash size ", (ulong)bd->bi_flashsize);
+ print_num ("flash offset ", (ulong)bd->bi_flashoffset);
+#endif
+
+#if defined(CONFIG_CMD_NET)
+ print_eth(0);
+ printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
+#endif
+ printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
+ return 0;
+}
#else
#error "a case for this architecture does not exist!"
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 18019d6..08321e7 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -187,6 +187,8 @@ void arch_preboot_os(void) __attribute__((weak, alias("__arch_preboot_os")));
#define IH_INITRD_ARCH IH_ARCH_SH
#elif defined(__sparc__)
#define IH_INITRD_ARCH IH_ARCH_SPARC
+#elif defined(__H8300H__) || defined(__H8300S__)
+ #define IH_INITRD_ARCH IH_ARCH_H8300
#else
# error Unknown CPU type
#endif
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index c1dfdce..e5eaf5b 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -68,8 +68,6 @@ ELF := $(addprefix $(obj),$(ELF))
BIN := $(addprefix $(obj),$(BIN))
SREC := $(addprefix $(obj),$(SREC))
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
-
CPPFLAGS += -I..
# For PowerPC there's no need to compile standalone applications as a
@@ -86,6 +84,7 @@ endif
# application's entry point will be the first function in the application's
# source file.
CFLAGS += $(call cc-option,-fno-toplevel-reorder)
+gcclibdir := $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`)
all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 2d2e709..957326f 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -167,7 +167,20 @@ gd_t *global_data;
" jmp %%g1\n" \
" nop\n" \
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
-
+#elif defined(CONFIG_H8300)
+/*
+ * er5 holds the pointer to the global_data. er0 is call clobbered.
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile( \
+ " .globl\t_" #x "\n" \
+ "_" #x ":\n" \
+ " mov.l er5,er0\n" \
+ " add.l %0,er0\n" \
+ " add.l %1,er0\n" \
+ " mov.l @er0,er0\n" \
+ " jmp @er0\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "er0" );
#else
#error stubs definition missing for this architecture
#endif
@@ -186,7 +199,10 @@ void __attribute__((unused)) dummy(void)
{
#include <_exports.h>
}
-
+#if defined(CONFIG_H8300)
+#define __bss_start _bss_start
+#define _end end
+#endif
extern unsigned long __bss_start, _end;
void app_startup(char * const *argv)
diff --git a/include/image.h b/include/image.h
index 005e0d2..8cee0fc 100644
--- a/include/image.h
+++ b/include/image.h
@@ -106,6 +106,7 @@
#define IH_ARCH_BLACKFIN 16 /* Blackfin */
#define IH_ARCH_AVR32 17 /* AVR32 */
#define IH_ARCH_ST200 18 /* STMicroelectronics ST200 */
+#define IH_ARCH_H8300 19 /* H8/300 */
/*
* Image Types
@@ -504,6 +505,8 @@ static inline int image_check_target_arch (const image_header_t *hdr)
if (!image_check_arch (hdr, IH_ARCH_SH))
#elif defined(__sparc__)
if (!image_check_arch (hdr, IH_ARCH_SPARC))
+#elif defined(__H8300H__) || defined(__H8300S__)
+ if (!image_check_arch (hdr, IH_ARCH_H8300))
#else
# error Unknown CPU type
#endif
@@ -656,6 +659,8 @@ static inline int fit_image_check_target_arch (const void *fdt, int node)
if (!fit_image_check_arch (fdt, node, IH_ARCH_SH))
#elif defined(__sparc__)
if (!fit_image_check_arch (fdt, node, IH_ARCH_SPARC))
+#elif defined(__H8300H__) || defined(__H8300S__)
+ if (!image_check_arch (hdr, IH_ARCH_H8300))
#else
# error Unknown CPU type
#endif
--
1.7.2.3
More information about the U-Boot
mailing list