
{"id":190,"date":"2015-01-24T20:32:57","date_gmt":"2015-01-24T20:32:57","guid":{"rendered":"http:\/\/timallen.name\/?p=190"},"modified":"2015-08-14T21:12:40","modified_gmt":"2015-08-14T21:12:40","slug":"embedded-makefile","status":"publish","type":"post","link":"https:\/\/timallen.name\/index.php\/2015\/01\/24\/embedded-makefile\/","title":{"rendered":"Embedded Makefile"},"content":{"rendered":"<pre class=\"lang:default decode:true \" >\r\n\r\nCC      = arm-none-eabi-gcc\r\nLD      = arm-none-eabi-gcc\r\nAR      = arm-none-eabi-ar\r\nAS      = arm-none-eabi-as\r\nCP      = arm-none-eabi-objcopy\r\nOD\t= arm-none-eabi-objdump\r\n\r\nDRIVER \t= STM32_USB-FS-Device_Lib_V4.0.0\/Libraries\/STM32F10x_StdPeriph_Driver\r\nCMSIS \t= STM32_USB-FS-Device_Lib_V4.0.0\/Libraries\/CMSIS\r\nCMSISD\t= STM32_USB-FS-Device_Lib_V4.0.0\/Libraries\/CMSIS\/Device\/ST\/STM32F10x\r\nlibdir  = lib\r\n\r\nCFLAGS  = -I. -I$(DRIVER)\/inc -I$(CMSIS)\/Include -I$(CMSISD)\/Include -DSTM32F10X_XL -DUSE_STDPERIPH_DRIVER -c -fno-common -O0 -g -march=armv7-m -mcpu=cortex-m3 -mthumb -mthumb-interwork --std=gnu99\r\nAFLAGS  = -mapcs-32 \r\nLFLAGS  = -nostartfiles\r\nCPFLAGS = -Obinary\r\nODFLAGS\t= -S\r\n\r\nlibs = $(libdir)\/libstdperiphdriver.a $(libdir)\/libcmsisd.a\r\n\r\nall: libs main\r\n\r\n.PHONY : libs\r\nlibs: $(libs)\r\n\r\n\r\nclean:\r\n\t-rm -f main.lst main.bin main.elf main.hex main.map *.o $(libdir)\/*\r\n\r\n\r\n#################\r\n# libraries\r\n#################\r\n$(libdir)\/libstdperiphdriver.a: stm32f10x_rcc.o stm32f10x_gpio.o stm32f10x_usart.o stm32f10x_exti.o stm32f10x_dac.o stm32f10x_tim.o stm32f10x_dma.o stm32f10x_pwr.o\r\n\t$(AR) rvs $@ $^\r\n\r\nstm32f10x_rcc.o: $(DRIVER)\/src\/stm32f10x_rcc.c \r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\t \r\nstm32f10x_gpio.o: $(DRIVER)\/src\/stm32f10x_gpio.c\r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\t \r\nstm32f10x_usart.o: $(DRIVER)\/src\/stm32f10x_usart.c \r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\r\nstm32f10x_exti.o: $(DRIVER)\/src\/stm32f10x_exti.c \r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\r\nstm32f10x_dac.o: $(DRIVER)\/src\/stm32f10x_dac.c\r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\r\nstm32f10x_tim.o: $(DRIVER)\/src\/stm32f10x_tim.c\r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\r\nstm32f10x_dma.o: $(DRIVER)\/src\/stm32f10x_dma.c\r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\r\nstm32f10x_pwr.o: $(DRIVER)\/src\/stm32f10x_pwr.c\r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\r\n$(libdir)\/libcmsisd.a: system_stm32f10x.o\r\n\t$(AR) rvs $@ $^\r\n\r\nsystem_stm32f10x.o: $(CMSISD)\/Source\/Templates\/system_stm32f10x.c\r\n\t@ echo\r\n\t$(CC) $(CFLAGS) $^\r\n\r\nmain: main.elf\r\n\t@ echo \"...copying\"\r\n\t$(CP) $(CPFLAGS) main.elf main.bin\r\n\t$(OD) $(ODFLAGS) main.elf &gt; main.lst\r\n\r\nmain.elf: stm32.ld main.o crt0.o crt1.o irq.o svc.o $(libs)\r\n\t@ echo \r\n\t$(LD) $(LFLAGS) -T$^ speex\/lib\/libspeex.a -o$@\r\n\r\ncrt0.o: crt0.c\r\n\t@ echo\r\n\t$(CC) $(CFLAGS) $^\r\n\r\ncrt1.o: crt1.c\r\n\t@ echo\r\n\t$(CC) $(CFLAGS) $^\r\n\r\nirq.o: irq.c\r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\r\nsvc.o: svc.s\r\n\t@ echo\r\n\t $(AS) $(AFLAGS) $^ -o$@\r\n\r\nmain.o: main.c\r\n\t@ echo\r\n\t $(CC) $(CFLAGS) $^\r\n\r\nsamples.bin: samples\/samples.raw\r\n\tdd if=$^ of=$@ bs=1 count=512K\r\n\r\nsamples\/samples.raw: samples\/samples.wav\r\n\tsox -v.9 $^ -c1 -r8k -b8 -eunsigned-integer $@\r\n\r\ntags: Makefile\r\n\tctags-exuberant --c-kinds=+p --c++-kinds=+p --fields=+iaS --extra=+q * \\\r\n\t\t$(DRIVER)\/src\/* $(DRIVER)\/inc\/* \\\r\n\t\t$(CMSIS)\/Include\/* \\\r\n\t\t$(CMSISD)\/Include\/* \\\r\n\t\tspeex\/* \\\r\n\t\t~\/usr\/arm-none-eabi\/include\/* \r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CC = arm-none-eabi-gcc LD = arm-none-eabi-gcc AR = arm-none-eabi-ar AS = arm-none-eabi-as CP = arm-none-eabi-objcopy OD = arm-none-eabi-objdump DRIVER = STM32_USB-FS-Device_Lib_V4.0.0\/Libraries\/STM32F10x_StdPeriph_Driver CMSIS = STM32_USB-FS-Device_Lib_V4.0.0\/Libraries\/CMSIS CMSISD = STM32_USB-FS-Device_Lib_V4.0.0\/Libraries\/CMSIS\/Device\/ST\/STM32F10x libdir = lib CFLAGS = -I. -I$(DRIVER)\/inc -I$(CMSIS)\/Include -I$(CMSISD)\/Include -DSTM32F10X_XL -DUSE_STDPERIPH_DRIVER -c -fno-common -O0 -g -march=armv7-m -mcpu=cortex-m3 -mthumb -mthumb-interwork &#8211;std=gnu99 AFLAGS = -mapcs-32 LFLAGS = -nostartfiles CPFLAGS = &hellip; <a href=\"https:\/\/timallen.name\/index.php\/2015\/01\/24\/embedded-makefile\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Embedded Makefile<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,8],"tags":[],"class_list":["post-190","post","type-post","status-publish","format-standard","hentry","category-aph","category-embedded"],"_links":{"self":[{"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/comments?post=190"}],"version-history":[{"count":6,"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":432,"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions\/432"}],"wp:attachment":[{"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/media?parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/categories?post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/timallen.name\/index.php\/wp-json\/wp\/v2\/tags?post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}