Electronics > Beginners
To Bootload Or Not To Bootload That Is The Question....
<< < (3/4) > >>
westfw:

--- Quote ---What is an example of a In-field firmware update
--- End quote ---
Well, you know, the endless cycle of debugging software probably counts.
Being able to bootload new code over an ordinary computer connection, without having to dig out a special-purpose programmer, connect up a half-dozen signals or more that may or may not conflict with your actual product (or, taking the chip out and reprogramming it separately) is a HUGE advantage.Not as much as it used to be, now that you can get development boards with built-in programmers, debug/ICSP interfaces are much laxer about number of pins and voltages, and USB is a cheap and common high-speed interface with power.  But hugely important, none-the-less.

--- Quote ---so lets say a PicKit is a real programmer .... what are the advantages/disadvantages of arduino's UNO  compared to a PicKit....
--- End quote ---
Well, my PICKit4 has an 8-pin connector.  Not all of those pins are used for any one device (it does JTAG, SWD, ISP, ICSP, PDI, UPDI, TPI, DebugWire, and probably more...)  But it's a pretty huge debug connector if I just want to "plug and play" during the debug phase of my software.  (Yeah, yeah, "adapter cables", "jumpers", etc.  PITA.)  My Arduinos just plug into a USB connector, and use the same serial pins for bootloading that I use for debug printouts.  Convenient and "low impact."


