реклама на сайте
подробности

 
 
> Странность при компиляции
Sirko
сообщение Feb 15 2011, 23:12
Сообщение #1


Местный
***

Группа: Участник
Сообщений: 245
Регистрация: 15-08-07
Пользователь №: 29 795



Вернее сказать странность некомпиляции.

Код
for(;;){
    evenFlag.Wait();
    u08 *data;
    u08 length = UART1_IsReceptionCompleate(data);

    UART1_TransmitData(data, length);

    u08 dataWeight[] = {0x03, 0x04, 0x76, 0xC1, 0x00, 0x02};
    UART0_TransmitData(dataWeight, 6);
    OS::Sleep(10);
    length = UART0_IsReceptionCompleate(data);
//    data[0] = 0;    
}

Вероятно я чего-то недопонимаю, но логики не вижу.
Суть проблемы в следующем:
если разкоментарить последнюю строчку, то все замечательно собирается. Но если переменная data не используется, то получается вот такая вот ерунда:
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr51/crtm128.o: In function `__vector_default':
(.vectors+0x80): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_32' defined in .text.__vector_32 section in obj/Signal_UART.o
make: *** [exe/event_flag.elf] Error 1
Build failed with 1 errors and 6 warnings...
Причем не имеет значения, какие действия над переменной будут производиться, важен сам факт использования переменной data после строки "length = UART0_IsReceptionCompleate(data);".
Makefile взят из примера scmRTOS прот GCC

Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
Sirko
сообщение Feb 16 2011, 07:02
Сообщение #2


Местный
***

Группа: Участник
Сообщений: 245
Регистрация: 15-08-07
Пользователь №: 29 795



laughing.gif
Код
Build started 16.2.2011 at 08:50:49
======== Beginning of project event_flag processing
avr-gcc.exe (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

==== Link to event_flag.elf
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr51/crtm128.o: In function `__vector_default':
(.vectors+0x80): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_32' defined in .text.__vector_32 section in obj/Signal_UART.o
make: *** [exe/event_flag.elf] Error 1
Build failed with 1 errors and 0 warnings...


#
# scmRTOS avr-gcc port
#
# project-dependent makefile for samples
#

# can change WinAVR version by setting AVRGCC variable here (override environment)
AVRGCC :=C:/WinAVR-20100110
#AVRGCC :=c:/kgp-avr/20071102
#AVRGCC :=c:/kgp-avr/20070928
#AVRGCC :=c:/WinAVR-20071221
#AVRGCC :=c:/WinAVR-20070525
#AVRGCC :=c:/WinAVR-20060421
#AVRGCC :=d:/mingw/local

# Y/N - !!! N for gcc < 4.x
MAKE_SMALLEST_HEX = Y

# point to start of project sources subtree,
PROJ_SRCTOP := .

#put the name of the target file here (without extension)
TRG = event_flag

# project modules (directories with source files)
# "current" directory (.) included automatically in gcc-avr.make
MODULES := ./src ../scmRTOS/Common ../scmRTOS/AVR
# needed for includes below
COMMON_MAKEFILES := ./makefiles

###########
# used in gcc-avr.make and avreal.make
MCU := atmega128
#MCU := atmega48
TRGPGMEXT := hex
#eep

# used in avreal.make and transferred to source files as '#define'
F_CPU=14745600

# additional options for avreal (like -n)
# put -l2 here for lock chip after programming by 'make run'
#AVREAL_OPT= -n
FUSES = bodlevel=5,cksel=2,ckdiv8=off,sut=0


# additional libraries and object files to link
LIB =

# assembler flags
ASFLAGS =

#OPT = -Os -mcall-prologues
OPT = -Os

# compiler flags
CSTD = # -std=c++98 --pedantic

CWARN = -Wextra -Wall #-Wstrict-prototypes -Wno-main
CFLAGS = -g $(OPT) $(CSTD) $(CWARN) \
-DF_CPU=$(F_CPU)UL \
-fno-exceptions -fno-rtti \
-funsigned-bitfields -fshort-enums

# -fpack-struct не йде для scmRTOS для avr-gcc 3.4.6
# OS_Kernel.h:167: error: cannot bind packed field `((OS::TKernel*)this)->OS::TKernel::ReadyProcessMap' to `OS::TProcessMap&'

# linker flags
#---------------- Library Options ----------------
LDFLAGS += -Wl
LDFLAGS += -lm


ifeq "$(MAKE_SMALLEST_HEX)" "Y"
CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--relax
endif

########### you should not need to change the following lines #############
# keep order!
# avreal.make must be included after gcc-avr because of TRGPGM definition
include $(COMMON_MAKEFILES)/gcc-avr.mak
include $(COMMON_MAKEFILES)/avreal.mak

## end



Пользуясь случаем, заодно спрошу, как поправить Makefile, что бы файл elf сохранялся по указанному пути, либо делалась его копия по указанному пути?
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 21st June 2025 - 01:23
Рейтинг@Mail.ru


Страница сгенерированна за 0.01368 секунд с 7
ELECTRONIX ©2004-2016