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.

bootdata.c 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. #if defined(ARDUINO_TEENSY40)
  55. 0x00200000, // sflashA1Size 0x50
  56. #elif defined(ARDUINO_TEENSY41)
  57. 0x00800000, // sflashA1Size 0x50
  58. #else
  59. #error "Unknow flash chip size";
  60. #endif
  61. 0, // sflashA2Size
  62. 0, // sflashB1Size
  63. 0, // sflashB2Size
  64. 0, // csPadSettingOverride 0x60
  65. 0, // sclkPadSettingOverride
  66. 0, // dataPadSettingOverride
  67. 0, // dqsPadSettingOverride
  68. 0, // timeoutInMs 0x70
  69. 0, // commandInterval
  70. 0, // dataValidTime
  71. 0x00000000, // busyBitPolarity,busyOffset
  72. 0x0A1804EB, // lookupTable[0] 0x80
  73. 0x26043206, // lookupTable[1]
  74. 0, // lookupTable[2]
  75. 0, // lookupTable[3]
  76. 0x24040405, // lookupTable[4] 0x90
  77. 0, // lookupTable[5]
  78. 0, // lookupTable[6]
  79. 0, // lookupTable[7]
  80. 0, // lookupTable[8] 0xA0
  81. 0, // lookupTable[9]
  82. 0, // lookupTable[10]
  83. 0, // lookupTable[11]
  84. 0x00000406, // lookupTable[12] 0xB0
  85. 0, // lookupTable[13]
  86. 0, // lookupTable[14]
  87. 0, // lookupTable[15]
  88. 0, // lookupTable[16] 0xC0
  89. 0, // lookupTable[17]
  90. 0, // lookupTable[18]
  91. 0, // lookupTable[19]
  92. 0x08180420, // lookupTable[20] 0xD0
  93. 0, // lookupTable[21]
  94. 0, // lookupTable[22]
  95. 0, // lookupTable[23]
  96. 0, // lookupTable[24] 0xE0
  97. 0, // lookupTable[25]
  98. 0, // lookupTable[26]
  99. 0, // lookupTable[27]
  100. 0, // lookupTable[28] 0xF0
  101. 0, // lookupTable[29]
  102. 0, // lookupTable[30]
  103. 0, // lookupTable[31]
  104. 0x081804D8, // lookupTable[32] 0x100
  105. 0, // lookupTable[33]
  106. 0, // lookupTable[34]
  107. 0, // lookupTable[35]
  108. 0x08180402, // lookupTable[36] 0x110
  109. 0x00002004, // lookupTable[37]
  110. 0, // lookupTable[38]
  111. 0, // lookupTable[39]
  112. 0, // lookupTable[40] 0x120
  113. 0, // lookupTable[41]
  114. 0, // lookupTable[42]
  115. 0, // lookupTable[43]
  116. 0x00000460, // lookupTable[44] 0x130
  117. 0, // lookupTable[45]
  118. 0, // lookupTable[46]
  119. 0, // lookupTable[47]
  120. 0, // lookupTable[48] 0x140
  121. 0, // lookupTable[49]
  122. 0, // lookupTable[50]
  123. 0, // lookupTable[51]
  124. 0, // lookupTable[52] 0x150
  125. 0, // lookupTable[53]
  126. 0, // lookupTable[54]
  127. 0, // lookupTable[55]
  128. 0, // lookupTable[56] 0x160
  129. 0, // lookupTable[57]
  130. 0, // lookupTable[58]
  131. 0, // lookupTable[59]
  132. 0, // lookupTable[60] 0x170
  133. 0, // lookupTable[61]
  134. 0, // lookupTable[62]
  135. 0, // lookupTable[63]
  136. 0, // LUT 0: Read 0x180
  137. 0, // LUT 1: ReadStatus
  138. 0, // LUT 3: WriteEnable
  139. 0, // LUT 5: EraseSector
  140. 0, // LUT 9: PageProgram 0x190
  141. 0, // LUT 11: ChipErase
  142. 0, // LUT 15: Dummy
  143. 0, // LUT unused?
  144. 0, // LUT unused? 0x1A0
  145. 0, // LUT unused?
  146. 0, // LUT unused?
  147. 0, // LUT unused?
  148. 0, // reserved 0x1B0
  149. 0, // reserved
  150. 0, // reserved
  151. 0, // reserved
  152. // 64 byte Serial NOR configuration block, 8.6.3.2, page 346
  153. 256, // pageSize 0x1C0
  154. 4096, // sectorSize
  155. 1, // ipCmdSerialClkFreq
  156. 0, // reserved
  157. 0x00010000, // block size 0x1D0
  158. 0, // reserved
  159. 0, // reserved
  160. 0, // reserved
  161. 0, // reserved 0x1E0
  162. 0, // reserved
  163. 0, // reserved
  164. 0, // reserved
  165. 0, // reserved 0x1F0
  166. 0, // reserved
  167. 0, // reserved
  168. 0 // reserved
  169. };