hpm_bootheader.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2021 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #include "hpm_bootheader.h"
  8. /* symbol exported from startup.S */
  9. extern uint32_t _start[];
  10. /* following symbols exported from linker script */
  11. extern uint32_t __app_load_addr__[];
  12. extern uint32_t __app_offset__[];
  13. extern uint32_t __fw_size__[];
  14. #define FW_SIZE (32768)
  15. __attribute__ ((section(".fw_info_table"))) const fw_info_table_t fw_info = {
  16. (uint32_t)__app_offset__, /* offset */
  17. (uint32_t)__fw_size__, /* size */
  18. 0, /* flags */
  19. 0, /* reserved0 */
  20. (uint32_t) &__app_load_addr__, /* load_addr */
  21. 0, /* reserved1 */
  22. (uint32_t) _start, /* entry_point */
  23. 0, /* reserved2 */
  24. {0}, /* hash */
  25. {0}, /* iv */
  26. };
  27. __attribute__ ((section(".boot_header"))) const boot_header_t header = {
  28. HPM_BOOTHEADER_TAG, /* tag */
  29. 0x10, /* version*/
  30. sizeof(header) + sizeof(fw_info),
  31. 0, /* flags */
  32. 0, /* sw_version */
  33. 0, /* fuse_version */
  34. 1, /* fw_count */
  35. 0,
  36. 0, /* sig_block_offset */
  37. };