Preparing to test on the C5471

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@7 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-02-18 23:46:29 +00:00
parent 864c80d909
commit b0611894f6
6 changed files with 459 additions and 4 deletions

View File

@ -105,15 +105,21 @@ examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE).a: context
$(BIN): context depend $(OBJS) $(LIBS)
ifeq ($(CONFIG_ARCH),sim)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(LDLIBS)
$(NM) $(BIN) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
@$(NM) $(BIN) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
else
$(LD) --entry=__start $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(LDLIBS)
$(NM) $(BIN) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
@$(NM) $(BIN) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
@export vflashstart=`$(OBJDUMP) --all-headers $(BIN) | grep _vflashstart | cut -d' ' -f1`; \
if [ ! -z "$$vflashstart" ]; then \
$(OBJCOPY) --adjust-section-vma=.vector=0x$$vflashstart $(BIN) $(BIN).flashimage; \
mv $(BIN).flashimage $(BIN); \
fi
ifeq ($(CONFIG_RRLOAD_BINARY),y)
@tools/mkimage.sh nuttx nuttx.rr
@if [ -w /tftpboot ] ; then \
cp -f nuttx.rr /tftpboot/nuttx.rr.${CONFIG_ARCH}; \
fi
endif
endif
depend:
@ -127,7 +133,7 @@ clean:
done
$(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) clean
$(MAKE) -C mm -f Makefile.test TOPDIR=$(TOPDIR) clean
rm -f $(BIN) context mm_test System.map *~ *.flashimage
rm -f $(BIN) $(BIN).rr $(BIN).stripped $(BIN).flashimage mm_test System.map *~
distclean: clean clean_context
@for dir in $(SUBDIRS) ; do \

View File

@ -98,12 +98,20 @@ CONFIG_ARCH_KMALLOC=n
CONFIG_ARCH_KZMALLOC=n
CONFIG_ARCH_KFREE=n
#
# General Compile environment setup
#
# CONFIG_HAVE_LONG_LONG - enable if your architecture supports
# long long types and if you plan to use them
CONFIG_HAVE_LONG_LONG=n
#
# General build options
#
# CONFIG_RRLOAD_BINY - make the rrload binary format used with
# BSPs from www.ridgerun.com
CONFIG_RRLOAD_BINARY=y
#
# Sizes of configurable things (0 disables)
#

View File

@ -38,7 +38,8 @@
MKDEP = $(TOPDIR)/tools/mkdeps.sh
CFLAGS += -I$(TOPDIR)/sched
ASRCS = up_vectors.S up_saveusercontext.S up_fullcontextrestore.S
ASRCS = up_vectors.S up_saveusercontext.S up_fullcontextrestore.S \
up_lowputc.S
AOBJS = $(ASRCS:.S=.o)
CSRCS = up_initialize.c up_initialstate.c up_idle.c \

127
arch/c5471/src/up_lowputc.S Normal file
View File

