add support for ATmega8535

Thanks to Jony Smith reporting this missing MCU.

Reported-by: Jony Smith <jony.nambela@gmail.com>
Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Remove precompiled hexfiles - use demoboard for testing

Because users often are confused by the provide hexfiles and
the firmware from tinyUSBboard, remove the hexfile from further
repositories and therefore put a remark instead

If you want to try out USBaspLoader, use tinyUSBboard:

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

However, for most recent version, you may need to compile your
own firmware.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
spminterface.h: cleanup some comments about the achievable size

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
updater: fix flash addressing BUG possibly reading wring data

Fix Updater-bug, when linked to position in flash space
(FLASHADDRESS > 64K - SIZEOF_new_firmware - "a little more")

void* always is 16Bit - for real addresses take FLASADDRESS
into account in order to find upper address bit:
(http://www.mikrocontroller.net/topic/298174#3186932)

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
cleanup and extend Makefiles

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
introduce new feature: BOOTLOADERENTRY_FROMSOFTWARE

An USBaspLoader supporting this feature is able to be called
(and bootLoaderConditioned) from user firmware.
You can check MCUCSR watchdog-flag to check for success.
(If USBaspLoader starts up, all MCUCSR are removed...)

You can use something like this code to switch to the
bootloader:

  #define BOOTLOADER_WORDADDRESS (BOOTLOADER_ADDRESS>>1)
  wdt_enable(WDTO_15MS);
  asm volatile (
    "ldi	r29		,	%[ramendhi]	\n\t"
    "ldi	r28		,	%[ramendlo]	\n\t"
    "ldi	r16		,	%[boothi]	\n\t"
    "st		Y+		,	r16		\n\t"
    "ldi	r16		,	%[bootme]	\n\t"
    "st		Y+		,	r16		\n\t"
    "ldi	r16		,	%[bootlo]	\n\t"
    "st		Y+		,	r16		\n\t"
    "resetloop%=:					\n\t"
    "rjmp	resetloop%=				\n\t"
    :
    : [ramendhi]	"M"	(((RAMEND - 2) >> 8) & 0xff),
      [ramendlo]	"M"	(((RAMEND - 2) >> 0) & 0xff),
      [boothi]		"M"	(((BOOTLOADER_WORDADDRESS) >>16) & 0xff),
      [bootme]		"M"	(((BOOTLOADER_WORDADDRESS) >> 8) & 0xff),
      [bootlo]		"M"	(((BOOTLOADER_WORDADDRESS) >> 0) & 0xff)
  );

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
BUGfix: Only clear MCUCSR register when bootLoaderCondition()

If bootLoaderCondition() is false, the users firmware must
be started transparently - so leave the register for it to read!

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
WORKfix: Change condition when to evaluate RAMEND

In cases users do not want to wait for a watchdog to time out,
they can ijmp to bootloaders reset-vector.
However they need to clear MCUCSR.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
introduce new feature: BOOTLOADER_HIDDENEXITCOMMAND

With this "BOOTLOADER_HIDDENEXITCOMMAND" feature, sending the RAW-ISP
command "11111111 xxxxxxxx xxxxxxxx xxxxxxxx" will cause the bootloader
to start the firmware as soon as the programming software disconnects.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
further trick to optimize code size

This is a very dangerous path to go, but it is worth it.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
BUGfix: "HAVE_BOOTLOADER_HIDDENEXITCOMMAND" depends on "BOOTLOADER_CAN_EXIT"

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
introduce new feature: BOOTLOADER_LOOPCYCLES_TIMEOUT

This feature must be explicitly defined (Makefile.inc)

When greater than "0", "BOOTLOADER_LOOPCYCLES_TIMEOUT" defines how
many 16bit loopcycles can be cycled, before bootloader times out
and starts user firmware. Of course "BOOTLOADER_CAN_EXIT" must be
enabled.

Even if this value is too small, bootloader  will not exit as
long as bootLoaderConditionSimple() stays true.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
introduce new feature: BOOTLOADER_ALWAYSENTERPROGRAMMODE

Enabling "BOOTLOADER_ALWAYSENTERPROGRAMMODE" ignores bootLoaderCondition()
(BUT NOT bootLoaderConditionSimple()) and always enter the program-mode.

This is helpful to emulate behaviour of Arduino bootloaders

Use "-DCONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE" within
DEFINES variable of Makefile.inc to enable this feature.

Otherwise default is off.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
BUGfix: fix race condition between TIMEOUT and HIDDENEXIT

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
introduce new feature: BOOTLOADER_ABORTTIMEOUTONACT

When defined, the bootloader will abort the timeout when
it sees some activity (bootLoaderConditionSimple() or programming).
After aborting timeout, the bootloader falls back to conventional
exitting.

By default this feature is deactivated.
Activate it via the "DEFINES" varibale within Makefile.inc.
There add: -DCONFIG_HAVE__BOOTLOADER_ABORTTIMEOUTONACT

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
introduce new feature: BOOTLOADER_IGNOREPROGBUTTON

"CONFIG_HAVE__BOOTLOADER_IGNOREPROGBUTTON" generates an USBaspLoader
without using the PROGBUTTON.
It can be used to reduce the required PINcount for USBaspLoader on the MCU.

However this feature is very dangerous, so it becomes only enabled, if
"CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE" is enabled and
"CONFIG_NO__BOOTLOADER_CAN_EXIT" is disabled, too.

Additionally "BOOTLOADER_LOOPCYCLES_TIMEOUT" must be greater or equal
than 8 (In order to give user enough time to program).

When active, "JUMPER_PORT" and "JUMPER_BIT" are ignored and can be soldered
otherwise.

Default if off. But the Option can be enabled by adding
"-DCONFIG_HAVE__BOOTLOADER_IGNOREPROGBUTTON" to the DEFINES variable of
Makefile.inc

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
fix: rename BOOTLOADER_LOOPCYCLES_TIMEOUT

All config-options need to be calles "CONFIG_*"

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
BUGfix: enable "CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE" not always

The feature "CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE" may be dangerous,
since bootloader may never exit ("CONFIG_NO__BOOTLOADER_CAN_EXIT").

So the feature only is enabled, if "CONFIG_NO__BOOTLOADER_CAN_EXIT" is disabled.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
put some extra (pre-)configuration into Makefile.inc

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
BUGfix and cleanup Makefiles

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>