Microchip Technology SW006023-2 Ficha De Dados
Main, Runtime Start-up and Reset
2012 Microchip Technology Inc.
DS51686E-page 157
12.4
THE ON RESET ROUTINE
Some hardware configurations require special initialization, often within the first few
instruction cycles after reset. To achieve this, there is a hook provided via the on reset
routine.
instruction cycles after reset. To achieve this, there is a hook provided via the on reset
routine.
This routine is called after initializing a minimum ‘C’ context. An empty weak version of
this procedure (_on_reset) is provided with the start-up code. A stub for this routine
can be found in pic32-libs/libc/stubs in the installation directory of your
compiler.
this procedure (_on_reset) is provided with the start-up code. A stub for this routine
can be found in pic32-libs/libc/stubs in the installation directory of your
compiler.
Special consideration needs to be taken by the user if this procedure is written in ‘C’.
Most importantly, statically allocated variables are not initialized (with either the speci-
fied initializer or a zero as required for uninitialized variables).The stack pointer has
been initialized when this routine is called.
Most importantly, statically allocated variables are not initialized (with either the speci-
fied initializer or a zero as required for uninitialized variables).The stack pointer has
been initialized when this routine is called.
12.4.1
Clearing Objects
The runtime start-up code will clear all memory locations occupied by uninitialized
variables so they will contain zero before main() is executed.
variables so they will contain zero before main() is executed.
Variables whose contents should be preserved over a reset should use the
persistent
persistent
attribute, see Section 6.10 “Standard Type Qualifiers” for more infor-
mation. Such variables are linked in a different area of memory and are not altered by
the runtime start-up code in any way.
the runtime start-up code in any way.