Skip to content

Commit

Permalink
simplified the includes, makefile now works with arduino23
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard committed Dec 22, 2011
1 parent 3c1a4aa commit 57f9359
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 84 deletions.
6 changes: 4 additions & 2 deletions Marlin/EEPROMwrite.h
Expand Up @@ -4,14 +4,16 @@
#include "Marlin.h"
#include "planner.h"
#include "temperature.h"
//#include <EEPROM.h>



template <class T> int EEPROM_writeAnything(int &ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
int i;
for (i = 0; i < (int)sizeof(value); i++)
EEPROM.write(ee++, *p++);
eeprom_write_byte((unsigned char *)ee++, *p++);
return i;
}

Expand All @@ -20,7 +22,7 @@ template <class T> int EEPROM_readAnything(int &ee, T& value)
byte* p = (byte*)(void*)&value;
int i;
for (i = 0; i < (int)sizeof(value); i++)
*p++ = EEPROM.read(ee++);
*p++ = eeprom_read_byte((unsigned char *)ee++);
return i;
}
//======================================================================================
Expand Down
21 changes: 17 additions & 4 deletions Marlin/Makefile
@@ -1,7 +1,7 @@
TARGET = $(notdir $(CURDIR))
# CHANGE BELOW:
#~ INSTALL_DIR = /Applications/Arduino.app/Contents/Resources/Java
INSTALL_DIR = /home/bkubicek/software/arduino-0022
INSTALL_DIR = /home/bkubicek/software/arduino-0023
#~ PORT = /dev/cu.usbserial*
PORT = /dev/ttyACM0

Expand Down Expand Up @@ -60,13 +60,25 @@ OPT = 2
#~ CDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
#~ CXXDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
# now called DF_CPU
CDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=22
CXXDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=22
CDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=23
CXXDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=23

# Place -I options here
CINCS = -I$(ARDUINO) -I$(INSTALL_DIR)/libraries/LiquidCrystal/ -I$(INSTALL_DIR)/libraries/EEPROM/
CXXINCS = -I$(ARDUINO)

OBJECTS= applet/Marlin.cpp.o \
applet/EEPROM.o \
applet/pins_arduino.o \
applet/wiring_analog.o \
applet/wiring_pulse.o \
applet/main.o \
applet/Print.o \
applet/wiring_digital.o \
applet/wiring_shift.o \
applet/stepper.o \
applet/wiring.o \
applet/WMath.o
# Compiler flag to set the C Standard level.
# c89 - "ANSI" C
# gnu89 - c89 plus GCC extensions
Expand Down Expand Up @@ -253,7 +265,8 @@ applet/$(TARGET).elf: $(TARGET).pde applet/$(TARGET).cpp.o applet/core.a
# $(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
# changed as in IDE v0022: link cpp obj files
@echo $$(tput bold)$$(tput setaf 2) $(CC) $$(tput sgr0) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
@$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ $OBJECTS -L. applet/core.a $(LDFLAGS)
#@$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/*.o applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)

# added: cpp.o depends on cpp (and .pde which generates it)
# $< "first item in the dependencies list"; $@ "left side of the :"; $^ "right side of the :"
Expand Down
52 changes: 36 additions & 16 deletions Marlin/Marlin.h
@@ -1,35 +1,55 @@
// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
// Licence: GPL

#ifndef __MARLINH
#define __MARLINH

// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
// Licence: GPL
#define HardwareSerial_h // trick to disable the standard HWserial
#include <stdio.h>

#define FORCE_INLINE __attribute__((always_inline)) inline

#include <math.h>
#include <util/delay.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>

#include <avr/delay.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>









#include "fastio.h"
#include "Configuration.h"
#include "pins.h"

#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <EEPROM.h>


#include "fastio.h"
#include "Configuration.h"
#include "pins.h"
#include "MarlinSerial.h"

#define FORCE_INLINE __attribute__((always_inline)) inline
//#define SERIAL_ECHO(x) Serial << "echo: " << x;
//#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
//#define SERIAL_ERROR(x) Serial << "Error: " << x;
//#define SERIAL_ERRORLN(x) Serial << "Error: " << x<<endl;
//#define SERIAL_PROTOCOL(x) Serial << x;
//#define SERIAL_PROTOCOLLN(x) Serial << x<<endl;
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

#include "WString.h"



//this is a unfinsihed attemp to removes a lot of warning messages, see:
// http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011
Expand Down
10 changes: 2 additions & 8 deletions Marlin/Marlin.pde
Expand Up @@ -25,15 +25,9 @@
http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
*/


#include "Marlin.h"
#include <EEPROM.h>
#include <stdio.h>

#include "EEPROMwrite.h"
#include "fastio.h"
#include "Configuration.h"
#include "pins.h"


#include "ultralcd.h"
#include "planner.h"
Expand All @@ -42,7 +36,7 @@
#include "motion_control.h"
#include "cardreader.h"
#include "watchdog.h"

#include "EEPROMwrite.h"



Expand Down
17 changes: 3 additions & 14 deletions Marlin/MarlinSerial.cpp
Expand Up @@ -20,25 +20,14 @@
Modified 28 September 2010 by Mark Sproul
*/


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <math.h>
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "wiring.h"
#endif
#include "wiring_private.h"
#include "Marlin.h"
#include "MarlinSerial.h"

