ARM VERSION 1.2 Guide de l'utilisateur Page 86

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 133
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 85
EXPORT Reset_Handler
Reset_Handler
; --- Initialize stack pointer registers
; Enter each mode in turn and set up the stack pointer
IMPORT top_of_stacks ;defined in stack.s and located by scatter file
LDR r0, =top_of_stacks
; MSR CPSR_c, #Mode_FIQ:OR:I_Bit:OR:F_Bit ; No interrupts
; SUB sp, r0, #Offset_FIQ_Stack
MSR CPSR_c, #Mode_IRQ:OR:I_Bit:OR:F_Bit ; No interrupts
SUB sp, r0, #Offset_IRQ_Stack
; MSR CPSR_c, #Mode_ABT:OR:I_Bit:OR:F_Bit ; No interrupts
; SUB sp, r0, #Offset_ABT_Stack
; MSR CPSR_c, #Mode_UND:OR:I_Bit:OR:F_Bit ; No interrupts
; SUB sp, r0, #Offset_UND_Stack
MSR CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit ; No interrupts
SUB sp, r0, #Offset_SVC_Stack
; ...
; --- Initialize memory system
IF :DEF: CACHE
IMPORT Clock_Speed ; in CMclocks.s
IMPORT Cache_Init ; in the core-specific files e.g. 940T.s
BL Clock_Speed
BL Cache_Init
ENDIF
; --- Initialize critical IO devices
; ...
; --- Now change to User mode and set up User mode stack.
MSR CPSR_c, #Mode_USR:OR:F_Bit ; IRQs now enabled
SUB sp, r0, #Offset_USR_Stack
IMPORT __main
; --- Now enter the C code
B __main ; note use B not BL
; because an application will never return this way
END
The code in Example 6-5 implements a retarget layer for low-level I/O. Typically, this contains your own
target-dependent implementations of fputc(), ferror(), and so on. This example provides implementations of
fputc(), ferror(), _sys_exit(), _ttywrch(), and __user_initial_stackheap().
Semihosting SWIs are used to display text onto the console of the host debugger. This mechanism is portable across
ARMulator, Angel, Multi-ICE, and EmbeddedICE. serial.c is an option that outputs characters from the serial port
of an ARM Integrator board. To use serial.c, add #define USE_SERIAL_PORT to the code or compile with
-DUSE_SERIAL_PORT.
Example 6-5 retarget.c
/*
** This implements a 'retarget' layer for low-level IO. Typically, this
** would contain your own target-dependent implementations of fputc(),
** ferror(), etc.
**
** This example provides implementations of fputc(), ferror(),
** _sys_exit(), _ttywrch() and __user_initial_stackheap().
**
** Here, semihosting SWIs are used to display text onto the console
** of the host debugger. This mechanism is portable across ARMulator,
** Angel, Multi-ICE and EmbeddedICE.
**
** Alternatively, to output characters from the serial port of an
** ARM Integrator Board (see serial.c), use:
Writing Code for ROM
Copyright ?1999 2001 ARM Limited 6-11
Vue de la page 85
1 2 ... 81 82 83 84 85 86 87 88 89 90 91 ... 132 133

Commentaires sur ces manuels

Pas de commentaire