You are here

Bootloader Configuration

To configure bootloader you have to define macros for LED, jumper and EEPROM mark. Detailed information about these marcoses can be found in the following sections.

Bootloader can run in 2 different modes:

  • firmware update mode;

In this mode, the device is recognized by computer as a standard HID device and user mode application can be reprogrammed;

  • user mode;

In this mode, the management is passed to user mode application and the interrupt vectors are redirected to the user mode application interrupt vectors.

The mode is determined in the main subroutine:

 global main
main
     UD_INIT
     UD_TX 'X'

; Decide what to run bootloader or application
#if USE_EEPROM_MARK
     ; Check EEPROM mark
     movlw EEPROM_MARK_ADDR
     movwf EEADR
     movlw 0x01
     movwf EECON1
     movlw EEPROM_MARK
     subwf EEDATA, W
     bz bootloader
#endif
     ; Check bootloader enable jumper
#ifdef USE_JP_BOOTLOADER_EN
     setf JP_BOOTLOADER_TRIS
     btfsc JP_BOOTLOADER_PORT, JP_BOOTLOADER_PIN
     goto APP_RESET_VECTOR ; Run Application FW
#endif
     ; Run bootloader
     bra bootloader
     reset

 

As you can see from the source code, bootloader first checks the EEPROM mark. If mark is present, bootloader starts in firmware update mode. For additional information about the EEPROM mark see the section called "EPROM Mark configuration (EEPROM Mark)".

If EEPROM mark is absent, bootloader checks the jumper. If jumper is closed, bootloader starts in firmware update mode. If jumper is opened, bootloader starts in user mode and control is passed to user mode application. For additional information about jumper configuration see the section called "Jumper configuration (jumper)".