ivt.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) 2010-2012, Freescale Semiconductor, Inc.
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification,
  6. * are permitted provided that the following conditions are met:
  7. *
  8. * o Redistributions of source code must retain the above copyright notice, this list
  9. * of conditions and the following disclaimer.
  10. *
  11. * o Redistributions in binary form must reproduce the above copyright notice, this
  12. * list of conditions and the following disclaimer in the documentation and/or
  13. * other materials provided with the distribution.
  14. *
  15. * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
  16. * contributors may be used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  23. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  26. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #include "hab_defines.h"
  31. extern unsigned * _start_image_add;
  32. extern unsigned * __start_boot_data;
  33. extern unsigned * _image_size;
  34. extern unsigned * __hab_data;
  35. extern uint8_t input_dcd_hdr[];
  36. extern void _start(void);
  37. struct hab_ivt input_ivt __attribute__ ((section (".ivt"))) ={
  38. /** @ref hdr word with tag #HAB_TAG_IVT, length and HAB version fields
  39. * (see @ref data)
  40. */
  41. IVT_HDR(sizeof(struct hab_ivt), HAB_VER(4, 0)),
  42. /** Absolute address of the first instruction to execute from the
  43. * image
  44. */
  45. (hab_image_entry_f)_start,
  46. /** Reserved in this version of HAB: should be NULL. */
  47. NULL,
  48. /** Absolute address of the image DCD: may be NULL. */
  49. &input_dcd_hdr,
  50. /** Absolute address of the Boot Data: may be NULL, but not interpreted
  51. * any further by HAB
  52. */
  53. &__start_boot_data,
  54. /** Absolute address of the IVT.*/
  55. (const void*) (&input_ivt),
  56. /** Absolute address of the image CSF.*/
  57. (const void*) &__hab_data,
  58. /** Reserved in this version of HAB: should be zero. */
  59. 0
  60. };
  61. typedef struct {
  62. uint32_t start; /**< Start address of the image */
  63. uint32_t size; /**< Size of the image */
  64. uint32_t plugin; /**< Plugin flag */
  65. } boot_data_t;
  66. boot_data_t bd __attribute__ ((section (".boot_data"))) ={
  67. (uint32_t) &_start_image_add,
  68. (uint32_t) &_image_size,
  69. 0,
  70. };