⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 b_m56621evb.s

📁 realview22.rar
💻 S
字号:
; ============================================================================
; B_M56621EVB - Flash programming routine for ARM using Intel Flash.
;
; Library Name: <B_M56621EVB.AXF>
;
; Module Name:  B_M56621EVB.S
; Module Descr: Flash programming for ARM+IntelFlash.
; Creation Date:2000
; Author:       Jonathan Jefferies copied from AEB1 by Paul K.
;
; THIS INFORMATION IS PROPRIETARY TO
; ARM (ALLANT SOFTWARE, INC.)
; 1280 Civic Drive, Suite 206
; Walnut Creek, CA 94596
; USA
; ----------------------------------------------------------------------
; Copyright (c) 2000  Allant Software, Inc.
; ALL RIGHTS RESERVED;
;
; Revisions of B_AEB1.S: (latest revision on top)
; #.#  Name  Date      Description
; $Revision: 1.1.6.1 $
; ---  ----- --------  -----------------------------------------------------
;
; Implementation notes:
;
; GENERAL
; -------
;
;       This file is an example initialization and setup for
; an ARM Board using Intel Flash and an ARM tool chain (see the
; separate example for TI boards and tools).
;
;       This should be modified to reflect the changes for your 
; board/chip:
;       - set access size to 1 or 2 or 4.
;       - setup any registers for waitstates, chip selects,
;         write-enables, etc.
;       - disable any watchdog timers, etc.
;       Note that the .ame file should include information on 
; what has been changed so RVDEBUG can save/restore to allow
; continuation.
;
; -----------------------------------------------------------------------------
; Description:
; ----------------------------------------------------------------------------
;                               NOTICE
;
;       This code is proprietary; the use of this source is
; restricted, and all rights are reserved.
;
;       If reading for interest, enjoy.
;
;       If maintaining, read comments carefully! There are some inter-depen-
; dencies and connectivities. Areas with particular connection are marked.
; There are some variable protocols that are not self evident: check all uses
; of variables before making big changes.
; ============================================================================
;



;************************************************************************/
;* DEFINE MACROS AND EQUATES                                            */
;************************************************************************/

WIDTH   EQU     2               ; word accesses (set to 2 for half)

ALLRAM  EQU     1               ; is in RAM vs. CODE in ROM

TRUE    EQU     1

;************************************************************************/
;* STACK DATA (in CODE or DATA seg)                                     */
;************************************************************************/

        ; now define a tiny stack for the two levels of call we do
        IF ALLRAM = TRUE        ; is PC-rel and in RAM
         AREA   FLASH_STACK, CODE
         DCD    0,0,0,0,0,0,0,0,0,0,0,0 ; 12 words for call depth
stack_top DATA
        ELSE                    ; CODE in ROM, so stack in RAM
         ; note that we use initialized data. This is not really
         ; needed but works around a problem in the ARM model where
         ; the section name is lost so we have to be able to see
         ; stack+data vs. buffer (BSS).
         AREA   FLASH_VARS, DATA, READWRITE
         DCD    0,0,0,0,0,0,0,0,0,0,0,0 ; 12 words for call depth
stack_top
        ENDIF

;************************************************************************/
;* PRIVATE DATA FOR INIT ROUTINE                                        */
;************************************************************************/

        AREA    FLASH_TEXT, CODE, READONLY
; These variables below (read-only) are used for init routine
CHIP_SELECT     DATA            ; example chip select ptr
                ;DCD    0x2000000
        IF ALLRAM <> TRUE       ; CODE in ROM
STACK           DATA
                DCD     stack_top; top of stack
        ENDIF

;************************************************************************/
;* THE GLOBAL FUNCTIONS (EXPORTED PUBLICLY)                             */
;************************************************************************/
 
;* -----------------------------------------------------------------------
;  FLASH_init - initialize the board (memory access controls, etc).
;
;  Notes:
;     - this routine can do any initialization needed for the board
;       or ASICs. Examples include disabling watchdogs, enabling
;       chip selectors/enables to allow write to this memory, etc.
;     - In this implementation, we setup the MEMIF registers to allow
;       access to the Flash. Instead of restore in terminate routine,
;       we let host restore the MEMIF memory.
;
;  Input/Output:
;     - In: R1=Base of Flash
;           R0=Page of Flash (no meaning for ARM)
;     - Out:R0=status code (0=OK, else error)
;   ----------------------------------------------------------------------- */

        EXPORT          FLASH_init
        ENTRY                   ; 1st instruction below

FLASH_init
        IF ALLRAM = TRUE        ; is PC-rel and in RAM
        ldr     SP,stack_top    ; get stack directly 
        ELSE
        ldr     SP,STACK        ; get stack indirectly
        ENDIF
        ;ldr    R2,CHIP_SELECT  ; set CHIP_SELECT state
        ;ldrh   R0,[R2]         ; get current state
        ;orr    R0,R0,#3        ; allow writes to Flash
        ;strh   R0,[R2]         ; write back original plus change

        mov     R0,#0x50
        strb    R0,[R1]         ; write to Flash - clear status
 
        bl      check_status    ; check Flash status and return in R0
        b       Local_init      ; finish init, then Stop on breakpoint


;************************************************************************/
;* Include the INTEL Flash algorithm here to do actual work             */
;************************************************************************/

        INCLUDE f_intel_arm.s   ; include Intel routine

;************************************************************************/
;* DEFINE BUFFER FOR WRITE/VERIFY and STACK                             */
;************************************************************************/


        AREA BUFFER, NOINIT
buffer  %       1024    ; buffer for copying
        ; Note on above: we do not need to do it this way, but this is 
        ; simplest if we want to have the routine and buffer all in one 
        ; memory block

        END

⌨️ 快捷键说明

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