/* fuses:
* avrdude -p atmega1284p -P usb -c avrispmkii -U lfuse:w:0xff:m -U hfuse:w:0x91:m -U efuse:w:0xff:m
* -> it failed but I answered y, then make reset and it was ok
+ *
+ * with bootloader:
+ * avrdude -p atmega1284p -P usb -c avrispmkii -U lfuse:w:0xff:m -U hfuse:w:0x90:m -U efuse:w:0xff:m
*/
#include <aversive.h>
#include "eeprom_config.h"
#include "gps.h"
+#ifdef GPS_VENUS
#include "gps_venus.h"
+#endif
+#ifdef GPS_UBX
+#include "gps_ubx.h"
+#endif
#include "sd_log.h"
#include "../common/i2c_commands.h"
#include "i2c_protocol.h"
struct imuboard imuboard;
volatile uint32_t global_ms;
-/* global xbee device */
-struct xbee_dev *xbee_dev;
-
void bootloader(void)
{
-#define BOOTLOADER_ADDR 0x3f000
+#define BOOTLOADER_ADDR 0x1e000
if (pgm_read_byte_far(BOOTLOADER_ADDR) == 0xff) {
printf_P(PSTR("Bootloader is not present\r\n"));
return;
ACSR = 0;
ADCSRA = 0;
- /* XXX */
- /* __asm__ __volatile__ ("ldi r31,0xf8\n"); */
- /* __asm__ __volatile__ ("ldi r30,0x00\n"); */
- /* __asm__ __volatile__ ("eijmp\n"); */
+ __asm__ __volatile__ ("ldi r30,0x00\n");
+ __asm__ __volatile__ ("ldi r31,0xf0\n");
+ //__asm__ __volatile__ ("eijmp\n");
+ __asm__ __volatile__ ("ijmp\n");
}
/* return time in milliseconds on unsigned 16 bits */
callout_mgr_init(&imuboard.intr_cm, get_time_ms);
+#if 0
+ sei(); //XXX
+ printf_P(PSTR("starting...\r\n"));
+ while (1) {
+ int16_t c;
+ c = uart_recv_nowait(0);
+ if (c >= 0)
+ printf("%x\n", (uint8_t)c);
+ }
+#endif
+
cmdline_init();
/* LOGS */
error_register_emerg(mylog);
rdline_newline(&imuboard.rdl, imuboard.prompt);
imu_init();
+#ifdef GPS_VENUS
gps_venus_init();
+#endif
+#ifdef GPS_UBX
+ gps_ubx_init();
+#endif
imuboard.flags |= IMUBOARD_F_BOOT_OK;