summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormasterm <devnull@localhost>2007-02-16 16:22:03 +0100
committermasterm <devnull@localhost>2007-02-16 16:22:03 +0100
commitba182f0ee0d0dbc798e4c782655f440339dcffdd (patch)
tree91efddcee13188e784336bcac358a4ac92deab9e /source
parent91b2508dc92a97802353bd2e96f2849c835f0b2a (diff)
downloadrc2007-soccer-ba182f0ee0d0dbc798e4c782655f440339dcffdd.tar
rc2007-soccer-ba182f0ee0d0dbc798e4c782655f440339dcffdd.zip
+++ added AVR_Studio compatibility for framework
Diffstat (limited to 'source')
-rw-r--r--source/Concept/Framework/RoboCode.aps1
-rw-r--r--source/Concept/Framework/atmega128io.h3
-rw-r--r--source/Concept/Framework/default/Makefile103
-rw-r--r--source/Concept/Framework/defines.h2
-rw-r--r--source/Concept/Framework/engine.h6
-rw-r--r--source/Concept/Framework/robot.cpp7
-rw-r--r--source/Concept/Framework/stdafx.h3
-rw-r--r--source/Concept/Framework/tools.cpp4
-rw-r--r--source/Concept/Framework/tools.h6
9 files changed, 124 insertions, 11 deletions
diff --git a/source/Concept/Framework/RoboCode.aps b/source/Concept/Framework/RoboCode.aps
new file mode 100644
index 0000000..3864c4f
--- /dev/null
+++ b/source/Concept/Framework/RoboCode.aps
@@ -0,0 +1 @@
+<AVRStudio><MANAGEMENT><ProjectName>RoboCode</ProjectName><Created>16-Feb-2007 15:16:46</Created><LastEdit>16-Feb-2007 16:19:25</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>16-Feb-2007 15:16:46</Created><Version>4</Version><Build>4, 12, 0, 462</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\RoboCode.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET></CURRENT_TARGET><CURRENT_PART></CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM></COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>main.cpp</SOURCEFILE><SOURCEFILE>sensor.cpp</SOURCEFILE><SOURCEFILE>tools.cpp</SOURCEFILE><SOURCEFILE>atmega128io.cpp</SOURCEFILE><SOURCEFILE>distance_sensor.cpp</SOURCEFILE><SOURCEFILE>engine.cpp</SOURCEFILE><SOURCEFILE>io_module.cpp</SOURCEFILE><SOURCEFILE>ir_sensor.cpp</SOURCEFILE><SOURCEFILE>kicker.cpp</SOURCEFILE><SOURCEFILE>led.cpp</SOURCEFILE><SOURCEFILE>robot.cpp</SOURCEFILE><HEADERFILE>sensor.h</HEADERFILE><HEADERFILE>stdafx.h</HEADERFILE><HEADERFILE>tools.h</HEADERFILE><HEADERFILE>atmega128io.h</HEADERFILE><HEADERFILE>defines.h</HEADERFILE><HEADERFILE>distance_sensor.h</HEADERFILE><HEADERFILE>engine.h</HEADERFILE><HEADERFILE>io_module.h</HEADERFILE><HEADERFILE>ir_sensor.h</HEADERFILE><HEADERFILE>kicker.h</HEADERFILE><HEADERFILE>led.h</HEADERFILE><HEADERFILE>robot.h</HEADERFILE><OTHERFILE>default\Makefile</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>YES</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE>default\Makefile</EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>0</LIST><MAP>0</MAP><OUTPUTFILENAME>RoboCode.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -O0 -fsigned-char</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>G:\_Tools\Winavr\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>G:\_Tools\Winavr\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\sensor.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\stdafx.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\tools.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\atmega128io.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\defines.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\distance_sensor.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\engine.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\io_module.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\ir_sensor.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\kicker.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\led.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\robot.h</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\main.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\sensor.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\tools.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\atmega128io.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\distance_sensor.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\engine.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\io_module.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\ir_sensor.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\kicker.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\led.cpp</Name><Name>I:\Projects\RoboCup WM 2006 07\trunk\rc2007-soccer\source\Concept\Framework\robot.cpp</Name></Files></ProjectFiles><Files><File00000><FileId>00000</FileId><FileName>stdafx.h</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>engine.h</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>defines.h</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>io_module.h</FileName><Status>1</Status></File00003><File00004><FileId>00004</FileId><FileName>robot.h</FileName><Status>1</Status></File00004><File00005><FileId>00005</FileId><FileName>robot.cpp</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>atmega128io.h</FileName><Status>1</Status></File00006><File00007><FileId>00007</FileId><FileName>main.cpp</FileName><Status>1</Status></File00007><File00008><FileId>00008</FileId><FileName>tools.cpp</FileName><Status>1</Status></File00008><File00009><FileId>00009</FileId><FileName>tools.h</FileName><Status>1</Status></File00009></Files><Workspace><File00000><Position>331 119 937 393</Position><LineCol>7 24</LineCol></File00000><File00001><Position>353 141 953 387</Position><LineCol>123 3</LineCol></File00001><File00002><Position>375 163 975 409</Position><LineCol>107 8</LineCol></File00002><File00003><Position>397 185 997 431</Position><LineCol>16 0</LineCol></File00003><File00004><Position>419 207 1019 453</Position><LineCol>3 19</LineCol></File00004><File00005><Position>309 97 909 343</Position><LineCol>44 0</LineCol></File00005><File00006><Position>353 141 953 387</Position><LineCol>4 26</LineCol></File00006><File00007><Position>375 163 975 409</Position><LineCol>5 0</LineCol></File00007><File00008><Position>397 185 997 431</Position><LineCol>2 11</LineCol></File00008><File00009><Position>419 207 1019 453</Position><LineCol>5 11</LineCol></File00009></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
diff --git a/source/Concept/Framework/atmega128io.h b/source/Concept/Framework/atmega128io.h
index 94912b6..a6044c4 100644
--- a/source/Concept/Framework/atmega128io.h
+++ b/source/Concept/Framework/atmega128io.h
@@ -1,6 +1,9 @@
#ifndef _ATMEGA128IO_H
#define _ATMEGA128IO_H
+#include <avr/io.h>
+#include <avr/interrupt.h>
+
namespace hardware
{
diff --git a/source/Concept/Framework/default/Makefile b/source/Concept/Framework/default/Makefile
new file mode 100644
index 0000000..ca32983
--- /dev/null
+++ b/source/Concept/Framework/default/Makefile
@@ -0,0 +1,103 @@
+###############################################################################
+# Makefile for the project RoboCode
+###############################################################################
+
+## General Flags
+PROJECT = RoboCode
+MCU = atmega128
+TARGET = RoboCode.elf
+CC = avr-gcc.exe
+
+## Options common to compile, link and assembly rules
+COMMON = -mmcu=$(MCU)
+
+## Compile options common for all C compilation units.
+CFLAGS = $(COMMON)
+CFLAGS += -Wall -gdwarf-2 -O0
+CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
+
+## Assembly specific flags
+ASMFLAGS = $(COMMON)
+ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
+
+## Linker flags
+LDFLAGS = $(COMMON)
+LDFLAGS +=
+
+
+## Intel Hex file production flags
+HEX_FLASH_FLAGS = -R .eeprom
+
+HEX_EEPROM_FLAGS = -j .eeprom
+HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
+HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0
+
+
+## Objects that must be built in order to link
+OBJECTS = main.o sensor.o tools.o atmega128io.o distance_sensor.o engine.o io_module.o ir_sensor.o kicker.o led.o robot.o
+
+## Objects explicitly added by the user
+LINKONLYOBJECTS =
+
+## Build
+all: $(TARGET) RoboCode.hex RoboCode.eep size
+
+## Compile
+main.o: ../main.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+tools.o: ../tools.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+io_module.o: ../io_module.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+robot.o: ../robot.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+sensor.o: ../sensor.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+engine.o: ../engine.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+led.o: ../led.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+ir_sensor.o: ../ir_sensor.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+distance_sensor.o: ../distance_sensor.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+kicker.o: ../kicker.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+atmega128io.o: ../atmega128io.cpp
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+##Link
+$(TARGET): $(OBJECTS)
+ $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
+
+%.hex: $(TARGET)
+ avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@
+
+%.eep: $(TARGET)
+ avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@
+
+%.lss: $(TARGET)
+ avr-objdump -h -S $< > $@
+
+size: ${TARGET}
+ @echo
+ @avr-size -C --mcu=${MCU} ${TARGET}
+
+## Clean target
+.PHONY: clean
+clean:
+ -rm -rf $(OBJECTS) RoboCode.elf dep/* RoboCode.hex RoboCode.eep
+
+## Other dependencies
+-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
+
diff --git a/source/Concept/Framework/defines.h b/source/Concept/Framework/defines.h
index 15e6c35..1b14aa7 100644
--- a/source/Concept/Framework/defines.h
+++ b/source/Concept/Framework/defines.h
@@ -18,7 +18,7 @@
#ifdef __int16
#define int16 __int16
#else
- #define int16 short
+ #define int16 int
#endif
#endif
diff --git a/source/Concept/Framework/engine.h b/source/Concept/Framework/engine.h
index 6454a32..2d8c409 100644
--- a/source/Concept/Framework/engine.h
+++ b/source/Concept/Framework/engine.h
@@ -120,15 +120,15 @@ public:
if(pwmSpeed)
{
- *pwmSpeed = uint16(abs(newSpeed / SPEED_PER_PWM));
+ *pwmSpeed = abs(newSpeed / SPEED_PER_PWM);
}
- else if(pwmPort && uint16(abs(newSpeed / SPEED_PER_PWM)))
+ else if(pwmPort && (uint16)(abs(newSpeed / SPEED_PER_PWM)))
{
*pwmPort |= pinPwm;
}
else if(pwmPort)
{
- *pwmPort &= ~pinPwn;
+ *pwmPort &= ~pinPwm;
}
UpdateDirection();
diff --git a/source/Concept/Framework/robot.cpp b/source/Concept/Framework/robot.cpp
index 3d3ae48..f14f2f7 100644
--- a/source/Concept/Framework/robot.cpp
+++ b/source/Concept/Framework/robot.cpp
@@ -45,7 +45,10 @@ Robot::Robot()
sei();
//Interface
- memset(modules, NULL, sizeof(modules));
+ for(uint8 i = 0; i < IO_END; i++)
+ {
+ modules[i] = NULL;
+ }
}
//-----------------------------------------------------------------------------
@@ -120,7 +123,7 @@ uint16 Robot::GetADCValue(uint8 channel)
result /= 3;
- return uint16(result);
+ return (uint16)(result);
}
//--- EOF ---
diff --git a/source/Concept/Framework/stdafx.h b/source/Concept/Framework/stdafx.h
index 436f117..218b774 100644
--- a/source/Concept/Framework/stdafx.h
+++ b/source/Concept/Framework/stdafx.h
@@ -4,7 +4,8 @@
#include <memory.h>
#endif
-#include "defines.h"
+#include "defines.h"
+#include "atmega128io.h"
#include "tools.h"
#include "io_module.h"
#include "sensor.h"
diff --git a/source/Concept/Framework/tools.cpp b/source/Concept/Framework/tools.cpp
index 625ef20..6fd107c 100644
--- a/source/Concept/Framework/tools.cpp
+++ b/source/Concept/Framework/tools.cpp
@@ -1,6 +1,6 @@
#include "tools.h"
-#ifndef __cplusplus
+#ifndef new
//-----------------------------------------------------------------------------
void* operator new(size_t sz)
@@ -14,4 +14,4 @@ void operator delete(void* p)
free(p);
}
-#endif \ No newline at end of file
+#endif
diff --git a/source/Concept/Framework/tools.h b/source/Concept/Framework/tools.h
index 9cd38f2..2af60df 100644
--- a/source/Concept/Framework/tools.h
+++ b/source/Concept/Framework/tools.h
@@ -1,7 +1,9 @@
#ifndef _TOOLS_H
-#define _TOOLS_H
+#define _TOOLS_H
+
+#include <stdlib.h>
-#ifndef __cplusplus
+#ifndef new
void* operator new(size_t sz);
void operator delete(void* p);
#endif