hello-armv7l.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #! /bin/sh
  2. ## Copyright (C) 2017 Jeremiah Orians
  3. ## Copyright (C) 2021 deesix <deesix@tuta.io>
  4. ## This file is part of M2-Planet.
  5. ##
  6. ## M2-Planet is free software: you can redistribute it and/or modify
  7. ## it under the terms of the GNU General Public License as published by
  8. ## the Free Software Foundation, either version 3 of the License, or
  9. ## (at your option) any later version.
  10. ##
  11. ## M2-Planet is distributed in the hope that it will be useful,
  12. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ## GNU General Public License for more details.
  15. ##
  16. ## You should have received a copy of the GNU General Public License
  17. ## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
  18. set -x
  19. TMPDIR="test/test0100/tmp-armv7l"
  20. mkdir -p ${TMPDIR}
  21. # Build the test
  22. ./bin/M2-Planet \
  23. --architecture armv7l \
  24. -f test/common_armv7l/functions/exit.c \
  25. -f test/common_armv7l/functions/file.c \
  26. -f functions/file_print.c \
  27. -f test/common_armv7l/functions/malloc.c \
  28. -f functions/calloc.c \
  29. -f functions/match.c \
  30. -f test/test0100/blood-elf.c \
  31. --debug \
  32. --bootstrap-mode \
  33. -o ${TMPDIR}/blood-elf.M1 \
  34. || exit 1
  35. # Build debug footer
  36. blood-elf \
  37. -f ${TMPDIR}/blood-elf.M1 \
  38. --entry _start \
  39. -o ${TMPDIR}/blood-elf-footer.M1 \
  40. || exit 2
  41. # Macro assemble with libc written in M1-Macro
  42. M1 \
  43. -f test/common_armv7l/armv7l_defs.M1 \
  44. -f test/common_armv7l/libc-core.M1 \
  45. -f ${TMPDIR}/blood-elf.M1 \
  46. -f ${TMPDIR}/blood-elf-footer.M1 \
  47. --LittleEndian \
  48. --architecture armv7l \
  49. -o ${TMPDIR}/blood-elf.hex2 \
  50. || exit 3
  51. # Resolve all linkages
  52. hex2 \
  53. -f test/common_armv7l/ELF-armv7l-debug.hex2 \
  54. -f ${TMPDIR}/blood-elf.hex2 \
  55. --LittleEndian \
  56. --architecture armv7l \
  57. --BaseAddress 0x10000 \
  58. -o test/results/test0100-armv7l-binary \
  59. --exec_enable \
  60. || exit 4
  61. # Ensure binary works if host machine supports test
  62. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ]
  63. then
  64. # Verify that the compiled program returns the correct result
  65. out=$(./test/results/test0100-armv7l-binary --version 2>&1 )
  66. [ 0 = $? ] || exit 5
  67. [ "$out" = "blood-elf 0.1
  68. (Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6
  69. . ./sha256.sh
  70. # Verify that the resulting file works
  71. ./test/results/test0100-armv7l-binary -f test/test0100/test.M1 -o test/test0100/proof || exit 7
  72. out=$(sha256_check test/test0100/proof.answer)
  73. [ "$out" = "test/test0100/proof: OK" ] || exit 8
  74. fi
  75. exit 0