--- Quote ---Arduino Zero includes a programmer on board, but I don't know if they actually use it.
--- End quote ---
I believe that they do.  (they don't currently use the debug capabilities that the programmer also provides.)  The new "Uno WiFi 2" also has the programmer/debugger chip.
Nerull:
The arduino bootloader is what allows you to program the device over UART or via USB. The bootloader option in the menu flashes a bootloader using a programmer to a chip that doesn't have one. If you get a blank chip with nothing programmed and drop it in an Uno, it won't be able to program it.

The Arduino IDE doesn't 'bootload' anything - the bootloader is a small piece of code on the chip itself that runs first on startup, typically has some way to check if it should go into programming mode, and if not it jumps into the normal program code.

You can use a programmer to flash code without a bootloader, but then you lose the ability to program the chip without using a programmer.

The chip in the Pickit 4 contains a bootloader which allows it to be flashed with new and target-specific firmware when you use it.
rstofer:
If  you are building a product that doesn't need serial IO, you are unlikely to add the USB->Serial chip and there is no reason to use up code space on a boot loader.  You would probably use ICSP or <whatever> to program the device upon assembly and that would be the end of it.  No doubt the serial pins would be used for something in the product.  You could break out an ICSP header for future use or just have some pads for pogo pins used during factory programming.

A huge advantage of the Arduino compatible devices is the existence of that bootloader.  It takes up a bit of memory space but it allows nearly instant updating following compilation.  I certainly don't look back fondly at having to use JTAG or ICSP.

You can see the STM32 boards coming with the same features (plus debugging) whereas the MBED approach is to use a 2d CPU to emulate bulk storage - also a nice prgramming approach.  In this case, debugging is done with printf().
Rick Law:
As a hobbyist with limited and non-professional experience, let me make an attempt to put it in more beginner's terms to help you understand what the boot loader is.

A boot-loader is a start-up program that can load another program or run a previously loaded program.

UNO, Arduino NANO, ATTiny, 8080, 6502 whatever Microprocessor/MCU, doesn't matter.  When it powers up, it goes to a boot location (boot address) to begin doing whatever it should do when it powers up.

If your MCU has a specific purpose (say controlling a flashlight), you can with an "ISP" (hardware called "In System Programmer") stuff a flashlight  controlling program into that MCU.  Of course that flashlight program will be loaded at the location that the MCU goes to when it powers up.  The MCU can be programed by other means.  ISP hardware and protocol allows it to be programmed AFTER it is installed in a system already - hence the name In-System-Programmer.

For your MCU driven flashlight (or your microwave oven, or your dishwasher...), chances are, you are always running that specific program, you wont be changing it.  On the other hand, you may want to change your flashlight program or run something entirely different.  In that case, you merely load the other program using an ISP.  Well, of course assuming your hardware supports it - otherwise there is no point in ISP-ing your microwave oven program to your flashlight's MCU.

Now, to make it really easier to reassign to different purpose, you can make a power-up program that can load another program.  So, instead of needing an ISP, your power-up program first detects if you want to load a new program, or to run the existing one you last loaded.  That kinds of power-up program is called boot-loader.

The Arduino IDE is NOT on your MCU.  It is on your PC.  It allows you to edit and compiles your code, and if you choose to, it can tell the power up code (boot loader) to get ready to receive the code to to flash.  The IDE sends the code down.  The flashing is done within the MCU by the power up (boot loader) code.

Boot-loader is not a new concept.  In the early days of computing, the early computers powers up and begin with talking to the punch-card-reader.  The stack of key-punch cards contains your "power-up" code with each code punched as holes in different positions on a card.

When your Arduino MCU (in UNO/NANO/whatever) powers up, it goes to the power-up (boot) code and in the case of Arduino, it would contain the Arduino boot loader as the power up code.  The boot loader would check for a specific condition.  If that condition exist, it gets ready to download new program.  If not, it would jump to your prior downloaded program.  When you choose to flash using your Arduino IDE, the IDE reboots the MCU, sent it the signal to get ready to download.  The bootloader sees the condition, it receives the downloaded program and flashes it.  So the IDE doesn't do the flashing; it tells the boot loader "I want to flash", sends down the program, and waits for the MCU to send back the flash-status.

As exampled above, your hardware has to support it too...  There is no point in downloading your dish-washer MCU program onto your Arduino MCU because your Arduino UNO doesn't have a water jet or dryer on the board.  UNO, NANO, MEGA, all has different default hardware (and/or different MCU in the same AVR line of MCUs) so they can do different level of things.  The ATTiny13 has so little memory it can't even run a boot loader.  ATTiny85 has enough for a boot loader and then not much else.  ATMEGA 318 or 328 are the MCU in NANO/UNO/Mini, they have enough to run the boot-loader as well as another program.  None of them has water-valve or dish-dryer heater, but they have the IO-ports to control one if you hook up the Arduino board to one.

Each of these MCU's or boards has different hardware, so their boot-loader may do similar things but they are different.  The ATMEGA 328's has more memory/features than the 318's.  The 318's has more than ATTiny85.  The ATTiny85 has more than the ATTiny13.  The ATTiny85 doesn't even have I2C or RS232-Serial for example, it has a "universal serial" that can be used to support either I2C or RS232 but no TX/RX lines.  The boot loader has to initialize different things and supports different feature/size in the "user program" so the differences in the boot loaders are significant while the type of functions they perform are similar.  So, you will find the Tiny85's boot loader to be entirely different than the UNO's boot loader.

Typically, the NANO/UNO are ATMEGA 328's, but you can find super cheap ones on AliEpxress/eBay with ATMEGA 318's.   I almost made a mistake once with some super cheap NANOs/UNOs but 318 instead of 328.

The Arduino IDE, the Arduino boot-loader, the standard Arduino board hardware, and the standard Arduino code libraries together is what can be consider as the Ardunio environment.

I have ATTiny13 on my simple flashlights.  I have ATTiny85 on my flashlights with more option.  While the 85 can, I don't use boot loader and I do not use any of the standard Arduino library.  I use NANO/UNO for more complex tasks - well, "more complex" as in needing more than ATTiny85.  While I may not download programs to those "mission-specific" NANO/UNO all the time, but I have the space and it does make my life easier to just keep the boot loader and use the Arduino-specific stuff in my case.

Hope this "layman's explanation" helps...

EDIT: replaced the phrase "wake up" with "power up" so as not to confuse with sleep mode type awaking.
sleemanj:
It should be pointed out, that in Arduino land "burn bootloader" is also how you set fuses, so for example, even if using an ATTiny13 which doesn't generally have any room for a bootloader you still want to "Burn Bootloader" to set the fuses.

---

For those unaware, fuses are configuration bits, set-able only using a programmer not via the bootloader, they set things like the clock source and divider, brown out detection level, reset disable...
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod