Jelajahi Sumber

add make files

balbekova 8 tahun lalu
induk
melakukan
9915d2e9da
9 mengubah file dengan 296 tambahan dan 0 penghapusan
  1. 85 0
      .cproject
  2. 5 0
      .gdbinit_bt6702
  3. 4 0
      .gdbinit_bt6702_noflash
  4. 3 0
      .gdbinit_iap
  5. 2 0
      .gdbinit_iap_noflash
  6. 79 0
      .project
  7. 47 0
      Makefile
  8. 71 0
      Makefile.inc.stm32
  9. TEMPAT SAMPAH
      tracefile.bin

+ 85 - 0
.cproject

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+	<storageModule moduleId="org.eclipse.cdt.core.settings">
+		<cconfiguration id="org.eclipse.cdt.cross.arm.gnu.linux.toolchain.base.811693384">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.cdt.cross.arm.gnu.linux.toolchain.base.811693384" moduleId="org.eclipse.cdt.core.settings" name="Default">
+				<externalSettings/>
+				<extensions>
+					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+				</extensions>
+			</storageModule>
+			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+				<configuration buildProperties="" id="org.eclipse.cdt.cross.arm.gnu.linux.toolchain.base.811693384" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+					<folderInfo id="org.eclipse.cdt.cross.arm.gnu.linux.toolchain.base.811693384.1960454302" name="/" resourcePath="">
+						<toolChain id="org.eclipse.cdt.cross.arm.gnu.linux.toolchain.base.2083781928" name="org.eclipse.cdt.cross.arm.gnu.linux.toolchain.base" superClass="org.eclipse.cdt.cross.arm.gnu.linux.toolchain.base">
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.target.processor.625911353" name="Processor" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.target.processor"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.target.architecture.1392734920" name="Architecture" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.target.architecture"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.target.thumb.1150305377" name="Thumb (-mthumb)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.target.thumb"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.target.thumbinterwork.1411131122" name="Thumb interwork (-mthumb-interwork)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.target.thumbinterwork"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.target.endiannes.1051270964" name="Endianness" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.target.endiannes"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.target.fpu.abi.1820998323" name="Float ABI" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.target.fpu.abi"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.target.fpu.unit.1099778115" name="FPU Type" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.target.fpu.unit"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.target.other.1409839459" name="Other target flags" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.target.other"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.level.701828342" name="Debug level" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.level"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.format.991010024" name="Debug format" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.format"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.other.1974714150" name="Other debugging flags" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.other"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.prof.259725136" name="Generate prof information (-p)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.prof"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.gprof.1656218322" name="Generate gprof information (-pg)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.debugging.gprof"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.addtools.createflash.814801039" name="Create Flash Image" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.addtools.createflash"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.addtools.createlisting.1444101628" name="Create Extended Listing" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.addtools.createlisting"/>
+							<option id="org.eclipse.cdt.cross.arm.gnu.linux.option.addtools.printsize.567581423" name="Print Size" superClass="org.eclipse.cdt.cross.arm.gnu.linux.option.addtools.printsize"/>
+							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF" id="org.eclipse.cdt.cross.arm.gnu.linux.platform.base.211900" isAbstract="false" name="Linux Platform" osList="linux" superClass="org.eclipse.cdt.cross.arm.gnu.linux.platform.base"/>
+							<builder id="org.eclipse.cdt.cross.arm.gnu.linux.builder.base.1380598347" managedBuildOn="false" name="ARM Linux GNU Make builder (GNUARM).Default" superClass="org.eclipse.cdt.cross.arm.gnu.linux.builder.base"/>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.assembler.base.588776560" name="ARM Linux GCC Assembler (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.assembler.base">
+								<inputType id="org.eclipse.cdt.cross.arm.gnu.linux.assembler.base.input.1309898591" superClass="org.eclipse.cdt.cross.arm.gnu.linux.assembler.base.input"/>
+							</tool>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.c.compiler.base.1925605165" name="ARM Linux GCC C Compiler (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.c.compiler.base">
+								<inputType id="org.eclipse.cdt.cross.arm.gnu.linux.c.compiler.base.input.844001047" superClass="org.eclipse.cdt.cross.arm.gnu.linux.c.compiler.base.input"/>
+							</tool>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.cpp.compiler.base.952841897" name="ARM Linux GCC C++ Compiler (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.cpp.compiler.base">
+								<inputType id="org.eclipse.cdt.cross.arm.gnu.linux.cpp.compiler.base.input.1557779924" superClass="org.eclipse.cdt.cross.arm.gnu.linux.cpp.compiler.base.input"/>
+							</tool>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.c.linker.base.954578435" name="ARM Linux GCC C Linker (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.c.linker.base"/>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.cpp.linker.base.1624506551" name="ARM Linux GCC C++ Linker (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.cpp.linker.base"/>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.archiver.base.1331058758" name="ARM Linux GCC Archiver (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.archiver.base"/>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.createflash.base.1268754327" name="ARM Linux GNU Create Flash Image (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.createflash.base"/>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.createlisting.base.1036506083" name="ARM Linux GNU Create Listing (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.createlisting.base"/>
+							<tool id="org.eclipse.cdt.cross.arm.gnu.linux.printsize.base.1927248622" name="ARM Linux GNU Print Size (GNUARM)" superClass="org.eclipse.cdt.cross.arm.gnu.linux.printsize.base"/>
+						</toolChain>
+					</folderInfo>
+				</configuration>
+			</storageModule>
+			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+		</cconfiguration>
+	</storageModule>
+	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+		<project id="UPS_new.null.711428267" name="UPS_new"/>
+	</storageModule>
+	<storageModule moduleId="scannerConfiguration">
+		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+	</storageModule>
+	<storageModule moduleId="refreshScope"/>
+	<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+		<buildTargets>
+			<target name="distclean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+				<buildCommand>make</buildCommand>
+				<buildTarget>distclean</buildTarget>
+				<stopOnError>true</stopOnError>
+				<useDefaultCommand>true</useDefaultCommand>
+				<runAllBuilders>true</runAllBuilders>
+			</target>
+			<target name="HARDWARE=bt6702 VERBOSE=1 DEBUG=0 PRINTF=custom MAC=EC-4C-4D-00-00-0A" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+				<buildCommand>make</buildCommand>
+				<buildArguments/>
+				<buildTarget>HARDWARE=bt6702 VERBOSE=1 DEBUG=0 PRINTF=custom MAC=EC-4C-4D-00-00-0A</buildTarget>
+				<stopOnError>true</stopOnError>
+				<useDefaultCommand>true</useDefaultCommand>
+				<runAllBuilders>true</runAllBuilders>
+			</target>
+		</buildTargets>
+	</storageModule>
+</cproject>

+ 5 - 0
.gdbinit_bt6702

@@ -0,0 +1,5 @@
+target remote localhost:3333
+file build/bt6702/stm32bt6702/stm32bt6702.elf
+load
+break Reset_Handler
+

+ 4 - 0
.gdbinit_bt6702_noflash

@@ -0,0 +1,4 @@
+target remote localhost:3333
+file build/bt6702/stm32bt6702/stm32bt6702.elf
+break Reset_Handler
+monitor halt

+ 3 - 0
.gdbinit_iap

@@ -0,0 +1,3 @@
+target remote localhost:3333
+load build/iap/iap/iap.hex
+file build/iap/iap/iap.elf

+ 2 - 0
.gdbinit_iap_noflash

@@ -0,0 +1,2 @@
+target remote localhost:3333
+file build/iap/iap/iap.elf

+ 79 - 0
.project

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>UPS_new</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+			<triggers>clean,full,incremental,</triggers>
+			<arguments>
+				<dictionary>
+					<key>?name?</key>
+					<value></value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.append_environment</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+					<value>all</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.buildArguments</key>
+					<value></value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.buildCommand</key>
+					<value>make</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+					<value>clean</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.contents</key>
+					<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+					<value>false</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableFullBuild</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+					<value>all</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.stopOnError</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+					<value>true</value>
+				</dictionary>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+			<triggers>full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.core.ccnature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+	</natures>
+</projectDescription>

+ 47 - 0
Makefile

@@ -0,0 +1,47 @@
+TARGETS = iap modules 
+BUILDDIR = build
+
+.PHONY: all config $(TARGETS) tools distclean
+
+all: config $(TARGETS) 
+
+CFLAGS += -DHARDWARE_$(HARDWARE)
+
+bt6702:
+	@$(MAKE) HARDWARE=$@
+
+$(TARGETS):
+	@$(MAKE) -C $@
+
+clean: $(TARGETS)
+
+distclean:
+	rm -rf build output
+
+output: $(TARGETS)
+
+
+openocd_ups:
+	$(shell openocd -f projects/gcc/configs/stm32f4discovery.cfg)
+
+gdb:
+	$(shell arm-none-eabi-gdb build/stm32bt6702/stm32bt6702.elf)
+
+reset:
+	st-flash --reset read /dev/null 0x8000000 1
+
+erase:
+	st-flash --reset erase
+
+iapflash:
+	st-flash --reset write output/iap.bin 0x8000000
+
+fwflash:	
+	st-flash --reset write output/stm32bt6702.bin 0x8020000
+
+fullflash:
+	st-flash --reset write output/iap.bin 0x8000000
+	sleep 1
+	st-flash --reset write output/stm32bt6702.bin 0x8020000
+
+

+ 71 - 0
Makefile.inc.stm32

@@ -0,0 +1,71 @@
+OUTPUTDIR = $(BUILDDIR)/../../../output
+
+DEPDIR = $(BUILDDIR)/.dep
+PWD = $(shell pwd)
+
+COMMONFLAGS = -mcpu=cortex-m4 -mthumb -ggdb3
+CFLAGS += $(COMMONFLAGS) -Os $(INCLUDES) -I.
+CFLAGS += -std=c99 -Wall -Wextra -static -fdata-sections -ffunction-sections -fno-hosted -fno-builtin
+CFLAGS += -nostdlib -nodefaultlibs -fstack-usage
+CFLAGS += -mapcs-frame -msoft-float
+CFLAGS += -Werror-implicit-function-declaration
+CFLAGS += -MD -MP -MF $(DEPDIR)/$(@F).d
+LDFLAGS = $(COMMONFLAGS) -static
+LDFLAGS += -fno-exceptions -ffunction-sections -fdata-sections
+LDFLAGS += -static -Xlinker --gc-sections
+LDFLAGS += -Wl,-Map=$(BUILDDIR)/$(TARGET).map,--cref
+ASFLAGS = $(COMMONFLAGS)
+
+
+CROSS = arm-none-eabi
+GCC = $(CROSS)-gcc
+AS = $(CROSS)-as
+SIZE = $(CROSS)-size
+OBJCOPY = $(CROSS)-objcopy
+OBJDUMP = $(CROSS)-objdump
+NM = $(CROSS)-nm
+
+COBJ = $(addprefix $(BUILDDIR)/, $(CSRC:.c=.c.o))
+ASMOBJ = $(addprefix $(BUILDDIR)/, $(ASMSRC:.s=.s.o))
+OBJ = $(COBJ) $(ASMOBJ)
+
+V = $(if $(VERBOSE), , @)
+
+VCS = svn
+
+
+all: prebuild $(BUILDDIR)/$(TARGET).bin postbuild
+	@$(SIZE) $(BUILDDIR)/$(TARGET).elf
+	@$(SIZE) $(BUILDDIR)/$(TARGET).elf -A | awk '/.data/ || /.bss/ || /.memory_b1_text/ {sum+=$$2} END{per=sum/192/1024*100 ; print "RAM: "  per"% ", sum " bytes (" 192*1024-sum " bytes free )"}'
+	@$(SIZE) $(BUILDDIR)/$(TARGET).elf -A | awk '/.fill/ {fill=$$2} END{per=(640*1024-fill)/640/1024*100 ; print "FLASH: "  per"% ", 640*1024-fill " bytes (" fill " bytes free)"}' 
+	@echo =======================================================================
+
+$(BUILDDIR)/$(TARGET).bin: $(BUILDDIR)/$(TARGET).elf
+	@$(OBJCOPY) -O binary $(BUILDDIR)/$(TARGET).elf $(BUILDDIR)/$(TARGET).bin
+	@$(OBJCOPY) -O ihex $(BUILDDIR)/$(TARGET).elf $(BUILDDIR)/$(TARGET).hex
+	@$(OBJDUMP) -h -S -z $(BUILDDIR)/$(TARGET).elf > $(BUILDDIR)/$(TARGET).lss
+	@$(NM) -n $(BUILDDIR)/$(TARGET).elf > $(BUILDDIR)/$(TARGET).sym
+	@mkdir -p $(OUTPUTDIR)
+	@cp $(BUILDDIR)/$(TARGET).bin $(OUTPUTDIR)
+	
+$(BUILDDIR)/$(TARGET).elf: $(OBJ)
+	@echo Linking $@
+	$(V)$(GCC) $(LDFLAGS) -T $(PWD)/$(LDSCRIPT) -o $@ $(OBJ)
+
+$(COBJ): $(BUILDDIR)/%.c.o : %.c
+	@echo Compiling $<
+	@-mkdir -p $(@D)
+	$(V)$(GCC) $(CFLAGS) -c $< -o $@
+
+$(ASMOBJ): $(BUILDDIR)/%.s.o : %.s
+	@echo Assembling $<
+	@-mkdir -p $(@D)
+	$(V)$(AS) $(ASFLAGS) -c ./$< -o $@
+
+
+-include $(shell mkdir -p $(DEPDIR) 2>/dev/null) $(wildcard $(DEPDIR)/*)
+
+.PHONY: clean output
+
+clean:
+	rm -rf $(BUILDDIR)

TEMPAT SAMPAH
tracefile.bin