Files
1CAR/middleware/flashloader/flash_loader_asm.s
2025-10-25 21:11:06 +08:00

172 lines
3.8 KiB
ArmAsm

;---------------------------------
;
; Copyright (c) 2008 IAR Systems
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; $Revision: 117855 $
;
; Functions accessed by the debugger to perform a flash download.
; All public symbols and the function FlashBreak() are looked up and called by the debugger.
;
;---------------------------------
#define _CORTEX_ ((__CORE__ == __ARM6M__) || (__CORE__ == __ARM6SM__) || (__CORE__ == __ARM7M__) \
|| (__CORE__ == __ARM7EM__) || (__CORE__ == __ARM8M__) || (__CORE__ == __ARM8M_BASELINE__) \
|| (__CORE__ == __ARM8M_MAINLINE__) || (__CORE__ == __ARM8EM_MAINLINE__))
PUBLIC FlashInitEntry
PUBLIC FlashWriteEntry
PUBLIC FlashEraseWriteEntry
PUBLIC FlashChecksumEntry
PUBLIC FlashSignoffEntry
PUBLIC FlashBufferStart
PUBLIC FlashBufferEnd
EXTERN FlashBreak
EXTERN Fl2FlashInitEntry
EXTERN Fl2FlashWriteEntry
EXTERN Fl2FlashEraseWriteEntry
EXTERN Fl2FlashChecksumEntry
EXTERN Fl2FlashSignoffEntry
SECTION CSTACK:DATA:NOROOT(3)
;---------------------------------
;
; FlashInitEntry()
; Debugger interface function
;
;---------------------------------
SECTION .text:CODE:ROOT(2)
#if !_CORTEX_
ARM
#else
THUMB
#endif
FlashInitEntry:
#if !_CORTEX_
;; Set up the normal stack pointer.
LDR sp, =SFE(CSTACK) ; End of CSTACK
#endif
BL Fl2FlashInitEntry
BL FlashBreak
;---------------------------------
;
; FlashWriteEntry()
; Debugger interface function
;
;---------------------------------
SECTION .text:CODE:ROOT(2)
#if !_CORTEX_
ARM
#else
THUMB
#endif
FlashWriteEntry:
BL Fl2FlashWriteEntry
BL FlashBreak
;---------------------------------
;
; FlashEraseWriteEntry
; Debugger interface function
;
;---------------------------------
SECTION .text:CODE:ROOT(2)
#if !_CORTEX_
ARM
#else
THUMB
#endif
FlashEraseWriteEntry:
BL Fl2FlashEraseWriteEntry
BL FlashBreak
;---------------------------------
;
; FlashChecksumEntry
; Debugger interface function
;
;---------------------------------
SECTION .text:CODE:NOROOT(2)
#if !_CORTEX_
ARM
#else
THUMB
#endif
FlashChecksumEntry:
BL Fl2FlashChecksumEntry
BL FlashBreak
;---------------------------------
;
; FlashSignoffEntry
; Debugger interface function
;
;---------------------------------
SECTION .text:CODE:NOROOT(2)
#if !_CORTEX_
ARM
#else
THUMB
#endif
FlashSignoffEntry:
BL Fl2FlashSignoffEntry
BL FlashBreak
;---------------------------------
;
; Flash buffer and Cortex stack
;
;---------------------------------
SECTION LOWEND:DATA(8)
DATA
FlashBufferStart:
SECTION HIGHSTART:DATA
DATA
FlashBufferEnd:
#if _CORTEX_
PUBLIC __vector_table
SECTION .intvec:CODE:ROOT(2)
DATA
__vector_table:
DC32 SFE(CSTACK)
DC32 FlashInitEntry
; The following dummy entries are needed for NXP devices that requires a checksum for the range __vector_table-__vector_table+0x1B
DC32 0
DC32 0
DC32 0
DC32 0
DC32 0
DC32 0
#endif
END