aboutsummaryrefslogtreecommitdiff
path: root/bootloaders/nuevo_diskloader/src/DiskLoader.cpp
blob: 6dda4ae03359a555bc282e37bb4e253a262928a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 *  DiskLoader.cpp
 */

#include "Platform.h"

//extern "C"
void entrypoint(void) __attribute__ ((naked)) __attribute__ ((section (".vectors")));
void entrypoint(void)
{
	asm volatile (
//				  "eor	r1,		r1\n"	// Zero register
//				  "out	0x3F,	r1\n"	// SREG
//				  "ldi	r28,	0xFF\n"
//				  "ldi	r29,	0x0A\n"
//				  "out	0x3E,	r29\n"	// SPH
//				  "out	0x3D,	r28\n"	// SPL
				  "rjmp	main"			// Stack is all set up, start the main code
				  ::);
}

ISR(BADISR_vect)
{
	L_LED_ON();
}

int main(void) __attribute__ ((naked));
int main() 
{
	/* Enable change of interrupt vectors */ 
	MCUCR = (1<<IVCE); 
	/* Move interrupts to boot flash section */ 
	MCUCR = (1<<IVSEL); 
	
	wdt_disable();
	BOARD_INIT();
	TX_LED_OFF();
	RX_LED_OFF();
	L_LED_OFF();	
	USB.attach();
	sei();
	
	for (;;) 
	{
		L_LED_ON();
		_delay_ms(250);
		L_LED_OFF();
		_delay_ms(250);
	}
}