hello-armv7l.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 -ex
  19. TMPDIR="test/test0013/tmp-armv7l"
  20. mkdir -p ${TMPDIR}
  21. # Build the test
  22. bin/M2-Planet \
  23. --architecture armv7l \
  24. -f test/common_armv7l/functions/putchar.c \
  25. -f test/common_armv7l/functions/exit.c \
  26. -f test/test0013/break-while.c \
  27. -o ${TMPDIR}/break-while.M1 \
  28. || exit 1
  29. # Macro assemble with libc written in M1-Macro
  30. M1 \
  31. -f test/common_armv7l/armv7l_defs.M1 \
  32. -f test/common_armv7l/libc-core.M1 \
  33. -f ${TMPDIR}/break-while.M1 \
  34. --LittleEndian \
  35. --architecture armv7l \
  36. -o ${TMPDIR}/break-while.hex2 \
  37. || exit 2
  38. # Resolve all linkages
  39. hex2 \
  40. -f test/common_armv7l/ELF-armv7l.hex2 \
  41. -f ${TMPDIR}/break-while.hex2 \
  42. --LittleEndian \
  43. --architecture armv7l \
  44. --BaseAddress 0x10000 \
  45. -o test/results/test0013-armv7l-binary \
  46. --exec_enable \
  47. || exit 3
  48. # Ensure binary works if host machine supports test
  49. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ]
  50. then
  51. . ./sha256.sh
  52. # Verify that the resulting file works
  53. ./test/results/test0013-armv7l-binary >| test/test0013/proof || exit 4
  54. out=$(sha256_check test/test0013/proof.answer)
  55. [ "$out" = "test/test0013/proof: OK" ] || exit 5
  56. fi
  57. exit 0