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

📄 b_at91eb01.s

📁 realview22.rar
💻 S
字号:
; ============================================================================
; B_AT91EB01 - Flash programming routine for ARM using Atmel Flash.
;
; Library Name: <B_AT91EB01.AXF>
;
; Module Name:  B_AT91EB01.S
; Module Descr: Flash programming for ARM+AtmelFlash.
; Creation Date:April 2000
; Author:       Paul Kimelman
;
; THIS INFORMATION IS PROPRIETARY TO
; 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_AT91EB01.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 Atmel 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               ; half-word accesses (1 for bytes)

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

DATA_USED EQU   0               ; we do not need data vars

TRUE    EQU     1


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

        IF DATA_USED = TRUE
         ; now define a data pool
         IF ALLRAM = TRUE       ; is PC-rel and in RAM
         AREA   FLASH_VARS, CODE, PIC
data_base DATA
         DCD    0               ; data goes here!
         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
data_base
         DCD    0               ; data goes here!
         ENDIF                  ; ALLRAM
        ENDIF                   ; DATA_USED

;************************************************************************/
;* 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 DATA_USED = TRUE
         IF ALLRAM <> TRUE      ; CODE in ROM
DATA_VARS       DATA
                ;DCD    data_base; can get pointer to data
         ENDIF
        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: R11=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 DATA_USED = TRUE
         IF ALLRAM = TRUE       ; is PC-rel and in RAM
         adr    SP,data_base    ; get data directly 
         ELSE
         ldr    SP,DATA_VARS    ; get data indirectly
         ENDIF
        ENDIF

        b       Local_init      ; finish init, then Stop on breakpoint


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

        INCLUDE f_atmel_arm.s   ; include Atmel 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 + -