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

 
 
> uint24_t
Злодей
сообщение Jan 26 2010, 09:19
Сообщение #1


Частый гость
**

Группа: Участник
Сообщений: 149
Регистрация: 29-04-08
Из: Петербург
Пользователь №: 37 142



Бутлодер для mega128 малость не влезает в 2k флэша, а нужно впихнуть. Первое что приходит в голову - бороться с flash_size_t, который у меня из-за RAMP_Z для atmega128+ определен как uint32_t...

Откуда взять uint24_t? Если сделать структуру из трёх байт, и написать функции арифметических действий над ней, будет профит?
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
SysRq
сообщение Mar 12 2011, 12:50
Сообщение #2


Чайник, 1 литр
****

Группа: Свой
Сообщений: 655
Регистрация: 17-05-06
Из: Moscow
Пользователь №: 17 168



Ежели кого не сильно затруднит, выложите пожалуйста правильный Makefile с этими ключами:
Код
CFLAGS += --combine
CFLAGS += -fwhole-program

Я что-то страшное сотворил, никак не пойму где наврал wacko.gif . Получаю множество:
Цитата
In file included from main.h:10:
c:/winavr/lib/gcc/../../avr/include/avr/interrupt.h:38:20: error: calling fdopen: No such file or directory
Go to the top of the page
 
+Quote Post
demiurg_spb
сообщение Mar 13 2011, 09:50
Сообщение #3


неотягощённый злом
******

Группа: Свой
Сообщений: 2 746
Регистрация: 31-01-08
Из: Санкт-Петербург
Пользователь №: 34 643



Это мой Makefile для проекта из соседнего топика про сравнение gcc и iar.
CODE
#----------------------------------------------------------------------------
# Programmer type:
#----------------------------------------------------------------------------
PROGRAMMER = DUDE
#PROGRAMMER = REAL
#PROGRAMMER = BOOT

#----------------------------------------------------------------------------
PROJECT_NAME = monitor-gcc

COMPILE_NAME = test
MCU = atmega8
F_CPU = 4608000
#----------------------------------------------------------------------------

COMPILE_NAME := $(PROJECT_NAME)$(COMPILE_NAME)
DEVICE_ID = 3
DEVICE_REV = $(COMPILE_TYPE)
MAIN_BINDIR = ./bin
BINDIR = $(MAIN_BINDIR)/$(COMPILE_NAME)
TARGET = $(BINDIR)/$(PROJECT_NAME)

#----------------------------------------------------------------------------
ADD_COMPILE_FLAGS += -DPROJECT_NAME=$(PROJECT_NAME)


#----------------------------------------------------------------------------
# Output format. (can be srec, ihex, binary)
FORMAT = ihex

# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
OBJDIR = $(MAIN_BINDIR)./../obj
DEPDIR = $(OBJDIR)/dep

# List source directories here:
SOURCE_DIRS = .
VPATH := $(SOURCE_DIRS)


# List C source files here. (C dependencies are automatically generated.)
SRC = hal.c
SRC += app.c
SRC += lcd4.c
SRC += main.c

# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s


# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2

# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=c99
#CSTANDARD = -std=gnu99


# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL


#---------------- Compiler Options C ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS)
CFLAGS += -O$(OPT)
CFLAGS += -pedantic
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
CFLAGS += -fno-split-wide-types

CFLAGS += --combine
CFLAGS += -fwhole-program

CFLAGS += -ffunction-sections
CFLAGS += -fdata-sections
CFLAGS += -Wl,--relax

#************************************************
#CFLAGS += -fno-ivopts
CFLAGS += -ftree-loop-ivcanon
CFLAGS += -mcall-prologues

#CFLAGS += -ffreestanding

CFLAGS += -fno-tree-scev-cprop
CFLAGS += -finline-small-functions
CFLAGS += -fearly-inlining

#CFLAGS += --param inline-call-cost=0
CFLAGS += -finline-limit=65535

#CFLAGS += -fno-reorder-blocks
#CFLAGS += -fno-reorder-blocks-and-partition
#CFLAGS += -fno-reorder-functions
#CFLAGS += -fno-toplevel-reorder

#CFLAGS += -fno-move-loop-invariants

#CFLAGS += -fno-unroll-loops
#CFLAGS += -fno-unroll-all-loops
#CFLAGS += --param max-unroll-times=0
#************************************************


CFLAGS += -mshort-calls
CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wundef
#CFLAGS += -Wunreachable-code
CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(TARGET).lst
CFLAGS += $(CSTANDARD)
CFLAGS += $(ADD_COMPILE_FLAGS)
CFLAGS += $(addprefix -I, $(SOURCE_DIRS))

#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min

# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt


# If this is left blank, then it will use the Standard printf version.
#PRINTF_LIB =
PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)


# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min

# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt

# If this is left blank, then it will use the Standard scanf version.
#SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)


#MATH_LIB = -lm
MATH_LIB =


