There are a few things I can't figure out how to do. I'll run down the lines in the makefile and say how I *think* I should address them in CodeLite,
so you can correct me if/when I'm wrong, and ask questions where I don't know.
The following lines point to the cross compiler and the objcopy utility. I know how to tell CodeLite what compiler to use: I go to Settings -> Build Settings and add a new compiler.
I have no idea what to do with the objcopy utility.
Code: Select all
CC="C:\path\to\my\cross-gcc"
OBJCOPY="C:\path\to\my\cross-objcopy"
For the project specific flags, I put them in Project Settings -> Common Settings -> Compiler.
Code: Select all
CFLAGS=-mthumb -mcpu=cortex-m3 -DSTM32F10X_CL -DUSE_STDPERIPH_DRIVER \
-DMYFLAG1=0 -DMYFLAG2=0 -O0 \
-ffunction-sections -fdata-sections -g -Wall
Code: Select all
LDFLAGS=-mthumb -mcpu=cortex-m3 -Tstm32_flash.ld -static \
-Wl,-cref,-u,Reset_Handler -Wl,-Map=myproject.map \
-Wl,--gc-sections
Code: Select all
ASFLAGS=-mthumb -mcpu=cortex-m3 -g -Wa,--warn
Code: Select all
OBJS= \
./path/to/object/file.o \
./path/to/another/file.o
There's a long list of include directories. Do I need to add them all to the "Include Paths" in Project Settings?
Code: Select all
INC= \
-I./common_includes/inc/ \
-I./other/includes
Code: Select all
%.o: %.s
$(CC) -c $(ASFLAGS) -o $@ $<
Here's a second object file rule, which uses the compiler flags, if any .c files or include files have changed. I don't think I have to do anything in particular to instruct CodeLite to do this, right?
Code: Select all
%.o: %.c $(INCLUDES)
$(CC) -c $(CFLAGS) $(INC) -o $@ $<
Code: Select all
myproject.elf: $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
Code: Select all
myproject.bin: myproject.elf
$(OBJCOPY) -O binary myproject.elf myproject.bin