瀏覽代碼

simplified the includes, makefile now works with arduino23

Bernhard 13 年之前
父節點
當前提交
57f9359a41

+ 4
- 2
Marlin/EEPROMwrite.h 查看文件

4
 #include "Marlin.h"
4
 #include "Marlin.h"
5
 #include "planner.h"
5
 #include "planner.h"
6
 #include "temperature.h"
6
 #include "temperature.h"
7
+//#include <EEPROM.h>
8
+
7
 
9
 
8
 
10
 
9
 template <class T> int EEPROM_writeAnything(int &ee, const T& value)
11
 template <class T> int EEPROM_writeAnything(int &ee, const T& value)
11
   const byte* p = (const byte*)(const void*)&value;
13
   const byte* p = (const byte*)(const void*)&value;
12
   int i;
14
   int i;
13
   for (i = 0; i < (int)sizeof(value); i++)
15
   for (i = 0; i < (int)sizeof(value); i++)
14
-    EEPROM.write(ee++, *p++);
16
+    eeprom_write_byte((unsigned char *)ee++, *p++);
15
   return i;
17
   return i;
16
 }
18
 }
17
 
19
 
20
   byte* p = (byte*)(void*)&value;
22
   byte* p = (byte*)(void*)&value;
21
   int i;
23
   int i;
22
   for (i = 0; i < (int)sizeof(value); i++)
24
   for (i = 0; i < (int)sizeof(value); i++)
23
-    *p++ = EEPROM.read(ee++);
25
+    *p++ = eeprom_read_byte((unsigned char *)ee++);
24
   return i;
26
   return i;
25
 }
27
 }
26
 //======================================================================================
28
 //======================================================================================

+ 17
- 4
Marlin/Makefile 查看文件

1
 TARGET = $(notdir $(CURDIR))
1
 TARGET = $(notdir $(CURDIR))
2
 # CHANGE BELOW:
2
 # CHANGE BELOW:
3
 #~ INSTALL_DIR = /Applications/Arduino.app/Contents/Resources/Java
3
 #~ INSTALL_DIR = /Applications/Arduino.app/Contents/Resources/Java
4
-INSTALL_DIR = /home/bkubicek/software/arduino-0022
4
+INSTALL_DIR = /home/bkubicek/software/arduino-0023
5
 #~ PORT = /dev/cu.usbserial*
5
 #~ PORT = /dev/cu.usbserial*
6
 PORT = /dev/ttyACM0
6
 PORT = /dev/ttyACM0
7
 
7
 
60
 #~ CDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
60
 #~ CDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
61
 #~ CXXDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
61
 #~ CXXDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
62
 # now called DF_CPU
62
 # now called DF_CPU
63
-CDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=22
64
-CXXDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=22
63
+CDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=23
64
+CXXDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=23
65
 
65
 
66
 # Place -I options here
66
 # Place -I options here
67
 CINCS = -I$(ARDUINO) -I$(INSTALL_DIR)/libraries/LiquidCrystal/ -I$(INSTALL_DIR)/libraries/EEPROM/
67
 CINCS = -I$(ARDUINO) -I$(INSTALL_DIR)/libraries/LiquidCrystal/ -I$(INSTALL_DIR)/libraries/EEPROM/
68
 CXXINCS = -I$(ARDUINO)
68
 CXXINCS = -I$(ARDUINO)
69
 
69
 
70
+OBJECTS= applet/Marlin.cpp.o \
71
+         applet/EEPROM.o       \
72
+         applet/pins_arduino.o  \
73
+         applet/wiring_analog.o   \
74
+         applet/wiring_pulse.o \
75
+         applet/main.o        \
76
+         applet/Print.o         \
77
+         applet/wiring_digital.o  \
78
+         applet/wiring_shift.o   \
79
+         applet/stepper.o       \
80
+         applet/wiring.o   \
81
+         applet/WMath.o 
70
 # Compiler flag to set the C Standard level.
82
 # Compiler flag to set the C Standard level.
71
 # c89 - "ANSI" C
83
 # c89 - "ANSI" C
72
 # gnu89 - c89 plus GCC extensions
84
 # gnu89 - c89 plus GCC extensions
253
 #	$(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
265
 #	$(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
254
 # changed as in IDE v0022: link cpp obj files
266
 # changed as in IDE v0022: link cpp obj files
255
 	@echo $$(tput bold)$$(tput setaf 2) $(CC) $$(tput sgr0) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
267
 	@echo $$(tput bold)$$(tput setaf 2) $(CC) $$(tput sgr0) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
