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 # detect what shell is used
Sergunb 0:9dcf85d9b2f3 2 ifeq ($(findstring cmd.exe,$(SHELL)),cmd.exe)
Sergunb 0:9dcf85d9b2f3 3 $(info "Info : Running on Windows shell cmd.exe")
Sergunb 0:9dcf85d9b2f3 4 DEVNUL := NUL
Sergunb 0:9dcf85d9b2f3 5 WHICH := where
Sergunb 0:9dcf85d9b2f3 6 else
Sergunb 0:9dcf85d9b2f3 7 $(info "Info : Running on Unix shell")
Sergunb 0:9dcf85d9b2f3 8 DEVNUL := /dev/null
Sergunb 0:9dcf85d9b2f3 9 WHICH := which
Sergunb 0:9dcf85d9b2f3 10 endif
Sergunb 0:9dcf85d9b2f3 11
Sergunb 0:9dcf85d9b2f3 12
Sergunb 0:9dcf85d9b2f3 13 # Find first cross compilation tools
Sergunb 0:9dcf85d9b2f3 14 XTOOLS_DIR = $(abspath $(shell dirname `${WHICH} arm-none-eabi-gcc`)/..)
Sergunb 0:9dcf85d9b2f3 15
Sergunb 0:9dcf85d9b2f3 16 # Set tool & Lib paths
Sergunb 0:9dcf85d9b2f3 17 X_LIBC_DIR = $(XTOOLS_DIR)/arm-none-eabi/lib/armv7e-m/fpu
Sergunb 0:9dcf85d9b2f3 18 X_CC = $(XTOOLS_DIR)/bin/arm-none-eabi-gcc
Sergunb 0:9dcf85d9b2f3 19 X_OBJCOPY = $(XTOOLS_DIR)/bin/arm-none-eabi-objcopy
Sergunb 0:9dcf85d9b2f3 20 X_AR = $(XTOOLS_DIR)/bin/arm-none-eabi-ar
Sergunb 0:9dcf85d9b2f3 21 X_LD = $(XTOOLS_DIR)/bin/arm-none-eabi-ld
Sergunb 0:9dcf85d9b2f3 22 X_GDB = $(XTOOLS_DIR)/bin/arm-none-eabi-gdb
Sergunb 0:9dcf85d9b2f3 23
Sergunb 0:9dcf85d9b2f3 24 OUT_DIR = debug
Sergunb 0:9dcf85d9b2f3 25
Sergunb 0:9dcf85d9b2f3 26 OUTPUT = grbl-stm32
Sergunb 0:9dcf85d9b2f3 27
Sergunb 0:9dcf85d9b2f3 28 SRC= ./cmsis_boot/startup/startup_stm32f10x_md.c \
Sergunb 0:9dcf85d9b2f3 29 ./cmsis_boot/system_stm32f10x.c \
Sergunb 0:9dcf85d9b2f3 30 ./grbl/coolant_control.c \
Sergunb 0:9dcf85d9b2f3 31 ./grbl/eeprom.c \
Sergunb 0:9dcf85d9b2f3 32 ./grbl/gcode.c \
Sergunb 0:9dcf85d9b2f3 33 ./grbl/jog.c \
Sergunb 0:9dcf85d9b2f3 34 ./grbl/limits.c \
Sergunb 0:9dcf85d9b2f3 35 ./grbl/main.c \
Sergunb 0:9dcf85d9b2f3 36 ./grbl/motion_control.c \
Sergunb 0:9dcf85d9b2f3 37 ./grbl/nuts_bolts.c \
Sergunb 0:9dcf85d9b2f3 38 ./grbl/planner.c \
Sergunb 0:9dcf85d9b2f3 39 ./grbl/print.c \
Sergunb 0:9dcf85d9b2f3 40 ./grbl/probe.c \
Sergunb 0:9dcf85d9b2f3 41 ./grbl/protocol.c \
Sergunb 0:9dcf85d9b2f3 42 ./grbl/report.c \
Sergunb 0:9dcf85d9b2f3 43 ./grbl/serial.c \
Sergunb 0:9dcf85d9b2f3 44 ./grbl/settings.c \
Sergunb 0:9dcf85d9b2f3 45 ./grbl/spindle_control.c \
Sergunb 0:9dcf85d9b2f3 46 ./grbl/stepper.c \
Sergunb 0:9dcf85d9b2f3 47 ./grbl/system.c \
Sergunb 0:9dcf85d9b2f3 48 ./stm_lib/src/misc.c \
Sergunb 0:9dcf85d9b2f3 49 ./stm_lib/src/stm32f10x_exti.c \
Sergunb 0:9dcf85d9b2f3 50 ./stm_lib/src/stm32f10x_flash.c \
Sergunb 0:9dcf85d9b2f3 51 ./stm_lib/src/stm32f10x_gpio.c \
Sergunb 0:9dcf85d9b2f3 52 ./stm_lib/src/stm32f10x_rcc.c \
Sergunb 0:9dcf85d9b2f3 53 ./stm_lib/src/stm32f10x_tim.c \
Sergunb 0:9dcf85d9b2f3 54 ./stm_lib/src/stm32f10x_usart.c \
Sergunb 0:9dcf85d9b2f3 55 ./stm_usb_fs_lib/src/usb_core.c \
Sergunb 0:9dcf85d9b2f3 56 ./stm_usb_fs_lib/src/usb_init.c \
Sergunb 0:9dcf85d9b2f3 57 ./stm_usb_fs_lib/src/usb_int.c \
Sergunb 0:9dcf85d9b2f3 58 ./stm_usb_fs_lib/src/usb_mem.c \
Sergunb 0:9dcf85d9b2f3 59 ./stm_usb_fs_lib/src/usb_regs.c \
Sergunb 0:9dcf85d9b2f3 60 ./stm_usb_fs_lib/src/usb_sil.c \
Sergunb 0:9dcf85d9b2f3 61 ./usb/hw_config.c \
Sergunb 0:9dcf85d9b2f3 62 ./usb/usb_desc.c \
Sergunb 0:9dcf85d9b2f3 63 ./usb/usb_endp.c \
Sergunb 0:9dcf85d9b2f3 64 ./usb/usb_istr.c \
Sergunb 0:9dcf85d9b2f3 65 ./usb/usb_prop.c \
Sergunb 0:9dcf85d9b2f3 66 ./usb/usb_pwr.c \
Sergunb 0:9dcf85d9b2f3 67 ./util/stm32f10x_it.c
Sergunb 0:9dcf85d9b2f3 68
Sergunb 0:9dcf85d9b2f3 69 OBJ = $(patsubst %.c, %.o, $(SRC))
Sergunb 0:9dcf85d9b2f3 70 #OBJ += $(BOARD_DIR)/start.o
Sergunb 0:9dcf85d9b2f3 71
Sergunb 0:9dcf85d9b2f3 72 # include files
Sergunb 0:9dcf85d9b2f3 73 INC = .
Sergunb 0:9dcf85d9b2f3 74 INC += cmsis
Sergunb 0:9dcf85d9b2f3 75 INC += cmsis_boot
Sergunb 0:9dcf85d9b2f3 76 INC += cmsis_boot/startup
Sergunb 0:9dcf85d9b2f3 77 INC += grbl
Sergunb 0:9dcf85d9b2f3 78 INC += stm_lib/inc
Sergunb 0:9dcf85d9b2f3 79 INC += stm_lib/src
Sergunb 0:9dcf85d9b2f3 80 INC += stm_usb_fs_lib/inc
Sergunb 0:9dcf85d9b2f3 81 INC += stm_usb_fs_lib/src
Sergunb 0:9dcf85d9b2f3 82 INC += usb
Sergunb 0:9dcf85d9b2f3 83 INC += util
Sergunb 0:9dcf85d9b2f3 84
Sergunb 0:9dcf85d9b2f3 85 INCLUDE = $(addprefix -I,$(INC))
Sergunb 0:9dcf85d9b2f3 86
Sergunb 0:9dcf85d9b2f3 87 # compiler flags
Sergunb 0:9dcf85d9b2f3 88 # as in coocox
Sergunb 0:9dcf85d9b2f3 89 # -mcpu=cortex-m3 ; -mthumb ; -g2 ; -Wall ; -Os ; -DUSE_STDPERIPH_DRIVER ; -D__ASSEMBLY__ ; -D_GRBL_ ; -DSTM32F103C8 ; -DSTM32F10X_MD ; -DLEDBLINK ; -DUSEUSB ; -I. ; -Iusb ; -Iutil ; -Iuseusb ; -Igrbl ;
Sergunb 0:9dcf85d9b2f3 90
Sergunb 0:9dcf85d9b2f3 91 CFLAGS = -Wall
Sergunb 0:9dcf85d9b2f3 92 CFLAGS += -Os
Sergunb 0:9dcf85d9b2f3 93 CFLAGS += -g2
Sergunb 0:9dcf85d9b2f3 94 CFLAGS += -mthumb
Sergunb 0:9dcf85d9b2f3 95 CFLAGS += -mcpu=cortex-m3
Sergunb 0:9dcf85d9b2f3 96
Sergunb 0:9dcf85d9b2f3 97 # linker flags
Sergunb 0:9dcf85d9b2f3 98 LDSCRIPT = STM32F103C8T6.ld
Sergunb 0:9dcf85d9b2f3 99 LDFLAGS = -T$(LDSCRIPT) -Wl,-Map,$(OUT_DIR)/$(OUTPUT).map -Wl,--gc-sections
Sergunb 0:9dcf85d9b2f3 100
Sergunb 0:9dcf85d9b2f3 101 # defines
Sergunb 0:9dcf85d9b2f3 102 DEFINES = -DUSE_STDPERIPH_DRIVER -D__ASSEMBLY__ -D_GRBL_ -DSTM32F103C8 -DSTM32F10X_MD -DLEDBLINK -DUSEUSB
Sergunb 0:9dcf85d9b2f3 103
Sergunb 0:9dcf85d9b2f3 104 .S.o:
Sergunb 0:9dcf85d9b2f3 105 $(X_CC) $(INCLUDE) $(DEFINES) $(CFLAGS) -c $< -o $@
Sergunb 0:9dcf85d9b2f3 106 .c.o:
Sergunb 0:9dcf85d9b2f3 107 $(X_CC) $(INCLUDE) $(DEFINES) $(CFLAGS) -c $< -o $@
Sergunb 0:9dcf85d9b2f3 108
Sergunb 0:9dcf85d9b2f3 109 .PHONY: all flash grbl_src clean
Sergunb 0:9dcf85d9b2f3 110
Sergunb 0:9dcf85d9b2f3 111 all: $(OBJ)
Sergunb 0:9dcf85d9b2f3 112 $(X_CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -lm -o $(OUT_DIR)/$(OUTPUT)
Sergunb 0:9dcf85d9b2f3 113 mv $(OUT_DIR)/$(OUTPUT) $(OUT_DIR)/$(OUTPUT).elf
Sergunb 0:9dcf85d9b2f3 114 $(X_OBJCOPY) -O binary $(OUT_DIR)/$(OUTPUT).elf $(OUT_DIR)/$(OUTPUT).bin
Sergunb 0:9dcf85d9b2f3 115
Sergunb 0:9dcf85d9b2f3 116 flash:
Sergunb 0:9dcf85d9b2f3 117 make all
Sergunb 0:9dcf85d9b2f3 118 st-flash write $(OUT_DIR)/$(OUTPUT).bin 0x08000000
Sergunb 0:9dcf85d9b2f3 119
Sergunb 0:9dcf85d9b2f3 120 grbl_src:
Sergunb 0:9dcf85d9b2f3 121 make all
Sergunb 0:9dcf85d9b2f3 122
Sergunb 0:9dcf85d9b2f3 123 clean:
Sergunb 0:9dcf85d9b2f3 124 -rm $(OBJ)
Sergunb 0:9dcf85d9b2f3 125 -rm $(OUT_DIR)/$(OUTPUT).map
Sergunb 0:9dcf85d9b2f3 126 -rm $(OUT_DIR)/$(OUTPUT).bin
Sergunb 0:9dcf85d9b2f3 127 -rm $(OUT_DIR)/$(OUTPUT).elf