1
0

entry_gcc.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2019-12-04 Jiaxun Yang Initial version
  9. */
  10. #ifndef __ASSEMBLY__
  11. #define __ASSEMBLY__
  12. #endif
  13. #include <mips.h>
  14. #include <rtconfig.h>
  15. #include "asm.h"
  16. #include <rtconfig.h>
  17. .section ".start", "ax"
  18. .set noreorder
  19. /* the program entry */
  20. .globl _rtthread_entry
  21. _rtthread_entry:
  22. #ifndef RT_USING_SELF_BOOT
  23. .globl _start
  24. _start:
  25. #endif
  26. PTR_LA ra, _rtthread_entry
  27. /* disable interrupt */
  28. MTC0 zero, CP0_CAUSE
  29. MTC0 zero, CP0_STATUS # Set CPU to disable interrupt.
  30. ehb
  31. #ifdef ARCH_MIPS64
  32. dli t0, ST0_KX
  33. MTC0 t0, CP0_STATUS
  34. #endif
  35. /* setup stack pointer */
  36. PTR_LA sp, _system_stack
  37. PTR_LA gp, _gp
  38. bal rt_cpu_early_init
  39. nop
  40. /* clear bss */
  41. PTR_LA t0, __bss_start
  42. PTR_LA t1, __bss_end
  43. _clr_bss_loop:
  44. sw zero, 0(t0)
  45. bne t1, t0, _clr_bss_loop
  46. addu t0, 4
  47. /* jump to RT-Thread RTOS */
  48. jal rtthread_startup
  49. nop
  50. /* restart, never die */
  51. j _start
  52. nop