256
-	@$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
268
+	$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ $OBJECTS -L. applet/core.a $(LDFLAGS)
269
+	#@$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/*.o applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
257
 
270
 
258
 # added: cpp.o depends on cpp (and .pde which generates it)
271
 # added: cpp.o depends on cpp (and .pde which generates it)
259
 # $< "first item in the dependencies list"; $@ "left side of the :"; $^ "right side of the :"
272
 # $< "first item in the dependencies list"; $@ "left side of the :"; $^ "right side of the :"

+ 36
- 16
Marlin/Marlin.h 查看文件

1
+// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
2
+// Licence: GPL
3
+
1
 #ifndef __MARLINH
4
 #ifndef __MARLINH
2
 #define __MARLINH
5
 #define __MARLINH
3
 
6
 
4
-// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
5
-// Licence: GPL
6
 #define  HardwareSerial_h // trick to disable the standard HWserial
7
 #define  HardwareSerial_h // trick to disable the standard HWserial
7
-#include <stdio.h>
8
+
9
+#define  FORCE_INLINE __attribute__((always_inline)) inline
10
+
8
 #include <math.h>
11
 #include <math.h>
9
-#include <util/delay.h>
12
+#include <stdio.h>
13
+#include <stdlib.h>
14
+#include <string.h>
15
+#include <inttypes.h>
16
+
17
+#include <avr/delay.h>
10
 #include <avr/pgmspace.h>
18
 #include <avr/pgmspace.h>
19
+#include <avr/eeprom.h>
20
+#include  <avr/wdt.h>
21
+#include  <avr/interrupt.h>
22
+
23
+
24
+
25
+
26
+
11
 
27
 
12
 
28
 
29
+
30
+
31
+#include "fastio.h"
32
+#include "Configuration.h"
33
+#include "pins.h"
34
+
13
 #if ARDUINO >= 100
35
 #if ARDUINO >= 100
14
   #include "Arduino.h"
36
   #include "Arduino.h"
15
 #else
37
 #else
16
    #include "WProgram.h"
38
    #include "WProgram.h"
17
 #endif
39
 #endif
18
-#include <EEPROM.h>
19
 
40
 
20
-
21
-#include "fastio.h"
22
-#include "Configuration.h"
23
-#include "pins.h"
24
 #include "MarlinSerial.h"
41
 #include "MarlinSerial.h"
25
 
42
 
26
-#define  FORCE_INLINE __attribute__((always_inline)) inline
27
-//#define SERIAL_ECHO(x) Serial << "echo: " << x;
28
-//#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
29
-//#define SERIAL_ERROR(x) Serial << "Error: " << x;
30
-//#define SERIAL_ERRORLN(x) Serial << "Error: " << x<<endl;
31
-//#define SERIAL_PROTOCOL(x) Serial << x;
32
-//#define SERIAL_PROTOCOLLN(x) Serial << x<<endl;
43
+#ifndef cbi
44
+#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
45
+#endif
46
+#ifndef sbi
47
+#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
48
+#endif
49
+
50
+#include "WString.h"
51
+
52
+
33
 
53
 
34
 //this is a unfinsihed attemp to removes a lot of warning messages, see:
54
 //this is a unfinsihed attemp to removes a lot of warning messages, see:
35
 // http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011
55
 // http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011

+ 2
- 8
Marlin/Marlin.pde 查看文件

25
     http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
25
     http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
26
  */
26
  */
27
 
27
 
28
-
29
 #include "Marlin.h"
28
 #include "Marlin.h"
30
-#include <EEPROM.h>
31
-#include <stdio.h>
32
 
29
 
33
-#include "EEPROMwrite.h"
34
-#include "fastio.h"
35
-#include "Configuration.h"
36
-#include "pins.h"
30
+
37
 
31
 
38
 #include "ultralcd.h"
32
 #include "ultralcd.h"
39
 #include "planner.h"
33
 #include "planner.h"
42
 #include "motion_control.h"
36
 #include "motion_control.h"
43
 #include "cardreader.h"
37
 #include "cardreader.h"
44
 #include "watchdog.h"
38
 #include "watchdog.h"
45
-
39
+#include "EEPROMwrite.h"
46
 
40
 
47
 
41
 
48
 
42
 

+ 3
- 14
Marlin/MarlinSerial.cpp 查看文件

20
   Modified 28 September 2010 by Mark Sproul
20
   Modified 28 September 2010 by Mark Sproul
21
 */
21
 */
22
 
22
 
