start.S 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * (C) Copyright 2007 Michal Simek
  3. * (C) Copyright 2004 Atmark Techno, Inc.
  4. *
  5. * Michal SIMEK <monstr@monstr.eu>
  6. * Yasushi SHOJI <yashi@atmark-techno.com>
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <config.h>
  27. .text
  28. .global _start
  29. _start:
  30. mts rmsr, r0 /* disable cache */
  31. addi r1, r0, CFG_INIT_SP_OFFSET
  32. /* add opcode instruction for 32bit jump - 2 instruction imm & brai*/
  33. addi r6, r0, 0xb000 /* hex b000 opcode imm */
  34. bslli r6, r6, 16 /* shift */
  35. swi r6, r0, 0x0 /* reset address */
  36. swi r6, r0, 0x8 /* user vector exception */
  37. swi r6, r0, 0x10 /* interrupt */
  38. swi r6, r0, 0x20 /* hardware exception */
  39. addi r6, r0, 0xb808 /* hew b808 opcode brai*/
  40. bslli r6, r6, 16
  41. swi r6, r0, 0x4 /* reset address */
  42. swi r6, r0, 0xC /* user vector exception */
  43. swi r6, r0, 0x14 /* interrupt */
  44. swi r6, r0, 0x24 /* hardware exception */
  45. #ifdef CFG_RESET_ADDRESS
  46. /* reset address */
  47. addik r6, r0, CFG_RESET_ADDRESS
  48. sw r6, r1, r0
  49. lhu r7, r1, r0
  50. shi r7, r0, 0x2
  51. shi r6, r0, 0x6
  52. #endif
  53. #ifdef CFG_USR_EXCEP
  54. /* user_vector_exception */
  55. addik r6, r0, _exception_handler
  56. sw r6, r1, r0
  57. lhu r7, r1, r0
  58. shi r7, r0, 0xa
  59. shi r6, r0, 0xe
  60. #endif
  61. #ifdef CFG_INTC_0
  62. /* interrupt_handler */
  63. addik r6, r0, _interrupt_handler
  64. sw r6, r1, r0
  65. lhu r7, r1, r0
  66. shi r7, r0, 0x12
  67. shi r6, r0, 0x16
  68. #endif
  69. /* hardware exception */
  70. addik r6, r0, _hw_exception_handler
  71. sw r6, r1, r0
  72. lhu r7, r1, r0
  73. shi r7, r0, 0x22
  74. shi r6, r0, 0x26
  75. /* enable instruction and data cache */
  76. mfs r12, rmsr
  77. ori r12, r12, 0xa0
  78. mts rmsr, r12
  79. /* jumping to board_init */
  80. brai board_init
  81. 1: bri 1b