How to clon a Bootloader

EmbeddedLocoNet  Bootloader   


This page explains the steps to create a bootloader that uses the IPL (initial program loader) protocol to update the software in an Atmel AVR via Digitrax LocoNet.

Building blocks

  1. Project independant source: The *.inc files are independant of the project and should be used without any change. The file is the "main" file and includes all the others.
    CVS Web-Interrface: /apps/bootloader/Assembler
  2. The board dependant assembler root: This *.asm file stores all code that is defined by the board. It includes any user interface code (if any, maybe for debugging). You may use the test version for STK500 as template: /apps/bootloader/Assembler/BootLoader.asm
  3. AVR Studio Project File: The project file defines the application specific constants as command line #defines, the used AVR chip and the root assembler file. Have a look at the test version for STK500: /apps/bootloader/Assembler/BootLoader.aps


The following table lists all parameters, that have to be defined in the bootloader and where you enter them.

Parameter Description Where
MANUFACTURER_ID [8 bit] Identifies the manufacturer that builds the device. All manufacturers who have their own NMRA DCC Manufacturer ID should use that. Any LocoNet developers who have a formal or commercial relationship with Digitrax, but do not have a NMRA DCC Manufacturer ID should apply to Digitrax for a DEVELOPER_ID to be used with the MANUFACTURER_ID of Digitrax. AVR Studio Project File
DEVELOPER_ID [8 bit] Subdevides the manufacturer. A manufacturer that has his own MANUFACTURER_ID is free to allocate and manage their own set of DEVELOPER_ID values for their MANUFACTURER_ID. Any DIY LocoNet developers (LocoNet Hackers) wanting to use these protocols should coordinate the allocation and management of DEVELOPER_ID numbers under the special NMRA DCC Manufacturer ID of 13 which is reserved for DIY use. AVR Studio Project File
PRODUCT_ID [16 bit] Enumerates the devices of a manufacturer/developer AVR Studio Project File
  • Reset address of AVR as defined via fuses
  • Entry point of Bootloader for reset and jump from application
  • Bootloader occupies flash from this address to the end of the flash
Assembler Root File
F_CPU [MHz] Operating frequency of AVR as defined via fuses and by the possibly existing external crystal or resonator. Assembler Root File
IO port pin where the LocoNet receive signal can be read from. The port is assumed to be an input by default (both after reset and entered from application). Assembler Root File
EmbeddedLocoNet  Bootloader   
Author of this website: Stefan Bormann. Valid HTML 4.01 Transitional SourceForge Logo