The Powerup Routine

Some hardware configurations require special initialization, often within the first few instruction cycles after Reset. To achieve this, there is a hook to the Reset vector provided via the powerup routine.

This routine can be supplied in a user-defined assembler module. A template powerup routine is provided in the file powerup.S which is located in the pic/sources directory of your compiler distribution. Refer to comments in this file for more details.

The file should be copied to your working directory, modified, and included into your project as a source file. No special linker options or other code is required. The compiler will detect if you have defined a powerup routine and will automatically execute this code after reset, provided the code is contained in a psect (section) called powerup.

For correct operation, the code must end with a goto instruction that jumps to the label called start. As with all user-defined assembly code, any code inside this file must take into consideration program memory paging and/or data memory banking, as well as any applicable errata issues for the device you are using.