For Ubuntu14.04 (my version is 14.10), the applicable cross compiler apt-getinstallgcc-arm-none-eabi is available in the official repository. For earlier versions, refer /~ Terry. guo/+ archive/ubuntu/gcc-
For Ubuntu 14.04 (my version is 14.10), the cross compiler is available in the official repository.
apt-get install gcc-arm-none-eabi
For earlier versions, you can use the two-step compression package of https://launchpad.net/gcc-arm-embedded,
And https://launchpad.net /~ Software source provided by terry. guo/+ archive/ubuntu/gcc-arm-embedded
add-apt-repository ppa:terry.guo/gcc-arm-embedded
apt-get update
apt-get install gcc-arm-none-eabi
The following is the makefile of the project. The core of CMSIS supports version 2.00, the hardware supports version 3.5, and the peripheral driver is version 3.5.
Makefile uses find to find all. c and. s files and compile them based on automatic dependencies. The. bin and. hex files are generated based on cmd_f103ze_gcc.ld.
TARGET=stm32########################################################################export CC = arm-none-eabi-gccexport AS = arm-none-eabi-asexport LD = arm-none-eabi-ldexport OBJCOPY = arm-none-eabi-objcopyTOP=$(shell pwd)INC_FLAGS= -I $(TOP)/lib/CMSIS_200/CM3/CoreSupport/ \ -I $(TOP)/lib/CMSIS_200/CM3/DeviceSupport/ST/STM32F10x \ -I $(TOP)/lib/STM32F10x_StdPeriph_Driver/inc \ -I $(TOP)/srcexport CFLAGS= -W -Wall -g -mcpu=cortex-m3 -mthumb -D STM32F10X_HD -D USE_STDPERIPH_DRIVER $(INC_FLAGS) ASFLAGS= -W -Wall -g -Wall -mcpu=cortex-m3 -mthumb########################################################################C_SRC=$(shell find ./ -name '*.c')C_OBJ=$(C_SRC:%.c=%.o)C_DEP=$(C_SRC:%.c=%.cdep)ASM_SRC=$(shell find ./ -name '*.s')ASM_OBJ=$(ASM_SRC:%.s=%.o)ASM_DEP=$(ASM_SRC:%.s=%.adep)########################################################################.PHONY: all cleanall:$(C_DEP) $(ASM_DEP) $(C_OBJ) $(ASM_OBJ) $(LD) $(C_OBJ) $(ASM_OBJ) -T stm32_f103ze_gcc.ld -o $(TARGET).elf $(OBJCOPY) $(TARGET).elf $(TARGET).bin -Obinary $(OBJCOPY) $(TARGET).elf $(TARGET).hex -Oihex###################################%.cdep:%.c $(CC) -MM $< > $@ $(CFLAGS)sinclude $(C_DEP)$(C_OBJ):%.o:%.c $(CC) -c $< -o $@ $(CFLAGS)####################################%.adep:%.s $(CC) -MM $< > $@ $(ASFLAGS)sinclude $(ASM_DEP)$(ASM_OBJ):%.o:%.s $(AS) -c $@ -o $@ $(ASFLAGS)#################################### clean: @for i in $(shell find ./ -name '*.o');do if [ -e $${i} ];then rm $${i};fi;done @for i in $(shell find ./ -name '*.cdep');do if [ -e $${i} ];then rm $${i};fi;done @for i in $(shell find ./ -name '*.adep');do if [ -e $${i} ];then rm $${i};fi;done
Stm32_f103ze_gcc.ld content
_estack = 0x20000400;MEMORY{ FLASH_ON_CHIP (rx) : ORIGIN = 0x08000000, LENGTH = 512K SRAM_ON_CHIP (rwx) : ORIGIN = 0x20000000, LENGTH = 64K}SECTIONS{ .text : { KEEP(*(.isr_vector)) *(.text*) *(.rodata*) _etext = .; } > FLASH_ON_CHIP _sidata = .;/* .data : AT(ADDR(.text) + SIZEOF(.text)) {*/ .data : AT(_sidata) { _sdata = .; *(vtable) *(.data*) _edata = .; } > SRAM_ON_CHIP .bss : { _sbss = .; *(.bss*) *(COMMON) _ebss = .; } > SRAM_ON_CHIP}
Search for makefile and execute the shell script. It can be used in the compilation shortcut key of geany.
cd $1;while [ ! -e ./Makefile ] ; do cd ..; path=`pwd` ; if [ "$path" = "/" ] ; then break; fi;done;if [ -e ./Makefile ] ;then make $2;fi
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-08/121322.htm