hello_world.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #define OSI_LOG_TAG OSI_MAKE_LOG_TAG('M', 'Y', 'A', 'P')
  13. #include "osi_log.h"
  14. #include "osi_api.h"
  15. static void prvInvokeGlobalCtors(void)
  16. {
  17. extern void (*__init_array_start[])();
  18. extern void (*__init_array_end[])();
  19. size_t count = __init_array_end - __init_array_start;
  20. for (size_t i = 0; i < count; ++i)
  21. __init_array_start[i]();
  22. }
  23. static void prvThreadEntry(void *param)
  24. {
  25. OSI_LOGI(0x100075c9, "application thread enter, param 0x%x", param);
  26. for (int n = 0; n < 10; n++)
  27. {
  28. OSI_LOGI(0x10007cc5, "hello world %d", n);
  29. osiThreadSleep(500);
  30. }
  31. osiThreadExit();
  32. }
  33. int appimg_enter(void *param)
  34. {
  35. OSI_LOGI(0x100075ca, "application image enter, param 0x%x", param);
  36. prvInvokeGlobalCtors();
  37. osiThreadCreate("mythread", prvThreadEntry, NULL, OSI_PRIORITY_NORMAL, 1024, 0);
  38. return 0;
  39. }
  40. void appimg_exit(void)
  41. {
  42. OSI_LOGI(0x100075cb, "application image exit");
  43. }