Browse Source

Improve AVR arch detection

Replace ARDUINO_ARCH_AVR with __AVR__ to better detect architecture for non-Arduino dev environments.  Resolves compile failure in PIO for 8-bit Teensduino targets

More info:
https://forum.pjrc.com/threads/33234-Using-Teensyduino-Selecting-Teensy-3-2-3-1-board-has-incorrect-platform-define
http://www.atmel.com/webdoc/avrlibcreferencemanual/using_tools_1using_avr_gcc_mach_opt.html
Dave Johnson 7 years ago
parent
commit
f58ba3a64e

+ 2
- 2
Marlin/src/HAL/HAL.h View File

23
  *
23
  *
24
  * Supports platforms :
24
  * Supports platforms :
25
  *    ARDUINO_ARCH_SAM : For Arduino Due and other boards based on Atmel SAM3X8E
25
  *    ARDUINO_ARCH_SAM : For Arduino Due and other boards based on Atmel SAM3X8E
26
- *    ARDUINO_ARCH_AVR : For all Atmel AVR boards
26
+ *    __AVR__ : For all Atmel AVR boards
27
  */
27
  */
28
 
28
 
29
 #ifndef _HAL_H
29
 #ifndef _HAL_H
77
 /** Write token and then write from 512 byte buffer to SPI (for SD card) */
77
 /** Write token and then write from 512 byte buffer to SPI (for SD card) */
78
 void spiSendBlock(uint8_t token, const uint8_t* buf);
78
 void spiSendBlock(uint8_t token, const uint8_t* buf);
79
 
79
 
80
-#ifdef ARDUINO_ARCH_AVR
80
+#ifdef __AVR__
81
   #include "HAL_AVR/HAL_AVR.h"
81
   #include "HAL_AVR/HAL_AVR.h"
82
 #elif defined(ARDUINO_ARCH_SAM)
82
 #elif defined(ARDUINO_ARCH_SAM)
83
   #define CPU_32_BIT
83
   #define CPU_32_BIT

+ 2
- 2
Marlin/src/HAL/HAL_AVR/HAL_AVR.cpp View File

23
 /**
23
 /**
24
  * Description: HAL for AVR
24
  * Description: HAL for AVR
25
  *
25
  *
26
- * For ARDUINO_ARCH_AVR
26
+ * For __AVR__
27
  */
27
  */
28
 
28
 
29
 
29
 
30
-#ifdef ARDUINO_ARCH_AVR
30
+#ifdef __AVR__
31
 
31
 
32
 // --------------------------------------------------------------------------
32
 // --------------------------------------------------------------------------
33
 // Includes
33
 // Includes

+ 1
- 1
Marlin/src/HAL/HAL_AVR/HAL_AVR.h View File

22
 /**
22
 /**
23
  * Description: HAL for AVR
23
  * Description: HAL for AVR
24
  *
24
  *
25
- * For ARDUINO_ARCH_AVR
25
+ * For __AVR__
26
  */
26
  */
27
 
27
 
28
 
28
 

+ 3
- 3
Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp View File

28
 /**
28
 /**
29
  * Description: HAL for AVR - SPI functions
29
  * Description: HAL for AVR - SPI functions
30
  *
30
  *
31
- * For ARDUINO_ARCH_AVR
31
+ * For __AVR__
32
  */
32
  */
33
 
33
 
34
-#ifdef ARDUINO_ARCH_AVR
34
+#ifdef __AVR__
35
 
35
 
36
 // --------------------------------------------------------------------------
36
 // --------------------------------------------------------------------------
37
 // Includes
37
 // Includes
210
 #endif  // SOFTWARE_SPI
210
 #endif  // SOFTWARE_SPI
211
 
211
 
212
 
212
 
213
-#endif // ARDUINO_ARCH_AVR
213
+#endif // __AVR__

+ 1
- 1
Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp View File

28
  * Modified 28 September 2010 by Mark Sproul