23
-
24
-#include <stdlib.h>
25
-#include <stdio.h>
26
-#include <string.h>
27
-#include <inttypes.h>
28
-#include <math.h>
29
-#if ARDUINO >= 100
30
-  #include "Arduino.h"
31
-#else
32
-   #include "wiring.h"
33
-#endif
34
-#include "wiring_private.h"
23
+#include "Marlin.h"
24
+#include "MarlinSerial.h"
35
 
25
 
36
 // this next line disables the entire HardwareSerial.cpp, 
26
 // this next line disables the entire HardwareSerial.cpp, 
37
 // this is so I can support Attiny series and any other chip without a uart
27
 // this is so I can support Attiny series and any other chip without a uart
38
 #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
28
 #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
39
 
29
 
40
-#include "MarlinSerial.h"
41
-#include "Marlin.h"
30
+
42
 
31
 
43
 
32
 
44
 
33
 

+ 1
- 6
Marlin/MarlinSerial.h 查看文件

21
 
21
 
22
 #ifndef MarlinSerial_h
22
 #ifndef MarlinSerial_h
23
 #define MarlinSerial_h
23
 #define MarlinSerial_h
24
-#include <math.h>
25
-#include <inttypes.h>
26
-//#include <Stream.h>
27
-#include <string.h>
28
-#define  FORCE_INLINE __attribute__((always_inline)) inline
24
+#include "Marlin.h"
29
 
25
 
30
-#include "WString.h"
31
 
26
 
32
 #define DEC 10
27
 #define DEC 10
33
 #define HEX 16
28
 #define HEX 16

+ 1
- 6
Marlin/Sd2Card.cpp 查看文件

17
  * along with the Arduino Sd2Card Library.  If not, see
17
  * along with the Arduino Sd2Card Library.  If not, see
18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
-#define  HardwareSerial_h // trick to disable the standard HWserial
21
-#if ARDUINO < 100
22
-#include <WProgram.h>
23
-#else  // ARDUINO
24
-#include <Arduino.h>
25
-#endif  // ARDUINO
20
+#include "Marlin.h"
26
 #include "Sd2Card.h"
21
 #include "Sd2Card.h"
27
 //------------------------------------------------------------------------------
22
 //------------------------------------------------------------------------------
28
 #ifndef SOFTWARE_SPI
23
 #ifndef SOFTWARE_SPI

+ 1
- 8
Marlin/SdBaseFile.h 查看文件

23
  * \file
23
  * \file
24
  * \brief SdBaseFile class
24
  * \brief SdBaseFile class
25
  */
25
  */
26
-#include <avr/pgmspace.h>
27
-#define  HardwareSerial_h // trick to disable the standard HWserial
28
-#if ARDUINO < 100
29
-#include <WProgram.h>
30
-#else  // ARDUINO
31
-#include <Arduino.h>
32
-#endif  // ARDUINO
33
-#include "MarlinSerial.h"
26
+#include "Marlin.h"
34
 #include "SdFatConfig.h"
27
 #include "SdFatConfig.h"
35
 #include "SdVolume.h"
28
 #include "SdVolume.h"
36
 //------------------------------------------------------------------------------
29
 //------------------------------------------------------------------------------

+ 2
- 0
Marlin/SdFatUtil.cpp 查看文件

17
  * along with the Arduino SdFat Library.  If not, see
17
  * along with the Arduino SdFat Library.  If not, see
18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
+#include "Marlin.h"
20
 #include "SdFatUtil.h"
21
 #include "SdFatUtil.h"
22
+
21
 //------------------------------------------------------------------------------
23
 //------------------------------------------------------------------------------
22
 /** Amount of free RAM
24
 /** Amount of free RAM
23
  * \return The number of free bytes.
25
  * \return The number of free bytes.

+ 1
- 8
Marlin/SdFatUtil.h 查看文件

23
  * \file
23
  * \file
24
  * \brief Useful utility functions.
24
  * \brief Useful utility functions.
25
  */
25
  */
26
-#include <avr/pgmspace.h>
27
-
28
-#define  HardwareSerial_h // trick to disable the standard HWserial
29
-#if ARDUINO < 100
30
-#include <WProgram.h>
31
-#else  // ARDUINO
32
-#include <Arduino.h>
33
-#endif  // ARDUINO
26
+#include "Marlin.h"
34
 #include "MarlinSerial.h"
27
 #include "MarlinSerial.h"
35
 /** Store and print a string in flash memory.*/
28
 /** Store and print a string in flash memory.*/
36
 #define PgmPrint(x) SerialPrint_P(PSTR(x))
29
 #define PgmPrint(x) SerialPrint_P(PSTR(x))

