hello-armv7l.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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/test0105/tmp-armv7l"
  20. mkdir -p ${TMPDIR}
  21. # Build the test
  22. ./bin/M2-Planet \
  23. --architecture armv7l \
  24. -f test/test0105/lisp.h \
  25. -f test/common_armv7l/functions/malloc.c \
  26. -f functions/calloc.c \
  27. -f functions/in_set.c \
  28. -f test/common_armv7l/functions/file.c \
  29. -f test/common_armv7l/functions/exit.c \
  30. -f functions/numerate_number.c \
  31. -f functions/match.c \
  32. -f functions/file_print.c \
  33. -f test/test0105/lisp.c \
  34. -f test/test0105/lisp_cell.c \
  35. -f test/test0105/lisp_eval.c \
  36. -f test/test0105/lisp_print.c \
  37. -f test/test0105/lisp_read.c \
  38. --debug \
  39. --bootstrap-mode \
  40. -o ${TMPDIR}/lisp.M1 \
  41. || exit 1
  42. # Build debug footer
  43. blood-elf \
  44. -f ${TMPDIR}/lisp.M1 \
  45. --entry _start \
  46. -o ${TMPDIR}/lisp-footer.M1 \
  47. || exit 2
  48. # Macro assemble with libc written in M1-Macro
  49. M1 \
  50. -f test/common_armv7l/armv7l_defs.M1 \
  51. -f test/common_armv7l/libc-core.M1 \
  52. -f ${TMPDIR}/lisp.M1 \
  53. -f ${TMPDIR}/lisp-footer.M1 \
  54. --LittleEndian \
  55. --architecture armv7l \
  56. -o ${TMPDIR}/lisp.hex2 \
  57. || exit 3
  58. # Resolve all linkages
  59. hex2 \
  60. -f test/common_armv7l/ELF-armv7l-debug.hex2 \
  61. -f ${TMPDIR}/lisp.hex2 \
  62. --LittleEndian \
  63. --architecture armv7l \
  64. --BaseAddress 0x10000 \
  65. -o test/results/test0105-armv7l-binary \
  66. --exec_enable \
  67. || exit 4
  68. # Ensure binary works if host machine supports test
  69. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ]
  70. then
  71. # Verify that the compiled program returns the correct result
  72. out=$(./test/results/test0105-armv7l-binary --version 2>&1 )
  73. [ 0 = $? ] || exit 5
  74. [ "$out" = "Slow_Lisp 0.1" ] || exit 6
  75. # Verify that the resulting file works
  76. out=$(./test/results/test0105-armv7l-binary --file test/test0105/test.scm)
  77. [ "$out" = "42" ] || exit 7
  78. fi
  79. exit 0