8910_flashrun.ld 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #include "link_defs.ld"
  13. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  14. OUTPUT_ARCH(arm)
  15. ENTRY(Reset_Handler)
  16. EXTERN(Reset_Handler)
  17. #define ttbl1_contents *(.TTBL1)
  18. #define ttbl2_contents *(.TTBL2)
  19. #define entry_contents *(RESET)
  20. #define sramboottext_contents SORT(*)(.sramboottext .sramboottext.*)
  21. #define sramtext_contents *(VECTORS) \
  22. *libkernel.a:portASM.*(DEF_RO) \
  23. *libkernel.a:port.*(DEF_RO) \
  24. SORT(*)(.sramtext .sramtext.*)
  25. #define ramtext_contents SORT(*)(.ramtext .ramtext.*)
  26. #define text_contents SORT(*)(DEF_RO) KEEP(*(.rokeep))
  27. #define sramdata_contents SORT(*)(.sramdata .sramdata.*)
  28. #define data_contents SORT(*)(DEF_RW) KEEP(*(.rwkeep))
  29. #define srambss_contents *(.srambss .srambss.*)
  30. #define bss_contents *(DEF_ZI)
  31. #define init_array_contents KEEP(*(.init_array*))
  32. #ifdef CONFIG_APP_FLASH2_ENABLED
  33. /* libraries on external flash, should be tuned by requirement. */
  34. #define flash2text_contents SORT(*libonextflash.a:*)(DEF_RO)
  35. #endif
  36. #define SRAM_HEAP_END (ORIGIN(sram) + LENGTH(sram) - CONFIG_IRQ_STACK_SIZE - CONFIG_SVC_STACK_SIZE - CONFIG_BLUE_SCREEN_SIZE)
  37. MEMORY {
  38. flash(rx): ORIGIN = CONFIG_APP_FLASH_ADDRESS, LENGTH = CONFIG_APP_FLASH_SIZE
  39. ram(rwx): ORIGIN = CONFIG_APP_RAM_ADDRESS, LENGTH = CONFIG_APP_RAM_SIZE
  40. sram(rwx): ORIGIN = CONFIG_APP_SRAM_ADDRESS, LENGTH = CONFIG_APP_SRAM_SIZE
  41. #ifdef CONFIG_APP_FLASH2_ENABLED
  42. flash2(rx): ORIGIN = CONFIG_APP_FLASH2_ADDRESS, LENGTH = CONFIG_APP_FLASH2_SIZE
  43. #endif
  44. }
  45. SECTIONS {
  46. NOLOAD_SIZE_SECT(uimage, CONFIG_UIMAGE_HEADER_SIZE) > flash
  47. ANCHOR_SECT(flash_start) > flash
  48. NOAT_SECT_ALIGNED(ttbl1, 16384) > ram
  49. #ifdef CONFIG_BSCORE_ENABLE
  50. NOLOAD_SIZE_SECT(bscore, CONFIG_BSCORE_SIZE) >ram
  51. #endif
  52. NOAT_SECT_ALIGNED(ttbl2, 16384) > ram
  53. NOAT_SECT(entry) > flash
  54. LOAD_SECT(sramboottext) >sram AT>flash
  55. LOAD_SECT(sramtext) >sram AT>flash
  56. LOAD_SECT(ramtext) >ram AT>flash
  57. NOAT_SECT(init_array) > flash
  58. #ifdef CONFIG_APP_FLASH2_ENABLED
  59. ANCHOR_SECT(flash2_start) > flash2
  60. NOAT_SECT(flash2text) > flash2
  61. ANCHOR_SECT(flash2_end) > flash2
  62. #endif
  63. NOAT_SECT(text) > flash
  64. LOAD_SECT(sramdata) >sram AT>flash
  65. LOAD_SECT(data) >ram AT>flash
  66. NOLOAD_SECT(srambss) > sram
  67. NOLOAD_END_SECT(sram_heap, SRAM_HEAP_END) > sram
  68. NOLOAD_SIZE_SECT(blue_screen, CONFIG_BLUE_SCREEN_SIZE) > sram
  69. NOLOAD_SIZE_SECT(svc_stack, CONFIG_SVC_STACK_SIZE) > sram
  70. NOLOAD_SIZE_SECT(irq_stack, CONFIG_IRQ_STACK_SIZE) > sram
  71. NOLOAD_SECT(bss) > ram
  72. NOLOAD_END_SECT(heap, ORIGIN(ram) + LENGTH(ram)) > ram
  73. ANCHOR_SECT(flash_end) > flash
  74. IGNORE_DISCARD_SECTS
  75. }