hello-armv7l.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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/putchar.c \
  20. -f test/common_armv7l/functions/exit.c \
  21. -f test/test0009/goto.c \
  22. -o test/test0009/goto.M1 || exit 1
  23. # Macro assemble with libc written in M1-Macro
  24. M1 -f test/common_armv7l/armv7l_defs.M1 \
  25. -f test/common_armv7l/libc-core.M1 \
  26. -f test/test0009/goto.M1 \
  27. --LittleEndian \
  28. --architecture armv7l \
  29. -o test/test0009/goto.hex2 || exit 2
  30. # Resolve all linkages
  31. hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test0009/goto.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test0009-armv7l-binary --exec_enable || exit 3
  32. # Ensure binary works if host machine supports test
  33. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ]
  34. then
  35. # Verify that the compiled program returns the correct result
  36. out=$(./test/results/test0009-armv7l-binary 2>&1 )
  37. [ 42 = $? ] || exit 4
  38. [ "$out" = "Hello mes" ] || exit 5
  39. fi
  40. exit 0