Remove bootloader support
This commit is contained in:
parent
b02454c45b
commit
7310eb2c9a
@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) by BlackMark 2016
|
|
||||||
* Date 09/09/2016
|
|
||||||
* Version 1.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BOOTLOADER_H
|
|
||||||
#define BOOTLOADER_H
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
#include <avr/wdt.h>
|
|
||||||
|
|
||||||
typedef void (*flash)() __attribute__ ((noreturn));
|
|
||||||
|
|
||||||
flash boot = reinterpret_cast<flash>( 0x0000 );
|
|
||||||
flash bootloader = reinterpret_cast<flash>( 0x7E00 / 2 );
|
|
||||||
|
|
||||||
inline bool checkBootloader()
|
|
||||||
{
|
|
||||||
if( pgm_read_byte( reinterpret_cast<uint16_t>( bootloader ) * 2 ) == 0xF8 )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void callBootloader()
|
|
||||||
{
|
|
||||||
if( checkBootloader() )
|
|
||||||
{
|
|
||||||
bootloader();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boot();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline uint8_t handleReset()
|
|
||||||
{
|
|
||||||
wdt_reset();
|
|
||||||
uint8_t ui8MCUSR = MCUSR;
|
|
||||||
MCUSR &= ~( 1 << WDRF );
|
|
||||||
wdt_disable();
|
|
||||||
return ui8MCUSR;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void reset()
|
|
||||||
{
|
|
||||||
wdt_enable( WDTO_15MS );
|
|
||||||
while( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -215,9 +215,6 @@
|
|||||||
</ToolchainSettings>
|
</ToolchainSettings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="bootloader.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="clock.h">
|
<Compile Include="clock.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include "ds3231/systime.h"
|
#include "ds3231/systime.h"
|
||||||
|
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
#include "bootloader.h"
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@ -102,13 +101,6 @@ void setAlarm()
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
uint8_t ui8MCUSR = handleReset();
|
|
||||||
|
|
||||||
if( ui8MCUSR & ( 1 << WDRF ) )
|
|
||||||
{
|
|
||||||
callBootloader();
|
|
||||||
}
|
|
||||||
|
|
||||||
USART0 &cSerial = USART0::inst();
|
USART0 &cSerial = USART0::inst();
|
||||||
|
|
||||||
cSerial.init( 9600 );
|
cSerial.init( 9600 );
|
||||||
@ -142,13 +134,7 @@ int main()
|
|||||||
|
|
||||||
if( cSerial.receiveByte( ui8Cmd ) )
|
if( cSerial.receiveByte( ui8Cmd ) )
|
||||||
{
|
{
|
||||||
if( ui8Cmd == 'b' )
|
if( ui8Cmd == 's' )
|
||||||
{
|
|
||||||
cSerial << "Bootloader . . . " << "\r\n";
|
|
||||||
_delay_ms( 1000 );
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
else if( ui8Cmd == 's' )
|
|
||||||
{
|
{
|
||||||
setTime();
|
setTime();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user