Coder Social home page Coder Social logo

baerwolf / usbasploader Goto Github PK

View Code? Open in Web Editor NEW
176.0 22.0 141.0 459 KB

An (V)USB bootloader firmware for AVR-MCUs emulating the popular USBasp for programming itself

License: Other

Makefile 1.68% C++ 27.39% C 35.23% Assembly 28.65% SourcePawn 7.04% Batchfile 0.01%

usbasploader's Introduction

This is the README file for USBaspLoader.

USBaspLoader is a USB boot loader for AVR microcontrollers. It can be used on
most AVRs with at least 2 kB of boot loader section, e.g. the popular ATMega8.
The firmware is flashed into the bootloader-section of the flash memory and
takes control immediately after reset. If a certain hardware condition is met
(this condition can be configured, e.g. a jumper), the boot loader waits for
data on the USB interface and loads it into the remaining part of the flash
memory. If the condition is not met, control is passed to the loaded firmware.

This boot loader is similar to Thomas Fischl's avrusbboot and our own
bootloadHID, but it requires no separate command line tool to upload the data.
USBaspLoader emulates Thomas Fischl's USBasp programmer instead. You can thus
use AVRDUDE to upload flash memory data (and if the option is enabled) EEPROM
data.

Since USBaspLoader cooperates with AVRDUDE, it can be used in conjunction with
the Arduino software to upload flash memory data.


FILES IN THE DISTRIBUTION
=========================
Readme.txt ........ The file you are currently reading.
firmware .......... Source code of the controller firmware.
firmware/usbdrv ... USB driver -- See Readme.txt in that directory for info
updater ........... Source code of an updater-firmware exchanging bootloaders
License.txt ....... Public license (GPL2) for all contents of this project.
Schematics.txt .... File giving infos about default and recommended hw-layout.

*_usbasploader.hex  precompiled USBaspLoader for default layout and settings


BUILDING AND INSTALLING
=======================
This project can be built on Unix (Linux, FreeBSD or Mac OS X) or Windows.

For all platforms, you must first describe your hardware and layout 
specific parameters (PINs to use, etc...) in "firmware/bootloaderconfig.h".
Some USB tuning is possible by modifying "firmware/usbconfig.h".
All files provide working default settings, which can be used as an example.
Then edit "Makefile.inc" (NEVER any Makefile directly!) to reflect
the target device, and some feature set departing from the default one.
(You also can edit "firmware/bootloaderconfig.h" to change feature set
and therefore memory space requirements).
Since now "Makefile.inc" has an automatic selection logic based on
the type of the microcontroller, there is NO need for setting bootloader-
addresses, lock- or fusebits anymore...

Building on Windows:
You need WinAVR for the firmware, see http://winavr.sourceforge.net/.
To build the firmware with WinAVR, change into the "USBaspLoader" directory,
check whether you need to edit the files mentioned above (e.g. change device
settings, programmer hardware, clock rate etc.) and type "make" to compile
the complete source code.
After you upload the code to the device with "make flash", you should set
the fuses with "make fuse".

If you already have some working USBaspLoader on your controller, you can
use "make update" to flash the "updater"-firmware to it.
After starting this firmware on the microcontroller it will replace the
old bootloader with the new one just compiled.
The update-feature can be used on boards, where HVPP or ISP is not possible
after production anymore. (Or you just want to save trouble laying out ISP.)
Therefore you also could implement the "HAVE_SPMINTEREFACE_MAGICVALUE"-
feature, protecting your board from wrong updates for other boards.

At default configuration the bootloader protects itself from overwriting
itself. In order to sustain the new update-capability, no lock bits 
("make lock") should be programmed after uploading the firmware and
programming the fuse bits.


Building on Unix (Linux, FreeBSD and Mac):
You need the GNU toolchain and avr-libc for the firmware. See
    http://www.nongnu.org/avr-libc/user-manual/install_tools.html
for a good description on how to install the GNU compiler toolchain and
avr-libc on Unix. For Mac OS X, we provide a read-made package, see
    http://www.obdev.at/avrmacpack/

