+++ added AVR_Studio compatibility for framework
This commit is contained in:
parent
91b2508dc9
commit
ba182f0ee0
9 changed files with 124 additions and 11 deletions
1
source/Concept/Framework/RoboCode.aps
Normal file
1
source/Concept/Framework/RoboCode.aps
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,9 @@
|
||||||
#ifndef _ATMEGA128IO_H
|
#ifndef _ATMEGA128IO_H
|
||||||
#define _ATMEGA128IO_H
|
#define _ATMEGA128IO_H
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
|
||||||
namespace hardware
|
namespace hardware
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
103
source/Concept/Framework/default/Makefile
Normal file
103
source/Concept/Framework/default/Makefile
Normal file
|
@ -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/*)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#ifdef __int16
|
#ifdef __int16
|
||||||
#define int16 __int16
|
#define int16 __int16
|
||||||
#else
|
#else
|
||||||
#define int16 short
|
#define int16 int
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -120,15 +120,15 @@ public:
|
||||||
|
|
||||||
if(pwmSpeed)
|
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;
|
*pwmPort |= pinPwm;
|
||||||
}
|
}
|
||||||
else if(pwmPort)
|
else if(pwmPort)
|
||||||
{
|
{
|
||||||
*pwmPort &= ~pinPwn;
|
*pwmPort &= ~pinPwm;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateDirection();
|
UpdateDirection();
|
||||||
|
|
|
@ -45,7 +45,10 @@ Robot::Robot()
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
//Interface
|
//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;
|
result /= 3;
|
||||||
|
|
||||||
return uint16(result);
|
return (uint16)(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- EOF ---
|
//--- EOF ---
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "atmega128io.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "io_module.h"
|
#include "io_module.h"
|
||||||
#include "sensor.h"
|
#include "sensor.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef new
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void* operator new(size_t sz)
|
void* operator new(size_t sz)
|
||||||
|
@ -14,4 +14,4 @@ void operator delete(void* p)
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#ifndef _TOOLS_H
|
#ifndef _TOOLS_H
|
||||||
#define _TOOLS_H
|
#define _TOOLS_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef new
|
||||||
void* operator new(size_t sz);
|
void* operator new(size_t sz);
|
||||||
void operator delete(void* p);
|
void operator delete(void* p);
|
||||||
#endif
|
#endif
|
||||||
|
|
Reference in a new issue