summaryrefslogtreecommitdiffstats
path: root/recipes-bsp
diff options
context:
space:
mode:
authorYuan Yao <yao.yuan@nxp.com>2016-07-16 00:28:34 +0800
committerOtavio Salvador <otavio@ossystems.com.br>2016-07-22 11:30:51 -0300
commit7d2c49acdf78a798c92b6d6fbe9cbf8ef324059c (patch)
treee2c549c2c91e9c1afdfb0734e94b83ef88728691 /recipes-bsp
parent92d730104790f7394bdaff8c60ee2b37a44f1200 (diff)
downloadmeta-freescale-7d2c49acdf78a798c92b6d6fbe9cbf8ef324059c.tar.gz
change-file-endianess: keep 8 byte alignment
Signed-off-by: Yuan Yao <yao.yuan@nxp.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-bsp')
-rwxr-xr-xrecipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl9
1 files changed, 8 insertions, 1 deletions
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
index aca956bd..a4e8008f 100755
--- a/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl
+++ b/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl
@@ -11,6 +11,13 @@ fconfigure $fileid_o -translation {binary binary}
11 11
12set old_bin [read $fileid_i] 12set old_bin [read $fileid_i]
13set new_bin {} 13set new_bin {}
14set old_length [string length $old_bin]
15set old_rem [expr $old_length % $num_b]
16if {$old_rem != 0} {
17 for {set i 0} {$i< [expr $num_b - $old_rem]} {incr i 1} {
18 append old_bin y
19 }
20}
14for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { 21for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} {
15 for {set j $num_b} {$j>0} {incr j -1} { 22 for {set j $num_b} {$j>0} {incr j -1} {
16 append new_bin [string index $old_bin [expr $i+($j-1)]] 23 append new_bin [string index $old_bin [expr $i+($j-1)]]
@@ -20,7 +27,7 @@ for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} {
20for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { 27for {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)]] 28 set binValue [string range $old_bin [expr $i+0] [expr $i+($num_b-1)]]
22 binary scan $binValue H[expr $num_b*2] hexValue 29 binary scan $binValue H[expr $num_b*2] hexValue
23 30
24 set binValue [string range $new_bin [expr $i+0] [expr $i+($num_b-1)]] 31 set binValue [string range $new_bin [expr $i+0] [expr $i+($num_b-1)]]
25 binary scan $binValue H[expr $num_b*2] hexValue 32 binary scan $binValue H[expr $num_b*2] hexValue
26} 33}