Makefile – Mikrokontroléry – Fórum – Programujte.com
 x   TIP: Přetáhni ikonu na hlavní panel pro připnutí webu

Makefile – Mikrokontroléry – Fórum – Programujte.comMakefile – Mikrokontroléry – Fórum – Programujte.com

 

GeorgeW0
Newbie
24. 1. 2007   #1
-
0
-

ahoj,
snazim se prelozit jednu knihovnu pomoci souboru makefile, ale moc se mi nedari. Viz make:

ifndef TURBO_DIR
TURBO_DIR = c:/a-avr/turbo-devel
endif

TURBO_TAG = --turbo-manifest "Version: 1.2.3 Vendor: BLADOX" #--turbo-verbose
INCDIR = -I$(TURBO_DIR)/include -I.
LIBDIR = $(TURBO_DIR)/lib

CC = avr-gcc
LD = avr-ld
RM = rm -f

TRG = helloworld
SRC = hello_world.c

LIB =

CFLAGS = -std=gnu99 -mmcu=atmega128 -mno-tablejump -Wimplicit-function-declaration -Os -fno-builtin
LDFLAGS = -L$(LIBDIR) -T turbo.lds -d -r --emit-relocs -R $(LIBDIR)/public_calls $(LIB) -lm -lc `avr-gcc -print-libgcc-file-name`

OBJ = $(SRC:.c=.o)

all: $(TRG).trb

include $(SRC:.c=.d)

%.o : %.c
$(CC) -c $(CFLAGS) $(INCDIR) $< -o $@

%.d: %.c
$(CC) -M $(CFLAGS) $(INCDIR) $< | sed 's/$*.o/& $@/g' >$@

$(TRG).elf: $(OBJ)
$(LD) -o $@ $(OBJ) $(LDFLAGS)

$(TRG).trb: $(TRG).elf
avr-objdump $(TURBO_TAG) --turbo $(TRG).elf

dis: $(TRG).elf
avr-objdump -D --architecture=avr:5 $(TRG).elf >$(TRG).dis

install: all
cp $(TRG).trb ../bin

indent:
for X in *.[ch]; do \
indent -npsl -sob -bad -bli0 -cli2 $$X; \
done

clean:
$(RM) *.o
$(RM) *.d
$(RM) *.i
$(RM) *.s
$(RM) *~
$(RM) $(TRG).dis
$(RM) $(TRG).elf
$(RM) $(TRG).trb



Prekladac hlasi prvnim pruchodem todle

> "make.exe" all
Makefile:25: hello_world.d: No such file or directory
avr-gcc -M -std=gnu99 -mmcu=atmega128 -mno-tablejump -Wimplicit-function-declaration -Os -fno-builtin -Ic:/a-avr/turbo-devel/include -I. hello_world.c | sed 's/hello_world.o/& hello_world.d/g' >hello_world.d
avr-gcc -c -std=gnu99 -mmcu=atmega128 -mno-tablejump -Wimplicit-function-declaration -Os -fno-builtin -Ic:/a-avr/turbo-devel/include -I. hello_world.c -o hello_world.o
avr-ld -o helloworld.elf hello_world.o -Lc:/a-avr/turbo-devel/lib -T turbo.lds -d -r --emit-relocs -R c:/a-avr/turbo-devel/lib/public_calls -lm -lc `avr-gcc -print-libgcc-file-name`
avr-objdump --turbo-manifest "Version: 1.2.3 Vendor: BLADOX" --turbo helloworld.elf
c:\WinAVR\bin\avr-objdump.exe: unrecognized option `--turbo-manifest'
Usage: c:\WinAVR\bin\avr-objdump.exe <option(s)> <file(s)>
Display information from object <file(s)>.
At least one of the following switches must be given:
-a, --archive-headers Display archive header information
-f, --file-headers Display the contents of the overall file header
-p, --private-headers Display object format specific file header contents
-h, --[section-]headers Display the contents of the section headers
-x, --all-headers Display the contents of all headers
-d, --disassemble Display assembler contents of executable sections
-D, --disassemble-all Display assembler contents of all sections
-S, --source Intermix source code with disassembly
-s, --full-contents Display the full contents of all sections requested
-g, --debugging Display debug information in object file
-e, --debugging-tags Display debug information using ctags style
-G, --stabs Display (in raw form) any STABS info in the file
-t, --syms Display the contents of the symbol table(s)
-T, --dynamic-syms Display the contents of the dynamic symbol table
-r, --reloc Display the relocation entries in the file
-R, --dynamic-reloc Display the dynamic relocation entries in the file
-v, --version Display this program's version number
-i, --info List object formats and architectures supported
-H, --help Display this information

The following switches are optional:
-b, --target=BFDNAME Specify the target object format as BFDNAME
-m, --architecture=MACHINE Specify the target architecture as MACHINE
-j, --section=NAME Only display information for section NAME
-M, --disassembler-options=OPT Pass text OPT on to the disassembler
-EB --endian=big Assume big endian format when disassembling
-EL --endian=little Assume little endian format when disassembling
--file-start-context Include context from start of file (with -S)
-I, --include=DIR Add DIR to search list for source files
-l, --line-numbers Include line numbers and filenames in output
-C, --demangle[=STYLE] Decode mangled/processed symbol names
The STYLE, if specified, can be `auto', `gnu',
`lucid', `arm', `hp', `edg', `gnu-v3', `java'
or `gnat'
-w, --wide Format output for more than 80 columns
-z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling
--start-address=ADDR Only process data whose address is >= ADDR
--stop-address=ADDR Only process data whose address is <= ADDR
--prefix-addresses Print complete address alongside disassembly
--[no-]show-raw-insn Display hex alongside symbolic disassembly
--adjust-vma=OFFSET Add OFFSET to all displayed section addresses
--special-syms Include special symbols in symbol dumps

c:\WinAVR\bin\avr-objdump.exe: supported targets: elf32-avr coff-avr coff-ext-avr elf32-little elf32-big srec symbolsrec tekhex binary ihex
c:\WinAVR\bin\avr-objdump.exe: supported architectures: avr avr:1 avr:2 avr:3 avr:4 avr:5
make.exe: *** [helloworld.trb] Error 1

> Process Exit Code: 2
> Time Taken: 00:01

Znovu kompile a hlasi to todle

> "make.exe" all
avr-objdump --turbo-manifest "Version: 1.2.3 Vendor: BLADOX" --turbo helloworld.elf
c:\WinAVR\bin\avr-objdump.exe: unrecognized option `--turbo-manifest'
Usage: c:\WinAVR\bin\avr-objdump.exe <option(s)> <file(s)>
Display information from object <file(s)>.
At least one of the following switches must be given:
-a, --archive-headers Display archive header information
-f, --file-headers Display the contents of the overall file header
-p, --private-headers Display object format specific file header contents
-h, --[section-]headers Display the contents of the section headers
-x, --all-headers Display the contents of all headers
-d, --disassemble Display assembler contents of executable sections
-D, --disassemble-all Display assembler contents of all sections
-S, --source Intermix source code with disassembly
-s, --full-contents Display the full contents of all sections requested
-g, --debugging Display debug information in object file
-e, --debugging-tags Display debug information using ctags style
-G, --stabs Display (in raw form) any STABS info in the file
-t, --syms Display the contents of the symbol table(s)
-T, --dynamic-syms Display the contents of the dynamic symbol table
-r, --reloc Display the relocation entries in the file
-R, --dynamic-reloc Display the dynamic relocation entries in the file
-v, --version Display this program's version number
-i, --info List object formats and architectures supported
-H, --help Display this information

The following switches are optional:
-b, --target=BFDNAME Specify the target object format as BFDNAME
-m, --architecture=MACHINE Specify the target architecture as MACHINE
-j, --section=NAME Only display information for section NAME
-M, --disassembler-options=OPT Pass text OPT on to the disassembler
-EB --endian=big Assume big endian format when disassembling
-EL --endian=little Assume little endian format when disassembling
--file-start-context Include context from start of file (with -S)
-I, --include=DIR Add DIR to search list for source files
-l, --line-numbers Include line numbers and filenames in output
-C, --demangle[=STYLE] Decode mangled/processed symbol names
The STYLE, if specified, can be `auto', `gnu',
`lucid', `arm', `hp', `edg', `gnu-v3', `java'
or `gnat'
-w, --wide Format output for more than 80 columns
-z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling
--start-address=ADDR Only process data whose address is >= ADDR
--stop-address=ADDR Only process data whose address is <= ADDR
--prefix-addresses Print complete address alongside disassembly
--[no-]show-raw-insn Display hex alongside symbolic disassembly
--adjust-vma=OFFSET Add OFFSET to all displayed section addresses
--special-syms Include special symbols in symbol dumps

c:\WinAVR\bin\avr-objdump.exe: supported targets: elf32-avr coff-avr coff-ext-avr elf32-little elf32-big srec symbolsrec tekhex binary ihex
c:\WinAVR\bin\avr-objdump.exe: supported architectures: avr avr:1 avr:2 avr:3 avr:4 avr:5
make.exe: *** [helloworld.trb] Error 1

> Process Exit Code: 2
> Time Taken: 00:00

A sem z teho paf. Makefile vubec nepouzivam a linux tez ne a tudiz nevim co je spatne Poradi nekdo?

preklad pomoci WinAVR 20060421

Nahlásit jako SPAM
IP: ...–
technik160
Newbie
5. 7. 2008   #2
-
0
-

To GeorgeW :
tu mas funkcny makefile ... len si ho trosku uprav

zmen si nastavenie programatoru a to je asi vsetko
kompilaciu vyvolavas prikazom make flash s tym ze to nahras rovno aj do mp. ak chces len hex subor tak napis make hex ak si to nevies zapamatat tak napis iba make a vyhodi ti to napovedu :):) ... vela stastia ... mam taky pocit ze toto jednoduchsi makefile ako mas ty





# Name: Makefile
# Tabsize: 4

DEVICE = atmega8
F_CPU = 1000000 # in Hz
FUSE_L = # see below for fuse values for particular devices
FUSE_H =
AVRDUDE = avrdude -c usbasp -p m8 # edit this line for your programmer

CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0
OBJECTS = main.o

COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE)

##############################################################################
# Fuse values for particular devices
##############################################################################
# If your device is not listed here, go to
# http://palmavr.sourceforge.net/cgi-bin/fc.cgi
# and choose options for external crystal clock and no clock divider
#
################################## ATMega8 ##################################
# ATMega8 FUSE_L (Fuse low byte):
# 0x9f = 1 0 0 1 1 1 1 1
# ^ ^ \ / \--+--/
# | | | +------- CKSEL 3..0 (external >8M crystal)
# | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
# | +------------------ BODEN (BrownOut Detector enabled)
# +-------------------- BODLEVEL (2.7V)
# ATMega8 FUSE_H (Fuse high byte):
# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000)
# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0
# | | | | | +-------- BOOTSZ1
# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase)
# | | | +-------------- CKOPT (full output swing)
# | | +---------------- SPIEN (allow serial programming)
# | +------------------ WDTON (WDT not always on)
# +-------------------- RSTDISBL (reset pin is enabled)
#
############################## ATMega48/88/168 ##############################
# ATMega*8 FUSE_L (Fuse low byte):
# 0xdf = 1 1 0 1 1 1 1 1
# ^ ^ \ / \--+--/
# | | | +------- CKSEL 3..0 (external >8M crystal)
# | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
# | +------------------ CKOUT (if 0: Clock output enabled)
# +-------------------- CKDIV8 (if 0: divide by 8)
# ATMega*8 FUSE_H (Fuse high byte):
# 0xde = 1 1 0 1 1 1 1 0
# ^ ^ ^ ^ ^ \-+-/
# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V)
# | | | | + --------- EESAVE (preserve EEPROM over chip erase)
# | | | +-------------- WDTON (if 0: watchdog always on)
# | | +---------------- SPIEN (allow serial programming)
# | +------------------ DWEN (debug wire enable)
# +-------------------- RSTDISBL (reset pin is enabled)
#
############################## ATTiny25/45/85 ###############################
# ATMega*5 FUSE_L (Fuse low byte):
# 0xef = 1 1 1 0 1 1 1 1
# ^ ^ \+/ \--+--/
# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz)
# | | +--------------- SUT 1..0 (BOD enabled, fast rising power)
# | +------------------ CKOUT (clock output on CKOUT pin -> disabled)
# +-------------------- CKDIV8 (divide clock by 8 -> don't divide)
# ATMega*5 FUSE_H (Fuse high byte):
# 0xdd = 1 1 0 1 1 1 0 1
# ^ ^ ^ ^ ^ \-+-/
# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V)
# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved)
# | | | +-------------- WDTON (watchdog timer always on -> disable)
# | | +---------------- SPIEN (enable serial programming -> enabled)
# | +------------------ DWEN (debug wire enable)
# +-------------------- RSTDISBL (disable external reset -> enabled)
#
################################ ATTiny2313 #################################
# ATTiny2313 FUSE_L (Fuse low byte):
# 0xef = 1 1 1 0 1 1 1 1
# ^ ^ \+/ \--+--/
# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz)
# | | +--------------- SUT 1..0 (BOD enabled, fast rising power)
# | +------------------ CKOUT (clock output on CKOUT pin -> disabled)
# +-------------------- CKDIV8 (divide clock by 8 -> don't divide)
# ATTiny2313 FUSE_H (Fuse high byte):
# 0xdb = 1 1 0 1 1 0 1 1
# ^ ^ ^ ^ \-+-/ ^
# | | | | | +---- RSTDISBL (disable external reset -> enabled)
# | | | | +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V)
# | | | +-------------- WDTON (watchdog timer always on -> disable)
# | | +---------------- SPIEN (enable serial programming -> enabled)
# | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved)
# +-------------------- DWEN (debug wire enable)


# symbolic targets:
help:
@echo "This Makefile has no default rule. Use one of the following:"
@echo "make hex ....... to build main.hex"
@echo "make program ... to flash fuses and firmware"
@echo "make fuse ...... to flash the fuses"
@echo "make flash ..... to flash the firmware (use this on metaboard)"
@echo "make clean ..... to delete objects and hex file"

hex: main.hex

program: flash fuse

# rule for programming fuse bits:
fuse:
@[ "$(FUSE_H)" != "" -a "$(FUSE_L)" != "" ] || \
{ echo "*** Edit Makefile and choose values for FUSE_L and FUSE_H!"; exit 1; }
$(AVRDUDE) -U hfuse:w:$(FUSE_H):m -U lfuse:w:$(FUSE_L):m

# rule for uploading firmware:
flash: main.hex
$(AVRDUDE) -U flash:w:main.hex:i

# rule for deleting dependent files (those which can be built by Make):
clean:
rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s

# Generic rule for compiling C files:
.c.o:
$(COMPILE) -c $< -o $@

# Generic rule for assembling Assembler source files:
.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.

# Generic rule for compiling C to assembler, used for debugging only.
.c.s:
$(COMPILE) -S $< -o $@

# file targets:

main.elf: $(OBJECTS) # usbdrv dependency only needed because we copy it
$(COMPILE) -o main.elf $(OBJECTS)

main.hex: main.elf
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size main.hex

# debugging targets:

disasm: main.elf
avr-objdump -d main.elf

cpp:
$(COMPILE) -E main.c

Nahlásit jako SPAM
IP: 91.127.196.–
Zjistit počet nových příspěvků

Přidej příspěvek

Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!

Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku

×Vložení zdrojáku

×Vložení obrázku

Vložit URL obrázku Vybrat obrázek na disku
Vlož URL adresu obrázku:
Klikni a vyber obrázek z počítače:

×Vložení videa

Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×
 
Podporujeme Gravatara.
Zadej URL adresu Avatara (40 x 40 px) nebo emailovou adresu pro použití Gravatara.
Email nikam neukládáme, po získání Gravatara je zahozen.
-
Pravidla pro psaní příspěvků, používej diakritiku. ENTER pro nový odstavec, SHIFT + ENTER pro nový řádek.
Sledovat nové příspěvky (pouze pro přihlášené)
Sleduj vlákno a v případě přidání nového příspěvku o tom budeš vědět mezi prvními.
Reaguješ na příspěvek:

Uživatelé prohlížející si toto vlákno

Uživatelé on-line: 0 registrovaných, 1 host

Podobná vlákna

Makefile — založil DaLibor

Problém s Makefile — založil yxcvb

Makefile a debugging — založil Figa

Chyba v Makefile.win — založil smuffi

 

Hostujeme u Českého hostingu       ISSN 1801-1586       ⇡ Nahoru Webtea.cz logo © 20032024 Programujte.com
Zasadilo a pěstuje Webtea.cz, šéfredaktor Lukáš Churý