Skip to content

Commit 2fe81d0

Browse files
V1EngineeringIncthinkyhead
authored andcommittedOct 16, 2020
Fix Archim1 stepper timing (with new variant) (MarlinFirmware#19596)
1 parent fb7d7ee commit 2fe81d0

21 files changed

+2322
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"build": {
3+
"core": "arduino",
4+
"cpu": "cortex-m3",
5+
"extra_flags": "-D__SAM3X8E__ -DARDUINO_ARCH_SAM -DARDUINO_SAM_DUE",
6+
"f_cpu": "84000000L",
7+
"hwids": [
8+
[
9+
"0x27B1",
10+
"0x0001"
11+
],
12+
[
13+
"0x2341",
14+
"0x003E"
15+
],
16+
[
17+
"0x2341",
18+
"0x003D"
19+
]
20+
],
21+
"ldscript": "linker_scripts/gcc/flash.ld",
22+
"mcu": "at91sam3x8e",
23+
"usb_product": "Archim",
24+
"variant": "archim"
25+
},
26+
"connectivity": [
27+
"can"
28+
],
29+
"debug": {
30+
"jlink_device": "ATSAM3X8E",
31+
"openocd_chipname": "at91sam3X8E",
32+
"openocd_target": "at91sam3XXX",
33+
"svd_path": "ATSAM3X8E.svd"
34+
},
35+
"frameworks": [
36+
"arduino",
37+
"simba"
38+
],
39+
"name": "Archim",
40+
"upload": {
41+
"disable_flushing": true,
42+
"maximum_ram_size": 98304,
43+
"maximum_size": 524288,
44+
"native_usb": true,
45+
"protocol": "sam-ba",
46+
"protocols": [
47+
"sam-ba",
48+
"jlink",
49+
"blackmagic",
50+
"atmel-ice",
51+
"stlink"
52+
],
53+
"require_upload_port": true,
54+
"use_1200bps_touch": true,
55+
"wait_for_upload_port": true
56+
},
57+
"url": "https://ultimachine.com",
58+
"vendor": "UltiMachine"
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Exception for libsam
2+
!libsam_sam3x8e_gcc_rel.a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Copyright (c) 2011 Arduino. All right reserved.
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation; either
7+
# version 2.1 of the License, or (at your option) any later version.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
# See the GNU Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
#
18+
19+
SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables --no-print-directory
20+
21+
#-------------------------------------------------------------------------------
22+
# Rules
23+
#-------------------------------------------------------------------------------
24+
25+
all: arduino_due_x
26+
27+
.PHONY: arduino_due_x
28+
arduino_due_x:
29+
@echo ------------------------------------------------------------------------------------
30+
@echo --- Making variant arduino_due_x
31+
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libvariant_arduino_due_x.mk
32+
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libvariant_arduino_due_x.mk
33+
@echo ------------------------------------------------------------------------------------
34+
35+
.PHONY: clean
36+
clean:
37+
@echo ------------------------------------------------------------------------------------
38+
@echo --- Cleaning variant arduino_due_x
39+
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libvariant_arduino_due_x.mk $@
40+
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libvariant_arduino_due_x.mk $@
41+
@echo ------------------------------------------------------------------------------------
42+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright (c) 2011 Arduino. All right reserved.
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation; either
7+
# version 2.1 of the License, or (at your option) any later version.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
# See the GNU Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
#
18+
19+
# Optimization level
20+
# -O1 Optimize
21+
# -O2 Optimize even more
22+
# -O3 Optimize yet more
23+
# -O0 Reduce compilation time and make debugging produce the expected results
24+
# -Os Optimize for size
25+
OPTIMIZATION = -g -O0 -DDEBUG
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#
2+
# Copyright (c) 2011 Arduino. All right reserved.
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation; either
7+
# version 2.1 of the License, or (at your option) any later version.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
# See the GNU Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
#
18+
19+
# Tool suffix when cross-compiling
20+
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
21+
22+
# Compilation tools
23+
AR = $(CROSS_COMPILE)ar
24+
CC = $(CROSS_COMPILE)gcc
25+
CXX = $(CROSS_COMPILE)g++
26+
AS = $(CROSS_COMPILE)as
27+
NM = $(CROSS_COMPILE)nm
28+
ifeq ($(OS),Windows_NT)
29+
RM=cs-rm -Rf
30+
else
31+
RM=rm -Rf
32+
endif
33+
34+
SEP=\\
35+
36+
# ---------------------------------------------------------------------------------------
37+
# C Flags
38+
39+
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
40+
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
41+
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
42+
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
43+
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
44+
CFLAGS += -Wsign-compare -Waggregate-return -Wstrict-prototypes
45+
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
46+
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
47+
CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
48+
CFLAGS += -Wunreachable-code
49+
CFLAGS += -Wcast-align
50+
#CFLAGS += -Wmissing-noreturn
51+
#CFLAGS += -Wconversion
52+
53+
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -fdata-sections -nostdlib -std=c99
54+
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
55+
56+
# To reduce application size use only integer printf function.
57+
CFLAGS += -Dprintf=iprintf
58+
59+
# ---------------------------------------------------------------------------------------
60+
# CPP Flags
61+
62+
CPPFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2
63+
CPPFLAGS += -Wmain -Wparentheses -Wcast-align -Wunreachable-code
64+
CPPFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
65+
CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
66+
CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings
67+
CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations
68+
CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
69+
CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
70+
#CPPFLAGS += -Wmissing-noreturn
71+
#CPPFLAGS += -Wconversion
72+
73+
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -std=c++98
74+
CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
75+
76+
# To reduce application size use only integer printf function.
77+
CPPFLAGS += -Dprintf=iprintf
78+
79+
# ---------------------------------------------------------------------------------------
80+
# ASM Flags
81+
82+
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
#
2+
# Copyright (c) 2012 Arduino. All right reserved.
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation; either
7+
# version 2.1 of the License, or (at your option) any later version.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
# See the GNU Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
#
18+
19+
# Makefile for compiling libArduino
20+
.SUFFIXES: .o .a .c .s
21+
22+
CHIP=__SAM3X8E__
23+
VARIANT=arduino_due_x
24+
LIBNAME=libvariant_$(VARIANT)
25+
TOOLCHAIN=gcc
26+
27+
#-------------------------------------------------------------------------------
28+
# Path
29+
#-------------------------------------------------------------------------------
30+
31+
# Output directories
32+
OUTPUT_BIN = ../../../cores/arduino
33+
34+
# Libraries
35+
PROJECT_BASE_PATH = ..
36+
SYSTEM_PATH = ../../../system
37+
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
38+
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
39+
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
40+
#CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
41+
42+
ARDUINO_PATH = ../../../cores/arduino
43+
VARIANT_BASE_PATH = ../../../variants
44+
VARIANT_PATH = ../../../variants/$(VARIANT)
45+
46+
#-------------------------------------------------------------------------------
47+
# Files
48+
#-------------------------------------------------------------------------------
49+
50+
#vpath %.h $(PROJECT_BASE_PATH) $(SYSTEM_PATH) $(VARIANT_PATH)
51+
vpath %.cpp $(PROJECT_BASE_PATH)
52+
53+
VPATH+=$(PROJECT_BASE_PATH)
54+
55+
INCLUDES =
56+
#INCLUDES += -I$(PROJECT_BASE_PATH)
57+
INCLUDES += -I$(ARDUINO_PATH)
58+
INCLUDES += -I$(ARDUINO_PATH)/USB
59+
INCLUDES += -I$(SYSTEM_PATH)
60+
INCLUDES += -I$(SYSTEM_PATH)/libsam
61+
INCLUDES += -I$(SYSTEM_PATH)/USBHost
62+
INCLUDES += -I$(VARIANT_BASE_PATH)
63+
INCLUDES += -I$(VARIANT_PATH)
64+
INCLUDES += -I$(CMSIS_ARM_PATH)
65+
INCLUDES += -I$(CMSIS_ATMEL_PATH)
66+
67+
#-------------------------------------------------------------------------------
68+
ifdef DEBUG
69+
include debug.mk
70+
else
71+
include release.mk
72+
endif
73+
74+
#-------------------------------------------------------------------------------
75+
# Tools
76+
#-------------------------------------------------------------------------------
77+
78+
include $(TOOLCHAIN).mk
79+
80+
#-------------------------------------------------------------------------------
81+
ifdef DEBUG
82+
OUTPUT_OBJ=debug
83+
OUTPUT_LIB_POSTFIX=dbg
84+
else
85+
OUTPUT_OBJ=release
86+
OUTPUT_LIB_POSTFIX=rel
87+
endif
88+
89+
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_$(OUTPUT_LIB_POSTFIX).a
90+
OUTPUT_PATH=$(OUTPUT_OBJ)_$(VARIANT)
91+
92+
#-------------------------------------------------------------------------------
93+
# C source files and objects
94+
#-------------------------------------------------------------------------------
95+
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c)
96+
97+
C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
98+
99+
# during development, remove some files
100+
C_OBJ_FILTER=
101+
102+
C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP))
103+
104+
#-------------------------------------------------------------------------------
105+
# CPP source files and objects
106+
#-------------------------------------------------------------------------------
107+
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp)
108+
109+
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
110+
111+
# during development, remove some files
112+
CPP_OBJ_FILTER=
113+
114+
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
115+
116+
#-------------------------------------------------------------------------------
117+
# Assembler source files and objects
118+
#-------------------------------------------------------------------------------
119+
A_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.s)
120+
121+
A_OBJ_TEMP=$(patsubst %.s, %.o, $(notdir $(A_SRC)))
122+
123+
# during development, remove some files
124+
A_OBJ_FILTER=
125+
126+
A_OBJ=$(filter-out $(A_OBJ_FILTER), $(A_OBJ_TEMP))
127+
128+
#-------------------------------------------------------------------------------
129+
# Rules
130+
#-------------------------------------------------------------------------------
131+
all: $(VARIANT)
132+
133+
$(VARIANT): create_output $(OUTPUT_LIB)
134+
135+
.PHONY: create_output
136+
create_output:
137+
@echo ------------------------------------------------------------------------------------
138+
@echo -------------------------
139+
@echo --- Preparing variant $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
140+
@echo -------------------------
141+
# @echo *$(INCLUDES)
142+
# @echo -------------------------
143+
# @echo *$(C_SRC)
144+
# @echo -------------------------
145+
# @echo *$(C_OBJ)
146+
# @echo -------------------------
147+
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
148+
# @echo -------------------------
149+
# @echo *$(CPP_SRC)
150+
# @echo -------------------------
151+
# @echo *$(CPP_OBJ)
152+
# @echo -------------------------
153+
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
154+
# @echo -------------------------
155+
# @echo *$(A_SRC)
156+
# @echo -------------------------
157+
158+
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
159+
@echo ------------------------------------------------------------------------------------
160+
161+
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
162+
# @"$(CC)" -v -c $(CFLAGS) $< -o $@
163+
@"$(CC)" -c $(CFLAGS) $< -o $@
164+
165+
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
166+
# @"$(CC)" -c $(CPPFLAGS) $< -o $@
167+
@"$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
168+
169+
$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s
170+
@"$(AS)" -c $(ASFLAGS) $< -o $@
171+
172+
$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
173+
@"$(AR)" -v -r "$(OUTPUT_BIN)/$@" $^
174+
@"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt"
175+
176+
177+
.PHONY: clean
178+
clean:
179+
@echo ------------------------------------------------------------------------------------
180+
@echo --- Cleaning $(VARIANT) files [$(OUTPUT_PATH)$(SEP)*.o]
181+
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
182+
-@$(RM) $(OUTPUT_BIN)/$(OUTPUT_LIB) 1>NUL 2>&1
183+
@echo ------------------------------------------------------------------------------------
184+

0 commit comments

Comments
 (0)
Please sign in to comment.