From 57f9359a4147157189cedf6e934dcd5571a79a88 Mon Sep 17 00:00:00 2001 From: Bernhard Date: Thu, 22 Dec 2011 14:55:45 +0100 Subject: [PATCH] simplified the includes, makefile now works with arduino23 --- Marlin/EEPROMwrite.h | 6 ++-- Marlin/Makefile | 21 +++++++++++--- Marlin/Marlin.h | 56 ++++++++++++++++++++++++++------------ Marlin/Marlin.pde | 10 ++----- Marlin/MarlinSerial.cpp | 17 ++---------- Marlin/MarlinSerial.h | 7 +---- Marlin/Sd2Card.cpp | 7 +---- Marlin/SdBaseFile.h | 9 +----- Marlin/SdFatUtil.cpp | 2 ++ Marlin/SdFatUtil.h | 9 +----- Marlin/SdFile.cpp | 1 + Marlin/SdFile.h | 1 + Marlin/cardreader.pde | 3 +- Marlin/planner.h | 7 +---- Marlin/speed_lookuptable.h | 2 +- Marlin/stepper.cpp | 3 +- Marlin/thermistortables.h | 2 +- Marlin/ultralcd.pde | 1 + Marlin/watchdog.pde | 3 +- 19 files changed, 81 insertions(+), 86 deletions(-) diff --git a/Marlin/EEPROMwrite.h b/Marlin/EEPROMwrite.h index 5714dacfe..bb25ae896 100644 --- a/Marlin/EEPROMwrite.h +++ b/Marlin/EEPROMwrite.h @@ -4,6 +4,8 @@ #include "Marlin.h" #include "planner.h" #include "temperature.h" +//#include + template int EEPROM_writeAnything(int &ee, const T& value) @@ -11,7 +13,7 @@ template 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; } @@ -20,7 +22,7 @@ template 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; } //====================================================================================== diff --git a/Marlin/Makefile b/Marlin/Makefile index 0504319f7..585530bca 100644 --- a/Marlin/Makefile +++ b/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 @@ -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 @@ -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 :" diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 0773f11c1..2a237e093 100644 --- a/Marlin/Marlin.h +++ b/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 -#include -#include -#include +#define FORCE_INLINE __attribute__((always_inline)) inline + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + + + + + + + + +#include "fastio.h" +#include "Configuration.h" +#include "pins.h" #if ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif -#include - -#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: "< -#include -#include "EEPROMwrite.h" -#include "fastio.h" -#include "Configuration.h" -#include "pins.h" + #include "ultralcd.h" #include "planner.h" @@ -42,7 +36,7 @@ #include "motion_control.h" #include "cardreader.h" #include "watchdog.h" - +#include "EEPROMwrite.h" diff --git a/Marlin/MarlinSerial.cpp b/Marlin/MarlinSerial.cpp index 63268e8cf..7175561e2 100644 --- a/Marlin/MarlinSerial.cpp +++ b/Marlin/MarlinSerial.cpp @@ -20,25 +20,14 @@ Modified 28 September 2010 by Mark Sproul */ - -#include -#include -#include -#include -#include -#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" + diff --git a/Marlin/MarlinSerial.h b/Marlin/MarlinSerial.h index 0fe0c5227..71823de8f 100644 --- a/Marlin/MarlinSerial.h +++ b/Marlin/MarlinSerial.h @@ -21,13 +21,8 @@ #ifndef MarlinSerial_h #define MarlinSerial_h -#include -#include -//#include -#include -#define FORCE_INLINE __attribute__((always_inline)) inline +#include "Marlin.h" -#include "WString.h" #define DEC 10 #define HEX 16 diff --git a/Marlin/Sd2Card.cpp b/Marlin/Sd2Card.cpp index d7f018e4b..f421154ea 100644 --- a/Marlin/Sd2Card.cpp +++ b/Marlin/Sd2Card.cpp @@ -17,12 +17,7 @@ * along with the Arduino Sd2Card Library. If not, see * . */ -#define HardwareSerial_h // trick to disable the standard HWserial -#if ARDUINO < 100 -#include -#else // ARDUINO -#include -#endif // ARDUINO +#include "Marlin.h" #include "Sd2Card.h" //------------------------------------------------------------------------------ #ifndef SOFTWARE_SPI diff --git a/Marlin/SdBaseFile.h b/Marlin/SdBaseFile.h index f5c5e4de3..80402e56c 100644 --- a/Marlin/SdBaseFile.h +++ b/Marlin/SdBaseFile.h @@ -23,14 +23,7 @@ * \file * \brief SdBaseFile class */ -#include -#define HardwareSerial_h // trick to disable the standard HWserial -#if ARDUINO < 100 -#include -#else // ARDUINO -#include -#endif // ARDUINO -#include "MarlinSerial.h" +#include "Marlin.h" #include "SdFatConfig.h" #include "SdVolume.h" //------------------------------------------------------------------------------ diff --git a/Marlin/SdFatUtil.cpp b/Marlin/SdFatUtil.cpp index 0bf86f295..559305f11 100644 --- a/Marlin/SdFatUtil.cpp +++ b/Marlin/SdFatUtil.cpp @@ -17,7 +17,9 @@ * along with the Arduino SdFat Library. If not, see * . */ +#include "Marlin.h" #include "SdFatUtil.h" + //------------------------------------------------------------------------------ /** Amount of free RAM * \return The number of free bytes. diff --git a/Marlin/SdFatUtil.h b/Marlin/SdFatUtil.h index fc7a17e5b..d843da04c 100644 --- a/Marlin/SdFatUtil.h +++ b/Marlin/SdFatUtil.h @@ -23,14 +23,7 @@ * \file * \brief Useful utility functions. */ -#include - -#define HardwareSerial_h // trick to disable the standard HWserial -#if ARDUINO < 100 -#include -#else // ARDUINO -#include -#endif // ARDUINO +#include "Marlin.h" #include "MarlinSerial.h" /** Store and print a string in flash memory.*/ #define PgmPrint(x) SerialPrint_P(PSTR(x)) diff --git a/Marlin/SdFile.cpp b/Marlin/SdFile.cpp index 68f14b193..5781d10b4 100644 --- a/Marlin/SdFile.cpp +++ b/Marlin/SdFile.cpp @@ -17,6 +17,7 @@ * along with the Arduino SdFat Library. If not, see * . */ +#include "Marlin.h" #include "SdFile.h" /** Create a file object and open it in the current working directory. * diff --git a/Marlin/SdFile.h b/Marlin/SdFile.h index 931486285..2fd575592 100644 --- a/Marlin/SdFile.h +++ b/Marlin/SdFile.h @@ -22,6 +22,7 @@ * \brief SdFile class */ #include "SdBaseFile.h" +#include "Marlin.h" #include #ifndef SdFile_h #define SdFile_h diff --git a/Marlin/cardreader.pde b/Marlin/cardreader.pde index 89f4b2f93..3d9122497 100644 --- a/Marlin/cardreader.pde +++ b/Marlin/cardreader.pde @@ -1,7 +1,8 @@ +#include "Marlin.h" #include "cardreader.h" #ifdef SDSUPPORT -#include "Marlin.h" + CardReader::CardReader() { diff --git a/Marlin/planner.h b/Marlin/planner.h index 02e299fa8..ac9719fbc 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -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 diff --git a/Marlin/speed_lookuptable.h b/Marlin/speed_lookuptable.h index 002f852f6..ab3a076f1 100644 --- a/Marlin/speed_lookuptable.h +++ b/Marlin/speed_lookuptable.h @@ -1,7 +1,7 @@ #ifndef SPEED_LOOKUPTABLE_H #define SPEED_LOOKUPTABLE_H -#include +#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}, diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 6985da00b..076fbeea1 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -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" diff --git a/Marlin/thermistortables.h b/Marlin/thermistortables.h index 30f5b62ac..3071a6b5b 100644 --- a/Marlin/thermistortables.h +++ b/Marlin/thermistortables.h @@ -1,7 +1,7 @@ #ifndef THERMISTORTABLES_H_ #define THERMISTORTABLES_H_ -#include +#include "Marlin.h" #define OVERSAMPLENR 16 diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde index 5be09ac4a..bc1c9cc6c 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -1,5 +1,6 @@ #include "ultralcd.h" #ifdef ULTRA_LCD +#include "Marlin.h" #include //=========================================================================== //=============================imported variables============================ diff --git a/Marlin/watchdog.pde b/Marlin/watchdog.pde index 7af540c79..356e37473 100644 --- a/Marlin/watchdog.pde +++ b/Marlin/watchdog.pde @@ -1,7 +1,6 @@ #ifdef USE_WATCHDOG +#include "Marlin.h" #include "watchdog.h" -#include -#include //=========================================================================== //=============================private variables ============================