ARM VERSION 1.2 Guide de l'utilisateur Page 80

  • 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 79
See the code in the Examples\embedded\cache directory for examples of cache initialization code.
Initializing the stack pointers
The initialization code initializes the stack pointer registers. You might have to initialize some or all of the following
stack pointers, depending on the interrupts and exceptions you use:
sp_SVC
This must always be initialized.
sp_IRQ
This must be initialized if IRQ interrupts are used. It must be initialized before interrupts are
enabled.
sp_FIQ
This must be initialized if FIQ interrupts are used. It must be initialized before interrupts are
enabled.
sp_ABT
This must be initialized for Data and Prefetch Abort handling.
sp_UND
This must be initialized for Undefined Instruction handling.
Generally, sp_ABT and sp_UND are not used in a simple embedded system. However, you might want to initialize
them for debugging purposes.
You can set up the stack pointer sp_USR when you change to User mode to start executing the application.
Caution
If you are using scatter loading, you must retarget the function __user_initial_stackheap() to place the stack
and heap. If you do not, there might be link errors because the default implementation provided by the C library
attempts to use Image$$ZI$$Limit that is not defined when scatter loading is used. See Loading the ROM image
at address 0 for more information on retargeting this function.
Initializing any critical I/O devices
Critical I/O devices are any devices that you must initialize before you enable interrupts. Typically, you must initialize
these devices at this point. If you do not, they might cause spurious interrupts when interrupts are enabled.
Changing processor mode
At this stage the processor is still in Supervisor mode. If your application runs in User mode, change to User mode
and initialize the User mode sp register, sp_USR.
Changing processor state
All ARM cores, including Thumb-capable processors, start up in ARM state on reset. The initialization code (at least
the reset handler) must be ARM code. If the application is compiled for Thumb, main() is Thumb code. The linker
can add ARM to Thumb interworking veneers automatically to change state between the ARM initialization code and
the Thumb application.
6.3.2 Initializing the application
An application is initialized by:
initializing the nonzero writable data by copying the initializing values to the writable data region
setting to zero the ZI writable data region.
After memory initialization, control is passed to the entry point of the application in, for example, C library code.
Initializing memory required by C code
The initial values for any initialized variables (RW) must be copied from ROM to RAM. All other ZI variables must be
initialized to zero. The library initialization code called at __main performs the copying and initialization.
Note
The linker assigns memory addresses for RO code, RW data, and ZI data. If a scatter-load description file is not
used, the linker uses one of the default layouts. Scatter-loading examples are given in Loading the ROM image at
address 0 and Using both scatter loading and remapping.
Using the main function
When the compiler compiles a function called main(), it generates a reference to the symbol __main to force the
linker to include the basic C run-time system from the ANSI C library. (The symbol __main is marked as an entry
point.)
Writing Code for ROM
Copyright ?1999 2001 ARM Limited 6-5
Vue de la page 79
1 2 ... 75 76 77 78 79 80 81 82 83 84 85 ... 132 133

Commentaires sur ces manuels

Pas de commentaire