Avr32 Serial Bootloader

. AVR Universal Bootloader. A V R U n i v e r sa l B o o t l o a d e r. Last modified at 2012.Jue Bug fixed There two serious bugs found in V4.5, because new version has not publish, so I fix these bugs first here. In file bootldr.c, add below in line 475 and 499: bufptr -= BUFFERSIZE; It will cause download fail when CRC error.

The Boot-Loader codes in microcontrollers are actually very small and simple compared to the Boot-Loaders in advanced devices like PC. In most of the microcontroller the functionality of a Boot-Loader is limited only to set the initial clock and other settings for the microcontroller, load an application binary from the serial port etc. In this note I describe the steps I followed to develop the SD bootloader I use on my AVR32 AT32UC3A0256 board. The MAX 232 #define serial_232_PORT_USART (&AVR32.

Thank Ben Wilson found and fix this bug. In file bootldr.c, replace lines (.((void(.)(void))(BootStart))); to (.((void(.)(void))(BootStart/2)));. Introduction This project is a general AVR bootloader, for different type of AVR device, all you need to do is modify macro definition, and you don not need to modify the main program. There are many bootloader program on internet, but most of them are only available for special types. When we need to use other types device, we must do a lot of modification.

And many of them are only realize the basic functions, and have bugs, hidden problem or may be used inconveniently, so we have developed this program. This project based on ATmega128 bootloader program which developed by Mr ChaoMa, and combined experience in bootloader of PIC18 microcontroller I have wrote before, and used the macro definition skill from AVRUSB, and optimize and test the code time after time, finally get this project. This AVR universal bootloader can support most types of AVR microcontrollers(Mega series), which have self-programable capability, boot section and UART.

If the device have many serial ports, you can use any one of them. This bootloader supports RS232, RS485 and RS422. It can also supports USI, SPI, I2C interface if you made some modify. This bootloader will occupy less than 1k words flash maximum, and it may occupy less than 256 words minimum.

The space occupied by the bootloader is relative with device type, configuration parameters, funcations you select, and the optimize grade that the compiler use. Main feature. Support many types of AVR microcontrollers. Support AVR device with multi-uart. Support RS232/RS485/RS422 mode. Support customize communication baudrate and system clock frequcene. Automatically calculate the baudrate error.

Write with AVR GCC, 100% C code. High optimized code, occupy small space. Cut out the function conveniently, and can meet different requirements.

Support Watchdog. User may use the LED to show the upgrade status. Support to use super terminal as download software on PC. Support verification while write to FLASH. Can define the size of user program section.

Version v4.5 2008.Octo Add SafeMode v4.2 2008.Jun Add AES crypt routine (128/256 bits key) Fix a clerical error in WDG initialize Fix a bug in LED initialize, may cause RS485 not work Optimize code, reduce code size v4.0 2008.Apr Add PC1 decrypt algorithm routine (128/256 bits key) v3.5 2008.Mar Fix bug of Flash check above 64K error Auto create batch file 'avrub.bat' in AVRUBD's autocode, you don not need to set segment offset in AVR Studio, more easy to use. V3.2 2008.Mar Fix bug of URSEL bit, it may cause UART initiate fail in some device. V3.1 2007.Sep According to Douglas Hammond's suggest, modify ComInit macro. V3.0 2007.Jun Fix bug on ATmega162. Modify uart port number configuration. Pass test with WinAVR 20070522.

V2.0 2007.Apr.10 Add verification function while write Flash, improve the security of Bootloader. V1.2 2007.Apr.02 Correct a hidden error in baudrate register calculate. (This error is very common. We can find it in many books and codes in network). V1.0 2007.Mar.22 This is the first version. It realized all necessary functions, and extended XModem protocol to fit different application.

Develop environment The Develop environment of this project: WinAVR + AVR Studio WinAVR version: 20071221 AVR Studio version: 4.13.571 You may use other IDE or software to edit, debug AVR universal bootloader, such as KamAVR、AtmanAVR、PN. Project files Whole project include flowing files: bootldr.c Main program bootldr.h The header file of main program bootcfg.h User configuration of main aprogram bootldr.aps AVR Studio's project file of bootloader aes.c aes crypt routine pc1crypt.c PC1 crypt routine test.c Demo program to test uart communication testcfg.h Configuration file of test.c test.aps Project file of test readme.htm This file Because many people have AVR Butterfly demo board, so all project file here use AVR Butterfly hardware as example. If you use other hardware environment, all you need is to modify the congiguation parameter in file bootcfg.h.

