main.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2019-10-24 Magicoe first version
  10. * 2020-01-10 Kevin/Karl Add PS demo
  11. *
  12. */
  13. #include <rtdevice.h>
  14. #include "drv_pin.h"
  15. /* defined the LED pin: GPIO1_IO4 */
  16. /* GPIO1_4 is Blue LED */
  17. #define LEDB_PIN GET_PINS(1, 4)
  18. extern void protected_storage_demo_thread(void * parameters);
  19. int main(void)
  20. {
  21. rt_thread_t t_psa_ps_demo;
  22. #if defined(__CC_ARM)
  23. rt_kprintf("using armcc, version: %d\n", __ARMCC_VERSION);
  24. #elif defined(__CLANG_ARM)
  25. rt_kprintf("using armclang, version: %d\n", __ARMCC_VERSION);
  26. #elif defined(__ICCARM__)
  27. rt_kprintf("using iccarm, version: %d\n", __VER__);
  28. #elif defined(__GNUC__)
  29. rt_kprintf("using gcc, version: %d.%d\n", __GNUC__, __GNUC_MINOR__);
  30. #endif
  31. t_psa_ps_demo = rt_thread_create("psa_ps_demo",
  32. protected_storage_demo_thread,
  33. RT_NULL,
  34. 512,
  35. ( RT_MAIN_THREAD_PRIORITY - 1),
  36. 50);
  37. if (t_psa_ps_demo != RT_NULL) rt_thread_startup(t_psa_ps_demo);
  38. rt_pin_mode(LEDB_PIN, PIN_MODE_OUTPUT); /* Set GPIO as Output */
  39. while (1)
  40. {
  41. rt_pin_write(LEDB_PIN, PIN_HIGH); /* Set GPIO output 1 */
  42. rt_thread_mdelay(500); /* Delay 500mS */
  43. rt_pin_write(LEDB_PIN, PIN_LOW); /* Set GPIO output 0 */
  44. rt_thread_mdelay(500); /* Delay 500mS */
  45. }
  46. }
  47. // end file