28
  * Modified 28 September 2010 by Mark Sproul
29
  * Modified 14 February 2016 by Andreas Hardtung (added tx buffer)
29
  * Modified 14 February 2016 by Andreas Hardtung (added tx buffer)
30
  */
30
  */
31
-#ifdef ARDUINO_ARCH_AVR
31
+#ifdef __AVR__
32
 
32
 
33
 #include "MarlinSerial.h"
33
 #include "MarlinSerial.h"
34
 #include "../../Marlin.h"
34
 #include "../../Marlin.h"

+ 2
- 2
Marlin/src/HAL/HAL_AVR/persistent_store_impl.cpp View File

1
-#ifdef ARDUINO_ARCH_AVR
1
+#ifdef __AVR__
2
 
2
 
3
 #include "../persistent_store_api.h"
3
 #include "../persistent_store_api.h"
4
 
4
 
52
 }
52
 }
53
 
53
 
54
 #endif // EEPROM_SETTINGS
54
 #endif // EEPROM_SETTINGS
55
-#endif // ARDUINO_ARCH_AVR
55
+#endif // __AVR__

+ 2
- 2
Marlin/src/HAL/HAL_AVR/servo_AVR.cpp View File

51
  *
51
  *
52
  */
52
  */
53
 
53
 
54
-#ifdef ARDUINO_ARCH_AVR
54
+#ifdef __AVR__
55
 
55
 
56
 #include "../../inc/MarlinConfig.h"
56
 #include "../../inc/MarlinConfig.h"
57
 
57
 
215
 
215
 
216
 #endif // HAS_SERVOS
216
 #endif // HAS_SERVOS
217
 
217
 
218
-#endif // ARDUINO_ARCH_AVR
218
+#endif // __AVR__

+ 2
- 2
Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp View File

20
  *
20
  *
21
  */
21
  */
22
 
22
 
23
-#ifdef ARDUINO_ARCH_AVR
23
+#ifdef __AVR__
24
 
24
 
25
 #include "../../inc/MarlinConfig.h"
25
 #include "../../inc/MarlinConfig.h"
26
 
26
 
58
 #endif // WATCHDOG_RESET_MANUAL
58
 #endif // WATCHDOG_RESET_MANUAL
59
 
59
 
60
 #endif // USE_WATCHDOG
60
 #endif // USE_WATCHDOG
61
-#endif // ARDUINO_ARCH_AVR
61
+#endif // __AVR__

+ 1
- 1
Marlin/src/HAL/HAL_DUE/persistent_store_impl.cpp View File

52
 }
52
 }
53
 
53
 
54
 #endif // EEPROM_SETTINGS
54
 #endif // EEPROM_SETTINGS
55
-#endif // ARDUINO_ARCH_AVR
55
+#endif // __AVR__

+ 1
- 1
Marlin/src/HAL/HAL_SanityCheck.h View File

22
 
22
 
23
 #ifndef HAL_SANITYCHECK_H
23
 #ifndef HAL_SANITYCHECK_H
24
 
24
 
25
-#ifdef ARDUINO_ARCH_AVR
25
+#ifdef __AVR__
26
   #include "HAL_AVR/SanityCheck_AVR_8_bit.h"
26
   #include "HAL_AVR/SanityCheck_AVR_8_bit.h"
27
 #elif defined(ARDUINO_ARCH_SAM)
27
 #elif defined(ARDUINO_ARCH_SAM)
28
   #include "HAL_DUE/SanityCheck_Due.h"
28
   #include "HAL_DUE/SanityCheck_Due.h"

+ 1
- 1
Marlin/src/HAL/HAL_endstop_interrupts.h View File

34
 // One ISR for all EXT-Interrupts
34
 // One ISR for all EXT-Interrupts
35
 void endstop_ISR(void) { endstop_ISR_worker(); }
35
 void endstop_ISR(void) { endstop_ISR_worker(); }
36
 
36
 
