2017-06-14 16 views
1

変換プロジェクトでは、既存のメイクファイルチェーンを修正して改造しましたが、それを破ることができました。 私がContikiなしのAVRプロジェクト用にコンパイルしているときと、もう1つ(そしていくつかの拡張機能があるとき)のためにmakefileを別のチェーンに従わせる必要があります。 Contikiのメイクファイルも考慮する必要があるため、動作していないもの、もう使用していないものはもう使用しません。 私は完了しようとしますが、不必要な詳細は除外します。 CerberOS/UJ /ビルド/ /から、端末を使用してメイクファイルのチェーンが混乱しています:ターゲットを作るルールがありません

は、私は、次のコマンドを実行します。

make cerberos CLASSES=Test_NodeToNode Location= OS=PERIPHERAL 

と最後に次のメッセージ得られます

make[2]: *** No rule to make target 'blank.u'. Stop. 
make[2]: Leaving directory '/home/sven/git/uJVM_PhD_Project/CerberOS/uJ/build' 
../../UPNP/micropnp-contiki/build/Makefile_cerberos.include:159: recipe for target 'flash' failed 
make[1]: *** [flash] Error 2 
make[1]: Leaving directory '/home/sven/git/uJVM_PhD_Project/CerberOS/uJ/build' 
Makefile:41: recipe for target 'cerberos' failed 

を私のディレクトリ構造は次のようですこの:

/CerberOS/ 
-> /uJ/ 
---> /build/ 
-------> Makefile 
-------> Makefile.target 
-> /UPNP/ 
--->/contiki/ 
--------> Makefile.include 
---> /micropnp/ 
--------> Makefile_cerberos.local 
-------->/build/ 
-------------->Makefile_cerberos.include 
-------->/cpu/ 
-------------->/avr/ 
--------------------> Makefile.avr 

Makefile.targetはちょうど「TARGET = AVR-micropnpが含まれています次のようにMakefileは次のとおりです。

BUILDENV_JAVA = $(ROOT)/../uJ/buildenv_java/RT/ 

SRV = $(ROOT)/../uJ/Services/ 

CCVT ?= $(ROOT)/../classCvt/classCvt 
TOBIN ?= $(ROOT)/../classCvt/tobinOTA 
CMD = $(TOBIN) -c $(CCVT) 


# By default, uJ is assumed to be in the same parent folder as uPnP 
ROOT = ../.. 

ifndef UJ 
    UJ = $(ROOT)/uJ 
endif 

# OS possibilities: UPNP (ID=0), PERIPHERAL (ID=1) 
ifndef OS 
    OS = UPNP 
endif 

ifeq ($(OS), UPNP) 
CFLAGS += -DOS_ID=0 
else ifeq ($(OS), PERIPHERAL) 
CFLAGS += -DOS_ID=1 
else 
endif 

ifeq ($(TARGET),) 
    -include Makefile.target 
    ifeq ($(TARGET),) 
    ${info TARGET not defined, using target 'native'} 
    TARGET=native 
    else 
    ${info using saved target '$(TARGET)'} 
    endif 
endif 


cerberos: clean clean_uj __code.c 
    make flash 

$(info BUILDENV_JAVA is $(BUILDENV_JAVA)) 
$(info OS is $(OS)) 


include ../Makefile_uj.include 

ifeq ($(OS), UPNP) 

$(info Building as uPNP Platform) 
include ../../UPNP/micropnp-contiki/build/Makefile_cerberos.include 

else ifeq ($(OS), PERIPHERAL) 

$(info Building as periperal) 
include ../Makefile_peripheral.include 

else 
    $(info Including nothing) 
endif 

Makefile_cerberos.includeは次のとおりです。

$(info XXXXXXXXXXXXXXXXXXXXXXXX Starting Makefile_cerberos.include XXXXXXXXXXXXXXXXXXXXXXXX) 

UPNP = $(ROOT)/UPNP/micropnp-contiki 
CONTIKI_PROJECT = blank 

# Duplicated from Contiki's Makefile. Necessary because we need the 
# $TARGET var set earlier, and Contiki's Makefile is only included 
# last minute. 
ifeq ($(TARGET),) 
    -include Makefile.target 
    ifeq ($(TARGET),) 
    ${info TARGET not defined, using target 'native'} 
    TARGET=native 
    else 
    ${info using saved target '$(TARGET)'} 
    endif 
endif 

# Allow uPnP wide local settings to be defined in a seperate Makefile 
include $(UPNP)/Makefile_cerberos.local 

# This enables -ffunction-sections and -fdata-sections, and splits each 
# .text and .data section in the object-files in subsections for each function. 
# Next, the linker is instructed to garbage collect unused variables and 
# functions. The result of this is smaller files, but functions not called in 
# the core image will not be available for OTA deployed services. 
SMALL=1 

# Disable netstacks, except for IPv6 which is used for address parsing 
CONTIKI_WITH_IPV6=1 
CONTIKI_WITH_IPV4=0 
CONTIKI_WITH_RPL=0 

# Specify project-conf file (for Contiki settings specific to uPnP) 
CFLAGS += -DPROJECT_CONF_H=\"upnp-conf.h\" -fshort-enums 

###################################################################### 
# Setting a few defaults, customizable in Makefile.local 
###################################################################### 

# By default, Contiki is assumed to be in the same parent folder as uPnP 
ifndef CONTIKI 
    CONTIKI = $(ROOT)/UPNP/contiki 
endif 

### UPNP UJ SVEN 
APPDIRS += $(UPNP)/apps 
APPS += er-coap rest-engine 


###################################################################### 
# Including source files/directories 
###################################################################### 

# uPnP Core sourcefiles/dirs 
#PROJECT_SOURCEFILES += upnp.c vector.c twi_master.c rd-client.c controller.c \ 
         hal.c buzzer.c pir-sensor.c temp-sensor.c relay-switch.c\ 
         lamp.c accelerometer.c loudness-sensor.c rfid.c light-sensor.c\ 
         battery_varta.c thermocouple.c 
# Reduced set 
PROJECT_SOURCEFILES += upnp.c vector.c twi_master.c rd-client.c controller.c \ 
         hal.c buzzer.c pir-sensor.c temp-sensor.c relay-switch.c\ 
         loudness-sensor.c 

PROJECTDIRS += $(UPNP) \ 
       $(UPNP)/lib \ 
       $(UPNP)/drivers/ 

MCU=atmega1284p 

### Compiler definitions 
CC  = avr-gcc 
LD  = avr-gcc 
AS  = avr-as 
AR  = avr-ar 
ELF_SIZE = avr-size -C --mcu=$(MCU) 
OBJCOPY = avr-objcopy 
STRIP = avr-strip 
AVRDUDE = avrdude 

OPTI = s 

CFLAGS += -Wall -mmcu=$(MCU) -gdwarf-2 -fno-strict-aliasing -O$(OPTI) 
ASFLAGS += -mmcu=$(MCU) 
LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map \ 
      -Wl,--section-start=.bootloader=$(BOOTLOADER_START) 
MCU=atmega1284p 

# Bootsection start address (byte address!) for linker. Fuses are 
# set to the second smallest bootsection (1024 bytes) starting on 0xFC00 
# (word address) //TODO see if we can bring this down again! 
BOOTLOADER_START=0x1F800 

# Avrdude settings 
AVRDUDE_PROGRAMMER=atmelice_isp 
AVRDUDE_MCU=m1284p 
AVRDUDE_OPTIONS=-B 1 

### These flags help significantly reduce the code size 
ifeq ($(SMALL),1) 
CFLAGS += -ffunction-sections 
CFLAGS += -fdata-sections 
LDFLAGS += -Wl,--gc-sections 
endif # SMALL 

### Upload image to MCU 
#Let avrdude use defaults if options not defined 
ifdef AVRDUDE_PORT 
AVRDUDE_PORT:=-P $(AVRDUDE_PORT) 
endif 
ifdef AVRDUDE_PROGRAMMER 
AVRDUDE_PROGRAMMER:=-c $(AVRDUDE_PROGRAMMER) 
endif 
ifdef AVRDUDE_MCU 
AVRDUDE_MCU:=-p $(AVRDUDE_MCU) 
endif 

SOURCES=$(wildcard *.c $(PROJECT_SOURCEFILES)/*.c) 
SOURCES=$(wildcard *_avr.S $(PROJECT_SOURCEFILES)/*_avr.S) 

OBJECTS=$(PROJECT_SOURCEFILES:.c=.o) 
OBJECTS=$(PROJECT_SOURCEFILES:_avr.S=.o) 

HEADERS=$(PROJECT_SOURCEFILES:.c=.h) 
HEADERS=$(PROJECT_SOURCEFILES:_avr.S=.h) 

### Compilation rules 
#Use all standard contiki compile rules, except add .elf rule that prints size 
%.elf: %.$(TARGET) 
    cp $< [email protected] 
    $(ELF_SIZE) [email protected] 

#Prepare images from ELF 
%.fuses.bin: %.$(TARGET) 
    $(OBJCOPY) $< -j .fuse -O binary --change-section-lma .fuse=0 [email protected] 

%.eep: %.$(TARGET) 
    $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ 
    --change-section-lma .eeprom=0 -O ihex $^ [email protected] 

%.hex: %.$(TARGET) 
    $(OBJCOPY) $^ -j .text -j .data -j .bootloader -O ihex [email protected] 

#Flash targets 
%.fu: %.fuses.bin 
    $(eval LFUSE = $(shell od -A none --format=x1 --read-bytes=1 $<)) 
    $(eval HFUSE = $(shell od -A none --format=x1 --read-bytes=1 -j1 $<)) 
    $(eval EFUSE = $(shell od -A none --format=x1 --read-bytes=1 -j2 $<)) 
    $(AVRDUDE) $(AVRDUDE_MCU) -B 4 $(AVRDUDE_PORT) $(AVRDUDE_PROGRAMMER) \ 
     -U lfuse:w:0x$(LFUSE):m -U hfuse:w:0x$(HFUSE):m -U efuse:w:0x$(EFUSE):m 

%.u: %.hex 
    $(AVRDUDE) $(AVRDUDE_MCU) $(AVRDUDE_OPTIONS) $(AVRDUDE_PORT) $(AVRDUDE_PROGRAMMER) -U flash:w:$< 

%.eu: %.eep 
    $(AVRDUDE) $(AVRDUDE_MCU) ${AVRDUDE_OPTIONS} ${AVRDUDE_PORT} ${AVRDUDE_PROGRAMMER} -U eeprom:w:$< 

flash: 
    make blank.u 

# Include uPnP specific platform files 
include $(UPNP)/platform/$(TARGET)/Makefile.early.$(TARGET) 

# Include Contiki 
include $(CONTIKI)/Makefile.include 

# Party overrides compilation rules of Contiki with uPnP specific rules for target platform 
include $(UPNP)/platform/$(TARGET)/Makefile.$(TARGET) 

私はそれを理解する方法によると、それは、ターゲットblank.uを作るためのルールを見つけることができません意味がありません。 他のメイクファイルも同様ですが、pastebinに追加しました。 https://pastebin.com/SKz2FmjP

そしてMakefile.include:https://pastebin.com/NACUiv4Q

私は途方に暮れています Makefile_cerberos.localについて($(UPNP)/プラットフォーム/メイクファイルで同梱)Makefile.avrについてはhttps://pastebin.com/nT4TmwPY

を参照してください。 誰かが助けることができますか?あなたのメイクファイルを見てから

答えて

1

%.hex: %.$(TARGET) 
    $(OBJCOPY) $^ -j .text -j .data -j .bootloader -O ihex [email protected] 

%.u: %.hex 
    $(AVRDUDE) $(AVRDUDE_MCU) $(AVRDUDE_OPTIONS) $(AVRDUDE_PORT) $(AVRDUDE_PROGRAMMER) -U flash:w:$< 

flash: 
    make blank.u 

のでflashblank.uに依存し、blank.uは、静的なパターンルール%.hex: %.$(TARGET)に依存可能性が静的パターンルール%.u: %.hex、上依存可能性があります - しかしblank.$(TARGET) doesnの場合存在しない場合、Make(正しく)はblank.uを作るルールがないと判断し、あなたが言及したエラーで失敗します。

私はそれが定義されていない場合はトップレベルのMakefileがTARGETを設定していることに気づく:

ifeq ($(TARGET),) 
    ${info TARGET not defined, using target 'native'} 
    TARGET=native 

しかし、私はあなたがサブ作るプロセスにTARGETを輸出していることをどこにも表示されません。これを行う最も簡単な方法は、TARGETを設定した後に、トップレベルのmakefileにexport TARGETを追加することです。 GNU Make Manualに詳細があります。余談として

、あなたはメイクファイル内から作る起動している時はいつでも、あなたは、これは、メイクが正しくあなたの場合でも呼び出されることを保証

$(MAKE) blank.u 

代わりの

make blank.u 

としてそれを行う必要があります非標準のバイナリ名を使用していて、異なるコマンドライン引数に対して特別な処理を追加しています。再び、GNU Make Manualに詳細があります。

+0

ありがとう、これはちょっと役立ちます。 私は奇妙なことを発見しました。単純にMakefile_cerberos.includeのflash:ルールを削除するだけで、完全なmakeプロセスが動作してバイナリイメージをコンパイルできます。 このイメージはAVRDUDEでは使用されていません。恐らくコマンドがないからです。しかし、それは奇妙です。 何が起こっているのか何か手がかり? –

+0

@Sven - 単に 'make'を実行すると、Makeが見つけた最初のターゲットを実行する必要があります。これは' flash'です。それを削除すると、次のターゲットが何であっても見つかるはずです(投稿したファイルの内容がはっきりしません)。 –

関連する問題