hello-armv7l.sh 2.1 KB

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