37
-#ifdef ARDUINO_ARCH_AVR
37
+#ifdef __AVR__
38
 
38
 
39
   #include "HAL_AVR/endstop_interrupts.h"
39
   #include "HAL_AVR/endstop_interrupts.h"
40
 
40
 

+ 1
- 1
Marlin/src/HAL/HAL_pinsDebug.h View File

23
 #ifndef HAL_PINSDEBUG_H
23
 #ifndef HAL_PINSDEBUG_H
24
 #define HAL_PINSDEBUG_H
24
 #define HAL_PINSDEBUG_H
25
 
25
 
26
-#ifdef ARDUINO_ARCH_AVR
26
+#ifdef __AVR__
27
   #include "HAL_AVR/pinsDebug_AVR_8_bit.h"
27
   #include "HAL_AVR/pinsDebug_AVR_8_bit.h"
28
 #elif defined(ARDUINO_ARCH_SAM)
28
 #elif defined(ARDUINO_ARCH_SAM)
29
   #include "HAL_DUE/HAL_pinsDebug_Due.h"
29
   #include "HAL_DUE/HAL_pinsDebug_Due.h"

+ 1
- 1
Marlin/src/HAL/HAL_spi_pins.h View File

29
 #elif defined(IS_32BIT_TEENSY)
29
 #elif defined(IS_32BIT_TEENSY)
30
   #include "HAL_TEENSY35_36/spi_pins.h"
30
   #include "HAL_TEENSY35_36/spi_pins.h"
31
 
31
 
32
-#elif defined(ARDUINO_ARCH_AVR)
32
+#elif defined(__AVR__)
33
   #include "HAL_AVR/spi_pins.h"
33
   #include "HAL_AVR/spi_pins.h"
34
 
34
 
35
 #elif defined(TARGET_LPC1768)
35
 #elif defined(TARGET_LPC1768)

+ 1
- 1
Marlin/src/HAL/servo.h View File

78
 #else
78
 #else
79
   #include <stdint.h>
79
   #include <stdint.h>
80
 
80
 
81
-  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM)
81
+  #if defined(__AVR__) || defined(ARDUINO_ARCH_SAM)
82
     // we're good to go
82
     // we're good to go
83
   #else
83
   #else
84
     #error "This library only supports boards with an AVR or SAM3X processor."
84
     #error "This library only supports boards with an AVR or SAM3X processor."

+ 1
- 1
Marlin/src/HAL/servo_private.h View File

45
 #include <stdint.h>
45
 #include <stdint.h>
46
 
46
 
47
 // Architecture specific include
47
 // Architecture specific include
48
-#ifdef ARDUINO_ARCH_AVR
48
+#ifdef __AVR__
49
   #include "HAL_AVR/ServoTimers.h"
49
   #include "HAL_AVR/ServoTimers.h"
50
 #elif defined(ARDUINO_ARCH_SAM)
50
 #elif defined(ARDUINO_ARCH_SAM)
51
   #include "HAL_DUE/ServoTimers.h"
51
   #include "HAL_DUE/ServoTimers.h"

+ 1
- 1
Marlin/src/core/serial.h View File

27
 
27
 
28
 //todo: HAL: breaks encapsulation
28
 //todo: HAL: breaks encapsulation
29
 // For AVR only, define a serial interface based on configuration
29
 // For AVR only, define a serial interface based on configuration
30
-#ifdef ARDUINO_ARCH_AVR
30
+#ifdef __AVR__
31
   #ifdef USBCON
31
   #ifdef USBCON
32
     #include "HardwareSerial.h"
32
     #include "HardwareSerial.h"
33
     #if ENABLED(BLUETOOTH)
33
     #if ENABLED(BLUETOOTH)

+ 1
- 1
Marlin/src/inc/MarlinConfig.h View File

31
 #include "../../Configuration_adv.h"
31
 #include "../../Configuration_adv.h"
32
 #include "../HAL/HAL.h"
