From 4acf94a1756eb51e670e0e896febf7039341b8d3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 6 Nov 2008 17:37:16 +0000 Subject: [PATCH] Basic SH-1 build environment git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1139 42af7a65-404d-4744-a932-0658087f49c3 --- configs/us7032evb1/include/board.h | 94 +++++++++++++++++++++++++++++ configs/us7032evb1/ostest/Make.defs | 4 +- configs/us7032evb1/ostest/defconfig | 5 +- configs/us7032evb1/ostest/ld.script | 11 +++- configs/us7032evb1/ostest/setenv.sh | 2 +- configs/us7032evb1/src/Makefile | 77 +++++++++++++++++++++++ configs/us7032evb1/src/up_leds.c | 90 +++++++++++++++++++++++++++ 7 files changed, 276 insertions(+), 7 deletions(-) create mode 100644 configs/us7032evb1/include/board.h create mode 100644 configs/us7032evb1/src/Makefile create mode 100644 configs/us7032evb1/src/up_leds.c diff --git a/configs/us7032evb1/include/board.h b/configs/us7032evb1/include/board.h new file mode 100644 index 0000000000..a12b61a884 --- /dev/null +++ b/configs/us7032evb1/include/board.h @@ -0,0 +1,94 @@ +/**************************************************************************** + * configs/us7032evb1/include/board.h + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef _CONFIGS_US7032EVB1_BOARD_H +#define _CONFIGS_US7032EVB1_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +# include +#endif +#include "chip.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +/* LED definitions **********************************************************/ + +#define LED_STARTED 0 +#define LED_HEAPALLOCATE 1 +#define LED_IRQSENABLED 2 +#define LED_STACKCREATED 3 +#define LED_INIRQ 4 +#define LED_SIGNAL 5 +#define LED_ASSERTION 6 +#define LED_PANIC 7 + +/* Button definitions *******************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +#ifdef CONFIG_ARCH_BUTTONS +EXTERN void up_buttoninit(void); +EXTERN ubyte up_buttons(void); +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif +#endif + +#endif /* _CONFIGS_US7032EVB1_BOARD_H */ diff --git a/configs/us7032evb1/ostest/Make.defs b/configs/us7032evb1/ostest/Make.defs index 52b7eb5269..5851533077 100644 --- a/configs/us7032evb1/ostest/Make.defs +++ b/configs/us7032evb1/ostest/Make.defs @@ -42,14 +42,14 @@ else -fomit-frame-pointer endif -ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin +ARCHCPUFLAGS = -m1 -fno-builtin ARCHPICFLAGS = -fpic ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow ARCHDEFINES = ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script -CROSSDEV = arm-elf- +CROSSDEV = sh-elf- CC = $(CROSSDEV)gcc LD = $(CROSSDEV)ld AR = $(CROSSDEV)ar rcs diff --git a/configs/us7032evb1/ostest/defconfig b/configs/us7032evb1/ostest/defconfig index e80f02ccf3..afec58e444 100644 --- a/configs/us7032evb1/ostest/defconfig +++ b/configs/us7032evb1/ostest/defconfig @@ -46,6 +46,7 @@ # the board that supports the particular chip or SoC. # CONFIG_ENDIAN_BIG - define if big endian (default is little endian) # CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_ENDIAN_BIG - Define for big-endian operation # CONFIG_BOARD_LOOPSPERMSEC - for delay loops # CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to Olimex STR-P711 # CONFIG_ARCH_BUTTONS - Support reading buttons. Unique to Olimex STR-P711 @@ -60,8 +61,10 @@ CONFIG_ARCH=sh CONFIG_ARCH_CHIP=sh1 CONFIG_ARCH_SH1=y +CONFIG_ARCH_SH7032=y CONFIG_ARCH_BOARD=us7032evb1 CONFIG_ARCH_BOARD_US7032EVB1=y +CONFIG_ENDIAN_BIG=y CONFIG_BOARD_LOOPSPERMSEC=3270 CONFIG_ARCH_LEDS=y CONFIG_ARCH_BUTTONS=y @@ -549,7 +552,7 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0 # CONFIG_HEAP_BASE - The beginning of the heap # CONFIG_HEAP_SIZE - The size of the heap # -CONFIG_BOOT_FROM_FLASH=y +CONFIG_BOOT_FROM_FLASH=n CONFIG_CUSTOM_STACK=n CONFIG_STACK_POINTER= CONFIG_PROC_STACK_SIZE=2048 diff --git a/configs/us7032evb1/ostest/ld.script b/configs/us7032evb1/ostest/ld.script index 983f51f2f7..846fda4c6e 100644 --- a/configs/us7032evb1/ostest/ld.script +++ b/configs/us7032evb1/ostest/ld.script @@ -33,21 +33,26 @@ * ****************************************************************************/ -OUTPUT_ARCH(sh1) +OUTPUT_ARCH(sh) ENTRY(_stext) SECTIONS { /* The us7032evb1 has CMON in PROM beginning at address 0x00000000 and * either 64Kb or 256Kb of SRAM beginning at 0x0a000000. Neither the * PROM nor the first 8Kb of SRAM are avaible to the devoleper as these - * are used by CMON. The next 8Kb of SRAM is dedicated to redirected + * are used by CMON. The next 1Kb of SRAM is dedicated to relocated * interrupt vectors. */ - .text 0x0a002000 : { + . = 0x0a002000; + .vects : { _svect = ABSOLUTE(.); *(.vects); /* Redirected interrupt vectors */ _evect = ABSOLUTE(.); + } + + . = 0x0a002400; + .text : { _stext = ABSOLUTE(.); *(.text) /* Code */ *(.fixup) diff --git a/configs/us7032evb1/ostest/setenv.sh b/configs/us7032evb1/ostest/setenv.sh index fbb0092059..1ff180ec51 100755 --- a/configs/us7032evb1/ostest/setenv.sh +++ b/configs/us7032evb1/ostest/setenv.sh @@ -40,7 +40,7 @@ fi if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi WD=`pwd` -export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin +export BUILDROOT_BIN=${WD}/../buildroot/build_sh/staging_dir/bin export SH1BINARIES=$WD/configs/us7032evb11/bin export PATH=${BUILDROOT_BIN}:${SH1BINARIES}:/sbin:/usr/sbin:${PATH_ORIG} diff --git a/configs/us7032evb1/src/Makefile b/configs/us7032evb1/src/Makefile new file mode 100644 index 0000000000..421b67ac7e --- /dev/null +++ b/configs/us7032evb1/src/Makefile @@ -0,0 +1,77 @@ +############################################################################ +# configs/us7032evb1/src/Makefile +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/Make.defs + +ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src +CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(TOPDIR)/sched + +ASRCS = +AOBJS = $(ASRCS:.S=$(OBJEXT)) +CSRCS = up_leds.c +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src + +all: libboard$(LIBEXT) + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +libboard$(LIBEXT): $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + +.depend: Makefile $(SRCS) + @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f libboard$(LIBEXT) *~ .*.swp + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/configs/us7032evb1/src/up_leds.c b/configs/us7032evb1/src/up_leds.c new file mode 100644 index 0000000000..fb2eda376f --- /dev/null +++ b/configs/us7032evb1/src/up_leds.c @@ -0,0 +1,90 @@ +/**************************************************************************** + * configs/us7032evb1/src/up_leds.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include "chip.h" +#include "up_arch.h" +#include "up_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_ledinit + ****************************************************************************/ + +#ifdef CONFIG_ARCH_LEDS +void up_ledinit(void) +{ +#warning "To be provided" +} + +/**************************************************************************** + * Name: up_ledon + ****************************************************************************/ + +void up_ledon(int led) +{ +#warning "To be provided" +} + +/**************************************************************************** + * Name: up_ledoff + ****************************************************************************/ + +void up_ledoff(int led) +{ +#warning "To be provided" +} +#endif /* CONFIG_ARCH_LEDS */