startup_gcc.S 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018/10/01 Bernard The first version
  9. * 2018/12/27 Jesven Add SMP support
  10. * 2020/6/12 Xim Port to QEMU and remove SMP support
  11. */
  12. #define SSTATUS_FS 0x00006000U /* initial state of FPU, clear to disable */
  13. #include <cpuport.h>
  14. .global _start
  15. .section ".start", "ax"
  16. _start:
  17. j 1f
  18. .word 0xdeadbeef
  19. .align 3
  20. .global g_wake_up
  21. g_wake_up:
  22. .dword 1
  23. .dword 0
  24. 1:
  25. csrw sie, 0
  26. csrw sip, 0
  27. la t0, trap_entry
  28. csrw stvec, t0
  29. li x1, 0
  30. li x2, 0
  31. li x3, 0
  32. li x4, 0
  33. li x5, 0
  34. li x6, 0
  35. li x7, 0
  36. li x8, 0
  37. li x9, 0
  38. li x10,0
  39. li x11,0
  40. li x12,0
  41. li x13,0
  42. li x14,0
  43. li x15,0
  44. li x16,0
  45. li x17,0
  46. li x18,0
  47. li x19,0
  48. li x20,0
  49. li x21,0
  50. li x22,0
  51. li x23,0
  52. li x24,0
  53. li x25,0
  54. li x26,0
  55. li x27,0
  56. li x28,0
  57. li x29,0
  58. li x30,0
  59. li x31,0
  60. /* set to disable FPU */
  61. li t0, SSTATUS_FS
  62. csrc sstatus, t0
  63. li t0, 0x40000 // SUM in sstatus
  64. csrs sstatus, t0
  65. .option push
  66. .option norelax
  67. la gp, __global_pointer$
  68. .option pop
  69. // removed SMP support here
  70. la sp, __stack_start__
  71. li t0, __STACKSIZE__
  72. add sp, sp, t0
  73. csrw sscratch, sp
  74. j primary_cpu_entry