@ -0,0 +1,127 @@
/**************************************************************************
* up_lowputc.S
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* 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 Gregory Nutt 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 <nuttx/config.h>
#include "up_internal.h"
#include "c5471.h"
/**************************************************************************
* Private Definitions
**************************************************************************/
/**************************************************************************
* Private Types
**************************************************************************/
/**************************************************************************
* Private Function Prototypes
**************************************************************************/
/**************************************************************************
* Global Variables
**************************************************************************/
/**************************************************************************
* Private Variables
**************************************************************************/
/**************************************************************************
* Private Functions
**************************************************************************/
/**************************************************************************
* Public Functions
**************************************************************************/
/**************************************************************************
* Name: up_lowputc
**************************************************************************/
/* This assembly language version has the advantage that it can does not
* require a C stack and uses only r0-r1. Hence it can be used during
* early boot phases.
*/
.text
.global up_putc
.type up_lowputc, function
up_lowputc:
/* On entry, r0 holds the character to be printed */
#ifdef CONFIG_SERIAL_IRDA_CONSOLE
ldr r2, =UART_IRDA_BASE /* r2=IRDA UART base */
#else
ldr r2, =UART_MODEM_BASE /* r2=Modem UART base */
#endif
/* Poll bit 0 of the UART_SSR register. When the bit
* is clear, the TX FIFO is no longer full
*/
1: ldr r1, [r2, #UART_SSR_OFFS]
tst r1, #UART_SSR_TXFULL
bne 1b
/* Send the character by writing it into the UART_THR
* register.
*/
str r0, [r2, #UART_THR_OFFS]
/* Wait for the tranmsit holding regiser (THR) to be
* emptied. This is detemined when bit 6 of the LSR
* is set.
*/
2: ldr r1, [r2, #UART_LSR_OFFS]
tst r1, #0x00000020
beq 2b
/* If the character that we just sent was a linefeed,
* then send a carriage return as well.
*/
teq r0, #'\n'
moveq r0, #'\r'
beq 1b
/* And return */
mov pc, lr

View File

@ -96,12 +96,20 @@ CONFIG_ARCH_KMALLOC=n
CONFIG_ARCH_KZMALLOC=n
CONFIG_ARCH_KFREE=n
#
# General Compile environment setup
#
# CONFIG_HAVE_LONG_LONG - enable if your architecture supports
# long long types and if you plan to use them
CONFIG_HAVE_LONG_LONG=n
#
# General build options
#
# CONFIG_RRLOAD_BINY - make the rrload binary format used with
# BSPs from www.ridgerun.com
CONFIG_RRLOAD_BINARY=n
#
# Sizes of configurable things (0 disables)
#

305
tools/mkimage.sh Executable file
View File

@ -0,0 +1,305 @@
#!/bin/sh
#
# File: mkimage.sh
#
# Copyright (C) 2002 RidgeRun, Inc.
# Author: RidgeRun, Inc <skranz@@ridgerun.com>
# - Adapted for the Cadenux environment, 9-6-02, Gregory Nutt
# - Added --EAddr option, 6-18-03, Gregory Nutt
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 675 Mass Ave, Cambridge, MA 02139, USA.
#
########################################################
# Description:
# -----------
# Scenario #1
# -----------
# This utility was developed by RidgeRun for the
# purpose of converting a standard binary executable
# image (such as ELF) into a special format (RR
# format) suitable for quick downloads to the target
# TI925 RidgeRun Bootloader (rrload). The image is
# produced by constructing a special header which is
# then tacked onto the front of the supplied binary
# image. The resulting binary image is smaller than
# what would normally be encountered with traditional
# download formats (such as SREC or uuencoded; both
# ascii based). The special header at the front of the
# image is used to guide the target's rrload (a
# booloader developed by RidgeRun Inc). The header
# data contains a field representing the total byte
# count of the binary data following the header as
# well as a field that indicates the load address of
# run image. Additionally, a field exists in the
# header which indicates the image's entry point which
# could be called by the bootloader to invoked the
# just downloaded program.
# -----------
# Scenario #2
# -----------
# If the supplied image is not a standard binary
# executagle image then that is ok too, a header is
# constructed and tacked onto the front of the supplied
# binary data forming the new binary image (in rr format).
# In this case the EntryAddr is set to 0xFFFFFFFF by
# default and the LoadAddr is set to 0x00000000 by
# default unless otherwise indicated by command line
# arguments -LEntry and -LAddr which if used are assumed
# to be in hexidecimal units.
#
# -----------
# Scenario #3
# -----------
#
# Read/Write file system (like JFFS) that will not
# work if rrload stores a 20 byte header at the beginning
# of the flashed component image
#
# mkimage [--NoHeader ] <input-bin> <out-RR>
#
# Usage:
# mkimage [--LAddr h] [--EAddr h] [--NoHeader] <input-bin> <out-RR>
#
# Examples:
# $ mkimage linux linux.rr
# ..or..
# $ mkimage -LAddr 10008000 -EAddr 10008000 vmlinux vmlinux.rr
# ..or..
# $ mkimage --NoHeader fileSys.gz fileSys.gz.rr
# ..or..
# $ mkimage --LAddr A00 fileSys.gz fileSys.gz.rr
# ..or..
# $ mkimage --LAddr A00 fileSys.gz fileSys.gz.rr
# ^
# |
# Assumed hex units.
# Please omit the
# leading "0x".
########################################################
if [ "${CADENUX_ARCH}" = "dsc21" ] ; then
prefix="arm-uclinux-"
elif [ "${CADENUX_ARCH}" = "dsc24" ] ; then
prefix="arm-uclinux-"
elif [ "${CADENUX_ARCH}" = "dsc25" ] ; then
prefix="arm-uclinux-"
elif [ "${CADENUX_ARCH}" = "dm270" ] ; then
prefix="arm-uclinux-"
elif [ "${CADENUX_ARCH}" = "c5471" ] ; then
prefix="arm-uclinux-"
elif [ "${CADENUX_ARCH}" = "ti925" ] ; then
prefix="arm-linux-"
elif [ "${CADENUX_ARCH}" = "omap710" ] ; then
prefix="arm-linux-"
elif [ "${CADENUX_ARCH}" = "omap1510" ] ; then
prefix="arm-linux-"
elif [ "${CADENUX_ARCH}" = "dm310" ] ; then
prefix="arm-linux-"
else
prefix=""
fi
if [ $# -lt 2 ] ; then
echo "Error: missing argument"
echo "Usage: mkimage [--LAddr n] [--EAddr n] [--NoHeader] <input-Bin> <out-RR>"
exit 1
fi
# Pleae Note the following formatting inconsistency.
# (Sorry, for now this is necessary)
LoadAddr="00000000" # Note: hex val *without* proceeding "0x"
EntryAddr="0xFFFFFFFF" # Note: hex val *with* procedding "0x"
Header="y"
LAddrSupplied="n"
EAddrSupplied="n"
compress="n"
while [ $# -gt 0 ] ; do
case "$1" in
--LAddr )
shift
LoadAddr="$1"
# Next, make the supplied LAddr exactly 8 hex chars long.
LoadAddr="0000000${LoadAddr}"
LoadAddr=$(echo $LoadAddr | sed -e "s/^.*\(........\)$/\1/g")
LAddrSupplied="y"
shift
;;
--EAddr )
shift
EntryAddr="$1"
# Next, make the supplied LEntry exactly 8 hex chars long.
EntryAddr="0000000${EntryAddr}"
EntryAddr=$(echo $EntryAddr | sed -e "s/^.*\(........\)$/\1/g")
EntryAddr=0x$EntryAddr
EAddrSupplied="y"
shift
;;
--NoHeader )
Header="n"
shift
;;
--compress )
compress="y"
shift
;;
*)
break
;;
esac
done
if [ ! $# -eq 2 ] ; then
echo "Error: invalid argument set."
echo "Usage: mkimage [--LAddr h] <input-Bin> <out-RR>"
exit 1
fi
binary=$1.stripped
outbin=$2
cp $1 $binary
FileTypeExec=$(${prefix}objdump -f $binary 2>/dev/null | egrep "EXEC_P")
if [ ! -z "$FileTypeExec" ] ; then
# -----------
# Scenario #1
# -----------
# We have an executable style binary (like ELF, etc).
# So...
# ---------------------------------
# Next | Create the binary image data.
# ---------------------------------
${prefix}strip ${binary}
${prefix}objcopy -S -O binary $binary ${binary}.binary
# ---------------------------------
# Next | Create compress image if requested
# ---------------------------------
image_file=${binary}.binary
if [ "$compress" = "y" ] ; then
gzip -f -9 -c ${binary}.binary > ${binary}.binary.gz
image_file=${binary}.binary.gz
fi
# ---------------------------------
# Next | Create the header information (ascii) needed
# | by the TI925 bootloader. This includes the
# | load address, entry address and byte count of
# | the binary executable data which will follow it.
# ---------------------------------
if [ "$LAddrSupplied" = "n" ] ; then
# Next, Since LoadAddr not already supplied by user we'll
# derive it by consulting the binary executable file.
LoadAddr=$(${prefix}objdump -h ${binary} | grep " 0 \.")
LoadAddr=$(echo $LoadAddr | cut -d' ' -f4) # eight hex chars
fi
if [ "$EAddrSupplied" = "n" ] ; then
# Next, Since EntryAddr not already supplied by user we'll
# derive it by consulting the binary executable file.
EntryAddr=$(${prefix}objdump -f ${binary} | grep -i "start")
EntryAddr=$(echo $EntryAddr | cut -d' ' -f3) # eight hex chars
fi
# Next, Compute byte length of binary portion.
numBytes=$(wc --bytes $image_file)
numBytes=$(echo $numBytes | cut -d' ' -f1)
numBytes=$(echo 16o $numBytes p | dc) # converts to hex.
# Next, make the numBytes string exactly 8 hex chars long.
numBytes="0000000${numBytes}"
numBytes=$(echo $numBytes | sed -e "s/^.*\(........\)$/\1/g")
# ---------------------------------
# Next | Combine the ascii header information
# | with the binary image to make the
# | final downloadable *mostly* binary
# | image.
# ---------------------------------
rm -f ${outbin}
echo ">LoadAddr :0x${LoadAddr}" >> ${outbin}
if [ "${Header}" = "y" ]; then
echo ">EntryAddr:${EntryAddr}" >> ${outbin}
else
echo ">NoHeader" >> ${outbin}
fi
echo ">NumBytes :0x${numBytes}" >> ${outbin}
cat $image_file >> ${outbin}
# ---------------------------------
# Cleanup and exit
# ---------------------------------
rm -f ${binary}.binary $image_file
exit 0
else
# -----------
# Scenario #2
# -----------
# Just a binary image but not a standard executable
# style binary (like ELF, etc). Might be a compressed
# filesystem image, etc.
# So...
# ---------------------------------
# Next | Create the header information (ascii) needed
# | by the TI925 bootloader. This includes the
# | load address, entry address and byte count of
# | the binary file which will follow it.
# ---------------------------------
# | Create compress image if requested
# ---------------------------------
#
image_file=${binary}
if [ "$compress" = "y" ] ; then
gzip -f -9 -c ${image_file} > ${image_file}.gz
image_file=${image_file}.gz
fi
#
# Note: The LoadAddr and EntryAddr are already established
# for us at this point, but we will need to compute the
# byte length of binary portion next.
#
numBytes=$(wc --bytes ${image_file})
numBytes=$(echo $numBytes | cut -d' ' -f1)
numBytes=$(echo 16o $numBytes p | dc) # converts to hex.
# Next, make the numBytes string exactly 8 hex chars long.
numBytes="0000000${numBytes}"
numBytes=$(echo $numBytes | sed -e "s/^.*\(........\)$/\1/g")
#
# ---------------------------------
# Next | Combine the ascii header information
# | with the binary image to make the
# | final downloadable *mostly* binary
# | image.
# ---------------------------------
#
rm -f ${outbin}
echo ">LoadAddr :0x${LoadAddr}" >> ${outbin}
if [ ${Header} = "y" ]; then
echo ">EntryAddr:${EntryAddr}" >> ${outbin}
else
echo ">NoHeader" >> ${outbin}
fi
echo ">NumBytes :0x${numBytes}" >> ${outbin}
cat ${image_file} >> ${outbin}
# ---------------------------------
# Cleanup and exit
# ---------------------------------
rm -f ${image_file}.gz
exit 0
fi