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