[En-Nut-Discussion] Add simple feature to appload

Erik Lindstein erik at ledutveckling.com
Fri Jul 6 12:12:03 CEST 2007


I use the http://www.ethernut.de/arc/apploadbin.zip appload bootloader
with an ethernut board(2.1) (ATmega 128)
It workes fine but there are just one feature i would like to add.

Now everytime when the bootloader starts it tryes to download new
firmware and it takes a while before it timeouts if no TFTP server is
found.

Also it stops totaly if there are no network link.

Now I would like to use a simple jumper connected to a pin to select
if the bootloader is suposed to download new firmware or not.


So i just added this simple code ( se below //ADDED )

But it dossnt start the main application if i call
startApplication().



But if i let the bootloader download a new application it then
executes that new application.

Also if i dissable the TFTP-server so the bootloader timeouts it
starts the application. But then i have to wait for the timeout..

Code:


void (*startApplication)( void ) = 0x0000; // ADDED

int main(void)
{

// ADDED
       PORTF |= (1<<PF0);
      if(PINF & (1<<PF0))
      {
         startApplication();
      }
// END.

    /*
     * Enable external data and address bus.
     */
//
    MCUCR = _BV(SRE) | _BV(SRW);

    DEBUGINIT();
    DEBUG("\nAppLoad 1.1.1\n");

    BootConfigRead();

    /*
     * Initialize the network interface controller hardware.
     */


    DEBUG("ETHERNET ");
    if(EtherInit() == 0)
    {
        DEBUG("OK\n");

        /*
         * DHCP query and TFTP download.
         */
        if (DhcpQuery() == 0) {
            TftpRecv();
        }
    }
    else {
        DEBUG("No\n");
    }
    return 0;
}



More information about the En-Nut-Discussion mailing list