fsl_flexspi_nor_boot.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * The Clear BSD License
  3. * Copyright 2017 NXP
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted (subject to the limitations in the disclaimer below) provided
  8. * that the following conditions are met:
  9. *
  10. * o Redistributions of source code must retain the above copyright notice, this list
  11. * of conditions and the following disclaimer.
  12. *
  13. * o Redistributions in binary form must reproduce the above copyright notice, this
  14. * list of conditions and the following disclaimer in the documentation and/or
  15. * other materials provided with the distribution.
  16. *
  17. * o Neither the name of the copyright holder nor the names of its
  18. * contributors may be used to endorse or promote products derived from this
  19. * software without specific prior written permission.
  20. *
  21. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  24. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  26. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  29. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. #ifndef _QUADSPI_BOOT_H_
  34. #define _QUADSPI_BOOT_H_
  35. #include <stdint.h>
  36. /*************************************
  37. * IVT Data
  38. *************************************/
  39. typedef struct _ivt_ {
  40. /** @ref hdr with tag #HAB_TAG_IVT, length and HAB version fields
  41. * (see @ref data)
  42. */
  43. uint32_t hdr;
  44. /** Absolute address of the first instruction to execute from the
  45. * image
  46. */
  47. uint32_t entry;
  48. /** Reserved in this version of HAB: should be NULL. */
  49. uint32_t reserved1;
  50. /** Absolute address of the image DCD: may be NULL. */
  51. uint32_t dcd;
  52. /** Absolute address of the Boot Data: may be NULL, but not interpreted
  53. * any further by HAB
  54. */
  55. uint32_t boot_data;
  56. /** Absolute address of the IVT.*/
  57. uint32_t self;
  58. /** Absolute address of the image CSF.*/
  59. uint32_t csf;
  60. /** Reserved in this version of HAB: should be zero. */
  61. uint32_t reserved2;
  62. } ivt;
  63. #define IVT_MAJOR_VERSION 0x4
  64. #define IVT_MAJOR_VERSION_SHIFT 0x4
  65. #define IVT_MAJOR_VERSION_MASK 0xF
  66. #define IVT_MINOR_VERSION 0x1
  67. #define IVT_MINOR_VERSION_SHIFT 0x0
  68. #define IVT_MINOR_VERSION_MASK 0xF
  69. #define IVT_VERSION(major, minor) \
  70. ((((major) & IVT_MAJOR_VERSION_MASK) << IVT_MAJOR_VERSION_SHIFT) | \
  71. (((minor) & IVT_MINOR_VERSION_MASK) << IVT_MINOR_VERSION_SHIFT))
  72. #define IVT_TAG_HEADER (0xD1) /**< Image Vector Table */
  73. #define IVT_SIZE 0x2000
  74. #define IVT_PAR IVT_VERSION(IVT_MAJOR_VERSION, IVT_MINOR_VERSION)
  75. #define IVT_HEADER (IVT_TAG_HEADER | (IVT_SIZE << 8) | (IVT_PAR << 24))
  76. #define IVT_RSVD (uint32_t)(0x00000000)
  77. /*************************************
  78. * Boot Data
  79. *************************************/
  80. typedef struct _boot_data_ {
  81. uint32_t start; /* boot start location */
  82. uint32_t size; /* size */
  83. uint32_t plugin; /* plugin flag - 1 if downloaded application is plugin */
  84. uint32_t placeholder; /* placehoder to make even 0x10 size */
  85. }BOOT_DATA_T;
  86. /*************************************
  87. * DCD Data
  88. *************************************/
  89. #define DCD_TAG_HEADER (0xD2)
  90. #define DCD_TAG_HEADER_SHIFT (24)
  91. #define DCD_VERSION (0x40)
  92. #define DCD_ARRAY_SIZE 1
  93. #define FLASH_BASE 0x60000000
  94. #define FLASH_END 0x7F7FFFFF
  95. #define SCLK 1
  96. #define DCD_ADDRESS dcd_sdram
  97. #define BOOT_DATA_ADDRESS &boot_data
  98. #define CSF_ADDRESS 0
  99. #define PLUGIN_FLAG (uint32_t)0
  100. /* External Variables */
  101. extern const uint8_t dcd_sdram[1072];
  102. extern const BOOT_DATA_T boot_data;
  103. #endif