/*
 * @Author: Laputa
 * @Version: V0.0
 * @Date: 2023-05-30 15:44:53
 * @LastEditors: Laputa
 * @LastEditTime: 2023-09-15 18:26:03
 * @Description: 
 * 
 * Copyright (c) 2023 by Levetop, All Rights Reserved. 
 */
 
/* Highest address of the user mode stack */
/*_estack = 0x20010000; */   /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x8000;      /* required amount of heap  */
_Min_Stack_Size = 0x4000; /* required amount of stack */

MEMORY 
{
        Flash  (rx)	        		: ORIGIN = 0x6000A000, LENGTH = 1960K
        RAM    (rwx)        		: ORIGIN = 0x00800000, LENGTH = 512K		/* RGB: 512K others: 768K*/
        RAM_display (rw)    	: ORIGIN = 0x00880000, LENGTH = 256K		/* RGB: 0x880000 256K others: 0x8C0000 0K */
}

STACK_LOCATION = ORIGIN(RAM) + LENGTH(RAM) - 4 ;

SECTIONS
{
  .vector : 
    { 	
        VECTOR_LOCATION = .;
        KEEP(*vector_table.o(.rodata*));
    } > Flash
            
  .rodata :
  	{
        . = ALIGN(4);
  	    *( .rodata);
        *( .rodata*);
  	} > Flash = 0x0E

  .text   :    
    {
        . = ALIGN(4);
         *(.text);
        *(.text.*);
        _end_text = .;
    } > Flash = 0x0E
		
  .data   :  AT(_end_text)
    { 
     _start_data = .;
        . = ALIGN(4); 
           *( .data);
         *( .data.*);
       _end_data = .; 
    } > RAM = 0x0E

  .bss     : 
    { 
      _start_bss = .;
        . = ALIGN(4); 
            *( .bss);
          *( .bss.*);
           *(COMMON);
        _end_bss = .;
     } >RAM = 0x0E
     
		/* User_heap_stack section, used to check that there is enough RAM left */
		
._user_heap_stack :
	{
  		. = ALIGN(8);
		PROVIDE ( end = . );
	  	PROVIDE ( _end = . );
		. = . + _Min_Heap_Size;
		. = . + _Min_Stack_Size;
		. = ALIGN(8);
		 _end_bss = .;
	} >RAM   
          
     _end = _end_bss;

   .dispaly_buff 0x880000 : {*(.dispaly_buff)} > RAM_display
           
}      