To build the firmware, change to the "USBaspLoader" directory, edit the
files mentioned above if you need to change settings (as also described in
the Windows paragraph above) and type "make" to compile the source code.
After you upload the code to the device with "make flash", you should
set the fuses with "make fuse".
As described within the Windows paragraph, "make update" can also
be used instead.

WORKING WITH THE BOOT LOADER
============================
The boot loader is quite easy to use. Set the jumper (or whatever condition
you have configured) for boot loading on the target hardware, connect it to
the host computer and (if not bus powered) issue a Reset on the AVR.

You can now flash the device with AVRDUDE through a "virtual" USBasp
programmer.


ABOUT THE LICENSE
=================
It is our intention to make our USB driver and this demo application
available to everyone. Moreover, we want to make a broad range of USB
projects and ideas for USB devices available to the general public. We
therefore want that all projects built with our USB driver are published
under an Open Source license. Our license for the USB driver and demo code is
the GNU General Public License Version 2 (GPL2). See the file "License.txt"
for details.

If you don't want to publish your source code under the GPL2, you can simply
pay money for AVR-USB. As an additional benefit you get USB PIDs for free,
licensed exclusively to you. See the file "CommercialLicense.txt" in the usbdrv
directory for details.


MORE INFORMATION
================
For questions, reports, suggestions or just for fun please contact
Stephan Baerwolf ([email protected]) and/or visit demonstration-board
for USBaspLoader at

    http://matrixstorm.com/avr/tinyusbboard/


For more information about Objective Development's firmware-only USB driver
for Atmel's AVR microcontrollers please visit the URL

    http://www.obdev.at/products/avrusb/

A technical documentation of the driver's interface can be found in the
file "firmware/usbdrv/usbdrv.h".


--
recent version:
(c) 2013 by Stephan Baerwolf
[email protected]

