From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id A9454E008CC; Tue, 3 Feb 2015 01:02:23 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.0 SPF_HELO_PASS SPF: HELO matches SPF record * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [65.55.169.112 listed in list.dnswl.org] Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0112.outbound.protection.outlook.com [65.55.169.112]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 3B12FE0086F for ; Tue, 3 Feb 2015 01:02:18 -0800 (PST) Received: from BN3PR0301CA0011.namprd03.prod.outlook.com (25.160.180.149) by DM2PR0301MB1197.namprd03.prod.outlook.com (25.160.217.147) with Microsoft SMTP Server (TLS) id 15.1.75.20; Tue, 3 Feb 2015 09:02:16 +0000 Received: from BN1AFFO11FD021.protection.gbl (2a01:111:f400:7c10::116) by BN3PR0301CA0011.outlook.office365.com (2a01:111:e400:4000::21) with Microsoft SMTP Server (TLS) id 15.1.87.13 via Frontend Transport; Tue, 3 Feb 2015 09:02:16 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD021.mail.protection.outlook.com (10.58.52.81) with Microsoft SMTP Server (TLS) id 15.1.87.10 via Frontend Transport; Tue, 3 Feb 2015 09:02:16 +0000 Received: from sun.ap.freescale.net (sun.ap.freescale.net [10.192.208.75]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t13925UI030032; Tue, 3 Feb 2015 02:02:06 -0700 From: To: Date: Tue, 3 Feb 2015 17:01:53 +0800 Message-ID: <1422954116-26431-1-git-send-email-b40290@freescale.com> X-Mailer: git-send-email 1.9.2 X-EOPAttributedMessage: 0 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=b40290@freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(19580395003)(19580405001)(6806004)(86152002)(47776003)(87936001)(230783001)(110136001)(229853001)(2351001)(104016003)(46102003)(48376002)(77156002)(62966003)(450100001)(86362001)(77096005)(85426001)(105606002)(50986999)(50226001)(33646002)(106466001)(92566002)(36756003)(50466002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1197; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1197; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:DM2PR0301MB1197; X-Forefront-PRVS: 0476D4AB88 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1197; X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2015 09:02:16.1689 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB1197 Subject: [meta-fsl-arm][PATCH 1/4] byte-swap: add recipe X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2015 09:02:23 -0000 Content-Type: text/plain From: Chunrong Guo *provides the tcl script for endian swap Signed-off-by: Chunrong Guo --- recipes-bsp/byte-swap/byte-swap.bb | 21 +++++++++++++++++++ recipes-bsp/byte-swap/byte-swap/byte_swap.tcl | 29 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 recipes-bsp/byte-swap/byte-swap.bb create mode 100755 recipes-bsp/byte-swap/byte-swap/byte_swap.tcl diff --git a/recipes-bsp/byte-swap/byte-swap.bb b/recipes-bsp/byte-swap/byte-swap.bb new file mode 100644 index 0000000..9e7e868 --- /dev/null +++ b/recipes-bsp/byte-swap/byte-swap.bb @@ -0,0 +1,21 @@ +DESCRIPTION = "provides the tcl script for endian swap" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + + +SRC_URI = "file://byte_swap.tcl" + +RDEPENDS += "tcl-native" + +inherit native + +S = "${WORKDIR}" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install () { + install -d ${D}/${bindir} + install -m 755 ${WORKDIR}/byte_swap.tcl ${D}/${bindir} +} diff --git a/recipes-bsp/byte-swap/byte-swap/byte_swap.tcl b/recipes-bsp/byte-swap/byte-swap/byte_swap.tcl new file mode 100755 index 0000000..aca956b --- /dev/null +++ b/recipes-bsp/byte-swap/byte-swap/byte_swap.tcl @@ -0,0 +1,29 @@ +puts $argv +set i_file [lindex $argv 0] +set o_file [lindex $argv 1] +set num_b [lindex $argv 2] +puts "" + +set fileid_i [open $i_file "r"] +set fileid_o [open $o_file "w+"] +fconfigure $fileid_i -translation {binary binary} +fconfigure $fileid_o -translation {binary binary} + +set old_bin [read $fileid_i] +set new_bin {} +for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { + for {set j $num_b} {$j>0} {incr j -1} { + append new_bin [string index $old_bin [expr $i+($j-1)]] + } +} + +for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { + set binValue [string range $old_bin [expr $i+0] [expr $i+($num_b-1)]] + binary scan $binValue H[expr $num_b*2] hexValue + + set binValue [string range $new_bin [expr $i+0] [expr $i+($num_b-1)]] + binary scan $binValue H[expr $num_b*2] hexValue +} + +puts -nonewline $fileid_o $new_bin +close $fileid_o -- 1.9.2