diff options
author | Karl Palsson <karlp@tweak.net.au> | 2019-01-11 22:50:05 +0000 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2019-01-11 22:50:05 +0000 |
commit | e392dd5c4194543ab637bff72754a2669d3aac43 (patch) | |
tree | 302f4f9df33de136ed133ec874c7c1d42368915c | |
parent | 550c702cdbb9f7148376f3c3342f7fcc826eac6e (diff) | |
download | stm32f103c8-examples-e392dd5c4194543ab637bff72754a2669d3aac43.tar stm32f103c8-examples-e392dd5c4194543ab637bff72754a2669d3aac43.tar.zst stm32f103c8-examples-e392dd5c4194543ab637bff72754a2669d3aac43.zip |
Demonstrate assembly source files
-rw-r--r-- | my-project/Makefile | 1 | ||||
-rw-r--r-- | my-project/my-project.c | 5 | ||||
-rw-r--r-- | rules.mk | 10 |
3 files changed, 14 insertions, 2 deletions
diff --git a/my-project/Makefile b/my-project/Makefile index 2d009c3..5b6afde 100644 --- a/my-project/Makefile +++ b/my-project/Makefile @@ -4,6 +4,7 @@ BUILD_DIR = bin SHARED_DIR = ../my-common-code CFILES = my-project.c CFILES += api.c +AFILES += api-asm.S # TODO - you will need to edit these two lines! DEVICE=stm32f407vgt6 diff --git a/my-project/my-project.c b/my-project/my-project.c index f550c66..7f5bc79 100644 --- a/my-project/my-project.c +++ b/my-project/my-project.c @@ -1,6 +1,9 @@ #include "api.h" +#include "api-asm.h" int main(void) { /* add your own code */ - return my_func(3); + uint32_t rev = 0xaabbccdd; + rev = rev_bytes(rev); + return my_func(rev); } @@ -56,6 +56,7 @@ OPENCM3_INC = $(OPENCM3_DIR)/include INCLUDES += $(patsubst %,-I%, . $(OPENCM3_INC) ) OBJS = $(CFILES:%.c=$(BUILD_DIR)/%.o) +OBJS += $(AFILES:%.S=$(BUILD_DIR)/%.o) GENERATED_BINS = $(PROJECT).elf $(PROJECT).bin $(PROJECT).map $(PROJECT).list $(PROJECT).lss TGT_CPPFLAGS += -MD @@ -75,6 +76,8 @@ TGT_CXXFLAGS += -fno-common TGT_CXXFLAGS += -ffunction-sections -fdata-sections TGT_CXXFLAGS += -Wextra -Wshadow -Wredundant-decls -Weffc++ +TGT_ASFLAGS += $(OPT) $(ARCH_FLAGS) -ggdb3 + TGT_LDFLAGS += -T$(LDSCRIPT) -L$(OPENCM3_DIR)/lib -nostartfiles TGT_LDFLAGS += $(ARCH_FLAGS) TGT_LDFLAGS += -specs=nano.specs @@ -95,7 +98,7 @@ LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group # Burn in legacy hell fortran modula pascal yacc idontevenwat .SUFFIXES: -.SUFFIXES: .c .h .o .cxx .elf .bin .list .lss +.SUFFIXES: .c .S .h .o .cxx .elf .bin .list .lss # Bad make, never *ever* try to get a file out of source control by yourself. %: %,v @@ -129,6 +132,11 @@ $(BUILD_DIR)/%.o: %.cxx @mkdir -p $(dir $@) $(Q)$(CC) $(TGT_CXXFLAGS) $(CXXFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $@ -c $< +$(BUILD_DIR)/%.o: %.S + @printf " AS\t$<\n" + @mkdir -p $(dir $@) + $(Q)$(CC) $(TGT_ASFLAGS) $(ASFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $@ -c $< + $(PROJECT).elf: $(OBJS) $(LDSCRIPT) $(LIBDEPS) @printf " LD\t$@\n" $(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@ |