Forum: Mikrocontroller und Digitale Elektronik Arduino und Ubuntu


von paulaner (Gast)


Lesenswert?

Hallo
lässt sich ein Arduino-Board ohne Probleme und ohne komplizierte 
Installationsorgien unter Ubuntu programmieren/flashen?
Ich habe kein Windows und möchte auch keines anschaffen.

von michael (Gast)


Lesenswert?


von michael (Gast)


Lesenswert?


von Bernd59 (Gast)


Lesenswert?

Hallo,

Ja und noch besser als Windows, keine Treiberinstalltion o.ä.
Einfach
1
sudo apt-get install arduino

Bernd

von gerd (Gast)


Lesenswert?

>>lässt sich ein Arduino-Board ohne Probleme und ohne komplizierte
>>Installationsorgien unter Ubuntu programmieren/flashen?

> Ja und noch besser als Windows, keine Treiberinstalltion o.ä.

Kann man dann auch unter normalem C programmieren, oder ist man auf das 
Arduino-Spezial-C nebst Speziallibaries angewiesen?

von Bernd59 (Gast)


Lesenswert?

Beides,

Arduino erzeugt ja auch nur normalen C-Quelltext (in //tmp//...). Der 
Compiler usw. wird mit installiert

Bernd

von Stephan K. (stephan_k)


Lesenswert?

gerd schrieb:
> Kann man dann auch unter normalem C programmieren, oder ist man auf das
> Arduino-Spezial-C nebst Speziallibaries angewiesen?

Ja, kann man. Installier erst die Arduino Software mit
sudo apt-get install arduino
So hast du schon mal alle toolchains und den compiler mit installiert.
Dann passt du dir dieses Makefile an. Mueste aber eigendlich passen, 
wie's ist.
1
# MCU name
2
MCU = atmega328p
3
4
# Target file name (without extension).
5
TARGET = main
6
7
# List C source files here. (C dependencies are automatically generated.)
8
SRC = $(TARGET).c
9
10
# Start Address 
11
# use 0x0000 for normal program
12
# use 0x3800 for bootloader
13
#LOAD_ADDR=0x3800
14
LOAD_ADDR=0x0000
15
16
# Output format. (can be srec, ihex, binary)
17
FORMAT = ihex
18
19
# List Assembler source files here.
20
# Make them always end in a capital .S.  Files ending in a lowercase .s
21
# will not be considered source files but generated files (assembler
22
# output from the compiler), and will be deleted upon "make clean"!
23
# Even though the DOS/Win* filesystem matches both .s and .S the same,
24
# it will preserve the spelling of the filenames, and gcc itself does
25
# care about how the name is spelled on its command-line.
26
ASRC = adelay.S
27
28
# Optimization level, can be [0, 1, 2, 3, s]. 
29
# 0 = turn off optimization. s = optimize for size.
30
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
31
OPT = s
32
33
# Debugging format.
34
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
35
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
36
DEBUG = dwarf-2
37
38
# List any extra directories to look for include files here.
39
#     Each directory must be seperated by a space.
40
EXTRAINCDIRS = 
41
42
43
# Compiler flag to set the C Standard level.
44
# c89   - "ANSI" C
45
# gnu89 - c89 plus GCC extensions
46
# c99   - ISO C99 standard (not yet fully implemented)
47
# gnu99 - c99 plus GCC extensions
48
CSTANDARD = -std=gnu99
49
50
# Place -D or -U options here
51
CDEFS = -DF_CPU=16000000L
52
53
# Place -I options here
54
CINCS =
55
56
# Compiler flags.
57
#  -g*:          generate debugging information
58
#  -O*:          optimization level
59
#  -f...:        tuning, see GCC manual and avr-libc documentation
60
#  -Wall...:     warning level
61
#  -Wa,...:      tell GCC to pass this to the assembler.
62
#    -adhlns...: create assembler listing
63
CFLAGS = -g$(DEBUG)
64
CFLAGS += $(CDEFS) $(CINCS)
65
CFLAGS += -O$(OPT)
66
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
67
CFLAGS += -Wall -Wstrict-prototypes
68
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
69
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
70
CFLAGS += $(CSTANDARD)
71
72
## Zusatz Flags
73
CFLAGS += -fno-inline-small-functions
74
CFLAGS += -fno-split-wide-types
75
CFLAGS += -fno-tree-scev-cprop
76
CFLAGS += -fno-move-loop-invariants
77
CFLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections
78
CFLAGS += -Wl,--relax
79
## -- ende --
80
81
## Extrem Flags
82
#CFLAGS += -mtiny-stack
83
##
84
85
# Assembler flags.
86
#  -Wa,...:   tell GCC to pass this to the assembler.
87
#  -ahlms:    create listing
88
#  -gstabs:   have the assembler create line number information; note that
89
#             for use in COFF files, additional information about filenames
90
#             and function names needs to be present in the assembler source
91
#             files -- see avr-libc docs [FIXME: not yet described there]
92
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
93
94
#Additional libraries.
95
96
# Minimalistic printf version
97
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
98
99
# Floating point printf version (requires MATH_LIB = -lm below)
100
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
101
102
PRINTF_LIB = $(PRINTF_LIB_FLOAT)
103
104
# Minimalistic scanf version
105
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
106
107
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
108
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
109
110
SCANF_LIB = $(SCANF_LIB_FLOAT)
111
112
MATH_LIB = -lm
113
114
# External memory options
115
116
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
117
# used for variables (.data/.bss) and heap (malloc()).
118
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
119
120
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
121
# only used for heap (malloc()).
122
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
123
124
EXTMEMOPTS =
125
126
# Linker flags.
127
#  -Wl,...:     tell GCC to pass this to linker.
128
#    -Map:      create map file
129
#    --cref:    add cross reference to  map file
130
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
131
LDFLAGS += $(EXTMEMOPTS)
132
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
133
LDFLAGS += -Ttext=$(LOAD_ADDR)
134
LDFLAGS += $(GLCD-LIB)
135
136
137
138
139
# Programming support using avrdude. Settings and variables.
140
141
# Programming hardware: alf avr910 avrisp bascom bsd 
142
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
143
#
144
# Type: avrdude -c ?
145
# to get a full listing.
146
#
147
AVRDUDE_PROGRAMMER = stk500v1
148
149
# com1 = serial port. Use lpt1 to connect to parallel port.
150
AVRDUDE_PORT = /dev/ttyUSB0    # programmer connected to serial device
151
152
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
153
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
154
155
156
# Uncomment the following if you want avrdude's erase cycle counter.
157
# Note that this counter needs to be initialized first using -Yn,
158
# see avrdude manual.
159
#AVRDUDE_ERASE_COUNTER = -y
160
161
# Uncomment the following if you do /not/ wish a verification to be
162
# performed after programming the device.
163
#AVRDUDE_NO_VERIFY = -V
164
165
# Increase verbosity level.  Please use this when submitting bug
166
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> 
167
# to submit bug reports.
168
#AVRDUDE_VERBOSE = -v -v
169
170
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
171
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
172
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
173
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
174
AVRDUDE_FLAGS += -b57600
175
176
177
# ---------------------------------------------------------------------------
178
179
# Define directories, if needed.
180
DIRAVR = c:/winavr
181
DIRAVRBIN = $(DIRAVR)/bin
182
DIRAVRUTILS = $(DIRAVR)/utils/bin
183
DIRINC = .
184
DIRLIB = $(DIRAVR)/avr/lib
185
186
187
# Define programs and commands.
188
SHELL = sh
189
CC = avr-gcc
190
OBJCOPY = avr-objcopy
191
OBJDUMP = avr-objdump
192
SIZE = avr-size
193
NM = avr-nm
194
AVRDUDE = avrdude
195
REMOVE = rm -f
196
COPY = cp
197
198
199
200
201
# Define Messages
202
# English
203
MSG_ERRORS_NONE = Errors: none
204
MSG_BEGIN = -------- begin --------
205
MSG_END = --------  end  --------
206
MSG_SIZE_BEFORE = Size before: 
207
MSG_SIZE_AFTER = Size after:
208
MSG_COFF = Converting to AVR COFF:
209
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
210
MSG_FLASH = Creating load file for Flash:
211
MSG_EEPROM = Creating load file for EEPROM:
212
MSG_EXTENDED_LISTING = Creating Extended Listing:
213
MSG_SYMBOL_TABLE = Creating Symbol Table:
214
MSG_LINKING = Linking:
215
MSG_COMPILING = Compiling:
216
MSG_ASSEMBLING = Assembling:
217
MSG_CLEANING = Cleaning project:
218
219
220
221
222
# Define all object files.
223
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) 
224
225
# Define all listing files.
226
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
227
228
229
# Compiler flags to generate dependency files.
230
GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
231
232
# Combine all necessary flags and optional flags.
233
# Add target processor to flags.
234
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
235
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
236
237
238
239
240
241
# Default target.
242
all: begin gccversion sizebefore build sizeafter finished end
243
244
build: elf hex eep lss sym
245
246
elf: $(TARGET).elf
247
hex: $(TARGET).hex
248
eep: $(TARGET).eep
249
lss: $(TARGET).lss 
250
sym: $(TARGET).sym
251
252
253
254
# Eye candy.
255
# AVR Studio 3.x does not check make's exit code but relies on
256
# the following magic strings to be generated by the compile job.
257
begin:
258
  @echo
259
  @echo $(MSG_BEGIN)
260
261
finished:
262
  @echo $(MSG_ERRORS_NONE)
263
264
end:
265
  @echo $(MSG_END)
266
  @echo
267
268
269
# Display size of file.
270
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
271
ELFSIZE = $(SIZE) -A $(TARGET).elf
272
sizebefore:
273
  @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
274
275
sizeafter:
276
  @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
277
278
279
280
# Display compiler version information.
281
gccversion : 
282
  @$(CC) --version
283
284
285
286
# Program the device.  
287
program: $(TARGET).hex $(TARGET).eep
288
  $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
289
290
291
292
293
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
294
COFFCONVERT=$(OBJCOPY) --debugging \
295
--change-section-address .data-0x800000 \
296
--change-section-address .bss-0x800000 \
297
--change-section-address .noinit-0x800000 \
298
--change-section-address .eeprom-0x810000 
299
300
301
coff: $(TARGET).elf
302
  @echo
303
  @echo $(MSG_COFF) $(TARGET).cof
304
  $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
305
306
307
extcoff: $(TARGET).elf
308
  @echo
309
  @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
310
  $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
311
312
313
314
# Create final output files (.hex, .eep) from ELF output file.
315
%.hex: %.elf
316
  @echo
317
  @echo $(MSG_FLASH) $@
318
  $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
319
320
%.eep: %.elf
321
  @echo
322
  @echo $(MSG_EEPROM) $@
323
  -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
324
  --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
325
326
# Create extended listing file from ELF output file.
327
%.lss: %.elf
328
  @echo
329
  @echo $(MSG_EXTENDED_LISTING) $@
330
  $(OBJDUMP) -h -S $< > $@
331
332
# Create a symbol table from ELF output file.
333
%.sym: %.elf
334
  @echo
335
  @echo $(MSG_SYMBOL_TABLE) $@
336
  $(NM) -n $< > $@
337
338
339
340
# Link: create ELF output file from object files.
341
.SECONDARY : $(TARGET).elf
342
.PRECIOUS : $(OBJ)
343
%.elf: $(OBJ)
344
  @echo
345
  @echo $(MSG_LINKING) $@
346
  $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
347
348
349
# Compile: create object files from C source files.
350
%.o : %.c
351
  @echo
352
  @echo $(MSG_COMPILING) $<
353
  $(CC) -c $(ALL_CFLAGS) $< -o $@ 
354
355
356
# Compile: create assembler files from C source files.
357
%.s : %.c
358
  $(CC) -S $(ALL_CFLAGS) $< -o $@
359
360
361
# Assemble: create object files from assembler source files.
362
%.o : %.S
363
  @echo
364
  @echo $(MSG_ASSEMBLING) $<
365
  $(CC) -c $(ALL_ASFLAGS) $< -o $@
366
367
368
369
# Target: clean project.
370
clean: begin clean_list finished end
371
372
clean_list :
373
  @echo
374
  @echo $(MSG_CLEANING)
375
  $(REMOVE) $(TARGET).hex
376
  $(REMOVE) $(TARGET).eep
377
  $(REMOVE) $(TARGET).obj
378
  $(REMOVE) $(TARGET).cof
379
  $(REMOVE) $(TARGET).elf
380
  $(REMOVE) $(TARGET).map
381
  $(REMOVE) $(TARGET).obj
382
  $(REMOVE) $(TARGET).a90
383
  $(REMOVE) $(TARGET).sym
384
  $(REMOVE) $(TARGET).lnk
385
  $(REMOVE) $(TARGET).lss
386
  $(REMOVE) $(OBJ)
387
  $(REMOVE) $(LST)
388
  $(REMOVE) $(SRC:.c=.s)
389
  $(REMOVE) $(SRC:.c=.d)
