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 6 years ago
parent
commit
f58ba3a64e

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

@@ -23,7 +23,7 @@
23 23
  *
24 24
  * Supports platforms :
25 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 29
 #ifndef _HAL_H
@@ -77,7 +77,7 @@ void spiRead(uint8_t* buf, uint16_t nbyte);
77 77
 /** Write token and then write from 512 byte buffer to SPI (for SD card) */
78 78
 void spiSendBlock(uint8_t token, const uint8_t* buf);
79 79
 
80
-#ifdef ARDUINO_ARCH_AVR
80
+#ifdef __AVR__
81 81
   #include "HAL_AVR/HAL_AVR.h"
82 82
 #elif defined(ARDUINO_ARCH_SAM)
83 83
   #define CPU_32_BIT

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

@@ -23,11 +23,11 @@
23 23
 /**
24 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 33
 // Includes

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

@@ -22,7 +22,7 @@
22 22
 /**
23 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,10 +28,10 @@
28 28
 /**
29 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 37
 // Includes
@@ -210,4 +210,4 @@ void spiBegin (void) {
210 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,7 +28,7 @@
28 28
  * Modified 28 September 2010 by Mark Sproul
29 29
  * Modified 14 February 2016 by Andreas Hardtung (added tx buffer)
30 30
  */
31
-#ifdef ARDUINO_ARCH_AVR
31
+#ifdef __AVR__
32 32
 
33 33
 #include "MarlinSerial.h"
34 34
 #include "../../Marlin.h"

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

@@ -1,4 +1,4 @@
1
-#ifdef ARDUINO_ARCH_AVR
1
+#ifdef __AVR__
2 2
 
3 3
 #include "../persistent_store_api.h"
4 4
 
@@ -52,4 +52,4 @@ void read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
52 52
 }
53 53
 
54 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,7 +51,7 @@
51 51
  *
52 52
  */
53 53
 
54
-#ifdef ARDUINO_ARCH_AVR
54
+#ifdef __AVR__
55 55
 
56 56
 #include "../../inc/MarlinConfig.h"
57 57
 
@@ -215,4 +215,4 @@ void finISR(timer16_Sequence_t timer) {
215 215
 
216 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,7 +20,7 @@
20 20
  *
21 21
  */
22 22
 
23
-#ifdef ARDUINO_ARCH_AVR
23
+#ifdef __AVR__
24 24
 
25 25
 #include "../../inc/MarlinConfig.h"
26 26
 
@@ -58,4 +58,4 @@ void watchdog_init() {
58 58
 #endif // WATCHDOG_RESET_MANUAL
59 59
 
60 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,4 +52,4 @@ void read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
52 52
 }
53 53
 
54 54
 #endif // EEPROM_SETTINGS
55
-#endif // ARDUINO_ARCH_AVR
55
+#endif // __AVR__

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

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

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

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

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

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

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

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

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

@@ -78,7 +78,7 @@
78 78
 #else
79 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 82
     // we're good to go
83 83
   #else
84 84
     #error "This library only supports boards with an AVR or SAM3X processor."

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

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

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

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

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

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

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

@@ -88,7 +88,7 @@ void recalc_delta_settings(float radius, float diagonal_rod) {
88 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 93
    * Fast inverse sqrt from Quake III Arena
94 94
    * See: https://en.wikipedia.org/wiki/Fast_inverse_square_root

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

@@ -63,7 +63,7 @@ void recalc_delta_settings(float radius, float diagonal_rod);
63 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 68
    * Fast inverse sqrt from Quake III Arena
69 69
    * See: https://en.wikipedia.org/wiki/Fast_inverse_square_root

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

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

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

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

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

@@ -1081,7 +1081,7 @@ void Temperature::init() {
1081 1081
   #endif
1082 1082
 
1083 1083
   // todo: HAL: fix abstraction
1084
-  #ifdef ARDUINO_ARCH_AVR
1084
+  #ifdef __AVR__
1085 1085
     // Use timer0 for temperature measurement
1086 1086
     // Interleave temperature interrupt with millies interrupt
1087 1087
     OCR0B = 128;

Loading…
Cancel
Save