Removing quotations from linking command
Posted: Sun Jan 16, 2011 10:38 am
I just recently discovered CodeLite and like it quite a bit! I'm use to using VisualC++ and Keil uVision on windows but on linux your left with Code::Blocks (Very hard to customize and how it handles sources), MonoDevelop (Wont even run on Ubuntu..), Eclipse (Horribly clumsy and java based). Now that I got that out of the way I am having a few issues customizing CodeLite for my compiler.
The main issue is that my compiler does not allow quotations in is command line so "-I ." is illegal. Also my compiler does not want stripped library names as it looks for exactly what you specify. If you want libm.a thats that I need to have on the command line. I can easily just add this to the linker options manually and not worry but the quotations are a big issue.
I have a custom makefile that compiles my code perfectly so I have a baseline to setup CodeLite with a little help. Here is my makefile:
Currently I have all the linker and compiler options defined in the project settings and .c files compile without errors however the linker can not deal with the "-L." I changed the -L in the build settings -> switches to --userlibpath and now it shows up as "--userlibpath ." but those quotations are killing me. Is their any way to have CodeLite NOT include the "." directory search and only include what I explicitly define?
The main issue is that my compiler does not allow quotations in is command line so "-I ." is illegal. Also my compiler does not want stripped library names as it looks for exactly what you specify. If you want libm.a thats that I need to have on the command line. I can easily just add this to the linker options manually and not worry but the quotations are a big issue.
I have a custom makefile that compiles my code perfectly so I have a baseline to setup CodeLite with a little help. Here is my makefile:
Code: Select all
# ARM-MDK toolchain setup
# -------------------------------------------------------------------------------------------------
KEIL_DIR = /home/uminded/.wine/drive_c/Keil/ARM
TOOLCHAIN_DIR = $(KEIL_DIR)/BIN40
SYS_INC = -I $(KEIL_DIR)/RV31/INC
SYS_LIB = $(KEIL_DIR)/RV31/LIB
CC = $(TOOLCHAIN_DIR)/armcc.exe
AS = $(TOOLCHAIN_DIR)/armasm.exe
AR = $(TOOLCHAIN_DIR)/armar.exe
LD = $(TOOLCHAIN_DIR)/armlink.exe
CP = $(TOOLCHAIN_DIR)/fromelf.exe
# -------------------------------------------------------------------------------------------------
# CMSIS & Standard Firmware Library directories
# -------------------------------------------------------------------------------------------------
CMSIS_DIR = ./lib/STM32F10x_StdPeriph_Lib_V3.4.0/Libraries/CMSIS.2
STARTUP_DIR = $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x/startup/arm
STDPERIPH_DIR = ./lib/STM32F10x_StdPeriph_Lib_V3.4.0/Libraries/STM32F10x_StdPeriph_Driver
INCLUDES += -I $(CMSIS_DIR)/CM3/CoreSupport
INCLUDES += -I $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x
INCLUDES += -I $(STDPERIPH_DIR)/inc
# -------------------------------------------------------------------------------------------------
# Here is the list of locations to your source files
# -------------------------------------------------------------------------------------------------
VPATH = $(CMSIS_DIR)/CM3/CoreSupport
VPATH += $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x
VPATH += $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x/startup/arm
VPATH += $(STDPERIPH_DIR)/src
VPATH += ./src/
# Include obj dir so make does not rebuild everything unneccicarly
VPATH += ./obj/
# -------------------------------------------------------------------------------------------------
# Project setup
# -------------------------------------------------------------------------------------------------
DEFINES = -D STM32F10X_MD
DEFINES += -D USE_STDPERIPH_DRIVER
INCLUDES += $(SYS_INC)
INCLUDES += -I ./src
INCLUDES += -I $(CMSIS_DIR)/CM3/CoreSupport
INCLUDES += -I $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x
INCLUDES += -I $(STDPERIPH_DIR)/inc
CPP_SRC = main.c
CPP_SRC += stm32f10x_it.c
CPP_SRC += core_cm3.c
CPP_SRC += system_stm32f10x.c
CPP_SRC += stm32f10x_gpio.c
CPP_SRC += stm32f10x_rcc.c
CPP_OBJ = $(CPP_SRC:.c=.o)
ASM_SRC = startup_stm32f10x_md.s
ASM_OBJ = $(ASM_SRC:.s=.o)
DEPENDS = $(addprefix ./obj/, $(patsubst %.o,%.d, $(ASM_OBJ) $(CPP_OBJ)))
OBJECTS = $(addprefix ./obj/, $(ASM_OBJ) $(CPP_OBJ))
# -------------------------------------------------------------------------------------------------
# Make directives, recipes, whatever you like to call them...
# -------------------------------------------------------------------------------------------------
.PHONY : all scatter noscatter link_scatter link_noscatter copy clean
scatter : $(CPP_OBJ) $(ASM_OBJ) link_scatter copy
noscatter : $(CPP_OBJ) $(ASM_OBJ) link_noscatter copy
$(CPP_OBJ) : %.o : %.c
@echo -e "\n Compiling $@ ... \n"
$(CC) --cpu Cortex-M3 -g -O0 --apcs=interwork --split_sections \
$(INCLUDES) $(DEFINES) --depend ./obj/$*.d -o ./obj/$@ -c $<
@echo -e "\n done ... \n"
$(ASM_OBJ) : %.o : %.s
@echo -e "\n Assembling $@ ... \n"
$(AS) --cpu Cortex-M3 -g --16 --apcs=interwork $(INCLUDES) --xref \
--depend ./obj/$*.d -o ./obj/$@ $<
@echo -e "\n done ... \n"
link_scatter : $(CPP_OBJ) $(ASM_OBJ)
@echo -e "\n Linking project image ... \n"
$(LD) --cpu Cortex-M3 ./obj/*.o --libpath $(SYS_LIB) \
--strict --scatter ./prj/test.sct --autoat \
--info summarysizes --map --xref --callgraph --symbols \
--info sizes --info totals --info unused --info veneers \
--list ./lst/test.map -o ./img/test.axf
@echo -e "\n done ... \n"
link_noscatter : $(OBJECTS)
@echo -e "\n Linking project image ... \n"
$(LD) --cpu Cortex-M3 ./obj/*.o --libpath $(SYS_LIB) --strict \
--ro-base 0x08000000 --rw-base 0x20000000 --first="startup_stm32f10x_md.o(RESET)" \
--autoat --info summarysizes --map --xref --callgraph --symbols \
--info sizes --info totals --info unused --info veneers \
--list ./lst/test.map -o ./img/test.axf
@echo -e "\n done ... \n"
copy : ./img/test.axf
@echo $(OBJECTS)
@echo $(DEPENDS)
@echo -e "\n Translating To Binary ... \n"
$(CP) ./img/test.axf --bincombined --output ./img/test.bin
@echo -e "\n done ... \n"
clean :
@echo -e "\n Removing Old Files ... \n"
-rm ./img/*
-rm ./lst/*
-rm ./obj/*
@echo -e "\n done ... \n"