// this next line disables the entire HardwareSerial.cpp,
// this is so I can support Attiny series and any other chip without a uart
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)

#include "MarlinSerial.h"
#include "Marlin.h"




Expand Down
7 changes: 1 addition & 6 deletions Marlin/MarlinSerial.h
Expand Up @@ -21,13 +21,8 @@

#ifndef MarlinSerial_h
#define MarlinSerial_h
#include <math.h>
#include <inttypes.h>
//#include <Stream.h>
#include <string.h>
#define FORCE_INLINE __attribute__((always_inline)) inline
#include "Marlin.h"

#include "WString.h"

#define DEC 10
#define HEX 16
Expand Down
7 changes: 1 addition & 6 deletions Marlin/Sd2Card.cpp
Expand Up @@ -17,12 +17,7 @@
* along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#define HardwareSerial_h // trick to disable the standard HWserial
#if ARDUINO < 100
#include <WProgram.h>
#else // ARDUINO
#include <Arduino.h>
#endif // ARDUINO
#include "Marlin.h"
#include "Sd2Card.h"
//------------------------------------------------------------------------------
#ifndef SOFTWARE_SPI
Expand Down
9 changes: 1 addition & 8 deletions Marlin/SdBaseFile.h
Expand Up @@ -23,14 +23,7 @@
* \file
* \brief SdBaseFile class
*/
#include <avr/pgmspace.h>
#define HardwareSerial_h // trick to disable the standard HWserial
#if ARDUINO < 100
#include <WProgram.h>
#else // ARDUINO
#include <Arduino.h>
#endif // ARDUINO
#include "MarlinSerial.h"
#include "Marlin.h"
#include "SdFatConfig.h"
#include "SdVolume.h"
//------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions Marlin/SdFatUtil.cpp
Expand Up @@ -17,7 +17,9 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#include "SdFatUtil.h"

//------------------------------------------------------------------------------
/** Amount of free RAM
* \return The number of free bytes.
Expand Down
9 changes: 1 addition & 8 deletions Marlin/SdFatUtil.h
Expand Up @@ -23,14 +23,7 @@
* \file
* \brief Useful utility functions.
*/
#include <avr/pgmspace.h>

#define HardwareSerial_h // trick to disable the standard HWserial
#if ARDUINO < 100
#include <WProgram.h>
#else // ARDUINO
#include <Arduino.h>
#endif // ARDUINO
#include "Marlin.h"
#include "MarlinSerial.h"
/** Store and print a string in flash memory.*/
#define PgmPrint(x) SerialPrint_P(PSTR(x))
Expand Down
1 change: 1 addition & 0 deletions Marlin/SdFile.cpp
Expand Up @@ -17,6 +17,7 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#include "SdFile.h"
/** Create a file object and open it in the current working directory.
*
Expand Down
1 change: 1 addition & 0 deletions Marlin/SdFile.h
Expand Up @@ -22,6 +22,7 @@
* \brief SdFile class
*/
#include "SdBaseFile.h"
#include "Marlin.h"
#include <Print.h>
#ifndef SdFile_h
#define SdFile_h
Expand Down
3 changes: 2 additions & 1 deletion Marlin/cardreader.pde
@@ -1,7 +1,8 @@
#include "Marlin.h"
#include "cardreader.h"
#ifdef SDSUPPORT

#include "Marlin.h"


CardReader::CardReader()
{
Expand Down
7 changes: 1 addition & 6 deletions Marlin/planner.h
Expand Up @@ -98,12 +98,7 @@ extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
#endif


/////semi-private stuff
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif


extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed
Expand Down
2 changes: 1 addition & 1 deletion Marlin/speed_lookuptable.h
@@ -1,7 +1,7 @@
#ifndef SPEED_LOOKUPTABLE_H
#define SPEED_LOOKUPTABLE_H

#include <avr/pgmspace.h>
#include "Marlin.h"

uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\
{ 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135},
Expand Down
3 changes: 2 additions & 1 deletion Marlin/stepper.cpp
Expand Up @@ -22,9 +22,10 @@
and Philipp Tiefenbacher. */


#include "stepper.h"


#include "Marlin.h"
#include "stepper.h"
#include "planner.h"
#include "temperature.h"
#include "ultralcd.h"
Expand Down
2 changes: 1 addition & 1 deletion Marlin/thermistortables.h
@@ -1,7 +1,7 @@
#ifndef THERMISTORTABLES_H_
#define THERMISTORTABLES_H_

#include <avr/pgmspace.h>
#include "Marlin.h"

#define OVERSAMPLENR 16

Expand Down
1 change: 1 addition & 0 deletions Marlin/ultralcd.pde
@@ -1,5 +1,6 @@
#include "ultralcd.h"
#ifdef ULTRA_LCD
#include "Marlin.h"
#include <LiquidCrystal.h>
//===========================================================================
//=============================imported variables============================
Expand Down
3 changes: 1 addition & 2 deletions Marlin/watchdog.pde
@@ -1,7 +1,6 @@
#ifdef USE_WATCHDOG
#include "Marlin.h"
#include "watchdog.h"
#include <avr/wdt.h>
#include <avr/interrupt.h>

//===========================================================================
//=============================private variables ============================
Expand Down

0 comments on commit 57f9359

Please sign in to comment.