Skip to content

Commit

Permalink
Reorganize HAL (MarlinFirmware#14832)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored Sep 3, 2019
1 parent cdd5056 commit 75efa3c
Show file tree
Hide file tree
Showing 142 changed files with 546 additions and 421 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ jobs:
build_marlin_pio ./ ${TEST_PLATFORM}
restore_configs
echo testing STM32F1 targets...
export TEST_PLATFORM="-e STM32F1"
export TEST_PLATFORM="-e STM32F103R"
restore_configs
echo use_example_configs STM32/STM32F10
use_example_configs STM32/STM32F10
echo use_example_configs STM32/STM32F103R
use_example_configs STM32/STM32F103R
build_marlin_pio ./ ${TEST_PLATFORM}
restore_configs
echo use_example_configs STM32/stm32f103ret6
Expand Down
47 changes: 28 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,46 @@ notifications:
email: false

env:
- TEST_PLATFORM="ARMED"
#- TEST_PLATFORM="at90usb1286_cdc"
#- TEST_PLATFORM="at90usb1286_dfu"
# Base Environments
- TEST_PLATFORM="DUE"
- TEST_PLATFORM="esp32"
- TEST_PLATFORM="fysetc_f6_13"
- TEST_PLATFORM="jgaurora_a5s_a1"
- TEST_PLATFORM="linux_native"
- TEST_PLATFORM="LPC1768"
- TEST_PLATFORM="LPC1769"
#- TEST_PLATFORM="malyanm200"
- TEST_PLATFORM="megaatmega1280"
- TEST_PLATFORM="megaatmega2560"
- TEST_PLATFORM="SAMD51_grandcentral_m4"
- TEST_PLATFORM="STM32F103R"
- TEST_PLATFORM="teensy31"
- TEST_PLATFORM="teensy35"

# Extended AVR Environments
- TEST_PLATFORM="fysetc_f6_13"
- TEST_PLATFORM="megaatmega1280"
- TEST_PLATFORM="rambo"
- TEST_PLATFORM="sanguino_atmega1284p"
- TEST_PLATFORM="sanguino_atmega644p"

# Extended STM32 Environments
- TEST_PLATFORM="ARMED"
- TEST_PLATFORM="BIGTREE_BTT002"
- TEST_PLATFORM="BIGTREE_SKR_PRO"
- TEST_PLATFORM="STM32F103R_bigtree"
- TEST_PLATFORM="jgaurora_a5s_a1"
- TEST_PLATFORM="STM32F103V_longer"
- TEST_PLATFORM="STM32F407VE_black"

# Non-working environment tests
#- TEST_PLATFORM="at90usb1286_cdc"
#- TEST_PLATFORM="at90usb1286_dfu"
#- TEST_PLATFORM="malyanm200"
#- TEST_PLATFORM="mks_robin"
#- TEST_PLATFORM="mks_robin_lite"
#- TEST_PLATFORM="mks_robin_mini"
#- TEST_PLATFORM="mks_robin_nano"
- TEST_PLATFORM="rambo"
- TEST_PLATFORM="adafruit_grandcentral_m4"
- TEST_PLATFORM="sanguino_atmega1284p"
- TEST_PLATFORM="sanguino_atmega644p"
- TEST_PLATFORM="STM32F1"
- TEST_PLATFORM="BIGTREE_SKR_MINI"
#- TEST_PLATFORM="fysetc_STM32F1"
- TEST_PLATFORM="alfawise_U20"
#- TEST_PLATFORM="STM32F103R_bigtree"
#- TEST_PLATFORM="STM32F103R_fysetc"
#- TEST_PLATFORM="STM32F4"
- TEST_PLATFORM="black_stm32f407ve"
- TEST_PLATFORM="BIGTREE_SKR_PRO"
#- TEST_PLATFORM="STM32F7"
- TEST_PLATFORM="teensy31"
- TEST_PLATFORM="teensy35"

before_install:
#
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/HAL_AVR/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

#include "../shared/Marduino.h"
#include "../shared/HAL_SPI.h"
#include "fastio_AVR.h"
#include "watchdog_AVR.h"
#include "math_AVR.h"
#include "fastio.h"
#include "watchdog.h"
#include "math.h"

#ifdef USBCON
#include "HardwareSerial.h"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#ifdef __AVR__

#include "fastio_AVR.h"
#include "fastio.h"

#ifdef FASTIO_EXT_START

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_AVR/fastio/fastio_1280.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 72 75 76 77 74 xx xx xx xx xx
*/

#include "../fastio_AVR.h"
#include "../fastio.h"

// change for your board
#define DEBUG_LED DIO21
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_AVR/fastio/fastio_1281.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5
*/

#include "../fastio_AVR.h"
#include "../fastio.h"

// change for your board
#define DEBUG_LED DIO46
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_AVR/fastio/fastio_168.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
*/

#include "../fastio_AVR.h"
#include "../fastio.h"

#define DEBUG_LED AIO5

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_AVR/fastio/fastio_644.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* +--------+
*/

#include "../fastio_AVR.h"
#include "../fastio.h"

#define DEBUG_LED DIO0

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_AVR/fastio/fastio_AT90USB.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The logical pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3
*/

#include "../fastio_AVR.h"
#include "../fastio.h"

// change for your board
#define DEBUG_LED DIO31 /* led D5 red */
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#if ENABLED(USE_WATCHDOG)

#include "watchdog_AVR.h"
#include "watchdog.h"

#include "../../Marlin.h"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions Marlin/src/HAL/HAL_DUE/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio_Due.h"
#include "watchdog_Due.h"
#include "HAL_timers_Due.h"
#include "fastio.h"
#include "watchdog.h"
#include "timers.h"

#include <stdint.h>

Expand All @@ -58,8 +58,8 @@
#define NUM_SERIAL 1
#endif

#include "MarlinSerial_Due.h"
#include "MarlinSerialUSB_Due.h"
#include "MarlinSerial.h"
#include "MarlinSerialUSB.h"

// On AVR this is in math.h?
#define square(x) ((x)*(x))
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "../../inc/MarlinConfig.h"
#include "HAL.h"
#include "InterruptVectors_Due.h"
#include "InterruptVectors.h"

/* The relocated Exception/Interrupt Table - According to the ARM
reference manual, alignment to 128 bytes should suffice, but in
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#include "../../inc/MarlinConfig.h"

#include "MarlinSerial_Due.h"
#include "InterruptVectors_Due.h"
#include "MarlinSerial.h"
#include "InterruptVectors.h"
#include "../../Marlin.h"

template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#if SERIAL_PORT == -1

#include "MarlinSerialUSB_Due.h"
#include "MarlinSerialUSB.h"

#if ENABLED(EMERGENCY_PARSER)
#include "../../feature/emergency_parser.h"
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_DUE/Tone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include "../../inc/MarlinConfig.h"
#include "HAL.h"
#include "HAL_timers_Due.h"
#include "timers.h"

static pin_t tone_pin;
volatile static int32_t toggles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);

#include "../../shared/Marduino.h"
#include "../fastio_Due.h"
#include "../fastio.h"

void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "../../inc/MarlinConfig.h"
#include "HAL.h"

#include "HAL_timers_Due.h"
#include "timers.h"

// ------------------------
// Local defines
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "../../inc/MarlinConfig.h"
#include "../../Marlin.h"
#include "watchdog_Due.h"
#include "watchdog.h"

// Override Arduino runtime to either config or disable the watchdog
//
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_ESP32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifdef ARDUINO_ARCH_ESP32

#include "HAL.h"
#include "HAL_timers_ESP32.h"
#include "timers.h"
#include <rom/rtc.h>
#include <driver/adc.h>
#include <esp_adc_cal.h>
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/HAL_ESP32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"

#include "fastio_ESP32.h"
#include "watchdog_ESP32.h"
#include "fastio.h"
#include "watchdog.h"
#include "i2s.h"

#include "HAL_timers_ESP32.h"
#include "timers.h"

#include "WebSocketSerial.h"
#include "FlushableHardwareSerial.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#if HAS_SERVOS

#include "HAL_Servo_ESP32.h"
#include "Servo.h"

// Adjacent channels (0/1, 2/3 etc.) share the same timer and therefore the same frequency and resolution settings on ESP32,
// so we only allocate servo channels up high to avoid side effects with regards to analogWrite (fans, leds, laser pwm etc.)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "HAL.h"

#include "HAL_timers_ESP32.h"
#include "timers.h"

// ------------------------
// Local defines
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#if ENABLED(USE_WATCHDOG)

#include "watchdog_ESP32.h"
#include "watchdog.h"

void watchdogSetup(void) {
// do whatever. don't remove this function.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_LINUX/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ uint8_t _getc();
#include "../shared/HAL_SPI.h"
#include "fastio.h"
#include "watchdog.h"
#include "HAL_timers.h"
#include "timers.h"
#include "serial.h"

#define SHARED_SERVOS HAS_SERVOS
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_LINUX/arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void eeprom_read_block(void *__dst, const void *__src, size_t __n) { }

void eeprom_update_block(const void *__src, void *__dst, size_t __n) { }

char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) {
char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s) {
char format_string[20];
snprintf(format_string, 20, "%%%d.%df", __width, __prec);
sprintf(__s, format_string, __val);
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/HAL_LINUX/include/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ uint16_t analogRead(pin_t);
// EEPROM
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);
void eeprom_read_block(void *__dst, const void *__src, size_t __n);
void eeprom_update_block(const void *__src, void *__dst, size_t __n);

int32_t random(int32_t);
int32_t random(int32_t, int32_t);
void randomSeed(uint32_t);

char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s);
char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);

int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "hardware/Timer.h"

#include "../../inc/MarlinConfig.h"
#include "HAL_timers.h"
#include "timers.h"

/**
* Use POSIX signals to attempt to emulate Interrupts
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_LPC1768/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern "C" volatile uint32_t _millis;
#include "../shared/HAL_SPI.h"
#include "fastio.h"
#include "watchdog.h"
#include "HAL_timers.h"
#include "timers.h"
#include "MarlinSerial.h"

#include <adc.h>
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_LPC1768/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" {
#include "../../sd/cardreader.h"
#include "../../inc/MarlinConfig.h"
#include "HAL.h"
#include "HAL_timers.h"
#include "timers.h"

extern uint32_t MSC_SD_Init(uint8_t pdrv);
extern "C" int isLPC1769();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifdef TARGET_LPC1768

#include "../../inc/MarlinConfig.h"
#include "HAL_timers.h"
#include "timers.h"

void HAL_timer_init(void) {
SBI(LPC_SC->PCONP, SBIT_TIMER0); // Power ON Timer 0
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions Marlin/src/HAL/HAL_SAMD51/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio_SAMD51.h"
#include "watchdog_SAMD51.h"
#include "HAL_timers_SAMD51.h"
#include "fastio.h"
#include "watchdog.h"
#include "timers.h"

#ifdef ADAFRUIT_GRAND_CENTRAL_M4
#include "MarlinSerial_AGCM4.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "../shared/servo.h"
#include "../shared/servo_private.h"
#include "SAMD51.h"
#include "HAL_timers_SAMD51.h"
#include "timers.h"

#define __TC_GCLK_ID(t) TC##t##_GCLK_ID
#define _TC_GCLK_ID(t) __TC_GCLK_ID(t)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Includes
// --------------------------------------------------------------------------
#include "../../inc/MarlinConfig.h"
#include "HAL_timers_SAMD51.h"
#include "timers.h"

// --------------------------------------------------------------------------
// Local defines
Expand Down
File renamed without changes.
Loading

0 comments on commit 75efa3c

Please sign in to comment.