boot.S 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file SAMA5D2/boot.S
  15. * @brief SAMA5D2 boot-related code.
  16. *
  17. * @addtogroup SAMA5D2_BOOT
  18. * @{
  19. */
  20. #define FALSE 0
  21. #define TRUE 1
  22. #define _FROM_ASM_
  23. #include "chlicense.h"
  24. #include "chconf.h"
  25. #include "armparams.h"
  26. #if !defined(__DOXYGEN__)
  27. .set AIC_REDIR_KEY, 0x5B6C0E26 << 1
  28. .set SFR_SN1, 0xF8030050
  29. .set SFR_AICREDIR, 0xF8030054
  30. .set SFR_L2CC_HRAMC, 0xF8030058
  31. .set L2CC_CR, 0x00A00100
  32. .section .boot
  33. .code 32
  34. .balign 4
  35. /*
  36. * Boot initialization code
  37. */
  38. .global Boot_Handler
  39. Boot_Handler:
  40. /*
  41. * Set VBAR to system vectors table
  42. */
  43. ldr r0, =_start
  44. mcr p15, 0, r0, c12, c0, 0
  45. /*
  46. * Reset SCTLR Settings
  47. */
  48. mrc p15, 0, r0, c1, c0, 0 // Read CP15 System Control register
  49. #if defined(ARM_RESET_SYS_CTRL)
  50. bic r0, r0, #(0x1 << 12) // Clear I bit 12 to disable I Cache
  51. bic r0, r0, #(0x1 << 2) // Clear C bit 2 to disable D Cache
  52. bic r0, r0, #0x1 // Clear M bit 0 to disable MMU
  53. bic r0, r0, #(0x1 << 11) // Clear Z bit 11 to disable branch prediction
  54. #endif
  55. bic r0, r0, #(0x1 << 13) // Clear V bit 13 to disable hivecs
  56. mcr p15, 0, r0, c1, c0, 0 // Write value back to CP15 System Control register
  57. isb
  58. b Reset_Handler
  59. #endif /* !defined(__DOXYGEN__) */
  60. /** @} */