bug in export to codesourcery make file

21 May 2013

Hello MBED Team. Thanks for open sourcing the libraries!!! During compiling them I think I found a bug in the Make file that gets created when you export to codesourcery. The options being passed to the assembler are not valid and produce errors. I think the $(CC_FLAGS) and $(CC_SYMBOLS) options should be removed. I think you should only be passing some options like "-mcpu=cortex-m3 -mthumb" to the assembler like in the GNU GCC export Make file. What do you think?

CC = $(GCC_BIN)arm-none-eabi-gcc
CPP = $(GCC_BIN)arm-none-eabi-g++
CC_FLAGS = -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections 
ONLY_C_FLAGS = -std=gnu99
ONLY_CPP_FLAGS = -std=gnu++98
CC_SYMBOLS = -DTARGET_LPC1768 -DTOOLCHAIN_GCC_CS -DNDEBUG


AS = $(GCC_BIN)arm-none-eabi-as

LD = $(GCC_BIN)arm-none-eabi-gcc
LD_FLAGS = -mcpu=cortex-m3 -mthumb -Wl,--gc-sections
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc

OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy

all: $(PROJECT).bin

clean:
	rm -f $(PROJECT).bin $(PROJECT).elf $(OBJECTS)

.s.o:
	$(AS)  $(CC_FLAGS) $(CC_SYMBOLS) -o $@ $<

Here are the errors I get:

C:\mbed>cs-make
arm-none-eabi-as  -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions 
-mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections  -
 
DTARGET_LPC1768 -DTOOLCHAIN_GCC_CS -DNDEBUG -o 
mbed-NXP/cmsis/LPC1768/GCC_CS/startup_LPC17xx.o mbed-NXP/cmsis/LPC1768/GCC_CS/startup_LPC17xx.s
 
arm-none-eabi-as: unrecognized option `-Os'
 
cs-make: *** [mbed-NXP/cmsis/LPC1768/GCC_CS/startup_LPC17xx.o] Error 1