BootloaderAPITable.S 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. ; Trampolines to actual API implementations if the target address is outside the
  27. ; range of a rjmp instruction (can happen with large bootloader sections)
  28. .section .apitable_trampolines, "ax"
  29. .global BootloaderAPI_Trampolines
  30. BootloaderAPI_Trampolines:
  31. BootloaderAPI_ErasePage_Trampoline:
  32. jmp BootloaderAPI_ErasePage
  33. BootloaderAPI_WritePage_Trampoline:
  34. jmp BootloaderAPI_WritePage
  35. BootloaderAPI_FillWord_Trampoline:
  36. jmp BootloaderAPI_FillWord
  37. BootloaderAPI_ReadSignature_Trampoline:
  38. jmp BootloaderAPI_ReadSignature
  39. BootloaderAPI_ReadFuse_Trampoline:
  40. jmp BootloaderAPI_ReadFuse
  41. BootloaderAPI_ReadLock_Trampoline:
  42. jmp BootloaderAPI_ReadLock
  43. BootloaderAPI_WriteLock_Trampoline:
  44. jmp BootloaderAPI_WriteLock
  45. BootloaderAPI_UNUSED1:
  46. ret
  47. BootloaderAPI_UNUSED2:
  48. ret
  49. BootloaderAPI_UNUSED3:
  50. ret
  51. BootloaderAPI_UNUSED4:
  52. ret
  53. BootloaderAPI_UNUSED5:
  54. ret
  55. ; API function jump table
  56. .section .apitable_jumptable, "ax"
  57. .global BootloaderAPI_JumpTable
  58. BootloaderAPI_JumpTable:
  59. rjmp BootloaderAPI_ErasePage_Trampoline
  60. rjmp BootloaderAPI_WritePage_Trampoline
  61. rjmp BootloaderAPI_FillWord_Trampoline
  62. rjmp BootloaderAPI_ReadSignature_Trampoline
  63. rjmp BootloaderAPI_ReadFuse_Trampoline
  64. rjmp BootloaderAPI_ReadLock_Trampoline
  65. rjmp BootloaderAPI_WriteLock_Trampoline
  66. rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1
  67. rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2
  68. rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3
  69. rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4
  70. rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5
  71. ; Bootloader table signatures and information
  72. .section .apitable_signatures, "ax"
  73. .global BootloaderAPI_Signatures
  74. BootloaderAPI_Signatures:
  75. .long BOOT_START_ADDR ; Start address of the bootloader
  76. .word 0xDF00 ; Signature for the CDC class bootloader
  77. .word 0xDCFB ; Signature for a LUFA class bootloader