Skip to content

Commit 2e55152

Browse files
committed
feat(build): update build structure and versioning
Refactor the build system by changing the object directory to 'Build' from 'obj', enhancing clarity in the output structure. Update the firmware version from 1.0.0 to 2.0.1, reflecting new developments. Adjust the Makefile rules to accommodate the new directory structure for binaries and objects, ensuring proper organization of build artifacts. Additionally, increment the patch level in version.h to indicate minor bug fixes. These changes aim to streamline the build process and provide clearer version management.
1 parent 98ae78a commit 2e55152

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#object files
2-
obj/
2+
Build/
33
#static lib files
44
libs/
55
#Cygnus project settings files and hidden files

Makefile

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ TARGET ?= PRIMUSX
3030
BUILD_TYPE ?= BIN
3131
LIB_MAJOR_VERSION = 0
3232
LIB_MINOR_VERSION = 3
33-
FW_Version = 1.0.0
33+
FW_Version = 2.0.1
3434
API_Version = 1.0.1
3535
# Flash size (KB). Some low-end chips actually have more flash than advertised, use this to override.
3636
FLASH_SIZE ?=
@@ -66,8 +66,7 @@ VALID_TARGETS = PRIMUSV3R PRIMUSX
6666

6767
ROOT := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
6868
SRC_DIR = $(ROOT)/src/main
69-
OBJECT_DIR = $(ROOT)/obj/main
70-
BIN_DIR = $(ROOT)/obj
69+
BUILD_DIR = $(ROOT)/Build
7170
CMSIS_DIR = $(ROOT)/lib/main/CMSIS
7271
INCLUDE_DIRS = $(SRC_DIR)
7372
LINKER_DIR = $(ROOT)/src/main/target
@@ -489,12 +488,12 @@ ifeq ($(filter $(TARGET),$(VALID_TARGETS)),)
489488
$(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS))
490489
endif
491490

492-
TARGET_BIN = $(BIN_DIR)/$(FORKNAME)_$(TARGET).bin
493-
TARGET_HEX = $(BIN_DIR)/Experience_PLUTOX.hex
494-
TARGET_ELF = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).elf
495-
TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $($(TARGET)_SRC))))
496-
TARGET_DEPS = $(addsuffix .d,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $($(TARGET)_SRC))))
497-
TARGET_MAP = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).map
491+
TARGET_BIN = $(BUILD_DIR)/$(TARGET)/$(FORKNAME)_$(TARGET).bin
492+
TARGET_HEX = $(BUILD_DIR)/$(TARGET)/$(TARGET)-$(FW_Version).hex
493+
TARGET_ELF = $(BUILD_DIR)/$(TARGET)/$(FORKNAME)_$(TARGET).elf
494+
TARGET_MAP = $(BUILD_DIR)/$(TARGET)/$(FORKNAME)_$(TARGET).map
495+
TARGET_OBJS = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(TARGET)/bin/,$(basename $($(TARGET)_SRC))))
496+
TARGET_DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(TARGET)/bin/,$(basename $($(TARGET)_SRC))))
498497

499498
# List of buildable ELF files and their object dependencies.
500499
# It would be nice to compute these lists, but that seems to be just beyond make.
@@ -517,24 +516,24 @@ libs/libpluto_$(LIB_MAJOR_VERSION).$(LIB_MINOR_VERSION).a: $(TARGET_OBJS)
517516
$(AR) rcs $@ $^
518517

519518

520-
$(OBJECT_DIR)/$(TARGET)/%.o: %.cpp
519+
$(BUILD_DIR)/$(TARGET)/bin/%.o: %.cpp
521520
@mkdir -p $(dir $@)
522521
@echo %% $(notdir $<)
523522
@$(CC) -c -o $@ $(CCFLAGS) $<
524523

525524

526-
$(OBJECT_DIR)/$(TARGET)/%.o: %.c
525+
$(BUILD_DIR)/$(TARGET)/bin/%.o: %.c
527526
@mkdir -p $(dir $@)
528527
@echo %% $(notdir $<)
529528
@$(C) -c -o $@ $(CFLAGS) $<
530529

531530
# Assemble
532-
$(OBJECT_DIR)/$(TARGET)/%.o: %.s
531+
$(BUILD_DIR)/$(TARGET)/bin/%.o: %.s
533532
@mkdir -p $(dir $@)
534533
@echo %% $(notdir $<)
535534
@$(CC) -c -o $@ $(ASFLAGS) $<
536535

537-
$(OBJECT_DIR)/$(TARGET)/%.o: %.S
536+
$(BUILD_DIR)/$(TARGET)/bin/%.o: %.S
538537
@mkdir -p $(dir $@)
539538
@echo %% $(notdir $<)
540539
@$(CC) -c -o $@ $(ASFLAGS) $<
@@ -545,7 +544,7 @@ libcreate: libs/libpluto_$(LIB_MAJOR_VERSION).$(LIB_MINOR_VERSION).a
545544
## clean : clean up all temporary / machine-generated files
546545
clean:
547546
rm -f $(TARGET_BIN) $(TARGET_HEX) $(TARGET_ELF) $(TARGET_OBJS) $(TARGET_MAP)
548-
rm -rf $(OBJECT_DIR)/$(TARGET)
547+
rm -rf $(BUILD_DIR)/$(TARGET)
549548
cd src/test && $(MAKE) clean || true
550549

551550
flash_$(TARGET): $(TARGET_HEX)

src/main/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C" {
2222

2323
#define FC_VERSION_MAJOR 2 // increment when a major release is made (big new feature, etc)
2424
#define FC_VERSION_MINOR 0 // increment when a minor release is made (small new feature, change etc)
25-
#define FC_VERSION_PATCH_LEVEL 0 // increment when a bug is fixed
25+
#define FC_VERSION_PATCH_LEVEL 1 // increment when a bug is fixed
2626

2727
#define STR_HELPER( x ) #x
2828
#define STR( x ) STR_HELPER ( x )

0 commit comments

Comments
 (0)