Usage Now, you may use to configurate parameters automatically:. Creat a new project, and copy all above files to the folder where the new project is.

Run AVRUBD, choice 'AutoCode' function;. Selcect or set clock frequency, baudrate, comport etc.

Press button, save configuration file 'bootcfg.h'. AVRUBD will create batch file 'avrub.bat'. Run avrub.bat to compile your bootloader, make target HEX file. This is method I recommend. Or you may set parameters manual:. Creat a new project, and copy all above files to the folder where the new project is. Add bootldr.c、bootldr.h、bootcfg.h to the project. Modify the configuration parameter in bootcfg.h.

The meaning of these parameters are introduced in next section. Set the flash section address of the project as the beginning address of bootloader. Here the address is counted as word. Besides that, we need to set some parameters, such as the type of device( if you use AVR Studio or KamAVR, can set the parameters in IDE, otherwise you need to manual modify makefile file yourself).

Compile the project, then generate the target HEX file. Now you may program the target HEX file to the AVR mcu. Set lock bits and fuse bits to configurate Boot section size and enable Boot Reset Vector, and select clock source.

Connect target board to PC via comport, test bootloader. Main parameters The flowing parameters are very important. Please set these parameters carefully according to user system's hardware.

Parameters note BUFFERSIZE The size of communication buffer. When use the hyper terminal, it must be equal to 128. This parmeter must be multiple or submultiple of SPMPAGESIZE which is the size of mcu's flash section page.

