From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13876 invoked by alias); 25 Sep 2003 13:51:10 -0000 Mailing-List: contact ecos-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@sources.redhat.com Received: (qmail 13853 invoked from network); 25 Sep 2003 13:51:09 -0000 Received: from unknown (HELO draco.netpower.no) (212.33.133.34) by sources.redhat.com with SMTP; 25 Sep 2003 13:51:09 -0000 Received: from lair ([212.33.152.109]) by draco.netpower.no (8.12.10/8.12.8) with ESMTP id h8PDr9Xw025894; Thu, 25 Sep 2003 15:53:10 +0200 From: =?iso-8859-1?Q?=D8yvind_Harboe?= To: "'Gary Thomas'" Cc: "'eCos Discussion'" Date: Thu, 25 Sep 2003 13:51:00 -0000 Message-ID: <000001c3836c$107fe670$73dea8c0@lair> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0001_01C3837C.D408B670" X-Priority: 3 (Normal) X-MSMail-Priority: Normal Importance: Normal In-Reply-To: <1064487578.1015.2645.camel@hermes> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: RE: [ECOS] __attribute aligned and objcopy X-SW-Source: 2003-09/txt/msg00465.txt.bz2 ------=_NextPart_000_0001_01C3837C.D408B670 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-length: 974 What irked me about this one was that I had the feeling that surely someone had done this before me, and that it was just a matter of finding the right incatation to arm-elf-objcopy. :-) >What I've done in the past is use GCC to get the magic right. Try=20 >looking at packages/hal/arm/edb7xxx/current/misc/long*.h >These are binary data files which I then pass through GCC. When I got your e-mail I had started work on a Frankenmake. Modified rom/support/file2c.tcl attached.=20 # some singing and dancing to get an 4 bytes aligned data.=20 # raw data $(OUTPUT)/%.o: %.alignedraw echo -- Raw data file $*.alignedraw ../scripts/myfile2c.tcl $*.alignedraw $(OUTPUT)/$*.txt echo >$(OUTPUT)/$*.xxxx "const __attribute__((aligned(4))) char " echo $(OUTPUT)/$* | sed -e 's/\//_/g' | sed -e 's/\./_/g' >>$(OUTPUT)/$*.xxxx echo []=3D >>$(OUTPUT)/$*.xxxx cat $(OUTPUT)/$*.txt >>$(OUTPUT)/$*.xxxx $(XCC) -o $(OUTPUT)/$*.o $(CFLAGS) -c -x c $(OUTPUT)/$*.xxxx =D8yvind ------=_NextPart_000_0001_01C3837C.D408B670 Content-Type: application/octet-stream; name="myfile2c.tcl" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="myfile2c.tcl" Content-length: 5588 #!/bin/bash=0A= # restart using a Tcl shell \=0A= exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \=0A= ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath= -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \=0A= done ; \=0A= echo "file2c.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"=0A= =0A= #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=0A= #=0A= # file2c.tcl=0A= #=0A= # Convert a file into a header that can be #included from C.=0A= #=0A= #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=0A= #####ECOSGPLCOPYRIGHTBEGIN####=0A= ## -------------------------------------------=0A= ## This file is part of eCos, the Embedded Configurable Operating System.= =0A= ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.=0A= ##=0A= ## eCos is free software; you can redistribute it and/or modify it under=0A= ## the terms of the GNU General Public License as published by the Free=0A= ## Software Foundation; either version 2 or (at your option) any later vers= ion.=0A= ##=0A= ## eCos is distributed in the hope that it will be useful, but WITHOUT ANY= =0A= ## WARRANTY; without even the implied warranty of MERCHANTABILITY or=0A= ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License=0A= ## for more details.=0A= ##=0A= ## You should have received a copy of the GNU General Public License along= =0A= ## with eCos; if not, write to the Free Software Foundation, Inc.,=0A= ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.=0A= ##=0A= ## As a special exception, if other files instantiate templates or use macr= os=0A= ## or inline functions from this file, or you compile this file and link it= =0A= ## with other works to produce a work based on this file, this file does no= t=0A= ## by itself cause the resulting work to be covered by the GNU General Publ= ic=0A= ## License. However the source code for this file must still be made availa= ble=0A= ## in accordance with section (3) of the GNU General Public License.=0A= ##=0A= ## This exception does not invalidate any other reasons why a work based on= =0A= ## this file might be covered by the GNU General Public License.=0A= ##=0A= ## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc= .=0A= ## at http://sources.redhat.com/ecos/ecos-license/=0A= ## -------------------------------------------=0A= #####ECOSGPLCOPYRIGHTEND####=0A= #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=0A= ######DESCRIPTIONBEGIN####=0A= #=0A= # Author(s): jlarmour,bartv=0A= # Contact(s):=09=0A= # Date: 2001-07-20=0A= # Purpose:=20=20=20=20=20=20=0A= # Description:=0A= # Usage: file2c.tcl =0A= #=0A= #####DESCRIPTIONEND####=0A= #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=0A= =0A= =0A= =0A= if { $argc !=3D 2 } {=0A= puts "Usage: file2c.tcl "=0A= exit 1=0A= }=0A= set infile [lindex $argv 0]=0A= set outfile [lindex $argv 1]=0A= set variablename [lindex $argv 2]=0A= =0A= set status [ catch {=0A= set infilefd [open $infile "r"]=0A= fconfigure $infilefd -translation binary=0A= set data [read $infilefd]=0A= close $infilefd=0A= } message]=0A= =0A= if { $status !=3D 0 } {=0A= error "Unable to read file $infile: $message"=0A= }=0A= =0A= set result ""=0A= =0A= set status [ catch {=0A= set outfilefd [ open $outfile "w" ]=0A= } message ]=0A= =0A= if { $status !=3D 0 } {=0A= error "Unable to create file $outfile: $message"=0A= }=0A= =0A= append result "/* This is a generated file. Do not edit. */\n\n"=0A= append result "{\n"=0A= =0A= set datalength [ string length $data ]=0A= =0A= set aligned_datalength [expr $datalength - ($datalength % 8)]=0A= =0A= for { set i 0 } {$i < $aligned_datalength} {incr i 8} {=0A= binary scan $data "@[set i]H16" var0=0A= append result [format " 0x%2s, 0x%2s, 0x%2s, 0x%2s, 0x%2s, 0x%2s, 0x= %2s, 0x%2s,\n" \=0A= [string range $var0 0 1] \=0A= [string range $var0 2 3] \=0A= [string range $var0 4 5] \=0A= [string range $var0 6 7] \=0A= [string range $var0 8 9] \=0A= [string range $var0 10 11] \=0A= [string range $var0 12 13] \=0A= [string range $var0 14 15]]=0A= }=0A= =0A= if { $aligned_datalength !=3D $datalength } {=0A= append result " "=0A= for { set i $aligned_datalength } {$i < $datalength} {incr i} {=0A= binary scan $data "@[set i]H2" var0=0A= append result [format "0x%2s, " $var0]=0A= }=0A= }=0A= =0A= # Remove either comma+newline or comma+space from the end=0A= set result [string range $result 0 [expr [string length $result] - 3]]=0A= =0A= append result "\n};"=0A= =0A= puts $outfilefd $result=0A= close $outfilefd=0A= =0A= ------=_NextPart_000_0001_01C3837C.D408B670 Content-Type: text/plain; charset=us-ascii Content-length: 146 -- Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos and search the list archive: http://sources.redhat.com/ml/ecos-discuss ------=_NextPart_000_0001_01C3837C.D408B670--