How to clon a Bootloader

EmbeddedLocoNet  Bootloader   

About

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 BootloaderAsm.inc is the "main" file and includes all the others.
    SVN 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

Parameters

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 wanting to use these protocols should use a DEVELOPER_ID numbers under the special NMRA DCC Manufacturer ID of 13 which is reserved for DIY use. Allocation and management is coordinated in the LocoNet-Hackers mailing list, now on groups.io. AVR Studio Project File
PRODUCT_ID [16 bit] Enumerates the devices of a manufacturer/developer AVR Studio Project File
BOOTSTRAP_START_BYTE
  • 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
LN_RX_PORT
LN_RX_BIT
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