📄 mcf5213_lo.s
字号:
/*
* File: mcf5213.s
* Purpose: Low-level routines for the MCF5213/12/11.
*
* Notes:
*/
#ifdef _UNDERSCORE_
#define sysinit _sysinit
#define main _main
#define __IPSBAR ___IPSBAR
#define __SRAM ___SRAM
#define __FLASH ___FLASH
#define __SP_INIT ___SP_INIT
#endif
.extern ___IPSBAR
.extern ___SRAM
.extern ___FLASH
.extern ___SP_INIT
.extern sysinit
.extern main
.global asm_startmeup
.global _asm_startmeup
.global cpu_cache_flush
.global _cpu_cache_flush
.text
/********************************************************************
*
* This is the main entry point upon hard reset. The memory map is
* setup based on linker file definitions, then the higher level
* system initialization routine is called. Finally, we jump to the
* "main" process.
*/
asm_startmeup:
_asm_startmeup:
/* Initialize RAMBAR1: locate SRAM and validate it */
move.l #__SRAM,d0
add.l #0x21,d0
movec d0,RAMBAR1
/* Locate Stack Pointer */
move.l #__SP_INIT,sp
/* Initialize IPSBAR */
move.l #__IPSBAR,d0
add.l #0x1,d0
move.l d0,0x40000000
/* Initialize FLASHBAR */
move.l #__FLASH,d0
cmp.l #0x00000000,d0
bne change_flashbar
add.l #0x21,d0
movec d0,RAMBAR0
_continue_startup:
/* Locate Stack Pointer */
move.l #__SP_INIT,sp
/* Initialize the system */
jsr sysinit
/* Jump to the main process */
jsr main
bra .
nop
nop
halt
/*
* The following sequence is used to set FLASHBAR. Since we may
* be executing from Flash, we must put the routine into SRAM for
* execution and then jump back to Flash using the new address.
*
* The following instructions are coded into the SRAM:
*
* move.l #(__FLASH + 0x21),d0
* movec d0, RAMBAR0
* jmp _continue_startup
*
* An arbitrary SRAM address is chosen until the real address
* can be loaded.
*
* This routine is not necessary if the default Flash address
* (0x00000000) is used. In that case, initialization can
* begin at _continue_startup.
*
* If running in SRAM, change_flashbar should not be executed
*/
change_flashbar:
move.l #__SRAM,a0
/* Code "move.l #(__FLASH + 0x21),d7" into SRAM */
move.w #0x203C,d0
move.w d0,(a0)+
move.l #__FLASH,d0
add.l #0x21,d0
move.l d0,(a0)+
/* Code "movec d7,FLASHBAR" into SRAM */
move.l #0x4e7b0C04,d0
move.l d0,(a0)+
/* Code "jmp _continue_startup" into SRAM */
move.w #0x4EF9,d0
move.w d0,(a0)+
move.l #_continue_startup,d0
move.l d0,(a0)+
/* Jump to code segment in internal SRAM */
jmp __SRAM
/********************************************************************
* No cache - nothing to do here
*/
cpu_cache_flush:
_cpu_cache_flush:
rts
/********************************************************************/
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -