MPC5646C_init_ram.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. *
  3. * FILE : MPC55xx_init_debug.c
  4. *
  5. * DESCRIPTION:
  6. * This file contains the MPC55xx derivative needed initializations.
  7. * MPC55xx_init_debug.c is only used when willing to debug in RAM. Otherwise,
  8. * MPC55xx_init.c shall be used.
  9. * usr_init() is called by the startup code of the application at initialization time
  10. * You can add needed hardware initializations here.
  11. */
  12. #include "Exceptions.h" /* IVPR and default exception handlers setup */
  13. #include "IntcInterrupts.h" /* INTC Interrupts Requests configuration */
  14. #include "MPC5646C_HWInit.h"
  15. #pragma section code_type ".init"
  16. #define INIT_DERIVATIVE_INTERNAL_SETUP 0
  17. #define INIT_EXTERNAL_BUS_INTERFACE_SETUP 0
  18. #ifndef INIT_DERIVATIVE_INTERNAL_SETUP
  19. #pragma error INIT_DERIVATIVE_INTERNAL_SETUP should be defined !
  20. #endif
  21. #ifndef INIT_EXTERNAL_BUS_INTERFACE_SETUP
  22. #pragma error INIT_EXTERNAL_BUS_INTERFACE_SETUP should be defined !
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. extern __asm void __start();
  28. __asm void usr_init();
  29. /*lint -esym(752,__start) */
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. /*****************************************************************/
  34. /* usr_init(): */
  35. /* Define here the needed hardware initializations at startup */
  36. __asm void usr_init()
  37. {
  38. /* Add needed hardware initializations in this function */
  39. nofralloc
  40. mflr r30 /* Save off return address in NV reg */
  41. #if INIT_DERIVATIVE_INTERNAL_SETUP==1
  42. bl INIT_Derivative /* Derivative specific hardware initializations */
  43. #endif
  44. #if INIT_EXTERNAL_BUS_INTERFACE_SETUP==1
  45. bl INIT_ExternalBusAndMemory /* Set up access to external memory (inc. chip select and MMU) */
  46. #endif
  47. bl EXCEP_InitExceptionHandlers /* Set up Default Exception handling */
  48. bl INTC_InitINTCInterrupts /* Set up INTC Interrupts Requests handling */
  49. mtlr r30 /* Get saved return address */
  50. blr
  51. }