# List any extra directories to look for libraries here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRALIBDIRS =



#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS =
LDFLAGS += -Wl,-Map=$(TARGET).map,--cref
#LDFLAGS += -Wl,-static -fvtable-gc -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s
LDFLAGS += -Wl,--gc-section

LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#LDFLAGS += -T linker_script.x




#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
AR = avr-ar rcs
NM = avr-nm
REMOVE = rm -f
REMOVEDIR = rm -rf
COPY = cp
WINSHELL = cmd


# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_BUILDING = Building project:
MSG_CLEANING = Cleaning project:

# Compiler flags to generate dependency files.
GENDEPFLAGS = -MMD -MP -MF $(TARGET).dep

# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) $(GENDEPFLAGS) $(CFLAGS)


# Default target.
all: begin gccversion sizebefore build sizeafter end

# Change the build target to build a HEX file or a library.
build: elf hex eep lss sym

elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym


# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)

end:
@echo Device id_rev_opt: $(BOOT_HARDWARE_ID_HEX)
@echo $(MSG_END)
@echo


# Display size of file.
HEXSIZE = $(SIZE) --mcu=$(MCU) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf

sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
2>/dev/null; echo; fi

sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi


# Display compiler version information.
gccversion :
@$(CC) --version




# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT = $(OBJCOPY) --debugging
COFFCONVERT += --change-section-address .data-0x800000
COFFCONVERT += --change-section-address .bss-0x800000
COFFCONVERT += --change-section-address .noinit-0x800000
COFFCONVERT += --change-section-address .eeprom-0x810000



coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof


extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof



# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@

%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0


# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@

# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@

# Compile and Link whole program at time: create ELF output file from src files.
%.elf: $(SRC)
@echo
@echo $(MSG_BUILDING) $@
@echo
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)


#$(NAME).elf : $(CSRC)
# @echo $^
# @$(CC) -c $(CFLAGS) -combine -fwhole-program $^ $(LDFLAGS) -o $@



#=============================================================================
# Programmer section (ISP) :
#=============================================================================

ifeq ($(PROGRAMMER),DUDE)
include MakeProgDude.mak
endif

ifeq ($(PROGRAMMER),REAL)
include MakeProgReal.mak
endif

ifeq ($(PROGRAMMER),BOOT)
include MakeProgBoot.mak
endif

#=============================================================================
# Clean section:
#=============================================================================

clean: begin clean_list end

clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(TARGET).lst
$(REMOVE) $(TARGET).dep

# Create binary files directory
include $(shell mkdir $(MAIN_BINDIR) 2>/dev/null) $(shell mkdir $(BINDIR) 2>/dev/null)


# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff program \
clean clean_list


--------------------
“Будьте внимательны к своим мыслям - они начало поступков” (Лао-Цзы)
Go to the top of the page
 
+Quote Post

Сообщений в этой теме
- Злодей   uint24_t   Jan 26 2010, 09:19
- - demiurg_spb   Цитата(Злодей @ Jan 26 2010, 12:19) Если ...   Jan 26 2010, 09:31
- - Сергей Борщ   Цитата(Злодей @ Jan 26 2010, 11:19) Бутло...   Jan 26 2010, 10:16
|- - demiurg_spb   Цитата(Сергей Борщ @ Jan 26 2010, 13:16) ...   Jan 27 2010, 10:37
|- - Сергей Борщ   Цитата(demiurg_spb @ Jan 27 2010, 12:37) ...   Jan 27 2010, 10:52
|- - demiurg_spb   Using the GNU Compiler Collection. For gcc version...   Jan 27 2010, 12:00
||- - Сергей Борщ   Цитата(demiurg_spb @ Jan 27 2010, 14:00) ...   Jan 27 2010, 12:30
||- - demiurg_spb   Цитата(Сергей Борщ @ Jan 27 2010, 15:30) ...   Jan 27 2010, 12:36
|- - Злодей   Цитата(Сергей Борщ @ Jan 27 2010, 13:52) ...   Jan 28 2010, 09:51
|- - ARV   Цитата(Злодей @ Jan 28 2010, 12:51) Ключ ...   Jan 28 2010, 10:04
||- - _Pasha   Цитата(ARV @ Jan 28 2010, 13:04) придется...   Jan 28 2010, 10:53
|- - Сергей Борщ   Цитата(Злодей @ Jan 28 2010, 11:51) Ключ ...   Jan 28 2010, 11:16
|- - ReAl   Цитата(Злодей @ Jan 28 2010, 11:51) Ключ ...   Jan 28 2010, 14:50
|- - singlskv   Цитата(ReAl @ Jan 28 2010, 17:50) Стереот...   Jan 28 2010, 23:44
- - SysRq   Убрать таблицу векторов прерываний, если не нужна ...   Jan 29 2010, 20:52


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

 


RSS Текстовая версия Сейчас: 27th July 2025 - 18:50
Рейтинг@Mail.ru


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