BootloaderAPITable.S 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2018.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2018 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  9. Permission to use, copy, modify, distribute, and sell this
  10. software and its documentation for any purpose is hereby granted
  11. without fee, provided that the above copyright notice appear in
  12. all copies and that both that the copyright notice and this
  13. permission notice and warranty disclaimer appear in supporting
  14. documentation, and that the name of the author not be used in
  15. advertising or publicity pertaining to distribution of the
  16. software without specific, written prior permission.
  17. The author disclaims all warranties with regard to this
  18. software, including all implied warranties of merchantability
  19. and fitness. In no event shall the author be liable for any
  20. special, indirect or consequential damages or any damages
  21. whatsoever resulting from loss of use, data or profits, whether
  22. in an action of contract, negligence or other tortious action,
  23. arising out of or in connection with the use or performance of
  24. this software.
  25. */
  26. #if AUX_BOOT_SECTION_SIZE > 0
  27. #warning Using a AUX bootloader section in addition to the defined bootloader space (see documentation).
  28. ; Trampoline to jump over the AUX bootloader section to the start of the bootloader,
  29. ; on devices where an AUX bootloader section is used.
  30. .section .boot_aux_trampoline, "ax"
  31. .global Boot_AUX_Trampoline
  32. Boot_AUX_Trampoline:
  33. jmp BOOT_START_ADDR
  34. #endif
  35. ; Trampolines to actual API implementations if the target address is outside the
  36. ; range of a rjmp instruction (can happen with large bootloader sections)
  37. .section .apitable_trampolines, "ax"
  38. .global BootloaderAPI_Trampolines
  39. BootloaderAPI_Trampolines:
  40. BootloaderAPI_ErasePage_Trampoline:
  41. jmp BootloaderAPI_ErasePage
  42. BootloaderAPI_WritePage_Trampoline:
  43. jmp BootloaderAPI_WritePage
  44. BootloaderAPI_FillWord_Trampoline:
  45. jmp BootloaderAPI_FillWord
  46. BootloaderAPI_ReadSignature_Trampoline:
  47. jmp BootloaderAPI_ReadSignature
  48. BootloaderAPI_ReadFuse_Trampoline:
  49. jmp BootloaderAPI_ReadFuse
  50. BootloaderAPI_ReadLock_Trampoline:
  51. jmp BootloaderAPI_ReadLock
  52. BootloaderAPI_WriteLock_Trampoline:
  53. jmp BootloaderAPI_WriteLock
  54. BootloaderAPI_UNUSED1:
  55. ret
  56. BootloaderAPI_UNUSED2:
  57. ret
  58. BootloaderAPI_UNUSED3:
  59. ret
  60. BootloaderAPI_UNUSED4:
  61. ret
  62. BootloaderAPI_UNUSED5:
  63. ret
  64. ; API function jump table
  65. .section .apitable_jumptable, "ax"
  66. .global BootloaderAPI_JumpTable
  67. BootloaderAPI_JumpTable:
  68. rjmp BootloaderAPI_ErasePage_Trampoline
  69. rjmp BootloaderAPI_WritePage_Trampoline
  70. rjmp BootloaderAPI_FillWord_Trampoline
  71. rjmp BootloaderAPI_ReadSignature_Trampoline
  72. rjmp BootloaderAPI_ReadFuse_Trampoline
  73. rjmp BootloaderAPI_ReadLock_Trampoline
  74. rjmp BootloaderAPI_WriteLock_Trampoline
  75. rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1
  76. rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2
  77. rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3
  78. rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4
  79. rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5
  80. ; Bootloader table signatures and information
  81. .section .apitable_signatures, "ax"
  82. .global BootloaderAPI_Signatures
  83. BootloaderAPI_Signatures:
  84. .long BOOT_START_ADDR ; Start address of the bootloader
  85. .word 0xDF30 ; Signature for the MS class bootloader, V1
  86. .word 0xDCFB ; Signature for a LUFA class bootloader