📄 lh7a400_evbstart.s~
字号:
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; * $Workfile: LH7A400_evbstart.s $
; * $Revision: 1.0 $
; * $Author: WellsK $
; * $Date: Sep 23 2002 13:52:02 $
; *
; * Project: LH7A400 Evaluation Board
; *
; * Description:
; BootROM code for LH7A400
;
;Pre-defines: See also LH7A400_evb.i
; START_C_ENTRY
; If it is desired to use this startup to jump to C Runtime
; initialization code, pre-define START_C_ENTRY
; with an assembler SETA pre-define,e.g., "START_C_ENTRY SETA 0x1"
; Otherwise, this code will run, then spin while waiting
; for the debugger to interrupt it.
;
; BOOTMODE = 1
; Maps Asynchronous Flash to 0x0, Synchronous Flash to 0xF0000000
; Any other value swaps mapping.
;
;
; * $Log: //smaicnt2/pvcs/VM/CDROM/archives/KEV7A400/Software/Startup_lite/LH7A400_evbstart.s-arc $
;
; Rev 1.0 Sep 23 2002 13:52:02 WellsK
; Initial revision.
;
; Rev 1.0 Sep 14 2002 11:38:06 WellsK
; Initial revision.
;
; Rev 1.11 Jun 27 2002 09:37:22 BarnettH
; Allocated space for later installation of FIQ Handler, so default handlers will remain in effect.
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Copyright (c) 2002 Sharp Microelectronics of the Americas
;
; All rights reserved
;
; SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
; OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
; AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES,
; SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
;
; SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY
; FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A
; SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
; FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; AREA BootEVB400, CODE ; name this block of code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; KEV7A400 Definitions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; See LH7A400_evb.i
; IMPORT LH7A400_clkset_default
; IMPORT LH7A400_clock_set
; IMPORT LH7A400_delay_timer_msecs
; IMPORT LH7A400_evb_get_dipsw
; IMPORT LH7A400_evb_set_led
; IMPORT LH7A400_evb_toggle_led
; IMPORT LH7A400_init_mem
; IMPORT LH7A400_init_mmu_tables_wrapper
; IMPORT LH7A400_init_muxdpins
; IMPORT SMA_copylongs
; IMPORT SMA_get_mmu_control_reg
; IMPORT util_set_sevenseg_blank
; IMPORT util_set_sevenseg_hexval
; IMPORT default_clock
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;*********** The RESET entry point ***********
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; EXPORT Rom_Start
; ENTRY
; Exception vector table
;;Rom_Start
*/
.include "LH7A400_evb.i"
.global _start
.text
_start:
/*; run out of the ROM Physical location*/
LDR pc, L_Reset_Handler /*; 0x00*/
B Undefined_Handler /*; 0x04*/
B SWI_Handler /*; 0x08*/
B Prefetch_Handler /*; 0x0C*/
B Abort_Handler /*; 0x10*/
NOP /*; Reserved vector*/
B IRQ_Handler /*; 0x18*/
FIQ_Handler:
/*; FIQ code can grow from here up to space allocated maximum*/
SUBS pc,lr,#4 /*; 0x1C*/
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Allocate space for the FIQ Handler, if used.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*/
/*;SPACE 0x100 - 0x20*/
.space (0x100 - 0x20)
/*;ALIGN */
.align
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The following handlers save status if possible running from flash
; See Save_Status comments for locations in IRAM of saved status.
; User will replace these under program control as desired when
; Exception Vector Table is in RAM.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*/
L_Reset_Handler:
.word Reset_Handler
Undefined_Handler:
B Save_Status
SWI_Handler:
B Save_Status
Prefetch_Handler:
B Save_Status
Abort_Handler:
B Save_Status
IRQ_Handler:
B Save_Status
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Reset Handler
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*/
Reset_Handler:
/*; Ensure MMU disabled, all control bits cleared, FastBus Mode.*/
/*
; Save Boot Status in both Boot Type and Software Reset Type locations
; See LHA400_evb.i for addresses in IRAM where these data are stored
; for later reference if needed.
*/
save_boot_status:
clear_save_status:
Normal_Start:
/*; Enable I-Cache immediately*/
/*
; After Reset, the processor begins execution in ARM Supervisor Mode
; with interrupts disabled. However, the processor may be in another
; mode when it arrives here, e.g., a branch directly to 0x0 while in
; System Mode.
;
*/
/*; Enter SVC mode, ARM Mode, mask interrupts at core, clear status bits*/
init_CPU_mode:
MOV r0,#(MODE_SVC | I_MASK | F_MASK) /*; No Interrupts*/
MSR cpsr_cxsf, r0
/*; Reset the SVC stack pointer to Internal SRAM*/
init_SVC_stack:
LDR r13, =IRAM_SVC_STACK_BASE
/* LDR r13, =0x02000000*/
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Since we now have a stack, we can do basic initialization with C code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*/
/*; Initialize the Clocks*/
init_clock: /*;200-100-25*/
LDR r0, =default_clock
LDR r0, [r0]
/* BL LH7A400_clock_set*/
/*; Initialize SDRAM and SRAM memory*/
init_memory:
BL LH7A400_init_mem
/*; Watchdog Timer cannot be stopped, but it can be masked*/
/*; Ensure all interrupts are masked, including WDT interrupts*/
mask_interrupts:
MVN r0,#0
LDR r1,=INTC_REG_BASE
STR r0,[r1,#INTC_INTENC_OFFSET]
/*; Enter SVC mode, ARM Mode, no interrupts, clear status bits*/
reset_CPU_mode:
MOV r0,#(MODE_SVC | I_MASK | F_MASK) /*; No Interrupts*/
MSR cpsr_cxsf, r0
/*; Reset the SVC stack pointer to Internal SRAM*/
reset_SVC_stack:
LDR r13, =IRAM_SVC_STACK_BASE
init_regions:
/*; zzz Revisit this conditional assembly*/
/*; Zero Initialize .bss section in RAM*/
init_zi:
ldr a1,=__bss_start__ @ Pickup the start of the BSS area
mov a3,#0 @ Clear value in a3
ldr a2,=__bss_end__ @ Pickup the end of the BSS area
clear_loop:
cmp a1,a2 @ end of bss ?
strne a3,[a1],#4 @ Clear a word, a1 += 4
bne clear_loop
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Initialize MMU coprocessor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Since we have a stack, we can set up the Translation Table and
; Page Tables from 'C'.
*/
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Jump to the virtual address
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*/
/* MOV pc, r5 /*; Jump to the virtual address*/
/* NOP /*; These NOP's are in the pipeline and do nothing'*/
/* NOP /*; as they are executed.*/
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Running at Virtual Memory addresses hereafter
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*/
inVirtMem:
disable_interrupts:
MVN r0,#0
LDR r1,=INTC_REG_BASE
STR r0,[r1,#INTC_INTENC_OFFSET]
/*.if START_C_ENTRY = 1*/
MOV r0,#MODE_SVC /*; Enable Processor Interrupts*/
MSR cpsr_cxsf, r0
LDR r13, =IRAM_SVC_STACK_BASE
/*;-- Now we enter the C runtime initialization code*/
/* IMPORT C_Entry*/
/* B flash_prog32_entry*/
/* B v_start */
Save_Status:
1:
b 1b
/*.endif*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -