Skip to content

Commit 7730dab

Browse files
committed
Initial version.
1 parent 76ce1b3 commit 7730dab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+9202
-1
lines changed

Makefile

+202
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
##############################################################################
2+
# #
3+
# BeBoPr - 3D printer software for Linux on BeagleBone #
4+
# #
5+
# 2012-05-29 - ARM version for BeagleBone with BeBoPr cape #
6+
# #
7+
# Copyright (C) 2011-2012 Bas Laarhoven aka modmaker #
8+
# #
9+
# Partly based on code by Triffid Hunter, Traumflug, jakepoz, Markus Hitter, #
10+
# and many others. #
11+
# Previous Copyright: (C) 2009-2010 Michael Moon aka Triffid_Hunter #
12+
# #
13+
# This program is free software; you can redistribute it and/or modify #
14+
# it under the terms of the GNU General Public License as published by #
15+
# the Free Software Foundation; either version 2 of the License, or #
16+
# (at your option) any later version. #
17+
# #
18+
# This program is distributed in the hope that it will be useful, #
19+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
20+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
21+
# GNU General Public License for more details. #
22+
# #
23+
# You should have received a copy of the GNU General Public License #
24+
# along with this program; if not, write to the Free Software #
25+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
26+
# #
27+
##############################################################################
28+
29+
##############################################################################
30+
# #
31+
# These defaults should be ok, change if you need to #
32+
# #
33+
##############################################################################
34+
35+
# Name of this Makefile (used for "make depend").
36+
37+
DEFS=
38+
39+
#PATH=/home/bas/ti-sdk-am335x-evm-05.03.00.00/linux-devkit/bin:$(PATH)
40+
ARCH=arm
41+
CROSS_COMPILE=arm-arago-linux-gnueabi-
42+
43+
MAKEFILE = Makefile
44+
45+
CSTD=gnu99
46+
47+
PROGRAM = mendel
48+
49+
SOURCES = \
50+
analog.c \
51+
beaglebone-stubs.c \
52+
bebopr_r2.c \
53+
clock.c \
54+
dda.c \
55+
dda_queue.c \
56+
dda_util.c \
57+
debug.c \
58+
gcode_parse.c \
59+
gcode_process.c \
60+
gpio.c \
61+
heater.c \
62+
home.c \
63+
limit_switches.c \
64+
pinio.c \
65+
pruss.c \
66+
pwm.c \
67+
serial.c \
68+
sermsg.c \
69+
sersendf.c \
70+
temp.c \
71+
thermistor.c \
72+
timer.c \
73+
traject.c \
74+
$(PROGRAM).c
75+
76+
CC = $(CROSS_COMPILE)gcc
77+
OBJDUMP = $(CROSS_COMPILE)objdump
78+
OBJCOPY = $(CROSS_COMPILE)objcopy
79+
80+
#OPTIMIZE = -Os -ffunction-sections -finline-functions-called-once -mcall-prologues
81+
# OPTIMIZE = -O0
82+
CFLAGS = -g -Wall -Wstrict-prototypes $(OPTIMIZE) $(DEFS) -std=${CSTD} -funsigned-char -funsigned-bitfields -fpack-struct -save-temps -pthread
83+
LDFLAGS = -Wl,--as-needed -Wl,--gc-sections
84+
LIBS = -lm -pthread -lrt
85+
LIBDEPS =
86+
87+
SUBDIRS =
88+
89+
OBJ = $(patsubst %.c,%.o,${SOURCES})
90+
91+
.PHONY: all program clean subdirs doc
92+
.PRECIOUS: %.o %.elf
93+
94+
all: config.h $(PROGRAM).elf
95+
96+
$(PROGRAM).elf: $(LIBDEPS)
97+
98+
subdirs:
99+
@for dir in $(SUBDIRS); do \
100+
$(MAKE) -C $$dir; \
101+
done
102+
103+
clean: clean-subdirs
104+
-rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex *.al *.i *.s *~ *fuse
105+
106+
clean-subdirs:
107+
@for dir in $(SUBDIRS); do \
108+
$(MAKE) -C $$dir clean; \
109+
done
110+
111+
doc: Doxyfile *.c *.h
112+
doxygen $<
113+
114+
%.o: %.c config.h Makefile
115+
@echo " CC $@"
116+
@$(CC) -c $(CFLAGS) -Wa,-adhlns=$(<:.c=.al) -o $@ $(subst .o,.c,$@)
117+
118+
%.elf: $(OBJ)
119+
@echo " LINK $@"
120+
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
121+
122+
%.lst: %.elf
123+
@echo " OBJDUMP $@"
124+
@$(OBJDUMP) -h -S $< > $@
125+
126+
depend:
127+
@echo " Appending dependancy information to '$(MAKEFILE)'"
128+
@if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; then \
129+
sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > $(MAKEFILE).$$$$ && \
130+
mv -f $(MAKEFILE).$$$$ $(MAKEFILE); \
131+
fi; \
132+
echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> $(MAKEFILE) ; \
133+
if [ "$(MCU_TARGET)x"=="x" ] ; then \
134+
$(CC) -MM $(CDEFS) $(CINCS) $(SOURCES) $(ASRC) >> $(MAKEFILE) ; \
135+
else \
136+
$(CC) -MM -mmcu=$(MCU_TARGET) $(CDEFS) $(CINCS) $(SOURCES) $(ASRC) >> $(MAKEFILE) ; \
137+
fi
138+
139+
install:
140+
@echo " INSTALLING '$(PROGRAM)' TO '$(TARGET_NFS_ROOT)'"
141+
@if [ -n "$(TARGET_NFS_ROOT)" ] ; then \
142+
sudo cp $(PROGRAM).elf $(TARGET_NFS_ROOT)/home/root/ ; \
143+
else \
144+
echo "INSTALL: no destination specified" ; \
145+
fi
146+
147+
.PHONY: all build elf hex eep lss sym program coff extcoff clean depend applet_files install
148+
149+
# DO NOT DELETE THIS LINE -- make depend depends on it.
150+
analog.o: analog.c analog.h beaglebone.h mendel.h debug.h
151+
beaglebone-stubs.o: beaglebone-stubs.c beaglebone.h beaglebone-stubs.h
152+
bebopr_r2.o: bebopr_r2.c analog.h temp.h beaglebone.h thermistor.h \
153+
bebopr.h heater.h pwm.h
154+
clock.o: clock.c clock.h pinio.h config.h config_macros.h prusa_mech.h \
155+
wades_extruder.h sersendf.h dda_queue.h dda.h timer.h temp.h analog.h \
156+
debug.h heater.h pwm.h serial.h beaglebone-stubs.h memory_barrier.h \
157+
gcode_process.h gcode_parse.h
158+
dda.o: dda.c pruss.h algo2cmds.h dda.h config.h config_macros.h \
159+
prusa_mech.h wades_extruder.h timer.h serial.h beaglebone-stubs.h \
160+
sermsg.h gcode_parse.h dda_queue.h debug.h sersendf.h pinio.h \
161+
memory_barrier.h dda_util.h
162+
dda_queue.o: dda_queue.c dda_queue.h dda.h config.h config_macros.h \
163+
prusa_mech.h wades_extruder.h timer.h serial.h beaglebone-stubs.h \
164+
sermsg.h temp.h analog.h sersendf.h clock.h memory_barrier.h pruss.h \
165+
algo2cmds.h
166+
dda_util.o: dda_util.c dda_util.h
167+
debug.o: debug.c debug.h config.h config_macros.h prusa_mech.h \
168+
wades_extruder.h
169+
gcode_parse.o: gcode_parse.c gcode_parse.h dda.h config.h config_macros.h \
170+
prusa_mech.h wades_extruder.h serial.h beaglebone-stubs.h sermsg.h \
171+
debug.h heater.h temp.h analog.h pwm.h sersendf.h gcode_process.h
172+
gcode_process.o: gcode_process.c gcode_process.h gcode_parse.h dda.h \
173+
config.h config_macros.h prusa_mech.h wades_extruder.h dda_queue.h \
174+
timer.h serial.h beaglebone-stubs.h sermsg.h temp.h analog.h heater.h \
175+
pwm.h sersendf.h pinio.h debug.h clock.h home.h traject.h pruss.h \
176+
algo2cmds.h
177+
gpio.o: gpio.c gpio.h
178+
heater.o: heater.c heater.h temp.h analog.h pwm.h debug.h beaglebone.h \
179+
mendel.h
180+
home.o: home.c pruss.h algo2cmds.h limit_switches.h home.h dda_queue.h \
181+
dda.h config.h config_macros.h prusa_mech.h wades_extruder.h timer.h \
182+
pinio.h sersendf.h memory_barrier.h debug.h gcode_process.h \
183+
gcode_parse.h traject.h bebopr.h
184+
limit_switches.o: limit_switches.c limit_switches.h pruss.h algo2cmds.h \
185+
mendel.h bebopr.h gpio.h
186+
pinio.o: pinio.c pinio.h config.h config_macros.h prusa_mech.h \
187+
wades_extruder.h
188+
pruss.o: pruss.c pruss.h algo2cmds.h beaglebone.h
189+
pwm.o: pwm.c pwm.h
190+
serial.o: serial.c serial.h beaglebone-stubs.h mendel.h
191+
sermsg.o: sermsg.c sermsg.h serial.h beaglebone-stubs.h
192+
sersendf.o: sersendf.c sersendf.h serial.h beaglebone-stubs.h sermsg.h
193+
temp.o: temp.c temp.h analog.h beaglebone.h debug.h
194+
thermistor.o: thermistor.c beaglebone.h thermistor.h
195+
timer.o: timer.c timer.h platform.h beaglebone.h config.h config_macros.h \
196+
prusa_mech.h wades_extruder.h dda_queue.h dda.h memory_barrier.h
197+
traject.o: traject.c traject.h pruss.h algo2cmds.h debug.h
198+
mendel.o: mendel.c config.h config_macros.h prusa_mech.h wades_extruder.h \
199+
serial.h beaglebone-stubs.h dda_queue.h dda.h timer.h gcode_parse.h \
200+
temp.h analog.h sermsg.h debug.h sersendf.h heater.h pwm.h pinio.h \
201+
platform.h beaglebone.h clock.h bebopr.h mendel.h gcode_process.h \
202+
limit_switches.h

README.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
BeBoPr
22
======
33

4-
3D printer controller software for BeagleBone with BeBoPr Cape.
4+
3D printer controller software for BeagleBone with BeBoPr Cape.
5+
6+
Currently this is a very preliminary version, that allows some interactive
7+
experiments with the stepper driver. For this one needs the binary 'stepper.bin'
8+
that's not in this repository and only comes with the BeBoPr Cape.
9+
10+
Compilation:
11+
------------
12+
Change setenv to reflect the compilation environment.
13+
Source setenv before running 'make'.
14+
After compilation, copy mendel.elf together with stepper.bin and
15+
bebopr_test.sh to the beaglebone.
16+
The Linux kernel used needs several features to be able to run this code:
17+
The uio_pruss module should be available and the adc, pwm and gpio
18+
interfaces should be present in the /sys filesystem.
19+
The kernel should also contain the Cape EEPROM parsing code, otherwise all
20+
settings must be made manually.
21+
If all these conditions are met, run mendel.elf as root and play with
22+
the interactive gcode interpreter.
23+

ThermistorTable.h

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// default thermistor lookup table
2+
3+
#if ARCH == arm
4+
#define PROGMEM
5+
#endif
6+
7+
// How many thermistor tables we have
8+
#define NUMTABLES 1
9+
10+
#define THERMISTOR_EXTRUDER 0
11+
// #define THERMISTOR_BED 1
12+
13+
// Thermistor lookup table, generated with --num-temps=50 and trimmed in lower temperature ranges.
14+
// You may be able to improve the accuracy of this table in various ways.
15+
// 1. Measure the actual resistance of the resistor. It's "nominally" 4.7K, but that's ± 5%.
16+
// 2. Measure the actual beta of your thermistor:http://reprap.org/wiki/MeasuringThermistorBeta
17+
// 3. Generate more table entries than you need, then trim down the ones in uninteresting ranges. (done)
18+
// In either case you'll have to regenerate this table, which requires python, which is difficult to install on windows.
19+
// Since you'll have to do some testing to determine the correct temperature for your application anyway, you
20+
// may decide that the effort isn't worth it. Who cares if it's reporting the "right" temperature as long as it's
21+
// keeping the temperature steady enough to print, right?
22+
// ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4066 --max-adc=1023
23+
// r0: 100000
24+
// t0: 25
25+
// r1: 0
26+
// r2: 4700
27+
// beta: 4066
28+
// max adc: 1023
29+
#define NUMTEMPS 20
30+
// {ADC, temp*4 }, // temp
31+
uint16_t temptable[NUMTABLES][NUMTEMPS][2] PROGMEM = {
32+
{
33+
{1, 3364}, // 841.027617469 C
34+
{21, 1329}, // 332.486789769 C
35+
{41, 1104}, // 276.102666373 C
36+
{61, 987}, // 246.756060004 C
37+
{81, 909}, // 227.268080588 C
38+
{101, 851}, // 212.78847342 C
39+
{121, 805}, // 201.30176775 C
40+
{141, 767}, // 191.787692666 C
41+
{161, 734}, // 183.662212795 C
42+
{181, 706}, // 176.561442671 C
43+
{201, 680}, // 170.244089549 C
44+
{221, 658}, // 164.542298163 C
45+
{241, 637}, // 159.33475843 C
46+
{321, 567}, // 141.921298995 C
47+
{381, 524}, // 131.166509425 C
48+
{581, 406}, // 101.561865389 C
49+
{781, 291}, // 72.9710018071 C
50+
{881, 219}, // 54.8051659223 C
51+
{981, 93}, // 23.4825243529 C
52+
{1010, 1} // 0.498606463441 C
53+
}
54+
};

algo2cmds.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
#define CMD_AXIS_SET_ORIGIN 0
3+
#define CMD_AXIS_RAMP_UP 1
4+
#define CMD_AXIS_DWELL 2
5+
#define CMD_AXIS_RAMP_DOWN 3
6+
#define CMD_AXES_EXECUTE 4
7+
#define CMD_AXIS_SET_ACCEL 5
8+
#define CMD_AXIS_SET_PULSE_LENGTH 6
9+
#define CMD_AXIS_CONFIG_AXIS 7
10+
11+
#define CMD_ENABLE 12
12+
#define CMD_DISABLE 13
13+
14+
#define CMD_HALT_PRU 15

0 commit comments

Comments
 (0)