Browse Source

Allow compile under Windows Subsystem for Linux (#15606)

Marcio T 5 years ago
parent
commit
f6a799c7b3
2 changed files with 9 additions and 1 deletions
  1. 8
    0
      Marlin/src/HAL/HAL_AVR/HAL.h
  2. 1
    1
      Marlin/src/core/macros.h

+ 8
- 0
Marlin/src/HAL/HAL_AVR/HAL.h View File

38
 #include <avr/interrupt.h>
38
 #include <avr/interrupt.h>
39
 #include <avr/io.h>
39
 #include <avr/io.h>
40
 
40
 
41
+#ifndef pgm_read_ptr
42
+  // Compatibility for avr-libc 1.8.0-4.1 included with Ubuntu for
43
+  // Windows Subsystem for Linux on Windows 10 as of 10/18/2019
44
+  #define pgm_read_ptr_far(address_long) (void*)__ELPM_word((uint32_t)(address_long)) 
45
+  #define pgm_read_ptr_near(address_short) (void*)__LPM_word((uint16_t)(address_short))
46
+  #define pgm_read_ptr(address_short) pgm_read_ptr_near(address_short)
47
+#endif
48
+
41
 // ------------------------
49
 // ------------------------
42
 // Defines
50
 // Defines
43
 // ------------------------
51
 // ------------------------

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

279
 #define ATAN2(y, x) atan2f(y, x)
279
 #define ATAN2(y, x) atan2f(y, x)
280
 #define POW(x, y)   powf(x, y)
280
 #define POW(x, y)   powf(x, y)
281
 #define SQRT(x)     sqrtf(x)
281
 #define SQRT(x)     sqrtf(x)
282
-#define RSQRT(x)    (1 / sqrtf(x))
282
+#define RSQRT(x)    (1.0f / sqrtf(x))
283
 #define CEIL(x)     ceilf(x)
283
 #define CEIL(x)     ceilf(x)
284
 #define FLOOR(x)    floorf(x)
284
 #define FLOOR(x)    floorf(x)
285
 #define LROUND(x)   lroundf(x)
285
 #define LROUND(x)   lroundf(x)

Loading…
Cancel
Save