hello.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * hello - sample boot loader application
  3. *
  4. * Copyright (c) 2009 Openmoko Inc.
  5. *
  6. * Authors Christopher Hall <hsw@openmoko.com>
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #define APPLICATION_TITLE "hello world"
  22. #define APPLICATION_TITLE2 "hello you"
  23. #define APPLICATION_TITLE3 "hello me"
  24. #include "application.h"
  25. int x = 0xcafedeca;
  26. unsigned char c = 2;
  27. int y;
  28. unsigned char d;
  29. // this must be the first executable code as the loader executes from the first program address
  30. ReturnType hello(int block, int status)
  31. {
  32. APPLICATION_INITIALISE();
  33. print("hello world\n");
  34. print(" status = ");
  35. print_uint(status);
  36. print_char('\n');
  37. print(" 1 + 2 = ");
  38. print_uint(1 + 2);
  39. print_char('\n');
  40. {
  41. print(" x = ");
  42. print_hex((uint32_t)&x);
  43. print_char(':');
  44. print_hex(x);
  45. print_char('\n');
  46. print(" y = ");
  47. print_hex((uint32_t)&y);
  48. print_char(':');
  49. print_uint(y);
  50. print_char('\n');
  51. }
  52. print("goodbye world\n");
  53. APPLICATION_FINALISE(0, 0);
  54. }