Author Topic: Source code of bootloader  (Read 4287 times)

conkuser

  • Newbie
  • *
  • Posts: 1
    • View Profile
Source code of bootloader
« on: December 10, 2006, 06:26:47 AM »
I am using the Modtronix Network Bootloader v1.50
I need source code of this application.
Thanks 

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
Re: Source code of bootloader
« Reply #1 on: December 10, 2006, 10:25:10 PM »
Hello

I have included the requested Java source code. It will not compile, seeing that it depends on some open source libraries. You can however use it to see how the bootloader works. The main bootloader code is in the "com.modtronix.netloader" package. Specifically in the following files:
"UpdateFirmware.java", "UpdateFirmwareListener.java", "PaneFirmware.java"

Following is a short description of what is done. It is taken from the actual PIC source code. I can not send you the source code for the PIC firmware.
Code: [Select]
* The Netloader PC program will send the bootloader a sequence of instructions
 * that will program it's FLASH and EEPROM memory area. Each instruction is
 * contained in a 256 byte long UDP packet (NetloaderPacket) addressed to port 54211.
 * If the actual data meant for the bootloader is not 256 bytes long, the packet
 * is padded - it must always be 256 bytes long!
 * The NetloaderPacket is always 256 bytes long, and consists
 * out of a 8 byte header and a 248 byte data array. The format is:
 * 0     = [cmd]
 * 1     = [length]
 * 2     = [adress upper]
 * 3     = [address high]
 * 4     = [address low]
 * 5     = [reserved]
 * 6     = [checksum MSB]
 * 7     = [checksum LSB]
 * 8-255 = [data]
 *
 * The commands are:
 *
 * ----- 0x01 = Identification message -----
 * The PC program will sent this message to the target board to try and establish a connection. Only
 * the first 5 bytes of the NetloaderPacket's data are used. When this message is sent from the PC to
 * the target, these 5 bytes are 0. On return, they contain:
 * - NetloaderPacket data byte 0 = hardware ID. Is a HW_ID_XX constant
 * - NetloaderPacket data byte 1 = hardware PCB revision. Is a HW_PCB_XX constant
 * - NetloaderPacket data byte 2 = hardware Assbembly code. Is a HW_ASM_XX constant
 * - NetloaderPacket data byte 3 = Bootloader Major code
 * - NetloaderPacket data byte 4 = Bootloader Minor code
 *
 * ----- 0x02 = Write to FLASH/EEPROM memory -----
 * The given data will be written to the FLASH or EEPROM memory. If [address upper] = 0xf0, then
 * the given data is for the EEPROM. If [address upper] is smaller then 0x04, then the given data
 * is for the FLASH.
 * The FLASH will always be programmed 8 bytes at a time, so when sending flash
 * data [length] will always be a multiple of 8. The PC program will pad the data with NOPs if the
 * hex file does not contain data with a multiple of 8 length.
 * The EEPROM is always programmed a single byte at a time.
 *
 * ----- 0x04 = Erase FLASH memory -----
 * FLASH memory is erase in 64 byte blocks. The address bytes will point to the first block to
 * be erased, and ([length] + 1) will indicate how many consecutive blocks to erase. If [length]
 * = 0, only a single block pointed to by the address bytes will be erased.
 * The contents of [data] is ignored
 *
 * ----- 0x06 = Exit bootloader and start user program -----
 * Will set the
« Last Edit: December 10, 2006, 10:26:54 PM by modtro2 »

Tom Mariner

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Source code of bootloader
« Reply #2 on: March 13, 2007, 03:00:55 PM »
OK, I understand there may be some proprietary features of the bootloader, but what is the deal with getting the pic source code? There may be some legal reasons why we would like to get this as a leg up on our development and because we are interested in more than just program and web pages.

ccg

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Source code of bootloader
« Reply #3 on: March 11, 2009, 11:31:35 AM »
By any chance there is a way to get the hex file with the bootloader code?

I'm trying to make my SBC65EC with websrv65_nobl_mc_hw211.mcp to websrv65_mc_hw211.mcp.

Thanks