initial version:
(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH.
http://www.obdev.at/

usbasploader's People

Contributors

arnie97 avatar baerwolf avatar gloob avatar vale avatar whiteneon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usbasploader's Issues

USBaspLoader on 12 Mhz USBasp dongle timing issue in Arudino

I am trying to follow http://jethomson.wordpress.com/2011/08/18/project-ouroboros-reflashing-a-betemcu-usbasp-programmer/ to turn a USBasp dongle into an Arduino target board, but with the newer USBaspLoader from this repository.

I have tried with two USBasp dongles and I always get a timing issue: When I compile the "blink" example from Arudino (be sure to change the LED pin to D0 or D1), the LED does blink but a bit too slow.

Here is my boards.txt snippet:

usbasploader_board.name=USBaspLoader w/ ATmega8 at 12MHz
usbasploader_board.upload.protocol=usbasp
usbasploader_board.upload.maximum_size=6144
usbasploader_board.upload.speed=115200
usbasploader_board.upload.disable_flushing=true
usbasploader_board.bootloader.low_fuses=0xBF
usbasploader_board.bootloader.high_fuses=0xC8
usbasploader_board.bootloader.unlock_bits=0x3F
usbasploader_board.bootloader.lock_bits=0x0F
usbasploader_board.build.mcu=atmega8
usbasploader_board.build.f_cpu=12000000L
usbasploader_board.build.core=arduino
usbasploader_board.build.variant=arduino:standard

(This is slightly off-topic here since the actual uploading of the sketch does work and the sketch even does run but a bit too slow...)

Issues when Compiling

Hi,

I am having a bit strange problem when compiling the downloaded source code.

I downloaded the source code, opened command prompt, went to the extracted folder and typed in make all

a the first attempt, IT WORKED [though it showed a few warnings], however when I try to compile it second time after using make clean or make deepclean and then use make all, it gives error. If I change any parameters in make, it still gives error. I wanted to make it with a 12MHz and had changed the D+/- pins to be same as those on the USBasp as I have a few circuits of that made btu it simply won't compile - gives text region size error (complete error mentioned below) when compiling for ATMega8 and gives some other eeprom error when using ATMega328 etc.

PLEASE HELP

Thanks for your time and work on this bootloader, I wish to use it as arduino as we can't get arduinos easily in my country. Thanks in advance for your time and help.

I will try tonight with same schematic as you mentioned but need to have this MAKE problem resolved soon.

THANKS AGAIN.

Regards,

Zaid Pirwani

Details of my system:
Windows 7 Ultimate 32-Bit
AVR Toolchain 3.4.1.1195

copy of command prompt
=====================FIRST TIME MAKE ALL===============
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' usbdrv/usbdrv.h:213:24: warning: 'usbFunctionDescriptor' used but never defined [enabled by default] text data bss dec hex filename 2034 8 54 2096 830 main.bin make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/upd ater' updater.c:38:4: warning: #warning I do not know where new "bootloader__do_spm" i s located - assuming "NEW_BOOTLOADER_ADDRESS+(funcaddr___bootloader__do_spm % SP M_PAGESIZE)" [-Wcpp] updater.c:46:4: warning: #warning "TEMP_SPM_PAGEADR" is not defined explicitly - will choose END OF FLASH ! [-Wcpp] . text data bss dec hex filename 3022 2 0 3024 bd0 updater.elf . avrdude -c usbasp -p atmega8 -D -U flash:w:updater.hex:i . make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/upda
ter'

================ SECOND TIME MAKE ALL==============
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' make[1]: Nothing to be done forall'.
make[1]: Leaving directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/firm ware' make[1]: Entering directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/upd
ater'
make[1]: Nothing to be done for all'. make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/upda
ter'

==================using MAKE DEEPCLEAN======================
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make deepclean
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/upd ater' make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/upda
ter'
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
c:\Program Files\Atmel\AVR Tools\AVR Toolchain\bin\rm.exe: cannot remove `~': I
nvalid argument
make: *
* [deepclean] Error 1

====================== THIRD TIME MAKE ALL=======================
======================without any changes to makefile.inc==============
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' usbdrv/usbdrv.h:213:24: warning: 'usbFunctionDescriptor' used but never defined [enabled by default] c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.6.2/../../.. /../avr/bin/ld.exe: address 0x2024 of main.bin section.text' is not within reg
ion text' c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.6.2/../../.. /../avr/bin/ld.exe: address 0x2024 of main.bin section.text' is not within reg
ion text' collect2: ld returned 1 exit status make[1]: *** [main.bin] Error 1 make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
make: *** [do_firmware] Error 2

===================== using MAKE DDEEPCLEAN======================
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make deepclean
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/upd ater' c:\Program Files\Atmel\AVR Tools\AVR Toolchain\bin\rm.exe: cannot remove.o':
Invalid argument
make[1]: *
* [clean] Error 1
make[1]: Leaving directory `E:/Dropbox/My Documents/AVR/USBaspLoader-master/upda
ter'
make: *** [clean] Error 2

====================== FOURTH TIME MAKE ALL=======================
======================changed F_CPU to 12M in makefile.inc==============
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.6.2/../../.. /../avr/bin/ld.exe: address 0x2024 of main.bin section.text' is not within reg
ion text' c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.6.2/../../.. /../avr/bin/ld.exe: address 0x2024 of main.bin section.text' is not within reg
ion text' collect2: ld returned 1 exit status make[1]: *** [main.bin] Error 1 make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
make: *** [do_firmware] Error 2

====================== FIFTH TIME MAKE ALL=======================
=========changed F_CPU to 12M and MCU to atmega328 in makefile.inc==========
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' main.o: In functionmain':
main.c:(.text.startup+0xea): undefined reference to __eerd_byte_m8' main.c:(.text.startup+0xf4): undefined reference to__eewr_byte_m8'
main.c:(.text.startup+0x284): undefined reference to __eewr_byte_m8' main.c:(.text.startup+0x3a8): undefined reference to__eerd_byte_m8'
collect2: ld returned 1 exit status
make[1]: *** [main.bin] Error 1
make[1]: Leaving directory `E:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
make: *** [do_firmware] Error 2

Compilation error on Ubuntu 12.04

/home/ubuntu/baerwolf-USBaspLoader-43d06dd# make firmware
make[1]: Entering directory `/home/ubuntu/baerwolf-USBaspLoader-43d06dd/firmware'
usbdrv/usbdrv.h:213:24: warning: ‘usbFunctionDescriptor’ used but never defined
/usr/lib/gcc/avr/4.5.3/../../../avr/bin/ld: address 0x2052 of main.bin section `.text' is not within region `text'
/usr/lib/gcc/avr/4.5.3/../../../avr/bin/ld: address 0x2052 of main.bin section `.text' is not within region `text'
collect2: ld returned 1 exit status
make[1]: *** [main.bin] Error 1
make[1]: Leaving directory `/home/ubuntu/baerwolf-USBaspLoader-43d06dd/firmware'
make: *** [do_firmware] Error 2

Bootloader size exceeds 2 kb (avr-gcc 4.8.2)

With default options a build for atmega328p (20 MHz) results in a binary size of 2108 bytes (exceeding 2048 bytes by 60 bytes).

Compiling with additional flags -flto -fwhole-program yields 2082 bytes (34 bytes too much, still).

Setting DANGEROUS=1 didn't change anything about the size.

Theoretically the 328p allows up to 4K for the bootloader, but my firmware is already 29K in size and some features are still missing...

By the way, the last usbasploader release by OBdev (2012-12-08) compiles to 1964 bytes with the same settings (328p, 20 MHz).

Compiler used is a recent avr-gcc 4.8.2 on x64.

A little more delay

I am building a version with an atmega168 / 12 Mhz / 3.3V (I think this is out of specifications, but it seems to work for now).

I have a boot button instead of a boot jumper. With the USBaspLoader from Objective Development everything worked fine except I would get a warning about setting "sck" or something. So I decided to try this one.

With the latest USBaspLoader (20 November 2013) I could not get out of the bootloader. More precisely, even if I did not press my button, most of the time the bootloader would run and very rarely would the main code run. I suspected that the bootloader condition was checking before the button's pin had time to settle.

To solve this issue, I added the -DCONFIG_NO__NEED_WATCHDOG configuration to make some space. And then I added "_delay_ms(250);" just before the first "if(bootLoaderCondition())". The device now detects correctly if I a am pressing the boot button or not.

Is this ok? Is there another better solution?

Does D+ also work on other external interrupt input pins?

In firmware/bootloaderconfig.h, it says D+ must also be connected to interrupt pin INT0. For ATmega328P, INT0 is on PD2, so USB D+ connects to PD2. However, 328P has a second INT1 on PD3. From the official datasheet, it looks like no difference when they serve as external interrupt sources.

I haven't tested it, but in theory does D+ also work on INT1 (PD3)? And more specifically, is it possibly reliable to set INT1 as D+ and INT0 as D-?

Buil Not fit into your MCUs bootloader section

Hi,
I builed your project. But not fit into bootloader section.
My device: atmega328
And Buil
!!!ATTANTION!!!
(data+text) MUST fit into your MCUs bootloader section
.
text data bss dec hex filename
4102 6 57 4165 1045 main.elf

Data+text = 4108 while Bootloader is 4096.
How to fix problem. Tks!

Flash bootloader with avrdude/avrdudess and usbtinyisp

Hi,
i try to flash the bootloader on the Atmega328P chip.

The chip is on the plaid pcb and the UsbTinyIsp is connected via the isp pins.
Are the settings correct in the screenshot below? Don't wanna brick the chip.

avrdudess-USBaspLoader-plaid

Issues when Compiling

Hi,

I am having a bit strange problem when compiling the downloaded source code.

I downloaded the source code, opened command prompt, went to the extracted folder and typed in make all

a the first attempt, IT WORKED [though it showed a few warnings], however when I try to compile it second time after using make clean or make deepclean and then use make all, it gives error. If I change any parameters in make, it still gives error. I wanted to make it with a 12MHz and had changed the D+/- pins to be same as those on the USBasp as I have a few circuits of that made btu it simply won't compile - gives text region size error (complete error mentioned below) when compiling for ATMega8 and gives some other eeprom error when using ATMega328 etc.

PLEASE HELP

Thanks for your time and work on this bootloader, I wish to use it as arduino as we can't get arduinos easily in my country. Thanks in advance for your time and help.

I will try tonight with same schematic as you mentioned but need to have this MAKE problem resolved soon.

THANKS AGAIN.

Regards,

Zaid Pirwani

Details of my system:
Windows 7 Ultimate 32-Bit
AVR Toolchain 3.4.1.1195

copy of command prompt
=====================FIRST TIME MAKE ALL===============
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' usbdrv/usbdrv.h:213:24: warning: 'usbFunctionDescriptor' used but never defined [enabled by default] text data bss dec hex filename 2034 8 54 2096 830 main.bin make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/upd ater' updater.c:38:4: warning: #warning I do not know where new "bootloader__do_spm" i s located - assuming "NEW_BOOTLOADER_ADDRESS+(funcaddr___bootloader__do_spm % SP M_PAGESIZE)" [-Wcpp] updater.c:46:4: warning: #warning "TEMP_SPM_PAGEADR" is not defined explicitly - will choose END OF FLASH ! [-Wcpp] . text data bss dec hex filename 3022 2 0 3024 bd0 updater.elf . avrdude -c usbasp -p atmega8 -D -U flash:w:updater.hex:i . make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/upda
ter'

================ SECOND TIME MAKE ALL==============
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' make[1]: Nothing to be done forall'.
make[1]: Leaving directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/firm ware' make[1]: Entering directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/upd
ater'
make[1]: Nothing to be done for all'. make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/upda
ter'

==================using MAKE DEEPCLEAN======================
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make deepclean
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/upd ater' make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/upda
ter'
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
c:\Program Files\Atmel\AVR Tools\AVR Toolchain\bin\rm.exe: cannot remove `~': I
nvalid argument
make: *
* [deepclean] Error 1

====================== THIRD TIME MAKE ALL=======================
======================without any changes to makefile.inc==============
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' usbdrv/usbdrv.h:213:24: warning: 'usbFunctionDescriptor' used but never defined [enabled by default] c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.6.2/../../.. /../avr/bin/ld.exe: address 0x2024 of main.bin section.text' is not within reg
ion text' c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.6.2/../../.. /../avr/bin/ld.exe: address 0x2024 of main.bin section.text' is not within reg
ion text' collect2: ld returned 1 exit status make[1]: *** [main.bin] Error 1 make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
make: *** [do_firmware] Error 2

===================== using MAKE DDEEPCLEAN======================
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make deepclean
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/upd ater' c:\Program Files\Atmel\AVR Tools\AVR Toolchain\bin\rm.exe: cannot remove.o':
Invalid argument
make[1]: *
* [clean] Error 1
make[1]: Leaving directory `E:/Dropbox/My Documents/AVR/USBaspLoader-master/upda
ter'
make: *** [clean] Error 2

====================== FOURTH TIME MAKE ALL=======================
======================changed F_CPU to 12M in makefile.inc==============
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.6.2/../../.. /../avr/bin/ld.exe: address 0x2024 of main.bin section.text' is not within reg
ion text' c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.6.2/../../.. /../avr/bin/ld.exe: address 0x2024 of main.bin section.text' is not within reg
ion text' collect2: ld returned 1 exit status make[1]: *** [main.bin] Error 1 make[1]: Leaving directoryE:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
make: *** [do_firmware] Error 2

====================== FIFTH TIME MAKE ALL=======================
=========changed F_CPU to 12M and MCU to atmega328 in makefile.inc==========
E:\Dropbox\My Documents\AVR\USBaspLoader-master>make all
make[1]: Entering directory E:/Dropbox/My Documents/AVR/USBaspLoader-master/fir mware' main.o: In functionmain':
main.c:(.text.startup+0xea): undefined reference to __eerd_byte_m8' main.c:(.text.startup+0xf4): undefined reference to__eewr_byte_m8'
main.c:(.text.startup+0x284): undefined reference to __eewr_byte_m8' main.c:(.text.startup+0x3a8): undefined reference to__eerd_byte_m8'
collect2: ld returned 1 exit status
make[1]: *** [main.bin] Error 1
make[1]: Leaving directory `E:/Dropbox/My Documents/AVR/USBaspLoader-master/firm
ware'
make: *** [do_firmware] Error 2

Build error when doing a 'make' in USBaspLoader-master/

I am getting the following build error when doing a 'make' in USBaspLoader-master/.

I am using OS X 10.9.2, with the latest CrossPack-AVR 20130-12-16. It has Avr-gcc version 4.8.1.

I couldn't find where in the project usbasploader is defined.

In file included from updater.c:8:0:
usbasploader.h:20:61: error: expected expression before '>>' token
extern const const uint16_t usbasploader[SIZEOF_new_firmware>>1] PROGMEM;
^
usbasploader.h:21:39: error: 'usbasploader' undeclared here (not in a function)
const uint8_t new_firmware = (void)&usbasploader;
^

In all USBaspLoader version up to 0.97 exists a bug, which causes the watchdog timer to continously reboot.

Date of discovery:
2014/11/29

Rating:
High

URL:
https://github.com/baerwolf/USBaspLoader

Description:
In all USBaspLoader version up to 0.97 exists a bug, which causes the watchdog timer to continously reboot.

When a users firmware activates the watchdog timer, and then times out:
The MCUC(S)R register then has WDRF bit to HIGH.
On some ATmegas this keeps the AVRs internal hardware reset,
from resetting the active watchdog (even when the WDTON fuse is unprogrammed).
However the timeout period is reset anyway to minimal value of 16ms (WDP* to LOW).

In the bootloaders PROG-PIN chargeup phase, the bootloader stalls 50ms, causing the AVR to reboot.

For deactivating the watchdog timer, some AVRs need to reset the WDRF bit first.
But since also the hardware reset seems to be restricted to this measure (hardware bug???), the watchdog stays on ever - even during RESET presses.
This also renders the RESET pin/button effectivly useless.

ATmega8 v0.97 is NOT effected by this bug.

Patch:
Upcoming asap - but still ongoing investigation

Workaround:
NO software workaround known.
In order to access the bootloader again, dis- and reconnect the power where possible.

On AVRs except ATmega8, it is recommended to avoid using the API (https://github.com/tinyusbboard/API) until a patch/update is provided.

I get an error when I try to run "make"

i try to run typing "make" in console but i receive this error
.
.
======>BUILDING BOOTLOADER FIRMWARE
.
make[1]: Entering directory D:/Nataniel/Documents/custom keyboard/discipline/bootloader/USBaspLoader-master/firmware' main.c: In function 'leaveBootloader': main.c:322: warning: 'noreturn' function does return c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: address 0x2002 of main.elf section .text is not within region text c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: address 0x2002 of main.elf section .text is not within region text make[1]: *** [main.elf] Error 1 make[1]: Leaving directory D:/Nataniel/Documents/custom keyboard/discipline/bootloader/USBaspLoader-master/firmware'
make: *** [do_firmware] Error 2

Size exceed 2kB

OS: Windows 7 64-bit
Toolchain: avr-toolchain-installer-3.4.2.1573-win32.win32.x86.exe

I modified nothing. Just download, extract, and then make. The main.hex have size of 5.62kB.

Any clue?

cpufunc.h

could not compile with winavr 20100110 (recent download) because of missing /avr/cpufunc.h
if you copy cpufunc.h from AVR Studio 5.0 installation (i.e. C:\Program Files (x86)\Atmel\AVR Studio 5.0\AVR Toolchain\avr\include\avr) 'make' compiles with no errors (only some warnings obout unused USB Device Descriptor)

Help on options

Hello!

What set of options should I have enabled to achieve the following behavior:

  1. on reset enter usbasp mode
  2. after 3 seconds of inactivity go to main app
  3. if there were activity and usbasp were used to upload the firmware, restart

Right now I use the following $(DEFINES)

-DCONFIG_NO__CHIP_ERASE -DCONFIG_NO__ONDEMAND_PAGEERASE -DCONFIG_NO__PRESERVE_WATCHDOG -DCONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE -DCONFIG_BOOTLOADER_LOOPCYCLES_TIMEOUT=16 -DCONFIG_HAVE__BOOTLOADER_ABORTTIMEOUTONACT -DBOOTLOADER_CAN_EXIT=1 -DHAVE_BOOTLOADER_HIDDENEXITCOMMAND=1 -DCONFIG_HAVE__BOOTLOADER_IGNOREPROGBUTTON

but it fails to do point 3.

Or, if I could achieve that with HAVE_BOOTLOADER_HIDDENEXITCOMMAND, how to issue the exit sequence via avrdude?

TIA,
--Vladimir

Its not enough to call wdt_disable on some devices.

At least on the ATMega644, the MCUSR bit WDRF in the MCUSR needs to be cleared first, otherwise it is not possible to disable the watchdog. (See http://www.atmel.com/Images/doc2593.pdf, p.53)

• Bit 3 - WDE: Watchdog System Reset Enable
WDE is overridden by WDRF in MCUSR. This means that WDE is always set when
WDRF is set. To clear WDE, WDRF must be cleared first. This feature ensures
multiple resets during conditions causing failure, and a safe start-up after the failure.

Otherwise the software cannot disable the wdt.

This line just before wdt_disable will fix this

MCUCSR = ~(1<<WDRF);
wdt_disable(); /* main app may have enabled watchdog */

Trouble compiling with WinAVR

My setup :

  • windows 8.1
  • core i7
  • winAVR 2010-01-20
  • command prompt

When I try to compile UPDATER from the MASTER branch I get the following error :

process_begin: CreateProcess(NULL, stat -c %s usbasploader.raw, ...) failed.
make[1]: Entering directory `C:/Users/thoma_000/Documents/projects/agit pov/boards/coyote/bootloader
/USBaspLoader-master(previous)/updater'
In file included from updater.c:6:
usbasploader.h:17:3: error: #error SIZEOF_new_firmware
In file included from updater.c:6:
usbasploader.h:21: error: expected expression before '>>' token
usbasploader.h:22: error: 'usbasploader' undeclared here (not in a function)
updater.c:52:4: warning: #warning I do not know where new "bootloader__do_spm" is located - assuming
 "NEW_BOOTLOADER_ADDRESS+(funcaddr___bootloader__do_spm % SPM_PAGESIZE)"
updater.c:60:4: warning: #warning "TEMP_SPM_PAGEADR" is not defined explicitly - will choose END OF
FLASH !
updater.c:115:26: error: operator '<=' has no left operand
updater.c:120:26: error: operator '>' has no left operand
updater.c: In function 'mypgm_readpage':
updater.c:171: warning: implicit declaration of function 'memcpy_PF'
updater.c: In function 'main':
updater.c:282: error: expected expression before ';' token
updater.c:288: error: 'a' undeclared (first use in this function)
updater.c:288: error: (Each undeclared identifier is reported only once
updater.c:288: error: for each function it appears in.)
updater.c:289: error: 'b' undeclared (first use in this function)
updater.c:324: error: expected expression before ';' token
make[1]: *** [updater.o] Error 1
make[1]: Leaving directory `C:/Users/thoma_000/Documents/projects/agit pov/boards/coyote/bootloader/
USBaspLoader-master(previous)/updater'
make: *** [do_updater] Error 2

With the 94c580c branch, I get the following error when I try to compile the FIRMWARE :

======>BUILDING BOOTLOADER FIRMWARE
.
make[1]: Entering directory `C:/Users/thoma_000/Documents/projects/agit pov/boards/coyote/bootloader
/USBaspLoader-94c580c(last)/USBaspLoader-94c580c/firmware'
      0 [main] sh 8036 sync_with_child: child 4484(0x224) died before initialization with status cod
e 0xC0000142
   1081 [main] sh 8036 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
make[1]: *** [main.asm] Error 128
make[1]: Leaving directory `C:/Users/thoma_000/Documents/projects/agit pov/boards/coyote/bootloader/
USBaspLoader-94c580c(last)/USBaspLoader-94c580c/firmware'
make: *** [do_firmware] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.