+ 1
- 0
Marlin/SdFile.cpp 查看文件

17
  * along with the Arduino SdFat Library.  If not, see
17
  * along with the Arduino SdFat Library.  If not, see
18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
+#include "Marlin.h"
20
 #include "SdFile.h"
21
 #include "SdFile.h"
21
 /**  Create a file object and open it in the current working directory.
22
 /**  Create a file object and open it in the current working directory.
22
  *
23
  *

+ 1
- 0
Marlin/SdFile.h 查看文件

22
  * \brief SdFile class
22
  * \brief SdFile class
23
  */
23
  */
24
 #include "SdBaseFile.h"
24
 #include "SdBaseFile.h"
25
+#include "Marlin.h"
25
 #include <Print.h>
26
 #include <Print.h>
26
 #ifndef SdFile_h
27
 #ifndef SdFile_h
27
 #define SdFile_h
28
 #define SdFile_h

+ 2
- 1
Marlin/cardreader.pde 查看文件

1
+#include "Marlin.h"
1
 #include "cardreader.h"
2
 #include "cardreader.h"
2
 #ifdef SDSUPPORT
3
 #ifdef SDSUPPORT
3
 
4
 
4
-#include "Marlin.h"
5
+
5
 
6
 
6
 CardReader::CardReader()
7
 CardReader::CardReader()
7
 {
8
 {

+ 1
- 6
Marlin/planner.h 查看文件

98
 #endif
98
 #endif
99
 
99
 
100
     
100
     
101
-/////semi-private stuff
102
-#if ARDUINO >= 100
103
-  #include "Arduino.h"
104
-#else
105
-   #include "WProgram.h"
106
-#endif
101
+
107
 
102
 
108
 extern block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
103
 extern block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
109
 extern volatile unsigned char block_buffer_head;           // Index of the next block to be pushed
104
 extern volatile unsigned char block_buffer_head;           // Index of the next block to be pushed

+ 1
- 1
Marlin/speed_lookuptable.h 查看文件

1
 #ifndef SPEED_LOOKUPTABLE_H
1
 #ifndef SPEED_LOOKUPTABLE_H
2
 #define SPEED_LOOKUPTABLE_H
2
 #define SPEED_LOOKUPTABLE_H
3
 
3
 
4
-#include <avr/pgmspace.h>
4
+#include "Marlin.h"
5
 
5
 
6
 uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\
6
 uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\
7
 { 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, 
7
 { 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, 

+ 2
- 1
Marlin/stepper.cpp 查看文件

22
    and Philipp Tiefenbacher. */
22
    and Philipp Tiefenbacher. */
23
 
23
 
24
 
24
 
25
-#include "stepper.h"
25
+
26
 
26
 
27
 #include "Marlin.h"
27
 #include "Marlin.h"
28
+#include "stepper.h"
28
 #include "planner.h"
29
 #include "planner.h"
29
 #include "temperature.h"
30
 #include "temperature.h"
30
 #include "ultralcd.h"
31
 #include "ultralcd.h"

+ 1
- 1
Marlin/thermistortables.h 查看文件

1
 #ifndef THERMISTORTABLES_H_
1
 #ifndef THERMISTORTABLES_H_
2
 #define THERMISTORTABLES_H_
2
 #define THERMISTORTABLES_H_
3
 
3
 
4
-#include <avr/pgmspace.h>
4
+#include "Marlin.h"
5
 
5
 
6
 #define OVERSAMPLENR 16
6
 #define OVERSAMPLENR 16
7
 
7
 

+ 1
- 0
Marlin/ultralcd.pde 查看文件

1
 #include "ultralcd.h"
1
 #include "ultralcd.h"
2
 #ifdef ULTRA_LCD
2
 #ifdef ULTRA_LCD
3
+#include "Marlin.h"
3
 #include <LiquidCrystal.h>
4
 #include <LiquidCrystal.h>
4
 //===========================================================================
5
 //===========================================================================
5
 //=============================imported variables============================
6
 //=============================imported variables============================

+ 1
- 2
Marlin/watchdog.pde 查看文件

1
 #ifdef USE_WATCHDOG
1
 #ifdef USE_WATCHDOG
2
+#include "Marlin.h"
2
 #include "watchdog.h"
3
 #include "watchdog.h"
3
-#include  <avr/wdt.h>
4
-#include  <avr/interrupt.h>
5
 
4
 
6
 //===========================================================================
5
 //===========================================================================
7
 //=============================private variables  ============================
6
 //=============================private variables  ============================

Loading…
取消
儲存