[meta-freescale] [meta-fsl-arm][PATCH 19/41] change-file-endianess: keep 8 byte alignment
ting.liu at nxp.com
ting.liu at nxp.com
Fri Jun 24 03:41:14 PDT 2016
From: Yuan Yao <yao.yuan at nxp.com>
Signed-off-by: Yuan Yao <yao.yuan at nxp.com>
---
.../change-file-endianess/change-file-endianess/byte_swap.tcl | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
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 aca956b..a4e8008 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}
set old_bin [read $fileid_i]
set new_bin {}
+set old_length [string length $old_bin]
+set old_rem [expr $old_length % $num_b]
+if {$old_rem != 0} {
+ for {set i 0} {$i< [expr $num_b - $old_rem]} {incr i 1} {
+ append old_bin y
+ }
+}
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)]]
@@ -20,7 +27,7 @@ for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} {
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
}
--
1.9.2
More information about the meta-freescale
mailing list