在linux下最简单的STM32gcc程序
在linux下最简单的STM32 gcc程序,需要三个文件分别为main.c makefile和stm32-linux.ld:main.c:int main(void){return 0;}makefile:TARGET = mainOBJS = main.oCC = arm-none-eabi-gccLD = arm-none-eabi-ldOBJCP = arm-none-eabi-objcopyCFLAGS = -mcpu=cortex-m3 -mthumb -nostartfilesLFLAGS = -T stm32-linux.ldCPFLAGS = -ObinaryTARGET_ELF = $(TARGET).elfTARGET_BIN = $(TARGET).bin$(TARGET_BIN):$(TARGET_ELF)$(OBJCP) $(CPFLAGS) $< $@$(TARGET_ELF):$(OBJS)$(LD) $(LFLAGS) -o $@ $: (void*)STACK_TOP, (void*)main};int main(void){ 0: b480 push {r7} 2: af00 add r7, sp, #0 return 0; 4: f04f 0300 mov.w r3, #0} 8: 4618 mov r0, r3 a: 46bd mov sp, r7 c: bc80 pop {r7} e: 4770 bx lr[root@localhost src]# make cleanrm -f main *.o *.elf *.bin[root@localhost src]#