32
 #include "../HAL/HAL.h"
33
 #include "../pins/pins.h"
33
 #include "../pins/pins.h"
34
-#if defined(ARDUINO_ARCH_AVR) && !defined(USBCON)
34
+#if defined(__AVR__) && !defined(USBCON)
35
   #define HardwareSerial_h // trick to disable the standard HWserial
35
   #define HardwareSerial_h // trick to disable the standard HWserial
36
 #endif
36
 #endif
37
 #include "Conditionals_post.h"
37
 #include "Conditionals_post.h"

+ 1
- 1
Marlin/src/module/delta.cpp View File

88
  *   (see above)
88
  *   (see above)
89
  */
89
  */
90
 
90
 
91
-#if ENABLED(DELTA_FAST_SQRT) && defined(ARDUINO_ARCH_AVR)
91
+#if ENABLED(DELTA_FAST_SQRT) && defined(__AVR__)
92
   /**
92
   /**
93
    * Fast inverse sqrt from Quake III Arena
93
    * Fast inverse sqrt from Quake III Arena
94
    * See: https://en.wikipedia.org/wiki/Fast_inverse_square_root
94
    * See: https://en.wikipedia.org/wiki/Fast_inverse_square_root

+ 1
- 1
Marlin/src/module/delta.h View File

63
  *   (see above)
63
  *   (see above)
64
  */
64
  */
65
 
65
 
66
-#if ENABLED(DELTA_FAST_SQRT) && defined(ARDUINO_ARCH_AVR)
66
+#if ENABLED(DELTA_FAST_SQRT) && defined(__AVR__)
67
   /**
67
   /**
68
    * Fast inverse sqrt from Quake III Arena
68
    * Fast inverse sqrt from Quake III Arena
69
    * See: https://en.wikipedia.org/wiki/Fast_inverse_square_root
69
    * See: https://en.wikipedia.org/wiki/Fast_inverse_square_root

+ 2
- 2
Marlin/src/module/stepper.cpp View File

46
 
46
 
47
 #include "stepper.h"
47
 #include "stepper.h"
48
 
48
 
49
-#ifdef ARDUINO_ARCH_AVR
49
+#ifdef __AVR__
50
   #include "speed_lookuptable.h"
50
   #include "speed_lookuptable.h"
51
 #endif
51
 #endif
52
 
52
 
1139
     E_AXIS_INIT(4);
1139
     E_AXIS_INIT(4);
1140
   #endif
1140
   #endif
1141
 
1141
 
1142
-  #ifdef ARDUINO_ARCH_AVR
1142
+  #ifdef __AVR__
1143
     // waveform generation = 0100 = CTC
1143
     // waveform generation = 0100 = CTC
1144
     SET_WGM(1, CTC_OCRnA);
1144
     SET_WGM(1, CTC_OCRnA);
1145
 
1145
 

+ 1
- 1
Marlin/src/module/stepper.h View File

45
 
45
 
46
 #include "stepper_indirection.h"
46
 #include "stepper_indirection.h"
47
 
47
 
48
-#ifdef ARDUINO_ARCH_AVR
48
+#ifdef __AVR__
49
   #include "speed_lookuptable.h"
49
   #include "speed_lookuptable.h"
50
 #endif
50
 #endif
51
 
51
 

+ 1
- 1
Marlin/src/module/temperature.cpp View File

1081
   #endif
1081
   #endif
1082
 
1082
 
1083
   // todo: HAL: fix abstraction
1083
   // todo: HAL: fix abstraction
1084
-  #ifdef ARDUINO_ARCH_AVR
1084
+  #ifdef __AVR__
1085
     // Use timer0 for temperature measurement
1085
     // Use timer0 for temperature measurement
1086
     // Interleave temperature interrupt with millies interrupt
1086
     // Interleave temperature interrupt with millies interrupt
1087
     OCR0B = 128;
1087
     OCR0B = 128;

Loading…
Cancel
Save