background
Huawei liteOS STM32F4 migration to the development board, the modified makefile according to the official procedure error:
arm-none-eabi-gcc.exe: warning: '-x assembler-with-cpp' after last input file has no effect
arm-none-eabi-gcc.exe: fatal error: no input files
compilation terminated.
Resolution process
According to the error location can be seen Makefile file can not be found due to the compilation of .S file, print out the results:
arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_STDPERIPH_DRIVER -DSTM32F407xx -DSTM32F40_41xxx -I./Inc -IProjectDrivers/Inc -IProjectDrivers/Inc/Inc -IProjectDrivers/Inc/CORE -IDrivers/CMSIS/include -I./Src/SYSTEM -I./Src/MALLOC -I./ProjectDrivers/HARDWARE -IThirdParties/LWIP -I./ThirdParties/LWIP -I./ThirdParties/LWIP/arch -I./ThirdParties/LWIP/lwip_app -I./ThirdParties/LWIP/lwip_app/lwip_comm -I./ThirdParties/LWIP/lwip_app/tcp_server_demo -I./ThirdParties/LWIP/lwip_app/udp_demo -I./ThirdParties/LWIP/lwip-1.4.1 -I./ThirdParties/LWIP/lwip-1.4.1/src -I./ThirdParties/LWIP/lwip-1.4.1/src/api -I./ThirdParties/LWIP/lwip-1.4.1/src/core -I./ThirdParties/LWIP/lwip-1.4.1/src/core/ipv4 -I./ThirdParties/LWIP/lwip-1.4.1/src/include -I./ThirdParties/LWIP/lwip-1.4.1/src/include/ipv4 -I./ThirdParties/LWIP/lwip-1.4.1/src/include/ipv4/lwip -I./ThirdParties/LWIP/lwip-1.4.1/src/include/lwip -I./ThirdParties/LWIP/lwip-1.4.1/src/include/netif -I./ThirdParties/LWIP/lwip-1.4.1/src/netif -I./utils/datastructure -I./utils/tools -I ./Middlewares/LiteOS/arch/arm/arm-m/include -I ./Middlewares/LiteOS/arch/arm/common/cmsis -I./OS_CONFIG -I ./Middlewares/LiteOS/kernel/base/include -I ./Middlewares/LiteOS/kernel/extended/include -I ./Middlewares/LiteOS/kernel/include -O1 -Wall -Wno-pointer-sign -Wno-missing-braces -Wno-format -Wno-address -Wno-unused-but-set-variable -s -fdata-sections -ffunction-sections -g -gdwarf-2 --specs=nano.specs --specs=nosys.specs -MMD -MP -MF"Output/obj/los_dispatch_gcc.d"./Middlewares/LiteOS/arch/arm/arm-m/cortex-m4/gcc/los_dispatch_gcc.S -o Output/obj/los_dispatch_gcc.o
Note that here -MF"Output/obj/los_dispatch_gcc.d"./Middlewares/LiteOS/arch/arm/arm-m/cortex-m4/gcc/los_dispatch_gcc.S
". D", followed by the ./Middlewares, indicating that the present divided into two parameters are combined together, see Makefile:
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
@echo $(notdir $(<:.s=.o))
$(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS)$< -o $@
@echo $(notdir $(<:.s=.o))
Less spaces after the second CFLAGS, modified as follows:
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
@echo $(notdir $(<:.s=.o))
$(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
@echo $(notdir $(<:.s=.o))
Recompile:
$ make
main.o
linking...
arm-none-eabi-size Output/obj/out.elf
text data bss dec hex filename
31876 308 3456 35640 8b38 Output/obj/out.elf
# rm -fR Output/obj/Output/obj
# mkdir Output/obj/Output/obj
arm-none-eabi-objcopy -O ihex Output/obj/out.elf Output/obj/out.hex
arm-none-eabi-objcopy -O binary -S Output/obj/out.elf Output/obj/out.bin
cp Output/obj/*.bin Output/bin/
cp Output/obj/*.elf Output/bin/
cp Output/obj/*.hex Output/bin/
cp Output/obj/*.map Output/bin/
bug solved
to sum up
Engineering transplant must be careful not to arbitrarily adjust the content of the Makefile, make a record and contrast, which helps to solve the problem, even though this is just a space, but the error caused is difficult to find direct, and if the transplant when careful it is completely avoided.