You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. //#include "imxrt.h"
  2. #include <stdint.h>
  3. extern void ResetHandler(void);
  4. extern unsigned long _estack;
  5. extern unsigned long _flashimagelen;
  6. __attribute__ ((section(".vectors"), used))
  7. const uint32_t vector_table[2] = {
  8. #if defined(__IMXRT1062__)
  9. 0x20010000, // 64K DTCM for boot, ResetHandler configures stack after ITCM/DTCM setup
  10. #endif
  11. (uint32_t)&ResetHandler
  12. };
  13. __attribute__ ((section(".bootdata"), used))
  14. const uint32_t BootData[3] = {
  15. 0x60000000,
  16. (uint32_t)&_flashimagelen,
  17. 0
  18. };
  19. __attribute__ ((section(".ivt"), used))
  20. const uint32_t ImageVectorTable[8] = {
  21. 0x402000D1, // header
  22. (uint32_t)vector_table, // docs are wrong, needs to be vec table, not start addr
  23. 0, // reserved
  24. 0, // dcd
  25. (uint32_t)BootData, // abs address of boot data
  26. (uint32_t)ImageVectorTable, // self
  27. 0, // command sequence file
  28. 0 // reserved
  29. };
  30. __attribute__ ((section(".flashconfig"), used))
  31. uint32_t FlexSPI_NOR_Config[128] = {
  32. // 448 byte common FlexSPI configuration block, 8.6.3.1 page 223 (RT1060 rev 0)
  33. // MCU_Flashloader_Reference_Manual.pdf, 8.2.1, Table 8-2, page 72-75
  34. 0x42464346, // Tag 0x00
  35. 0x56010000, // Version
  36. 0, // reserved
  37. 0x00020101, // columnAdressWidth,dataSetupTime,dataHoldTime,readSampleClkSrc
  38. 0x00000000, // waitTimeCfgCommands,-,deviceModeCfgEnable
  39. 0, // deviceModeSeq
  40. 0, // deviceModeArg
  41. 0x00000000, // -,-,-,configCmdEnable
  42. 0, // configCmdSeqs 0x20
  43. 0,
  44. 0,
  45. 0,
  46. 0, // cfgCmdArgs 0x30
  47. 0,
  48. 0,
  49. 0,
  50. 0x00000000, // controllerMiscOption 0x40
  51. 0x00030401, // lutCustomSeqEnable,serialClkFreq,sflashPadType,deviceType
  52. 0, // reserved
  53. 0, // reserved
  54. 0x00200000, // sflashA1Size 0x50
  55. 0, // sflashA2Size
  56. 0, // sflashB1Size
  57. 0, // sflashB2Size
  58. 0, // csPadSettingOverride 0x60
  59. 0, // sclkPadSettingOverride
  60. 0, // dataPadSettingOverride
  61. 0, // dqsPadSettingOverride
  62. 0, // timeoutInMs 0x70
  63. 0, // commandInterval
  64. 0, // dataValidTime
  65. 0x00000000, // busyBitPolarity,busyOffset
  66. 0x0A1804EB, // lookupTable[0] 0x80
  67. 0x26043206, // lookupTable[1]
  68. 0, // lookupTable[2]
  69. 0, // lookupTable[3]
  70. 0x24040405, // lookupTable[4] 0x90
  71. 0, // lookupTable[5]
  72. 0, // lookupTable[6]
  73. 0, // lookupTable[7]
  74. 0, // lookupTable[8] 0xA0
  75. 0, // lookupTable[9]
  76. 0, // lookupTable[10]
  77. 0, // lookupTable[11]
  78. 0x00000406, // lookupTable[12] 0xB0
  79. 0, // lookupTable[13]
  80. 0, // lookupTable[14]
  81. 0, // lookupTable[15]
  82. 0, // lookupTable[16] 0xC0
  83. 0, // lookupTable[17]
  84. 0, // lookupTable[18]
  85. 0, // lookupTable[19]
  86. 0x08180420, // lookupTable[20] 0xD0
  87. 0, // lookupTable[21]
  88. 0, // lookupTable[22]
  89. 0, // lookupTable[23]
  90. 0, // lookupTable[24] 0xE0
  91. 0, // lookupTable[25]
  92. 0, // lookupTable[26]
  93. 0, // lookupTable[27]
  94. 0, // lookupTable[28] 0xF0
  95. 0, // lookupTable[29]
  96. 0, // lookupTable[30]
  97. 0, // lookupTable[31]
  98. 0x081804D8, // lookupTable[32] 0x100
  99. 0, // lookupTable[33]
  100. 0, // lookupTable[34]
  101. 0, // lookupTable[35]
  102. 0x08180402, // lookupTable[36] 0x110
  103. 0x00002004, // lookupTable[37]
  104. 0, // lookupTable[38]
  105. 0, // lookupTable[39]
  106. 0, // lookupTable[40] 0x120
  107. 0, // lookupTable[41]
  108. 0, // lookupTable[42]
  109. 0, // lookupTable[43]
  110. 0x00000460, // lookupTable[44] 0x130
  111. 0, // lookupTable[45]
  112. 0, // lookupTable[46]
  113. 0, // lookupTable[47]
  114. 0, // lookupTable[48] 0x140
  115. 0, // lookupTable[49]
  116. 0, // lookupTable[50]
  117. 0, // lookupTable[51]
  118. 0, // lookupTable[52] 0x150
  119. 0, // lookupTable[53]
  120. 0, // lookupTable[54]
  121. 0, // lookupTable[55]
  122. 0, // lookupTable[56] 0x160
  123. 0, // lookupTable[57]
  124. 0, // lookupTable[58]
  125. 0, // lookupTable[59]
  126. 0, // lookupTable[60] 0x170
  127. 0, // lookupTable[61]
  128. 0, // lookupTable[62]
  129. 0, // lookupTable[63]
  130. 0, // LUT 0: Read 0x180
  131. 0, // LUT 1: ReadStatus
  132. 0, // LUT 3: WriteEnable
  133. 0, // LUT 5: EraseSector
  134. 0, // LUT 9: PageProgram 0x190
  135. 0, // LUT 11: ChipErase
  136. 0, // LUT 15: Dummy
  137. 0, // LUT unused?
  138. 0, // LUT unused? 0x1A0
  139. 0, // LUT unused?
  140. 0, // LUT unused?
  141. 0, // LUT unused?
  142. 0, // reserved 0x1B0
  143. 0, // reserved
  144. 0, // reserved
  145. 0, // reserved
  146. // 64 byte Serial NOR configuration block, 8.6.3.2, page 346
  147. 256, // pageSize 0x1C0
  148. 4096, // sectorSize
  149. 1, // ipCmdSerialClkFreq
  150. 0, // reserved
  151. 0x00010000, // block size 0x1D0
  152. 0, // reserved
  153. 0, // reserved
  154. 0, // reserved
  155. 0, // reserved 0x1E0
  156. 0, // reserved
  157. 0, // reserved
  158. 0, // reserved
  159. 0, // reserved 0x1F0
  160. 0, // reserved
  161. 0, // reserved
  162. 0 // reserved
  163. };