ramrun_8811.ld 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. // * CONFIG_SIMAGE_HEADER_SIZE: uimage header size.
  18. //
  19. // Address between [__flash_start, __flash_end] is romable.
  20. #include "link_defs.ld"
  21. #include "hal_config.h"
  22. #include "boot_config.h"
  23. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  24. OUTPUT_ARCH(arm)
  25. ENTRY(bootEntry)
  26. EXTERN(bootEntry)
  27. #define text_contents *(BOOT_ENTRY) \
  28. SORT(*)(.sramboottext .sramboottext.*) \
  29. SORT(*)(.sramtext .sramtext.*) \
  30. SORT(*)(.ramtext .ramtext.*) \
  31. SORT(*)(DEF_RO)
  32. #define data_contents SORT(*)(.sramdata .sramdata.*) \
  33. SORT(*)(DEF_RW)
  34. #define bss_contents *(.srambss .srambss.*) \
  35. *(DEF_ZI)
  36. MEMORY {
  37. sram(rwx): ORIGIN = RAMRUN_IMAGE_START, LENGTH = RAMRUN_IMAGE_SIZE
  38. }
  39. SECTIONS {
  40. NOLOAD_SIZE_SECT(simage, CONFIG_SIMAGE_HEADER_SIZE) > sram
  41. ANCHOR_SECT(flash_start) > sram
  42. NOAT_SECT(text) > sram
  43. NOAT_SECT(data) > sram
  44. ANCHOR_SECT(flash_end) > sram
  45. NOLOAD_SECT(bss) > sram
  46. NOLOAD_SIZE_SECT(main_stack, CONFIG_BOOT_MAIN_STACK_SIZE) > sram
  47. NOLOAD_SIZE_SECT(process_stack, CONFIG_BOOT_PROCESS_STACK_SIZE) > sram
  48. NOLOAD_SIZE_SECT(blue_screen, CONFIG_BLUE_SCREEN_SIZE) > sram
  49. NOLOAD_END_SECT(sram_heap, ORIGIN(sram) + LENGTH(sram)) > sram
  50. #ifdef RAMRUN_FLASH_SIZE
  51. ASSERT(__flash_end - RAMRUN_IMAGE_START <= RAMRUN_FLASH_SIZE, "flash overflow")
  52. #endif
  53. IGNORE_DISCARD_SECTS
  54. }