embed_uish.s

来自「ADS1.2 samples」· S 代码 · 共 57 行

S
57
字号
;;  Copyright ARM Ltd 2002. All rights reserved.
;;
;;  This implementation of __user_initial_stackheap places the
;;  heap at the location of the symbol bottom_of_heap.  
;;  This symbol is placed by the scatter file.  
;;
;;  It assumes that the application mode stack has been placed
;;  in the reset handler.  
;;

        AREA   UISH, CODE, READONLY      ; name this block of code

    IF :DEF: LOCATIONS_IN_CODE
heap_base       DCD     0x14000
    ELSE
    
    IF :DEF: USE_SCATTER_SYMS
    
		IMPORT      ||Image$$HEAP$$ZI$$Base||
		IMPORT      ||Image$$HEAP$$ZI$$Limit||

heap_base	DCD     ||Image$$HEAP$$ZI$$Base||
heap_limit	DCD     ||Image$$HEAP$$ZI$$Limit||

    ELSE
    IMPORT  bottom_of_heap
heap_base       DCD     bottom_of_heap
    ENDIF
    ENDIF

        EXPORT __user_initial_stackheap

__user_initial_stackheap
    LDR   r0,heap_base
    MOV   pc,lr

        END
        
;; The following is the equivalent implementation of the above in C

;;
;; extern unsigned int bottom_of_heap;    //defined in heap.s
;;
;; __value_in_regs struct __initial_stackheap __user_initial_stackheap(
;;         unsigned R0, unsigned SP, unsigned R2, unsigned SL)
;; {
;;     struct __initial_stackheap config;
;;
;;     config.heap_base = (unsigned int)&bottom_of_heap; // defined in heap.s
;;                                                       // placed by scatterfile
;;     config.stack_base = SP;   // inherit SP from the execution environment
;;
;;     return config;
;; }
;;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?