Tushar Yadav
Tushar Yadav

Reputation: 31

Issue in compiling bootloader (ATMEGA2560) using make command

From last week i am working OTA system for arduino mega. I got one bootloader which flashes firmware from SD card. Here is the link of the github repository https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560/tree/master/hardware/microbridge.

As per readme file of the bootloader SD card chip select pin should be connected to digital pin 53 of arduino mega. When i define pin D53 for chip select of sd card then it working fine. Problem is that i want to change the default chip select pin of the SD card from D53 to D44.

And readme file (click here to read readme file) is saying that if you want to change CS pin from default (i.e. 53), you need to change the pinout in asmfunc.S and recompile the bootloader.

To compile bootloader, i using microchip studio command prompt and make commands. The make command are as follows:

But it gives error which i dont understand. Here is the screenshot of the command prompt.enter image description here.

Here are the things I using to complete OTA system:

Here is the code snippet I am using after burn bootloader:

#include <SPI.h>
#include <SD.h>
#include <avr/wdt.h>
#include "EEPROM.h"

#define sdcs 44

void setup()
{
   Serial.begin(9600);

   /*----(Initialise sd Module)-----*/
   if (!SD.begin(sdcs)) 
   {                       
      Serial.println(F("Card failed, or not present"));
   }
   else
   {
      Serial.println(F("card initialized."));
   }

   Serial.println("Press 'F' and 'enter' to set flagbit in eeprom 0x1FF to 0xF0 ");
   Serial.println("also to induce watchdog timeout which triggers the bootloader ");
   Serial.println("and flashes the new firmware on the sd card");
}
void loop()
{
   char inChar = '\0';

   while (Serial.available() > 0) 
   {
     inChar = Serial.read();
   }
   wdt_enable(WDTO_500MS); // have the wdt reset the chip

   // if 500ms passes without a reset
   if (inChar == 'F') {
   Serial.println("");
   Serial.println("rebooting and flashing with firmware.bin on sdcard");
   EEPROM.write(0x1FF, 0xF0);
   wdt_reset();
   delay(600); // wait 600ms to timeout wdt
   }
}

Below are the files present on the bootloader directory: enter image description here

Help needed. Thanks in advance!

Upvotes: 0

Views: 403

Answers (1)

Clifford
Clifford

Reputation: 93476

.cof is a type of object file, but looking at your build folder it looks like the build is creating a .elf object file rather then .cof. Modify the make file to correct the target, or perhaops run the make all to create the .cof file if that is what your tool chain is intended to produce.

That said, make clean should not fail on missing files in any case - the project might already be "clean". It is simply a means of deleting build artefacts to force a complete re-build - if those artefacts don't exist, that is not really a problem since the aim is only to delete them in any case.

Upvotes: 1

Related Questions