From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 41980E00988; Tue, 3 Feb 2015 23:18:24 -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 * [157.56.110.116 listed in list.dnswl.org] Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0116.outbound.protection.outlook.com [157.56.110.116]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id B3910E0097F for ; Tue, 3 Feb 2015 23:18:19 -0800 (PST) Received: from DM2PR03CA0004.namprd03.prod.outlook.com (10.141.96.14) by DM2PR03MB446.namprd03.prod.outlook.com (10.141.85.17) with Microsoft SMTP Server (TLS) id 15.1.65.19; Wed, 4 Feb 2015 07:18:17 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::175) by DM2PR03CA0004.outlook.office365.com (2a01:111:e400:2428::14) with Microsoft SMTP Server (TLS) id 15.1.87.13 via Frontend Transport; Wed, 4 Feb 2015 07:18:17 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD009.mail.protection.outlook.com (10.1.14.73) with Microsoft SMTP Server (TLS) id 15.1.87.10 via Frontend Transport; Wed, 4 Feb 2015 07:18:17 +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 t147IF58011040; Wed, 4 Feb 2015 00:18:15 -0700 From: To: Date: Wed, 4 Feb 2015 15:18:11 +0800 Message-ID: <1423034294-27470-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)(104016003)(77156002)(450100001)(50226001)(230783001)(46102003)(77096005)(33646002)(48376002)(105606002)(62966003)(19580395003)(85426001)(19580405001)(47776003)(36756003)(86362001)(87936001)(106466001)(6806004)(110136001)(50466002)(229853001)(2351001)(50986999)(86152002)(92566002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR03MB446; 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:DM2PR03MB446; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:DM2PR03MB446; X-Forefront-PRVS: 04772EA191 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB446; X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2015 07:18:17.1464 (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: DM2PR03MB446 Subject: [meta-fsl-arm][PATCH v2 1/4] change-file-endianess: 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: Wed, 04 Feb 2015 07:18:24 -0000 Content-Type: text/plain From: Chunrong Guo provides the tcl script for endian swap Signed-off-by: Chunrong Guo --- .../change-file-endianess/change-file-endianess.bb | 23 +++++++++++++++++ .../change-file-endianess/byte_swap.tcl | 29 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 recipes-bsp/change-file-endianess/change-file-endianess.bb create mode 100755 recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl diff --git a/recipes-bsp/change-file-endianess/change-file-endianess.bb b/recipes-bsp/change-file-endianess/change-file-endianess.bb new file mode 100644 index 0000000..2ad8c58 --- /dev/null +++ b/recipes-bsp/change-file-endianess/change-file-endianess.bb @@ -0,0 +1,23 @@ +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} +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl b/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl new file mode 100755 index 0000000..aca956b --- /dev/null +++ b/recipes-bsp/change-file-endianess/change-file-endianess/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