ramrun_8910.ld 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. // This will link an arm elf for uimage. The definitions needed:
  13. // * RAMRUN_IMAGE_START: The sram start address, including uimage header.
  14. // * RAMRUN_IMAGE_SIZE: The sram size.
  15. // * RAMRUN_FLASH_SIZE: The maximum romable size. When defined, it is only
  16. // used to check romable size.
  17. // * RAMRUN_MMU_ENABLE: 1 for MMU enabled, 0 for disabled
  18. // * CONFIG_UIMAGE_HEADER_SIZE: uimage header size.
  19. //
  20. // Address between [__flash_start, __flash_end] is romable.
  21. #include "link_defs.ld"
  22. #include "hal_config.h"
  23. #include "boot_config.h"
  24. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  25. OUTPUT_ARCH(arm)
  26. ENTRY(bootEntry)
  27. EXTERN(bootEntry)
  28. #define text_contents *(BOOT_ENTRY) \
  29. SORT(*)(.sramboottext .sramboottext.*) \
  30. SORT(*)(.sramtext .sramtext.*) \
  31. SORT(*)(.ramtext .ramtext.*) \
  32. SORT(*)(DEF_RO) \
  33. KEEP(*(.rokeep))
  34. #define data_contents SORT(*)(.sramdata .sramdata.*) \
  35. SORT(*)(DEF_RW) \
  36. KEEP(*(.rwkeep))
  37. #define bss_contents *(.srambss .srambss.*) \
  38. *(DEF_ZI)
  39. MEMORY {
  40. sram(rwx): ORIGIN = RAMRUN_IMAGE_START, LENGTH = RAMRUN_IMAGE_SIZE
  41. }
  42. SECTIONS {
  43. NOLOAD_SIZE_SECT(uimage, CONFIG_UIMAGE_HEADER_SIZE) > sram
  44. ANCHOR_SECT(flash_start) > sram
  45. NOAT_SECT(text) > sram
  46. NOAT_SECT(data) > sram
  47. ANCHOR_SECT(flash_end) > sram
  48. NOLOAD_SECT(bss) > sram
  49. NOLOAD_SIZE_SECT(sys_stack, CONFIG_BOOT_SYS_STACK_SIZE) > sram
  50. NOLOAD_SIZE_SECT(irq_stack, CONFIG_BOOT_IRQ_STACK_SIZE) > sram
  51. NOLOAD_SIZE_SECT(blue_screen, CONFIG_BLUE_SCREEN_SIZE) > sram
  52. #if defined(RAMRUN_MMU_ENABLE) && (RAMRUN_MMU_ENABLE)
  53. NOLOAD_END_SECT(sram_heap, ORIGIN(sram) + LENGTH(sram) - 0x4400) > sram
  54. NOLOAD_SIZE_SECT(mmu_ttbl2, 0x400) > sram
  55. NOLOAD_SIZE_SECT(mmu_ttbl1, 0x4000) > sram
  56. ASSERT(__mmu_ttbl1_start % 16384 == 0, "TTB L1 is not aligned")
  57. #else
  58. NOLOAD_END_SECT(sram_heap, ORIGIN(sram) + LENGTH(sram)) > sram
  59. #endif
  60. #ifdef RAMRUN_FLASH_SIZE
  61. ASSERT(__flash_end - RAMRUN_IMAGE_START <= RAMRUN_FLASH_SIZE, "flash overflow")
  62. #endif
  63. IGNORE_DISCARD_SECTS
  64. }