mirror of
https://github.com/dgibson/dtc.git
synced 2025-12-08 20:55:18 -05:00
dtc: Make asm output more portable and add testcases
This patch adds some testcases for dtc's -Oasm mode. Specifically it checks that building the asm will result in the same device tree blob in memory as -Odtb mode would produce, for a variety of trees. This test uncovered two difficulties with our current -Oasm output, both of which are addressed in this patch as well. First, -Oasm output would only be correct if assembled for a big-endian target. Usually that would be the case, when building device trees into a firmware or similar. However this makes life inconvenient for testing on a little-endian target, and one can think up use cases where a program running on a little endian host might want to embed a device tree for a big-endian target. This patch therefore changes -Oasm output to use .byte directives instead of .long throughout in order to generate byte-for-byte identical trees regardless of the endianness of the assembler target. Second, -Oasm output emitted several #define statements which were then used in the innards of the output - i.e. it assumed the output would be processed by cpp before being assembled. That may not be convenient in all build environments, and in any case doesn't work well with the above fix. So, -Oasm output no longer needs to be preprocessed before assembling. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
b2b4990bbf
commit
26d93f6c92
6 changed files with 149 additions and 42 deletions
|
|
@ -71,6 +71,15 @@ run_dtc_test () {
|
|||
base_run_test wrap_test $VALGRIND $DTC "$@"
|
||||
}
|
||||
|
||||
asm_to_so () {
|
||||
as -o $1.test.o data.S $1.test.s && \
|
||||
ld -shared -o $1.test.so $1.test.o
|
||||
}
|
||||
|
||||
asm_to_so_test () {
|
||||
run_wrap_test asm_to_so "$@"
|
||||
}
|
||||
|
||||
tree1_tests () {
|
||||
TREE=$1
|
||||
|
||||
|
|
@ -228,6 +237,16 @@ dtc_tests () {
|
|||
run_dtc_test -I dtb -O dtb -o boot_cpuid_preserved_test_tree1.test.dtb boot_cpuid_test_tree1.test.dtb
|
||||
run_test dtbs_equal_ordered boot_cpuid_preserved_test_tree1.test.dtb boot_cpuid_test_tree1.test.dtb
|
||||
|
||||
# Check -Oasm mode
|
||||
for tree in test_tree1.dts escapes.dts references.dts path-references.dts \
|
||||
comments.dts aliases.dts include0.dts incbin.dts ; do
|
||||
run_dtc_test -I dts -O asm -o oasm_$tree.test.s $tree
|
||||
asm_to_so_test oasm_$tree
|
||||
run_dtc_test -I dts -O dtb -o $tree.test.dtb $tree
|
||||
run_test asm_tree_dump ./oasm_$tree.test.so oasm_$tree.test.dtb
|
||||
run_wrap_test cmp oasm_$tree.test.dtb $tree.test.dtb
|
||||
done
|
||||
|
||||
# Check -Odts mode preserve all dtb information
|
||||
for tree in test_tree1.dtb dtc_tree1.test.dtb dtc_escapes.test.dtb \
|
||||
dtc_references.test.dtb; do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue