F2837xD_CodeStartBranch.asm 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. ;//###########################################################################
  2. ;//
  3. ;// FILE: F2837xD_CodeStartBranch.asm
  4. ;//
  5. ;// TITLE: Branch for redirecting code execution after boot.
  6. ;//
  7. ;// For these examples, code_start is the first code that is executed after
  8. ;// exiting the boot ROM code.
  9. ;//
  10. ;// The codestart section in the linker cmd file is used to physically place
  11. ;// this code at the correct memory location. This section should be placed
  12. ;// at the location the BOOT ROM will re-direct the code to. For example,
  13. ;// for boot to FLASH this code will be located at 0x3f7ff6.
  14. ;//
  15. ;// In addition, the example F2837xD projects are setup such that the codegen
  16. ;// entry point is also set to the code_start label. This is done by linker
  17. ;// option -e in the project build options. When the debugger loads the code,
  18. ;// it will automatically set the PC to the "entry point" address indicated by
  19. ;// the -e linker option. In this case the debugger is simply assigning the PC,
  20. ;// it is not the same as a full reset of the device.
  21. ;//
  22. ;// The compiler may warn that the entry point for the project is other then
  23. ;// _c_init00. _c_init00 is the C environment setup and is run before
  24. ;// main() is entered. The code_start code will re-direct the execution
  25. ;// to _c_init00 and thus there is no worry and this warning can be ignored.
  26. ;//
  27. ;//###########################################################################
  28. ;// $TI Release: F2837xD Support Library v3.05.00.00 $
  29. ;// $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
  30. ;// $Copyright:
  31. ;// Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
  32. ;//
  33. ;// Redistribution and use in source and binary forms, with or without
  34. ;// modification, are permitted provided that the following conditions
  35. ;// are met:
  36. ;//
  37. ;// Redistributions of source code must retain the above copyright
  38. ;// notice, this list of conditions and the following disclaimer.
  39. ;//
  40. ;// Redistributions in binary form must reproduce the above copyright
  41. ;// notice, this list of conditions and the following disclaimer in the
  42. ;// documentation and/or other materials provided with the
  43. ;// distribution.
  44. ;//
  45. ;// Neither the name of Texas Instruments Incorporated nor the names of
  46. ;// its contributors may be used to endorse or promote products derived
  47. ;// from this software without specific prior written permission.
  48. ;//
  49. ;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  50. ;// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  51. ;// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  52. ;// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  53. ;// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  54. ;// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  55. ;// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  56. ;// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  57. ;// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  58. ;// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  59. ;// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  60. ;// $
  61. ;//###########################################################################
  62. ***********************************************************************
  63. WD_DISABLE .set 0 ;set to 1 to disable WD, else set to 0
  64. .ref _c_int00
  65. .global code_start
  66. ***********************************************************************
  67. * Function: codestart section
  68. *
  69. * Description: Branch to code starting point
  70. ***********************************************************************
  71. .sect "codestart"
  72. code_start:
  73. .if WD_DISABLE == 1
  74. LB wd_disable ;Branch to watchdog disable code
  75. .else
  76. LB _c_int00 ;Branch to start of boot._asm in RTS library
  77. .endif
  78. ;end codestart section
  79. ***********************************************************************
  80. * Function: wd_disable
  81. *
  82. * Description: Disables the watchdog timer
  83. ***********************************************************************
  84. .if WD_DISABLE == 1
  85. .text
  86. wd_disable:
  87. SETC OBJMODE ;Set OBJMODE for 28x object code
  88. EALLOW ;Enable EALLOW protected register access
  89. MOVZ DP, #7029h>>6 ;Set data page for WDCR register
  90. MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
  91. EDIS ;Disable EALLOW protected register access
  92. LB _c_int00 ;Branch to start of boot._asm in RTS library
  93. .endif
  94. ;end wd_disable
  95. .end
  96. ;//
  97. ;// End of file.
  98. ;//