Author: jaguarondi
Date: 2008-06-24 15:04:28 +0200 (Tue, 24 Jun 2008)
New Revision: 1261

Added:
   firmware/rf/trunk/rf.ld
   firmware/rf/trunk/svnrev.tmpl.h
Modified:
   firmware/rf/trunk/Makefile
   firmware/rf/trunk/bootloader.h
   firmware/rf/trunk/device.c
   firmware/rf/trunk/version.h
Log:
* Added versioning and bootloader. The bootloader is disabled for now as it
  runs over the available space.


Modified: firmware/rf/trunk/Makefile
===================================================================
--- firmware/rf/trunk/Makefile  2008-06-24 12:16:28 UTC (rev 1260)
+++ firmware/rf/trunk/Makefile  2008-06-24 13:04:28 UTC (rev 1261)
@@ -32,6 +32,7 @@
 
 ## Linker flags
 LDFLAGS = $(COMMON)
+LDFLAGS += -Wl,--section-start=.bootloader=0x0F00  
-Wl,--section-start=.version=0x0EF0 rf.ld
 
 ## Intel Hex file production flags
 HEX_FLASH_FLAGS = -R .eeprom
@@ -41,13 +42,13 @@
 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 = 
 
 ## Build
-all: $(TARGET) fuxrf.hex fuxrf.eep fuxrf.lss size
+all: svnrev.h $(TARGET) fuxrf.hex fuxrf.eep fuxrf.lss size
 
 ## Compile
 device.o: device.c
@@ -74,6 +75,9 @@
 bootloader.o: bootloader.c
        $(CC) $(INCLUDES) $(CFLAGS) -c  $<
 
+svnrev.h: $(CSOURCE) $(HEADERS)
+       svnwcrev . svnrev.tmpl.h svnrev.h
+
 ##Link
 $(TARGET): $(OBJECTS)
         $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o 
$(TARGET)
@@ -94,7 +98,7 @@
 ## Clean target
 .PHONY: clean
 clean:
-       -rm -rf $(OBJECTS) device.elf dep/* device.hex device.eep device.lss 
device.map
+       -rm -rf $(OBJECTS) device.elf dep/* fuxrf.* tuxrf.* svnrev.h
 
 
 ## Other dependencies

Modified: firmware/rf/trunk/bootloader.h
===================================================================
--- firmware/rf/trunk/bootloader.h      2008-06-24 12:16:28 UTC (rev 1260)
+++ firmware/rf/trunk/bootloader.h      2008-06-24 13:04:28 UTC (rev 1261)
@@ -1,11 +1,20 @@
-
-/* KySoH's iTux agent
-   Copyright (c) 2006, C2ME S.A.
-    All rights reserved.
- * Bootloader source code
- * created on 2006/11/25                               David Bourgeois
- * -------------------------------------------------------------------
- * $Id: bootloader.h 456 2007-06-26 14:12:36Z jaguarondi
+/*
+ * RF - Firmware for the 'RF' CPU of tuxdroid
+ * Copyright (C) 2007 KySoH S.A. <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #ifndef _BOOTLOADER_H_

Modified: firmware/rf/trunk/device.c
===================================================================
--- firmware/rf/trunk/device.c  2008-06-24 12:16:28 UTC (rev 1260)
+++ firmware/rf/trunk/device.c  2008-06-24 13:04:28 UTC (rev 1261)
@@ -50,8 +50,35 @@
 #include "prot.h"
 #include "rf_ctrl.h"
 
-#define DBG_STACK 1
+/*
+ * Version number
+ */
+#include "version.h"
+#include "svnrev.h"
+#include "common/api.h"
+#include "common/defines.h"
 
+#ifdef _SLAVE
+#define CPU_NUMBER      TUXRF_CPU_NUM /* TUXRF CPU */
+#else
+#define CPU_NUMBER      FUXRF_CPU_NUM /* FUXRF CPU */
+#endif
+const author_t author __attribute__ ((section("version.3"))) =
+{AUTHOR_CMD, AUTHOR_ID, VARIATION};
+const revision_t svn_revision __attribute__ ((section("version.2"))) =
+{REVISION_CMD, SVN_REV, RELEASE_TYPE};
+const version_t tag_version __attribute__ ((section("version.1"))) =
+{VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE};
+
+/* Bootloader can be included with the program */
+#define BOOTLOADER 0
+/* Set to 1 to enable stack debugging. */
+#define DBG_STACK 0
+
+#if (BOOTLOADER)
+#include "bootloader.h"
+#endif
+
 #if (DBG_STACK)
 extern uint16_t __heap_start;
 void init_ram(void) __attribute__ ((naked))
@@ -89,6 +116,13 @@
 //*****************************************************************************
 int main(void)
 {
+#if (BOOTLOADER)
+    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 */
+#endif
+
     /* System init */
     init_avr();
     init_varis();

Added: firmware/rf/trunk/rf.ld
===================================================================
--- firmware/rf/trunk/rf.ld                             (rev 0)
+++ firmware/rf/trunk/rf.ld     2008-06-24 13:04:28 UTC (rev 1261)
@@ -0,0 +1,10 @@
+SECTIONS {
+    __start_.version = .;
+    .version :
+    {
+           *(version.1)
+           *(version.2)
+           *(version.3)
+    }
+    __stop_.version = .;
+}

Added: firmware/rf/trunk/svnrev.tmpl.h
===================================================================
--- firmware/rf/trunk/svnrev.tmpl.h                             (rev 0)
+++ firmware/rf/trunk/svnrev.tmpl.h     2008-06-24 13:04:28 UTC (rev 1261)
@@ -0,0 +1,38 @@
+/*
+ * TUXCORE - Firmware for the 'core' CPU of tuxdroid
+ * Copyright (C) 2007 C2ME S.A. <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/* $Id$ */
+
+/* This file is a template to generate svnrev.h automatically.
+ * SubWCRev performs keyword susbstitution whith SVN information.
+ */
+
+#ifndef _SVNREV_H_
+#define _SVNREV_H_
+
+#define SVN_REV     $WCREV$
+#define SVN_REVSTR  "$WCREV$"
+#define SVN_REVDATE "$WCDATE$"
+#define SVN_MOD     $WCMODS?1:0$
+#define SVN_MIX     $WCMIXED?1:0$
+#define SVN_STATUS  (SVN_MOD + (SVN_MIX<<1))
+#define SVN_RANGE   "$WCRANGE$"
+#define SVN_URL     "$WCURL$"
+
+#endif /* _SVNREV_H_ */


Property changes on: firmware/rf/trunk/svnrev.tmpl.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: firmware/rf/trunk/version.h
===================================================================
--- firmware/rf/trunk/version.h 2008-06-24 12:16:28 UTC (rev 1260)
+++ firmware/rf/trunk/version.h 2008-06-24 13:04:28 UTC (rev 1261)
@@ -17,8 +17,14 @@
 #define VER_MINOR           2
 #define VER_UPDATE          0
 
+/** RELEASE should be set to '1' prior to tagging a release, and reset
+ * immediately after. It's like appending (SVN_UNRELEASED) to a version number
+ * when equal to '0'. */
+#define RELEASE             0
+
 #define AUTHOR_ID           0 /* official release */
-#define SVN_REV 0xFFEE /* XXX find a way to define this automatically in the 
Makefile from SVN */
-#define SVN_STATUS 0 /* XXX also fix this in the Makefile */
+#define VARIATION           0 /* generic firmware */
 
-#endif /* _VERSION_H_ */
+#define RELEASE_TYPE (SVN_STATUS | (RELEASE << 2))
+
+#endif /* VERSION_H */


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to