[tuxdroid-svn] r1274 - firmware/rf/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-06-26 13:46:06
|
Author: jaguarondi Date: 2008-06-26 15:46:14 +0200 (Thu, 26 Jun 2008) New Revision: 1274 Modified: firmware/rf/trunk/Makefile firmware/rf/trunk/bootloader.h firmware/rf/trunk/device.c firmware/rf/trunk/init.c firmware/rf/trunk/rf_ctrl.c Log: * Fixed some problems around the bootloader. We have to compile the bootlodaer to have the jump to it correctly set. Note that the bootloader is located at 0x0F00 but the entry point is at 0x0F0A. We should probably have a jump to that address instead of compiling the bootloader which doesn't fit in the flash anyway. * Removed the debug signal which was keeping the RF board in reset thanks to some clever hardwired autoreset feature ;-). Re-enable this if you want to kill your tux. Modified: firmware/rf/trunk/Makefile =================================================================== --- firmware/rf/trunk/Makefile 2008-06-26 13:41:51 UTC (rev 1273) +++ firmware/rf/trunk/Makefile 2008-06-26 13:46:14 UTC (rev 1274) @@ -42,7 +42,7 @@ HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 ## Objects that must be built in order to link -OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o #bootloader.o +OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o bootloader.o ## Objects explicitly added by the user LINKONLYOBJECTS = @@ -98,7 +98,7 @@ ## Clean target .PHONY: clean clean: - -rm -rf $(OBJECTS) device.elf dep/* fuxrf.* tuxrf.* svnrev.h + -rm -rf $(OBJECTS) device.elf dep/* $(PROJECT).* svnrev.h ## Other dependencies Modified: firmware/rf/trunk/bootloader.h =================================================================== --- firmware/rf/trunk/bootloader.h 2008-06-26 13:41:51 UTC (rev 1273) +++ firmware/rf/trunk/bootloader.h 2008-06-26 13:46:14 UTC (rev 1274) @@ -48,7 +48,11 @@ /** \ingroup tuxRF_firmware Slave address for bootloader mode */ +#if defined(_SLAVE) +#define I2C_BL_TWAR (0X32 << 1) +#elif defined(_MASTER) #define I2C_BL_TWAR (0X33 << 1) +#endif void bootloader(void) __attribute__ ((section(".bootloader"))) __attribute__ ((naked)); Modified: firmware/rf/trunk/device.c =================================================================== --- firmware/rf/trunk/device.c 2008-06-26 13:41:51 UTC (rev 1273) +++ firmware/rf/trunk/device.c 2008-06-26 13:46:14 UTC (rev 1274) @@ -71,7 +71,7 @@ {VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE}; /* Bootloader can be included with the program */ -#define BOOTLOADER 0 +#define BOOTLOADER 1 /* Set to 1 to enable stack debugging. */ #define DBG_STACK 0 @@ -117,11 +117,16 @@ int main(void) { #if (BOOTLOADER) +#ifdef _SLAVE volatile uint16_t _count=0; for (;_count<0xFFFF; _count++); if (!(PIND & 0x40)) /* if head is pushed at startup */ asm volatile ("rjmp bootloader" ::); /* jump to bootloader */ +#elif defined(_MASTER) + if (!(PINB & 0x04)) /* if SPI_SS is cleared at startup */ + asm volatile ("rjmp bootloader" ::); /* jump to bootloader */ #endif +#endif /* System init */ init_avr(); Modified: firmware/rf/trunk/init.c =================================================================== --- firmware/rf/trunk/init.c 2008-06-26 13:41:51 UTC (rev 1273) +++ firmware/rf/trunk/init.c 2008-06-26 13:46:14 UTC (rev 1274) @@ -89,13 +89,13 @@ //PORTD.0 -> IN RX_DATA //PORTD.1 -> OUT TX_DATA/Data //PORTD.2 -> OUT PU_TRX/PU_REG - //PORTD.3 -> OUTPUT DEBUG + //PORTD.3 -> PASCAL SAID NOT TO TOUCH THIS ONE //PORTD.4 -> I/O CLK_REC/Clock //PORTD.5 -> OUT RXON //PORTD.6 -> NOT USED, PULLED UP //PORTD.7 -> LINK PORTD = 0x40; - DDRD = 0xAE; + DDRD = 0xA6; //*************PORTD*************// //***********init-needed-peripherals***************// UBRR0L = 0x05; Modified: firmware/rf/trunk/rf_ctrl.c =================================================================== --- firmware/rf/trunk/rf_ctrl.c 2008-06-26 13:41:51 UTC (rev 1273) +++ firmware/rf/trunk/rf_ctrl.c 2008-06-26 13:46:14 UTC (rev 1274) @@ -231,7 +231,6 @@ { OCR1A = OCR1A+T_RX2TX; } - PORTD ^= 0x08; // XXX DEBUG } else /* Wrong frame, just continue. */ |