FCPU Frequency of system clock (in Hz). BAUDRATE Baudrate of uart communication(bps). LEVELMODE Bootloader triger mode(0=uart 1= pin level) SafeMode Enable SafeMode, it will set a flag in EEPROM, and it will not jump to user application till update successfully timeclk Basic time interval(ms) TimeOutCnt Bootloader maximal timeout count(' periodically from AVR mcu. If you send a character to mcu via Hyper terminal, send data will become to what you send.

Q: Why bootloader can't jump to user's application after upgrade? A: If this happen, there are most likely to below reasons(90%):. Compiler's bug, made jump instruction incorrect.

You may see disassemble code to analyse jump codes, or try to update you compiler to new version. Not set fuse bits and lock bits correctly. Parameters wrong, such as bootloader segment offset. Q: How to cutdown unused function? A: In file bootcfg.h, there are many macro definition, set macro to 0 will disable corresponding fuction.

For example, not use LED in bootloader, set macro LEDEn to 0. Q: How to reduce bootloader target size, leave more flash space to user? A: Cutdown unnecessary functions, such as verbose hint, LED indication, use add up instead of CRC as check sum. And you can also set optimization of compiler, these will reduce target file size. Due to indeterminacy of optimization, code size optimize will not get the smallest size in some condition. You may also remove IVT(interrupt vect table) to save more space. In AVR-GCC, compiler will create IVT in application head.

Avrub not use any interrupt, so IVT is not necessary, this will save about 40-160 bytes. Q: If AVRUB support other AVR C compiler? A: AVR universal bootloader use AVR GCC as compiler, other C compiler have not been test. IAR C compiler is very close to AVR GCC, I think there are only few place need to be modify(AVRUSB is compatible with AVR GCC and IAR C compiler). Other C compiler may be use too, because I write code according to ANSI standard.

The code may need to modify is head file, some register name may be different. Q: Where can user get last version of AVRUB? A: In you will get last version or AVRUB. If you have any suggestion, or link above can't be access, please feel free to send email to me. Special thanks There are many people given me help in develop this project. Liu haitao give many help in coding and debuging tda1552 Tested ATmega32 Xu yankang Found bug in HEX format convert Ni enwei give some useful suggestion Cheng xiang help to translate this document to English Luiz Francisco Catalan Found Flash check bug, and help to test PC1 and AES decrypt algorithm. And many people who have not left names.

License OpenSource, base on GPL license.

A smaller serial bootloader for the ATmega8 Small Serial Bootloader? Short & Sweet Bootloader? Somewhat Smaller Bootloader? I got tired of fiddling with the available bootloaders for the Atmel ATmega8 chip and wrote my own.

This bootloader is designed to be small (fit in the smallest configurable boot block) but still support reasonably fast programming over a serial line. Most other bootloaders seem to be imitating an existing device programmer. SSBL doesn't take that approach; it tries to supply a small set of primitive operations using which the host can program the device. Most of the programming algorithm is therefore carried out by the host instead of by the bootloader. Pros:. Smaller than most bootloaders.

Kabhi khushi kabhi gham mp3. Much faster than a bit-bang in-circuit-serial-programmer. Doesn't require 8-bit-transparent communication with the host. Data is transferred in hex; commands/responses are normal printing characters. Cons:. Doesn't imitate a standalone programmer (unlike the avr910/butterfly/etc.

Style bootloaders). In fact, doesn't imitate any existing protocol.

Can't identify the device to the host. The host must already know what it's programming. Doesn't currently support EEPROM programming.

Can't reset the target chip. Download I've published two versions of this; version two is slightly cleaned up (especially the ssbl.py driver program) but doesn't include precompiled.hex files. (10329 bytes, sha1 sum 283f394d4869d3880f7ada29251bcf). (10202 bytes, sha1 sum ae9fcf4296d21cb0555cd31041bb043b35aa0c47) SSBL serial protocol Subject to change with changing revisions of the bootloader. Each command is one character, possibly followed by data.

Data is sent in hexadecimal. The bootloader responds to unrecognized characters with a question mark. When waiting for a command, the bootloader sends a CR (ascii 0x0D).

The exception to this is the 'p' command, which does not send a CR when it finishes. Hex digits may use either uppercase or lowercase letters. (SSBL always responds with uppercase letters). Whitespace or other characters in hex strings sent to SSBL are not allowed and will cause an error (see below). When the bootloader starts, it prints 'ok' followed by a CR.

Communication is at 9600 bps, 8N2. Command 'p' (0x70) Returns an 's' (0x73), without a trailing CR. This is used to help distinguish an SSBL bootloader from an avr910, butterfly, or the like.

Command 'z' (0x7A) Followed by four hex digits, loads the Z-register with the specified value. Command 'R' (0x52) Followed by two hex digits, which are interpreted as a byte count.

Reads program memory starting at the location pointed to by the Z register, and returns contents in hexadecimal. The Z register is advanced by the amount read. A value of 00 will cause 256 bytes to be read. Command 'W' (0x57) Writes to program memory. The command character is followed by a word count (not a byte count as in 'R').

Banner Mania. Full Version (197.1 kB). You simply can't get this type of software anymore. 8088 based computer with 580 k free conventional. Free banner software for printing. Banner Mania Program, free banner mania program freeware software downloads. Free Banner Mania Software. Overview - BANNER is an incredibly old program. I frequently go through tons of floppies to discern whether they are still good or not. BannerMania 1.0 Banner Mania is a banner making program for IBM PC compatible computers, enabling the user to create banners, posters, signs and logos. It can create and print multi-page banners, with 19 different fonts and effects in 16 colors.

That many words are read, and stored into program memory at the location pointed to by the Z register. The Z register is advanced accordingly. This command does not perform a full program sequence. The programmer will need to use the 'P' command to complete the programming operation, and will need to be aware of the page structure of the target chip. Command 'P' (0x50) Reads one word into R0:R1, then one byte into SPMCR, then executes an SPM instruction.

Command 'L' (0x52) Reads one byte into SPMCR, then executes an LPM instruction. (The host will want to set up the Z register beforehand.) The value loaded by LPM is returned to the host. Command 'Q' (0x51) Sends some state information back to the host. This might eventually be used to identify the version of SSBL.

Sends a 'z', followed by the contents of the Z register; then a 'b', followed by the address of the start of the bootloader. Command '@' (0x40) Performs an ICALL, transferring control to the address in the Z register. This is useful for jumping to address 0 to start a loaded program, but could also be used to call a utility routine. Unrecognized commands, or unexpected (non-hexadecimal) charcters in a command argument, cause SSBL to return a question mark (0x3F), followed by the usual CR and waiting for a new command. Configurations Eventually, the idea is, there will be a couple of #defines which will let you build SSBL as either a minimal bootloader (capable of loading program memory and not much else), or a slightly more full featured boot loader, capable of writing to data EEPROM as well. The minimal boot loader will be able to fit into the smallest configurable boot block on the mega8. The current feature set is approximately what I want from the minimal configuration, but it's just a little too large to fit in the smallest boot block.

I need to optimize it a little. Also, right now the bootloader checks PORTD.4 and if it's pulled low, it jumps directly to 0x0000 in order to imitate a chip whose BOOTRST fuse is not set. This needs to be configurable, I guess.

Python driver Talk a little about ssbl.py, the host-side part of the bootloader. (Reads an Intel Hex file and writes it to the target chip.) $Header: /home/wiml/www-cvs/wiml/proj/avr/ssbl.html,v 1.6 2011/03/19 05:28:48 wiml Exp $ — —.