Revision 195 trunk/bootloader/bootloader.c

bootloader.c (revision 195)
17 17
#define LED_PORT PORTB
18 18
#define LED      PORTB1
19 19

  
20
//Function prototypes
20
/**
21
 * Where we store the jump to user code. The jump address is in words
22
 * due to how the rjmp instruction works. It is 1 word below the bootloader
23
 */
21 24
void (*main_start)(void) = BOOT_START/2 - 1;
25

  
26
/**
27
 * We declare main as naked so that there is no overhead for entering
28
 * and returning from this function since we don't really care about
29
 * what happens to it after we leave it
30
 */
22 31
int main(void) __attribute__ ((naked));
23 32

  
24 33
typedef union {
......
26 35
    int16_t sword;
27 36
} rjump_t;
28 37

  
38
/** 
39
 * Restore the reset vector to point to the end of ctors. This
40
 * is because we are stripping out the interrupt vector table
41
 * from the bootloader as we don't use it.
42
 */
43
void ResetVector (void) __attribute__((naked))
44
                        __attribute__((section(".reset")));
45
void ResetVector(void) {
46
    asm("rjmp __ctors_end");
47
}
29 48

  
49

  
30 50
// SPM_PAGESIZE is set to 32 bytes
31 51
void onboard_program_write(uint16_t page, uint8_t *buf) {
32 52
  uint16_t i;

Also available in: Unified diff