I'm trying to port GRBL 1.1 to the STM32F746 chip. Tell me the solution, thanks.

Committer:
Sergunb
Date:
Mon Sep 04 12:05:05 2017 +0000
Revision:
0:9dcf85d9b2f3
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sergunb 0:9dcf85d9b2f3 1 /*
Sergunb 0:9dcf85d9b2f3 2 grbl.h - main Grbl include file
Sergunb 0:9dcf85d9b2f3 3 Part of Grbl
Sergunb 0:9dcf85d9b2f3 4
Sergunb 0:9dcf85d9b2f3 5 Copyright (c) 2015-2016 Sungeun K. Jeon for Gnea Research LLC
Sergunb 0:9dcf85d9b2f3 6
Sergunb 0:9dcf85d9b2f3 7 Grbl is free software: you can redistribute it and/or modify
Sergunb 0:9dcf85d9b2f3 8 it under the terms of the GNU General Public License as published by
Sergunb 0:9dcf85d9b2f3 9 the Free Software Foundation, either version 3 of the License, or
Sergunb 0:9dcf85d9b2f3 10 (at your option) any later version.
Sergunb 0:9dcf85d9b2f3 11
Sergunb 0:9dcf85d9b2f3 12 Grbl is distributed in the hope that it will be useful,
Sergunb 0:9dcf85d9b2f3 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
Sergunb 0:9dcf85d9b2f3 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Sergunb 0:9dcf85d9b2f3 15 GNU General Public License for more details.
Sergunb 0:9dcf85d9b2f3 16
Sergunb 0:9dcf85d9b2f3 17 You should have received a copy of the GNU General Public License
Sergunb 0:9dcf85d9b2f3 18 along with Grbl. If not, see <http://www.gnu.org/licenses/>.
Sergunb 0:9dcf85d9b2f3 19 */
Sergunb 0:9dcf85d9b2f3 20
Sergunb 0:9dcf85d9b2f3 21 #ifndef grbl_h
Sergunb 0:9dcf85d9b2f3 22 #define grbl_h
Sergunb 0:9dcf85d9b2f3 23
Sergunb 0:9dcf85d9b2f3 24 // Grbl versioning system
Sergunb 0:9dcf85d9b2f3 25 #define GRBL_VERSION "1.1f"
Sergunb 0:9dcf85d9b2f3 26 #define GRBL_VERSION_BUILD "20170324"
Sergunb 0:9dcf85d9b2f3 27
Sergunb 0:9dcf85d9b2f3 28 #if !defined(STM32F103C8) && !defined(WIN32)
Sergunb 0:9dcf85d9b2f3 29 #define AVRTARGET
Sergunb 0:9dcf85d9b2f3 30 #endif
Sergunb 0:9dcf85d9b2f3 31
Sergunb 0:9dcf85d9b2f3 32 // Define standard libraries used by Grbl.
Sergunb 0:9dcf85d9b2f3 33 #ifdef AVRTARGET
Sergunb 0:9dcf85d9b2f3 34 #include <avr/io.h>
Sergunb 0:9dcf85d9b2f3 35 #include <avr/pgmspace.h>
Sergunb 0:9dcf85d9b2f3 36 #include <avr/interrupt.h>
Sergunb 0:9dcf85d9b2f3 37 #include <avr/wdt.h>
Sergunb 0:9dcf85d9b2f3 38 #include <util/delay.h>
Sergunb 0:9dcf85d9b2f3 39 #include <inttypes.h>
Sergunb 0:9dcf85d9b2f3 40 #include <stdbool.h>
Sergunb 0:9dcf85d9b2f3 41 #define PORTPINDEF uint8_t
Sergunb 0:9dcf85d9b2f3 42 #endif
Sergunb 0:9dcf85d9b2f3 43 #include <math.h>
Sergunb 0:9dcf85d9b2f3 44 #ifdef WIN32
Sergunb 0:9dcf85d9b2f3 45 #include <Windows.h>
Sergunb 0:9dcf85d9b2f3 46 typedef signed char int8_t;
Sergunb 0:9dcf85d9b2f3 47 typedef signed short int16_t;
Sergunb 0:9dcf85d9b2f3 48 typedef signed int int32_t;
Sergunb 0:9dcf85d9b2f3 49 typedef unsigned char uint8_t;
Sergunb 0:9dcf85d9b2f3 50 typedef unsigned short uint16_t;
Sergunb 0:9dcf85d9b2f3 51 typedef unsigned int uint32_t;
Sergunb 0:9dcf85d9b2f3 52 typedef signed long long int64_t;
Sergunb 0:9dcf85d9b2f3 53 typedef unsigned long long uint64_t;
Sergunb 0:9dcf85d9b2f3 54 typedef int bool;
Sergunb 0:9dcf85d9b2f3 55 #define false 0
Sergunb 0:9dcf85d9b2f3 56 #define true 1
Sergunb 0:9dcf85d9b2f3 57 #define truncf(x) (int32_t)x
Sergunb 0:9dcf85d9b2f3 58 #define PSTR(x) x
Sergunb 0:9dcf85d9b2f3 59 #define pgm_read_byte_near(x) *(x)
Sergunb 0:9dcf85d9b2f3 60 #define _delay_ms(x) Sleep(x)
Sergunb 0:9dcf85d9b2f3 61 #define M_PI 3.1415926f
Sergunb 0:9dcf85d9b2f3 62 #define LOG(x,y)
Sergunb 0:9dcf85d9b2f3 63 #define PORTPINDEF uint8_t
Sergunb 0:9dcf85d9b2f3 64 #define printPgmString printString
Sergunb 0:9dcf85d9b2f3 65 //#define NOEEPROMSUPPORT
Sergunb 0:9dcf85d9b2f3 66 #endif
Sergunb 0:9dcf85d9b2f3 67 #ifdef STM32F103C8
Sergunb 0:9dcf85d9b2f3 68 #include "stm32f10x.h"
Sergunb 0:9dcf85d9b2f3 69 #include "stm32f10x_gpio.h"
Sergunb 0:9dcf85d9b2f3 70 #include "stm32f10x_exti.h"
Sergunb 0:9dcf85d9b2f3 71 #include "stm32f10x_tim.h"
Sergunb 0:9dcf85d9b2f3 72 #include "misc.h"
Sergunb 0:9dcf85d9b2f3 73 #define PSTR(x) x
Sergunb 0:9dcf85d9b2f3 74 #define pgm_read_byte_near(x) *(x)
Sergunb 0:9dcf85d9b2f3 75 void _delay_ms(uint32_t x);
Sergunb 0:9dcf85d9b2f3 76 void _delay_us(uint32_t x);
Sergunb 0:9dcf85d9b2f3 77 #define false 0
Sergunb 0:9dcf85d9b2f3 78 #define true 1
Sergunb 0:9dcf85d9b2f3 79 #define PORTPINDEF uint16_t
Sergunb 0:9dcf85d9b2f3 80 typedef int bool;
Sergunb 0:9dcf85d9b2f3 81 //#define NOEEPROMSUPPORT
Sergunb 0:9dcf85d9b2f3 82 #define printPgmString printString
Sergunb 0:9dcf85d9b2f3 83 #endif
Sergunb 0:9dcf85d9b2f3 84 #include <string.h>
Sergunb 0:9dcf85d9b2f3 85 #include <stdlib.h>
Sergunb 0:9dcf85d9b2f3 86 #include <stdint.h>
Sergunb 0:9dcf85d9b2f3 87
Sergunb 0:9dcf85d9b2f3 88 // Define the Grbl system include files. NOTE: Do not alter organization.
Sergunb 0:9dcf85d9b2f3 89 #include "config.h"
Sergunb 0:9dcf85d9b2f3 90 #include "nuts_bolts.h"
Sergunb 0:9dcf85d9b2f3 91 #include "settings.h"
Sergunb 0:9dcf85d9b2f3 92 #include "system.h"
Sergunb 0:9dcf85d9b2f3 93 #include "defaults.h"
Sergunb 0:9dcf85d9b2f3 94 #include "cpu_map.h"
Sergunb 0:9dcf85d9b2f3 95 #include "planner.h"
Sergunb 0:9dcf85d9b2f3 96 #include "coolant_control.h"
Sergunb 0:9dcf85d9b2f3 97 #include "eeprom.h"
Sergunb 0:9dcf85d9b2f3 98 #include "gcode.h"
Sergunb 0:9dcf85d9b2f3 99 #include "limits.h"
Sergunb 0:9dcf85d9b2f3 100 #include "motion_control.h"
Sergunb 0:9dcf85d9b2f3 101 #include "planner.h"
Sergunb 0:9dcf85d9b2f3 102 #include "print.h"
Sergunb 0:9dcf85d9b2f3 103 #include "probe.h"
Sergunb 0:9dcf85d9b2f3 104 #include "protocol.h"
Sergunb 0:9dcf85d9b2f3 105 #include "report.h"
Sergunb 0:9dcf85d9b2f3 106 #include "serial.h"
Sergunb 0:9dcf85d9b2f3 107 #include "spindle_control.h"
Sergunb 0:9dcf85d9b2f3 108 #include "stepper.h"
Sergunb 0:9dcf85d9b2f3 109 #include "jog.h"
Sergunb 0:9dcf85d9b2f3 110
Sergunb 0:9dcf85d9b2f3 111 // ---------------------------------------------------------------------------------------
Sergunb 0:9dcf85d9b2f3 112 // COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:
Sergunb 0:9dcf85d9b2f3 113
Sergunb 0:9dcf85d9b2f3 114 #ifndef HOMING_CYCLE_0
Sergunb 0:9dcf85d9b2f3 115 #error "Required HOMING_CYCLE_0 not defined."
Sergunb 0:9dcf85d9b2f3 116 #endif
Sergunb 0:9dcf85d9b2f3 117
Sergunb 0:9dcf85d9b2f3 118 #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)
Sergunb 0:9dcf85d9b2f3 119 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
Sergunb 0:9dcf85d9b2f3 120 #endif
Sergunb 0:9dcf85d9b2f3 121
Sergunb 0:9dcf85d9b2f3 122 #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
Sergunb 0:9dcf85d9b2f3 123 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
Sergunb 0:9dcf85d9b2f3 124 #endif
Sergunb 0:9dcf85d9b2f3 125
Sergunb 0:9dcf85d9b2f3 126 #if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)
Sergunb 0:9dcf85d9b2f3 127 #error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled"
Sergunb 0:9dcf85d9b2f3 128 #endif
Sergunb 0:9dcf85d9b2f3 129
Sergunb 0:9dcf85d9b2f3 130 #if defined(PARKING_ENABLE)
Sergunb 0:9dcf85d9b2f3 131 #if defined(HOMING_FORCE_SET_ORIGIN)
Sergunb 0:9dcf85d9b2f3 132 #error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time."
Sergunb 0:9dcf85d9b2f3 133 #endif
Sergunb 0:9dcf85d9b2f3 134 #endif
Sergunb 0:9dcf85d9b2f3 135
Sergunb 0:9dcf85d9b2f3 136 #if defined(ENABLE_PARKING_OVERRIDE_CONTROL)
Sergunb 0:9dcf85d9b2f3 137 #if !defined(PARKING_ENABLE)
Sergunb 0:9dcf85d9b2f3 138 #error "ENABLE_PARKING_OVERRIDE_CONTROL must be enabled with PARKING_ENABLE."
Sergunb 0:9dcf85d9b2f3 139 #endif
Sergunb 0:9dcf85d9b2f3 140 #endif
Sergunb 0:9dcf85d9b2f3 141
Sergunb 0:9dcf85d9b2f3 142 #if defined(SPINDLE_PWM_MIN_VALUE)
Sergunb 0:9dcf85d9b2f3 143 #if !(SPINDLE_PWM_MIN_VALUE > 0)
Sergunb 0:9dcf85d9b2f3 144 #error "SPINDLE_PWM_MIN_VALUE must be greater than zero."
Sergunb 0:9dcf85d9b2f3 145 #endif
Sergunb 0:9dcf85d9b2f3 146 #endif
Sergunb 0:9dcf85d9b2f3 147
Sergunb 0:9dcf85d9b2f3 148 #if (REPORT_WCO_REFRESH_BUSY_COUNT < REPORT_WCO_REFRESH_IDLE_COUNT)
Sergunb 0:9dcf85d9b2f3 149 #error "WCO busy refresh is less than idle refresh."
Sergunb 0:9dcf85d9b2f3 150 #endif
Sergunb 0:9dcf85d9b2f3 151 #if (REPORT_OVR_REFRESH_BUSY_COUNT < REPORT_OVR_REFRESH_IDLE_COUNT)
Sergunb 0:9dcf85d9b2f3 152 #error "Override busy refresh is less than idle refresh."
Sergunb 0:9dcf85d9b2f3 153 #endif
Sergunb 0:9dcf85d9b2f3 154 #if (REPORT_WCO_REFRESH_IDLE_COUNT < 2)
Sergunb 0:9dcf85d9b2f3 155 #error "WCO refresh must be greater than one."
Sergunb 0:9dcf85d9b2f3 156 #endif
Sergunb 0:9dcf85d9b2f3 157 #if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
Sergunb 0:9dcf85d9b2f3 158 #error "Override refresh must be greater than zero."
Sergunb 0:9dcf85d9b2f3 159 #endif
Sergunb 0:9dcf85d9b2f3 160 // ---------------------------------------------------------------------------------------
Sergunb 0:9dcf85d9b2f3 161
Sergunb 0:9dcf85d9b2f3 162 #endif