element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Custom Bootloader
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 13 replies
  • Subscribers 385 subscribers
  • Views 2214 views
  • Users 0 members are here
  • code
  • arduino_development_environment
  • bootloader_arduino
  • arduino
Related

Custom Bootloader

nicolaoscon96
nicolaoscon96 over 2 years ago

Hello team,

Hope I find you all well, I need your help on a small part of a personal project that am working on. So I made an Arduino based custom circuit board that it has on board GSM, GPS, Relays, Sensors and am receiving them on the phone on a custom application that I wrote. I can monitor the sensors, I can control the switches etc... So an idea that I had is to update the Arduino's firmware OTA (over the air) with the GSM. I setup a server at home (raspberry pi) nothing fancy that I can push to the binary file then go into the browser UI declare the new version upload the file and POST it and the Arduino see the new version and is downloading it into the EEPROM (by the way is an ATmega2560) and the updates may be for optimization, add new features


So my need for help is that in writing a bootloader I have no idea how. I need someone to guide me or help me to create a custom bootloader for the ATmega2560, so before jumping into the main sketch to check if there is a new update available saved to install it. and then continue with the new one.

If further discussion is needed please let me know so  i can explain more.

  • Sign in to reply
  • Cancel

Top Replies

  • balajivan1995
    balajivan1995 over 2 years ago in reply to shabaz +1
    Arduino comes with its own bootloader format for AVR devices right? Is it possible to edit that file?
Parents
  • balajivan1995
    0 balajivan1995 over 2 years ago

    You'll either need a Bluetooth or wifi module to get the file from raspberry pi. If you have a gsm board, you can connect to atmega2560 using uart lines, download the files directly from any server and update your board.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • nicolaoscon96
    0 nicolaoscon96 over 2 years ago in reply to balajivan1995

    the atmega2560 with the current sketch it can connect to the internet to download the firmware but in order to install it to it self it needs the bootloader to be customised 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balajivan1995
    0 balajivan1995 over 2 years ago in reply to nicolaoscon96

    Alternative way is to add cheap controller with two uart and delegating gsm related works to it. Let the new controller download file from server, once the download is done, send message to stm32 using uart to enable writing to memory. 

    https://github.com/JAndrassy/ArduinoOTA/blob/master/examples/Advanced/OTASketchDownload/OTASketchDownload.ino

    The above example downloads the file to Arduino memory and then updates to latest version using that file. 

    Implementation to apply the update is

    here github.com/.../InternalStorageAVR.cpp

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 2 years ago in reply to nicolaoscon96

    It's no different coding the bootloader, than it is coding application code.

    You can see any existing bootloader, and edit it to include your new interface:

    https://github.com/dcnewman/MightyBoardFirmware-2560-bootloader

    I'm not sure anyone is going to offer to do this work for you. Perhaps they might, but instead of clutching at straws, I think it could be better to go through the code, learn it, and then add your interface,, same as if you were developing an interface in normal application code. If you get nowhere, consider an option such as ESP32, which may have plenty of OTA examples using what is possibly a more popular interface for this (WiFi).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balajivan1995
    0 balajivan1995 over 2 years ago in reply to shabaz

    Arduino comes with its own bootloader format for AVR devices right? Is it possible to edit that file?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 2 years ago in reply to balajivan1995

    Yes, it's just code, no different from application code. The example linked above is pretty much just a single file, and it can be followed to see how the firmware is accepted over the serial connection and programmed into the Flash. Usually bootloaders are very simple, since for some microcontrollers there isn't a lot of space for the bootloader, so code is kept short. I've not written a bootloader for that Atmel chip, but have certainly written bootloaders for other microcontrollers, and it doesn't have to be difficult. Often there was a big incentive to write a bootloader (save on buying expensive programmer tools!). Nowadays programmers are cheap so that particular use-case might not be as important. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • shabaz
    0 shabaz over 2 years ago in reply to balajivan1995

    Yes, it's just code, no different from application code. The example linked above is pretty much just a single file, and it can be followed to see how the firmware is accepted over the serial connection and programmed into the Flash. Usually bootloaders are very simple, since for some microcontrollers there isn't a lot of space for the bootloader, so code is kept short. I've not written a bootloader for that Atmel chip, but have certainly written bootloaders for other microcontrollers, and it doesn't have to be difficult. Often there was a big incentive to write a bootloader (save on buying expensive programmer tools!). Nowadays programmers are cheap so that particular use-case might not be as important. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • balajivan1995
    0 balajivan1995 over 2 years ago in reply to shabaz

    I guess it is upto the original poster to select whichever one is convenient for him and for OTA as well.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube