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
2.0.x
Dave Johnson 7 years ago
parent 8089f73549
commit f58ba3a64e

@ -23,7 +23,7 @@
* *
* Supports platforms : * Supports platforms :
* ARDUINO_ARCH_SAM : For Arduino Due and other boards based on Atmel SAM3X8E * ARDUINO_ARCH_SAM : For Arduino Due and other boards based on Atmel SAM3X8E
* ARDUINO_ARCH_AVR : For all Atmel AVR boards * __AVR__ : For all Atmel AVR boards
*/ */
#ifndef _HAL_H #ifndef _HAL_H
@ -77,7 +77,7 @@ void spiRead(uint8_t* buf, uint16_t nbyte);
/** Write token and then write from 512 byte buffer to SPI (for SD card) */ /** Write token and then write from 512 byte buffer to SPI (for SD card) */
void spiSendBlock(uint8_t token, const uint8_t* buf); void spiSendBlock(uint8_t token, const uint8_t* buf);
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
#include "HAL_AVR/HAL_AVR.h" #include "HAL_AVR/HAL_AVR.h"
#elif defined(ARDUINO_ARCH_SAM) #elif defined(ARDUINO_ARCH_SAM)
#define CPU_32_BIT #define CPU_32_BIT

@ -23,11 +23,11 @@
/** /**
* Description: HAL for AVR * Description: HAL for AVR
* *
* For ARDUINO_ARCH_AVR * For __AVR__
*/ */
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Includes // Includes

@ -22,7 +22,7 @@
/** /**
* Description: HAL for AVR * Description: HAL for AVR
* *
* For ARDUINO_ARCH_AVR * For __AVR__
*/ */

@ -28,10 +28,10 @@
/** /**
* Description: HAL for AVR - SPI functions * Description: HAL for AVR - SPI functions
* *
* For ARDUINO_ARCH_AVR * For __AVR__
*/ */
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Includes // Includes
@ -210,4 +210,4 @@ void spiBegin (void) {
#endif // SOFTWARE_SPI #endif // SOFTWARE_SPI
#endif // ARDUINO_ARCH_AVR #endif // __AVR__

@ -28,7 +28,7 @@
* Modified 28 September 2010 by Mark Sproul * Modified 28 September 2010 by Mark Sproul
* Modified 14 February 2016 by Andreas Hardtung (added tx buffer) * Modified 14 February 2016 by Andreas Hardtung (added tx buffer)
*/ */
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
#include "MarlinSerial.h" #include "MarlinSerial.h"
#include "../../Marlin.h" #include "../../Marlin.h"

@ -1,4 +1,4 @@
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
#include "../persistent_store_api.h" #include "../persistent_store_api.h"
@ -52,4 +52,4 @@ void read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
} }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // ARDUINO_ARCH_AVR #endif // __AVR__

@ -51,7 +51,7 @@
* *
*/ */
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
@ -215,4 +215,4 @@ void finISR(timer16_Sequence_t timer) {
#endif // HAS_SERVOS #endif // HAS_SERVOS
#endif // ARDUINO_ARCH_AVR #endif // __AVR__

@ -20,7 +20,7 @@
* *
*/ */
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
@ -58,4 +58,4 @@ void watchdog_init() {
#endif // WATCHDOG_RESET_MANUAL #endif // WATCHDOG_RESET_MANUAL
#endif // USE_WATCHDOG #endif // USE_WATCHDOG
#endif // ARDUINO_ARCH_AVR #endif // __AVR__

@ -52,4 +52,4 @@ void read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
} }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // ARDUINO_ARCH_AVR #endif // __AVR__

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

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

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

@ -29,7 +29,7 @@
#elif defined(IS_32BIT_TEENSY) #elif defined(IS_32BIT_TEENSY)
#include "HAL_TEENSY35_36/spi_pins.h" #include "HAL_TEENSY35_36/spi_pins.h"
#elif defined(ARDUINO_ARCH_AVR) #elif defined(__AVR__)
#include "HAL_AVR/spi_pins.h" #include "HAL_AVR/spi_pins.h"
#elif defined(TARGET_LPC1768) #elif defined(TARGET_LPC1768)

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

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

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

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

@ -88,7 +88,7 @@ void recalc_delta_settings(float radius, float diagonal_rod) {
* (see above) * (see above)
*/ */
#if ENABLED(DELTA_FAST_SQRT) && defined(ARDUINO_ARCH_AVR) #if ENABLED(DELTA_FAST_SQRT) && defined(__AVR__)
/** /**
* Fast inverse sqrt from Quake III Arena * Fast inverse sqrt from Quake III Arena
* See: https://en.wikipedia.org/wiki/Fast_inverse_square_root * See: https://en.wikipedia.org/wiki/Fast_inverse_square_root

@ -63,7 +63,7 @@ void recalc_delta_settings(float radius, float diagonal_rod);
* (see above) * (see above)
*/ */
#if ENABLED(DELTA_FAST_SQRT) && defined(ARDUINO_ARCH_AVR) #if ENABLED(DELTA_FAST_SQRT) && defined(__AVR__)
/** /**
* Fast inverse sqrt from Quake III Arena * Fast inverse sqrt from Quake III Arena
* See: https://en.wikipedia.org/wiki/Fast_inverse_square_root * See: https://en.wikipedia.org/wiki/Fast_inverse_square_root

@ -46,7 +46,7 @@
#include "stepper.h" #include "stepper.h"
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
#include "speed_lookuptable.h" #include "speed_lookuptable.h"
#endif #endif
@ -1139,7 +1139,7 @@ void Stepper::init() {
E_AXIS_INIT(4); E_AXIS_INIT(4);
#endif #endif
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
// waveform generation = 0100 = CTC // waveform generation = 0100 = CTC
SET_WGM(1, CTC_OCRnA); SET_WGM(1, CTC_OCRnA);

@ -45,7 +45,7 @@
#include "stepper_indirection.h" #include "stepper_indirection.h"
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
#include "speed_lookuptable.h" #include "speed_lookuptable.h"
#endif #endif

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

Loading…
Cancel
Save