390
  $(REMOVE) .dep/*
391
  $(REMOVE) *~
392
393
394
395
# Include the dependency files.
396
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
397
398
399
# Listing of phony targets.
400
.PHONY : all begin finish end sizebefore sizeafter gccversion \
401
build elf hex eep lss sym coff extcoff \
402
clean clean_list program


Und dann einfach durch das Tutorial gehen und in C programieren. Fertig 
ist die Laube.

von egal (Gast)


Lesenswert?


von Vn N. (wefwef_s)


Lesenswert?

Bei den von dir verlinkten wurde einfach das Layout des Originals von 
der entsprechenden Internetseite kopiert und in China billig gefertigt. 
Das Kopieren an sich wäre ja kein Problem (ist ja Open Source), aber mit 
der Arbeit anderer Geld zu verdienen hat dann doch einen eigenartigen 
Beigeschmack.

von ???? (Gast)


Lesenswert?

vn nn schrieb:
> Bei den von dir verlinkten wurde einfach das Layout des Originals von
> der entsprechenden Internetseite kopiert und in China billig gefertigt.
> Das Kopieren an sich wäre ja kein Problem (ist ja Open Source), aber mit
> der Arbeit anderer Geld zu verdienen hat dann doch einen eigenartigen
> Beigeschmack.

Und wo ist das Problem? In diesem Fall ist das völlig legal!

von Eumel (Gast)


Lesenswert?

Nicht alles was legal ist ist auch moralisch einwandfrei.

von ???? (Gast)


Lesenswert?

Deswegen ist es doch opensource mit entsprechender Lizenz, die genau das 
erlaubt!

von egal (Gast)


Lesenswert?

> Bei den von dir verlinkten wurde einfach das Layout des Originals von
> der entsprechenden Internetseite kopiert und in China billig gefertigt.

Das ist mir egal.
Könnte trotzdem jemand sagen, was der Unterschied der beiden verlinkten 
Produkte ist?

von Antworter (Gast)


Lesenswert?

@egal:

Das Eine ist ein Duemilanove. Der benutzt einen FTDI-Chip für die 
Umsetzung auf USB.

Das Andere ist ein Uno, eine neuere Version des Duemilanove. Der hat 
anstatt des FTDI einen ATmega8U2. Ansonsten sollte es kaum Unterschiede 
geben.

Die kleineren Details (z.B. Buchsenhöhen, Lage der Pins und Buttons, 
etc.) sind teilweise bei verschiedlichen Revisionen geändert worden, was 
aber bei einem Nachbau sowieso ganz anders gelöst worden sein kann.

von Thomas L (Gast)


Lesenswert?

Das erste Angebot ist der Vorgänger des Uno von 2009
Die Daten des zweiten entsprechen dem aktuellen Uno.
Die Preise sind aber nicht wirklich berauschend.
Schau z.B. mal hier rein:
http://www.watterott.com/de/Boards-Kits/Arduino
Die genauen Daten der Einzelnen Boards kanst du hier nachlesen:
http://arduino.cc/

Ps: Ich glaube da war jemand schneller.

von Martina (Gast)


Lesenswert?

???? schrieb:
> Und wo ist das Problem? In diesem Fall ist das völlig legal!

Genau genommen nicht. Wenn du dir mal die Lizenz durchliest wirst du 
bemerken das zwar der Nachbau ausdrücklich erlaubt ist, die Nachbauten 
jedoch nicht den Namen "Arduino" tragen dürfen.

von egal (Gast)


Lesenswert?

Martina schrieb:
>> Und wo ist das Problem? In diesem Fall ist das völlig legal!
>
> Genau genommen nicht. Wenn du dir mal die Lizenz durchliest wirst du
> bemerken das zwar der Nachbau ausdrücklich erlaubt ist, die Nachbauten
> jedoch nicht den Namen "Arduino" tragen dürfen.

Die genannten Boards nennen sich auch nicht Arduino (schau auf die 
Fotos) und auch im Angebotstext steht das nicht, außer "Board for 
Arduino".

von Martina (Gast)


Lesenswert?

egal schrieb:
> auch im Angebotstext steht das nicht, außer "Board for
> Arduino"

Das genügt schon. Die Lizenzbedingungen schreiben ausdrücklich vor, dass 
Nachbauten als "Arduino-kompatibel" zu bezeichnen sind. Bezeichnungen 
wie "für Arduino", "wie Arduino" etc. sind ausdrücklich nicht zulässig. 
Auf dem Foto ist es durchaus richtig gemacht, sie hätten das Ding auch 
"SainSmartuino" oder etwas in der Art nennen dürfen; das wird in der 
Lizenz ausdrücklich erlaubt. Der Angebotstext ist jedoch ein 
Lizenzverstoß.

von lach (Gast)


Lesenswert?

Man kann auch Erbsenzählerei betreiben. Was ist denn der Unterschied der 
Bezeichnung "Arduino-kompatibel" und "für Arduino" oder "wie Arduino"?

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.