summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/change-file-endianess
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2015-07-15 17:14:27 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2015-07-16 15:01:29 -0300
commitf8517afc7a5ada4538b3b7d397fa32586d57ffe5 (patch)
tree79349f091306d1760fd4687e62336ffa8fb8c721 /recipes-bsp/change-file-endianess
parentc92b415d653afc55f33b6b93fb9248193bfd4fa0 (diff)
downloadmeta-freescale-f8517afc7a5ada4538b3b7d397fa32586d57ffe5.tar.gz
Move meta-fsl-arm content to layer root
The meta-fsl-arm is going to be used as the base for this layer. It contains a clean history and allowing a more granullar set of changes. This commit is just a rename of all contents of meta-fsl-arm subdirectory to this layer's root, subsequent changes are based on top of that. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-bsp/change-file-endianess')
-rw-r--r--recipes-bsp/change-file-endianess/change-file-endianess.bb23
-rwxr-xr-xrecipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl29
2 files changed, 52 insertions, 0 deletions
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 00000000..2ad8c588
--- /dev/null
+++ b/recipes-bsp/change-file-endianess/change-file-endianess.bb
@@ -0,0 +1,23 @@
1DESCRIPTION = "provides the tcl script for endian swap"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
4 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
5
6
7SRC_URI = "file://byte_swap.tcl"
8
9RDEPENDS += "tcl-native"
10
11inherit native
12
13S = "${WORKDIR}"
14
15do_configure[noexec] = "1"
16do_compile[noexec] = "1"
17
18do_install () {
19 install -d ${D}/${bindir}
20 install -m 755 ${WORKDIR}/byte_swap.tcl ${D}/${bindir}
21}
22
23BBCLASSEXTEND = "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 00000000..aca956bd
--- /dev/null
+++ b/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl
@@ -0,0 +1,29 @@
1puts $argv
2set i_file [lindex $argv 0]
3set o_file [lindex $argv 1]
4set num_b [lindex $argv 2]
5puts ""
6
7set fileid_i [open $i_file "r"]
8set fileid_o [open $o_file "w+"]
9fconfigure $fileid_i -translation {binary binary}
10fconfigure $fileid_o -translation {binary binary}
11
12set old_bin [read $fileid_i]
13set new_bin {}
14for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} {
15 for {set j $num_b} {$j>0} {incr j -1} {
16 append new_bin [string index $old_bin [expr $i+($j-1)]]
17 }
18}
19
20for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} {
21 set binValue [string range $old_bin [expr $i+0] [expr $i+($num_b-1)]]
22 binary scan $binValue H[expr $num_b*2] hexValue
23
24 set binValue [string range $new_bin [expr $i+0] [expr $i+($num_b-1)]]
25 binary scan $binValue H[expr $num_b*2] hexValue
26}
27
28puts -nonewline $fileid_o $new_bin
29close $fileid_o