hal_startup.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /**************************************************************************************************
  2. Filename: hal_startup.c
  3. Revised: $Date: 2010-01-28 16:31:53 -0800 (Thu, 28 Jan 2010) $
  4. Revision: $Revision: 21613 $
  5. Description: Contains code that needs to run before main()
  6. Copyright 2008 Texas Instruments Incorporated. All rights reserved.
  7. IMPORTANT: Your use of this Software is limited to those specific rights
  8. granted under the terms of a software license agreement between the user
  9. who downloaded the software, his/her employer (which must be your employer)
  10. and Texas Instruments Incorporated (the "License"). You may not use this
  11. Software unless you agree to abide by the terms of the License. The License
  12. limits your use, and you acknowledge, that the Software may not be modified,
  13. copied or distributed unless embedded on a Texas Instruments microcontroller
  14. or used solely and exclusively in conjunction with a Texas Instruments radio
  15. frequency transceiver, which is integrated into your product. Other than for
  16. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  17. works of, modify, distribute, perform, display or sell this Software and/or
  18. its documentation for any purpose.
  19. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  20. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  21. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  22. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  23. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  24. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  25. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  26. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  27. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  28. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  29. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  30. Should you have any questions regarding your right to use this Software,
  31. contact Texas Instruments Incorporated at www.TI.com.
  32. **************************************************************************************************/
  33. /**************************************************************************************************
  34. * INCLUDES
  35. *************************************************************************************************/
  36. #include "hal_board.h"
  37. #include "hal_types.h"
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. #pragma language=extended
  42. //
  43. // Locate low_level_init in the CSTART module
  44. //
  45. #pragma location="CSTART"
  46. //
  47. // If the code model is banked, low_level_init must be declared
  48. // __near_func elsa a ?BRET is performed
  49. //
  50. #if (__CODE_MODEL__ == 2)
  51. __near_func __root char
  52. #else
  53. __root char
  54. #endif
  55. __low_level_init(void);
  56. /**************************************************************************************************
  57. * @fn __low_level_init
  58. *
  59. * @brief The function __low_level_init is called by the start-up code before doing
  60. * the normal initialization of data segments. If the return value is zero,
  61. * initialization is not performed.
  62. *
  63. * @param None
  64. *
  65. * @return 0 - don't intialize data segments / 1 - do initialization
  66. **************************************************************************************************/
  67. #if (__CODE_MODEL__ == 2)
  68. __near_func __root char
  69. #else
  70. __root char
  71. #endif
  72. __low_level_init(void)
  73. {
  74. /*==================================*/
  75. /* Initialize hardware. */
  76. /*==================================*/
  77. // Map flash bank #1 into XDATA for access to "ROM mapped as data".
  78. MEMCTR = (MEMCTR & 0xF8) | 0x01;
  79. /*==================================*/
  80. /* Choose if segment initialization */
  81. /* should be done or not. */
  82. /* Return: 0 to omit seg_init */
  83. /* 1 to run seg_init */
  84. /*==================================*/
  85. return 1;
  86. }
  87. #pragma language=default
  88. #ifdef __cplusplus
  89. }
  90. #endif