|
所用的GCC最新版本:arm-eabi-gcc (WinARM March 2008) 4.3.0
下载地址:javascript:;
08版本比前面的06和07版本除了在内核的改进之外,同时增加了ISP 自动 Erase 和 download 功能,调试起来十分的方便快捷。
以下粉红色字体是调试结果:
------------------------------------------------------------
……(前部分省略,在此,只是为了说明isp的功能)
stm32boot -e -v main.bin
STM32boot v0.0 by Dale Wheat
Bootloader version 2.0 detected
Erasing device... ok
Writing file 'main.bin' to device... ok
Verifying... ok
------------------------------------------------------------
以下是最新版本的makefile 配置:
OPT = s
TARGET = main
# SShell
USR_SRCS= SShell/shell.c
USR_OBJS= SShell/shell.o
USR_INCS= -I SShell
USR_LIBS= -L SShell
# SShell Commands
USR_SRCS+= commands.c
USR_OBJS+= commands.o
USR_INCS+=
USR_LIBS+=
#FreeRTOS
USR_SRCS+=
USR_OBJS+=
USR_INCS+=
USR_LIBS+=
# FreeRTOS Tasks
USR_SRCS+=
USR_OBJS+=
USR_INCS+=
USR_LIBS+=
#TCHAIN = arm-eabi
TCHAIN = arm-eabi
INCLUDE_DIRS = -I . -I lib/inc $(USR_INCS)
COMPILE_OPTS = -mcpu=cortex-m3 -mthumb -Wall -g -O$(OPT)
LIBRARY_DIRS = -L lib $(USR_LIBS)
CC = $(TCHAIN)-gcc
CFLAGS = $(COMPILE_OPTS) $(INCLUDE_DIRS)
CXX = $(TCHAIN)-g++
CXXFLAGS = $(COMPILE_OPTS) $(INCLUDE_DIRS)
AS = $(TCHAIN)-gcc
ASFLAGS = $(COMPILE_OPTS) -c
LD = $(TCHAIN)-gcc
LDFLAGS = -Wl,--gc-sections,-Map=$(TARGET).map,-cref,-u,Reset_Handler $(INCLUDE_DIRS) $(LIBRARY_DIRS) -T stm32.ld
OBJCP = $(TCHAIN)-objcopy
OBJCPFLAGS = -O binary
AR = $(TCHAIN)-ar
ARFLAGS = cr
MAIN_OUT = main
MAIN_OUT_ELF = $(MAIN_OUT).elf
MAIN_OUT_BIN = $(MAIN_OUT).bin
STR_DIV = ------------------------------------------------------------
# all
all: start gcc-info $(MAIN_OUT_ELF) $(MAIN_OUT_BIN) flash end
# misc
start:
@echo Start Compiling Target $(TARGET)
end:
@echo $(STR_DIV)
@echo bye!!
gcc-info:
@echo $(STR_DIV)
@echo gcc version is
@$(CC) --version
@echo $(STR_DIV)
# main
$(MAIN_OUT_ELF): main.o stm32f10x_it.o lib/libstm32.a $(USR_OBJS)
$(LD) $(LDFLAGS) main.o stm32f10x_it.o lib/libstm32.a $(USR_OBJS) --output $@
$(MAIN_OUT_BIN): $(MAIN_OUT_ELF)
$(OBJCP) $(OBJCPFLAGS) $< $@
# flash
flash: $(MAIN_OUT)
@echo $(STR_DIV)
stm32boot -e -v $(MAIN_OUT_BIN)
# libstm32.a
LIBSTM32_OUT = lib/libstm32.a
LIBSTM32_OBJS = \
lib/src/stm32f10x_adc.o \
lib/src/stm32f10x_bkp.o \
lib/src/stm32f10x_can.o \
lib/src/stm32f10x_dma.o \
lib/src/stm32f10x_exti.o \
lib/src/stm32f10x_flash.o \
lib/src/stm32f10x_gpio.o \
lib/src/stm32f10x_i2c.o \
lib/src/stm32f10x_iwdg.o \
lib/src/stm32f10x_lib.o \
lib/src/stm32f10x_nvic.o \
lib/src/stm32f10x_pwr.o \
lib/src/stm32f10x_rcc.o \
lib/src/stm32f10x_rtc.o \
lib/src/stm32f10x_spi.o \
lib/src/stm32f10x_systick.o \
lib/src/stm32f10x_tim.o \
lib/src/stm32f10x_tim1.o \
lib/src/stm32f10x_usart.o \
lib/src/stm32f10x_wwdg.o \
lib/src/cortexm3_macro.o \
lib/src/stm32f10x_vector.o
$(LIBSTM32_OUT): $(LIBSTM32_OBJS)
$(AR) $(ARFLAGS) $@ $(LIBSTM32_OBJS)
$(LIBSTM32_OBJS): stm32f10x_conf.h
# User Code
$(USR_OBJS): $(USR_SRCS)
clean:
-rm stm32f10x_it.o $(USR_OBJS) $(TARGET).o $(TARGET) $(TARGET).map $(LIBSTM32_OBJS) $(LIBSTM32_OUT) $(MAIN_OUT_ELF) $(MAIN_OUT_BIN)
如果各位有什么高见,不妨直言。