Преглед изворни кода

simplified the includes, makefile now works with arduino23

Bernhard пре 13 година
родитељ
комит
57f9359a41

+ 4
- 2
Marlin/EEPROMwrite.h Прегледај датотеку

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

+ 17
- 4
Marlin/Makefile Прегледај датотеку

@@ -1,7 +1,7 @@
1 1
 TARGET = $(notdir $(CURDIR))
2 2
 # CHANGE BELOW:
3 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 5
 #~ PORT = /dev/cu.usbserial*
6 6
 PORT = /dev/ttyACM0
7 7
 
@@ -60,13 +60,25 @@ OPT = 2
60 60
 #~ CDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
61 61
 #~ CXXDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
62 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 66
 # Place -I options here
67 67
 CINCS = -I$(ARDUINO) -I$(INSTALL_DIR)/libraries/LiquidCrystal/ -I$(INSTALL_DIR)/libraries/EEPROM/
68 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 82
 # Compiler flag to set the C Standard level.
71 83
 # c89 - "ANSI" C
72 84
 # gnu89 - c89 plus GCC extensions
@@ -253,7 +265,8 @@ applet/$(TARGET).elf: $(TARGET).pde applet/$(TARGET).cpp.o applet/core.a
253 265
 #	$(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
254 266
 # changed as in IDE v0022: link cpp obj files
255 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 271
 # added: cpp.o depends on cpp (and .pde which generates it)
259 272
 # $< "first item in the dependencies list"; $@ "left side of the :"; $^ "right side of the :"

+ 36
- 16
Marlin/Marlin.h Прегледај датотеку

@@ -1,35 +1,55 @@
1
+// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
2
+// Licence: GPL
3
+
1 4
 #ifndef __MARLINH
2 5
 #define __MARLINH
3 6
 
4
-// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
5
-// Licence: GPL
6 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 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 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 35
 #if ARDUINO >= 100
14 36
   #include "Arduino.h"
15 37
 #else
16 38
    #include "WProgram.h"
17 39
 #endif
18
-#include <EEPROM.h>
19 40
 
20
-
21
-#include "fastio.h"
22
-#include "Configuration.h"
23
-#include "pins.h"
24 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 54
 //this is a unfinsihed attemp to removes a lot of warning messages, see:
35 55
 // http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011

+ 2
- 8
Marlin/Marlin.pde Прегледај датотеку

@@ -25,15 +25,9 @@
25 25
     http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
26 26
  */
27 27
 
28
-
29 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 32
 #include "ultralcd.h"
39 33
 #include "planner.h"
@@ -42,7 +36,7 @@
42 36
 #include "motion_control.h"
43 37
 #include "cardreader.h"
44 38
 #include "watchdog.h"
45
-
39
+#include "EEPROMwrite.h"
46 40
 
47 41
 
48 42
 

+ 3
- 14
Marlin/MarlinSerial.cpp Прегледај датотеку

@@ -20,25 +20,14 @@
20 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 26
 // this next line disables the entire HardwareSerial.cpp, 
37 27
 // this is so I can support Attiny series and any other chip without a uart
38 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,13 +21,8 @@
21 21
 
22 22
 #ifndef MarlinSerial_h
23 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 27
 #define DEC 10
33 28
 #define HEX 16

+ 1
- 6
Marlin/Sd2Card.cpp Прегледај датотеку

@@ -17,12 +17,7 @@
17 17
  * along with the Arduino Sd2Card Library.  If not, see
18 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 21
 #include "Sd2Card.h"
27 22
 //------------------------------------------------------------------------------
28 23
 #ifndef SOFTWARE_SPI

+ 1
- 8
Marlin/SdBaseFile.h Прегледај датотеку

@@ -23,14 +23,7 @@
23 23
  * \file
24 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 27
 #include "SdFatConfig.h"
35 28
 #include "SdVolume.h"
36 29
 //------------------------------------------------------------------------------

+ 2
- 0
Marlin/SdFatUtil.cpp Прегледај датотеку

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

+ 1
- 8
Marlin/SdFatUtil.h Прегледај датотеку

@@ -23,14 +23,7 @@
23 23
  * \file
24 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 27
 #include "MarlinSerial.h"
35 28
 /** Store and print a string in flash memory.*/
36 29
 #define PgmPrint(x) SerialPrint_P(PSTR(x))

+ 1
- 0
Marlin/SdFile.cpp Прегледај датотеку

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

+ 1
- 0
Marlin/SdFile.h Прегледај датотеку

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

+ 2
- 1
Marlin/cardreader.pde Прегледај датотеку

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

+ 1
- 6
Marlin/planner.h Прегледај датотеку

@@ -98,12 +98,7 @@ extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
98 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 103
 extern block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
109 104
 extern volatile unsigned char block_buffer_head;           // Index of the next block to be pushed

+ 1
- 1
Marlin/speed_lookuptable.h Прегледај датотеку

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

+ 2
- 1
Marlin/stepper.cpp Прегледај датотеку

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

+ 1
- 1
Marlin/thermistortables.h Прегледај датотеку

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

+ 1
- 0
Marlin/ultralcd.pde Прегледај датотеку

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

+ 1
- 2
Marlin/watchdog.pde Прегледај датотеку

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

Loading…
Откажи
Сачувај