fw_header.c 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. #include "fw_header.h"
  2. __attribute__((section(".fw_header"))) struct bootheader_t fw_header = {
  3. .magiccode = 0x504e4642,
  4. .rivison = 0x00000001,
  5. /*flash config */
  6. .flash_cfg.magiccode = 0x47464346,
  7. .flash_cfg.cfg.ioMode = 0x11, /*!< Serail flash interface mode,bit0-3:IF mode,bit4:unwrap */
  8. .flash_cfg.cfg.cReadSupport = 0x00, /*!< Support continuous read mode,bit0:continuous read mode support,bit1:read mode cfg */
  9. .flash_cfg.cfg.clkDelay = 0x01, /*!< SPI clock delay,bit0-3:delay,bit4-6:pad delay */
  10. .flash_cfg.cfg.clkInvert = 0x01, /*!< SPI clock phase invert,bit0:clck invert,bit1:rx invert,bit2-4:pad delay,bit5-7:pad delay */
  11. .flash_cfg.cfg.resetEnCmd = 0x66, /*!< Flash enable reset command */
  12. .flash_cfg.cfg.resetCmd = 0x99, /*!< Flash reset command */
  13. .flash_cfg.cfg.resetCreadCmd = 0xff, /*!< Flash reset continuous read command */
  14. .flash_cfg.cfg.resetCreadCmdSize = 0x03, /*!< Flash reset continuous read command size */
  15. .flash_cfg.cfg.jedecIdCmd = 0x9f, /*!< JEDEC ID command */
  16. .flash_cfg.cfg.jedecIdCmdDmyClk = 0x00, /*!< JEDEC ID command dummy clock */
  17. .flash_cfg.cfg.enter32BitsAddrCmd = 0xb7, /*!< Enter 32-bits addr command */
  18. .flash_cfg.cfg.exit32BitsAddrCmd = 0xe9, /*!< Exit 32-bits addr command */
  19. .flash_cfg.cfg.sectorSize = 0x04, /*!< *1024bytes */
  20. .flash_cfg.cfg.mid = 0x00, /*!< Manufacturer ID */
  21. .flash_cfg.cfg.pageSize = 0x100, /*!< Page size */
  22. .flash_cfg.cfg.chipEraseCmd = 0xc7, /*!< Chip erase cmd */
  23. .flash_cfg.cfg.sectorEraseCmd = 0x20, /*!< Sector erase command */
  24. .flash_cfg.cfg.blk32EraseCmd = 0x52, /*!< Block 32K erase command,some Micron not support */
  25. .flash_cfg.cfg.blk64EraseCmd = 0xd8, /*!< Block 64K erase command */
  26. .flash_cfg.cfg.writeEnableCmd = 0x06, /*!< Need before every erase or program */
  27. .flash_cfg.cfg.pageProgramCmd = 0x02, /*!< Page program cmd */
  28. .flash_cfg.cfg.qpageProgramCmd = 0x32, /*!< QIO page program cmd */
  29. .flash_cfg.cfg.qppAddrMode = 0x00, /*!< QIO page program address mode */
  30. .flash_cfg.cfg.fastReadCmd = 0x0b, /*!< Fast read command */
  31. .flash_cfg.cfg.frDmyClk = 0x01, /*!< Fast read command dummy clock */
  32. .flash_cfg.cfg.qpiFastReadCmd = 0x0b, /*!< QPI fast read command */
  33. .flash_cfg.cfg.qpiFrDmyClk = 0x01, /*!< QPI fast read command dummy clock */
  34. .flash_cfg.cfg.fastReadDoCmd = 0x3b, /*!< Fast read dual output command */
  35. .flash_cfg.cfg.frDoDmyClk = 0x01, /*!< Fast read dual output command dummy clock */
  36. .flash_cfg.cfg.fastReadDioCmd = 0xbb, /*!< Fast read dual io comamnd */
  37. .flash_cfg.cfg.frDioDmyClk = 0x00, /*!< Fast read dual io command dummy clock */
  38. .flash_cfg.cfg.fastReadQoCmd = 0x6b, /*!< Fast read quad output comamnd */
  39. .flash_cfg.cfg.frQoDmyClk = 0x01, /*!< Fast read quad output comamnd dummy clock */
  40. .flash_cfg.cfg.fastReadQioCmd = 0xeb, /*!< Fast read quad io comamnd */
  41. .flash_cfg.cfg.frQioDmyClk = 0x02, /*!< Fast read quad io comamnd dummy clock */
  42. .flash_cfg.cfg.qpiFastReadQioCmd = 0xeb, /*!< QPI fast read quad io comamnd */
  43. .flash_cfg.cfg.qpiFrQioDmyClk = 0x02, /*!< QPI fast read QIO dummy clock */
  44. .flash_cfg.cfg.qpiPageProgramCmd = 0x02, /*!< QPI program command */
  45. .flash_cfg.cfg.writeVregEnableCmd = 0x50, /*!< Enable write reg */
  46. .flash_cfg.cfg.wrEnableIndex = 0x00, /*!< Write enable register index */
  47. .flash_cfg.cfg.qeIndex = 0x01, /*!< Quad mode enable register index */
  48. .flash_cfg.cfg.busyIndex = 0x00, /*!< Busy status register index */
  49. .flash_cfg.cfg.wrEnableBit = 0x01, /*!< Write enable bit pos */
  50. .flash_cfg.cfg.qeBit = 0x01, /*!< Quad enable bit pos */
  51. .flash_cfg.cfg.busyBit = 0x00, /*!< Busy status bit pos */
  52. .flash_cfg.cfg.wrEnableWriteRegLen = 0x02, /*!< Register length of write enable */
  53. .flash_cfg.cfg.wrEnableReadRegLen = 0x01, /*!< Register length of write enable status */
  54. .flash_cfg.cfg.qeWriteRegLen = 0x02, /*!< Register length of contain quad enable */
  55. .flash_cfg.cfg.qeReadRegLen = 0x01, /*!< Register length of contain quad enable status */
  56. .flash_cfg.cfg.releasePowerDown = 0xab, /*!< Release power down command */
  57. .flash_cfg.cfg.busyReadRegLen = 0x01, /*!< Register length of contain busy status */
  58. .flash_cfg.cfg.readRegCmd[0] = 0x05, /*!< Read register command buffer */
  59. .flash_cfg.cfg.readRegCmd[1] = 0x35, /*!< Read register command buffer */
  60. .flash_cfg.cfg.readRegCmd[2] = 0x00, /*!< Read register command buffer */
  61. .flash_cfg.cfg.readRegCmd[3] = 0x00, /*!< Read register command buffer */
  62. .flash_cfg.cfg.writeRegCmd[0] = 0x01, /*!< Write register command buffer */
  63. .flash_cfg.cfg.writeRegCmd[1] = 0x01, /*!< Write register command buffer */
  64. .flash_cfg.cfg.writeRegCmd[2] = 0x00, /*!< Write register command buffer */
  65. .flash_cfg.cfg.writeRegCmd[3] = 0x00, /*!< Write register command buffer */
  66. .flash_cfg.cfg.enterQpi = 0x38, /*!< Enter qpi command */
  67. .flash_cfg.cfg.exitQpi = 0xff, /*!< Exit qpi command */
  68. .flash_cfg.cfg.cReadMode = 0x20, /*!< Config data for continuous read mode */
  69. .flash_cfg.cfg.cRExit = 0xf0, /*!< Config data for exit continuous read mode */
  70. .flash_cfg.cfg.burstWrapCmd = 0x77, /*!< Enable burst wrap command */
  71. .flash_cfg.cfg.burstWrapCmdDmyClk = 0x03, /*!< Enable burst wrap command dummy clock */
  72. .flash_cfg.cfg.burstWrapDataMode = 0x02, /*!< Data and address mode for this command */
  73. .flash_cfg.cfg.burstWrapData = 0x40, /*!< Data to enable burst wrap */
  74. .flash_cfg.cfg.deBurstWrapCmd = 0x77, /*!< Disable burst wrap command */
  75. .flash_cfg.cfg.deBurstWrapCmdDmyClk = 0x03, /*!< Disable burst wrap command dummy clock */
  76. .flash_cfg.cfg.deBurstWrapDataMode = 0x02, /*!< Data and address mode for this command */
  77. .flash_cfg.cfg.deBurstWrapData = 0xf0, /*!< Data to disable burst wrap */
  78. .flash_cfg.cfg.timeEsector = 300, /*!< 4K erase time */
  79. .flash_cfg.cfg.timeE32k = 1200, /*!< 32K erase time */
  80. .flash_cfg.cfg.timeE64k = 1200, /*!< 64K erase time */
  81. .flash_cfg.cfg.timePagePgm = 50, /*!< Page program time */
  82. .flash_cfg.cfg.timeCe = 30000, /*!< Chip erase time in ms */
  83. .flash_cfg.cfg.pdDelay = 20, /*!< Release power down command delay time for wake up */
  84. .flash_cfg.cfg.qeData = 0, /*!< QE set data */
  85. .flash_cfg.crc32 = 0xdeadbeef,
  86. /* clock cfg */
  87. .clk_cfg.magiccode = 0x47464350,
  88. .clk_cfg.cfg.xtal_type = 0x07, /*!< 0:None,1:24M,2:32M,3:38.4M,4:40M,5:26M,6:RC32M */
  89. .clk_cfg.cfg.mcu_clk = 0x04, /*!< mcu_clk 0:RC32M,1:Xtal,2:cpupll 400M,3:wifipll 192M,4:wifipll 320M */
  90. .clk_cfg.cfg.mcu_clk_div = 0x00,
  91. .clk_cfg.cfg.mcu_bclk_div = 0x00,
  92. .clk_cfg.cfg.mcu_pbclk_div = 0x03,
  93. .clk_cfg.cfg.lp_div = 0x01,
  94. .clk_cfg.cfg.dsp_clk = 0x03, /* 0:RC32M,1:Xtal,2:wifipll 240M,3:wifipll 320M,4:cpupll 400M */
  95. .clk_cfg.cfg.dsp_clk_div = 0x00,
  96. .clk_cfg.cfg.dsp_bclk_div = 0x01,
  97. .clk_cfg.cfg.dsp_pbclk = 0x02, /* 0:RC32M,1:Xtal,2:wifipll 160M,3:cpupll 160M,4:wifipll 240M */
  98. .clk_cfg.cfg.dsp_pbclk_div = 0x00,
  99. .clk_cfg.cfg.emi_clk = 0x02, /*!< 0:mcu pbclk,1:cpupll 200M,2:wifipll 320M,3:cpupll 400M */
  100. .clk_cfg.cfg.emi_clk_div = 0x01,
  101. .clk_cfg.cfg.flash_clk_type = 0x01, /*!< 0:wifipll 120M,1:xtal,2:cpupll 100M,3:wifipll 80M,4:bclk,5:wifipll 96M */
  102. .clk_cfg.cfg.flash_clk_div = 0x00,
  103. .clk_cfg.cfg.wifipll_pu = 0x01,
  104. .clk_cfg.cfg.aupll_pu = 0x01,
  105. .clk_cfg.cfg.cpupll_pu = 0x01,
  106. .clk_cfg.cfg.mipipll_pu = 0x01,
  107. .clk_cfg.cfg.uhspll_pu = 0x01,
  108. .clk_cfg.crc32 = 0xdeadbeef,
  109. /* basic cfg */
  110. .basic_cfg.sign_type = 0x0, /* [1: 0] for sign */
  111. .basic_cfg.encrypt_type = 0x0, /* [3: 2] for encrypt */
  112. .basic_cfg.key_sel = 0x0, /* [5: 4] key slot */
  113. .basic_cfg.xts_mode = 0x0, /* [6] for xts mode */
  114. .basic_cfg.aes_region_lock = 0x0, /* [7] rsvd */
  115. .basic_cfg.no_segment = 0x1, /* [8] no segment info */
  116. .basic_cfg.rsvd_0 = 0x0, /* [9] boot2 enable(rsvd_0) */
  117. .basic_cfg.rsvd_1 = 0x0, /* [10] boot2 rollback(rsvd_1) */
  118. .basic_cfg.cpu_master_id = 0x0, /* [14: 11] master id */
  119. .basic_cfg.notload_in_bootrom = 0x0, /* [15] notload in bootrom */
  120. .basic_cfg.crc_ignore = 0x1, /* [16] ignore crc */
  121. .basic_cfg.hash_ignore = 0x1, /* [17] hash ignore */
  122. .basic_cfg.power_on_mm = 0x1, /* [18] power on mm */
  123. .basic_cfg.em_sel = 0x1, /* [21: 19] em_sel */
  124. .basic_cfg.cmds_en = 0x1, /* [22] command spliter enable */
  125. #if 0
  126. # 0 : cmds bypass wrap commands to macro, original mode;
  127. # 1 : cmds handle wrap commands, original mode;
  128. # 2 : cmds bypass wrap commands to macro, cmds force wrap16 * 4 splitted into two wrap8 * 4;
  129. # 3 : cmds handle wrap commands, cmds force wrap16 * 4 splitted into two wrap8 * 4
  130. #endif
  131. .basic_cfg.cmds_wrap_mode = 0x1, /* [24: 23] cmds wrap mode */
  132. #if 0
  133. # 0 : SF_CTRL_WRAP_LEN_8, 1 : SF_CTRL_WRAP_LEN_16, 2 : SF_CTRL_WRAP_LEN_32,
  134. # 3 : SF_CTRL_WRAP_LEN_64, 9 : SF_CTRL_WRAP_LEN_4096
  135. #endif
  136. .basic_cfg.cmds_wrap_len = 0x9, /* [28: 25] cmds wrap len */
  137. .basic_cfg.icache_invalid = 0x1, /* [29] icache invalid */
  138. .basic_cfg.dcache_invalid = 0x1, /* [30] dcache invalid */
  139. .basic_cfg.rsvd_3 = 0x0, /* [31] rsvd_3 */
  140. #ifdef BFLB_BOOT2
  141. .basic_cfg.group_image_offset = 0x00002000, /* flash controller offset */
  142. #else
  143. .basic_cfg.group_image_offset = 0x00001000, /* flash controller offset */
  144. #endif
  145. .basic_cfg.aes_region_len = 0x00000000, /* aes region length */
  146. .basic_cfg.img_len_cnt = 0x00010000, /* image length or segment count */
  147. .basic_cfg.hash = { 0xdeadbeef }, /* hash of the image */
  148. /* cpu cfg */
  149. .cpu_cfg[0].config_enable = 0x01, /* coinfig this cpu */
  150. .cpu_cfg[0].halt_cpu = 0x0, /* halt this cpu */
  151. .cpu_cfg[0].cache_enable = 0x0, /* cache setting :only for BL Cache */
  152. .cpu_cfg[0].cache_wa = 0x0, /* cache setting :only for BL Cache*/
  153. .cpu_cfg[0].cache_wb = 0x0, /* cache setting :only for BL Cache*/
  154. .cpu_cfg[0].cache_wt = 0x0, /* cache setting :only for BL Cache*/
  155. .cpu_cfg[0].cache_way_dis = 0x0, /* cache setting :only for BL Cache*/
  156. .cpu_cfg[0].rsvd = 0x0,
  157. .cpu_cfg[0].cache_range_h = 0x00000000,
  158. .cpu_cfg[0].cache_range_l = 0x00000000,
  159. /* image_address_offset */
  160. .cpu_cfg[0].image_address_offset = 0x0,
  161. .cpu_cfg[0].rsvd0 = 0x58000000, /* rsvd0 */
  162. .cpu_cfg[0].msp_val = 0x00000000, /* msp value */
  163. /* cpu cfg */
  164. .cpu_cfg[1].config_enable = 0x0, /* coinfig this cpu */
  165. .cpu_cfg[1].halt_cpu = 0x0, /* halt this cpu */
  166. .cpu_cfg[1].cache_enable = 0x0, /* cache setting :only for BL Cache */
  167. .cpu_cfg[1].cache_wa = 0x0, /* cache setting :only for BL Cache*/
  168. .cpu_cfg[1].cache_wb = 0x0, /* cache setting :only for BL Cache*/
  169. .cpu_cfg[1].cache_wt = 0x0, /* cache setting :only for BL Cache*/
  170. .cpu_cfg[1].cache_way_dis = 0x0, /* cache setting :only for BL Cache*/
  171. .cpu_cfg[1].rsvd = 0x0,
  172. .cpu_cfg[1].cache_range_h = 0x00000000,
  173. .cpu_cfg[1].cache_range_l = 0x00000000,
  174. /* image_address_offset */
  175. .cpu_cfg[1].image_address_offset = 0x0,
  176. .cpu_cfg[1].rsvd0 = 0x58000000, /* rsvd0 */
  177. .cpu_cfg[1].msp_val = 0x00000000, /* msp value */
  178. /* address of partition table 0 */ /* 4 */
  179. .boot2_pt_table_0_rsvd = 0x00000000,
  180. /* address of partition table 1 */ /* 4 */
  181. .boot2_pt_table_1_rsvd = 0x00000000,
  182. /* address of flashcfg table list */ /* 4 */
  183. .flash_cfg_table_addr = 0x00000000,
  184. /* flashcfg table list len */ /* 4 */
  185. .flash_cfg_table_len = 0x00000000,
  186. .rsvd1[0] = 0x20000320,
  187. .rsvd1[1] = 0x00000000,
  188. .rsvd1[2] = 0x2000F038,
  189. .rsvd1[3] = 0x18000000,
  190. .crc32 = 0xdeadbeef /* 4 */
  191. };