Skip to content

Commit

Permalink
Allowing make all to pull only the required submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
lains committed Feb 17, 2024
1 parent bc9b556 commit 75e0373
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
22 changes: 8 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ ALL_OBJS = $(ALL_OBJS_SIMPLIFIED)

.PHONY: clean gdb-server_stlink gdb-server_openocd gdb-client

all: sanity elf
all: sanity fetch_bsp fetch_libticdecode elf

elf: $(SRC_BUILD_PREFIX)/$(BINARY).elf
bin: $(SRC_BUILD_PREFIX)/$(BINARY).bin
Expand All @@ -167,26 +167,20 @@ GENERATED_BINARIES=$(SRC_BUILD_PREFIX)/$(BINARY).elf \

sanity:

$(TARGET_BOARD_BSP_DIR):
fetch_bsp: $(TARGET_BOARD_BSP_DIR) $(TOPDIR)/.gitmodules
@echo " GIT $(<)"
@git submodule init $(TARGET_BOARD_BSP_DIR) && git submodule update

@git submodule init $(<) && git submodule update

fetch_libticdecode: ticdecodecpp $(TOPDIR)/.gitmodules
@echo " GIT $(<)"
@git submodule init $(<) && git submodule update

# Cross-compilation targets
$(SRC_BUILD_PREFIX)/%.o: %.s
@echo " CC $(<)"
@mkdir -p $(dir $@)
$(Q)$(CROSS_CC) $(CFLAGS) -o $@ -c $<

$(SRC_BUIL_PREFIX)/$(TARGET_BOARD_BSP_DIR)/%.o: %s $(TARGET_BOARD_BSP_DIR)
@echo " CC $(<)"
@mkdir -p $(dir $@)
$(Q)$(CROSS_CC) $(CFLAGS) -o $@ -c $<

$(SRC_BUILD_PREFIX)/$(TARGET_BOARD_BSP_DIR)/%.o: %.c $(TARGET_BOARD_BSP_DIR)
@echo " CC $(<)"
@mkdir -p $(dir $@)
$(Q)$(CROSS_CC) $(INCLUDES) $(CXXFLAGS) $(CFLAGS) -o $(@) -c $<

$(SRC_BUILD_PREFIX)/%.o: %.c
@echo " CC $(<)"
@mkdir -p $(dir $@)
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ The STM32-compatible makefile structure has been adapted from [a project develop
* The appropriate _STM32Cube MCU Firmware Package_ will be directly cloned as a submodule of this repository
* _ST-Link or OpenOCD_ - For debugging, you will need software that knows how to talk to your debug hardware over USB. On the Nucleo-144 board, there is an ST-Link debugger. You can talk to it using [ST-Link tools](https://github.com/stlink-org/stlink) or [OpenOCD](https://sourceforge.net/p/openocd/code/ci/master/tree/). On Linux I was able to build both of these packages from source easily following the instructions. On macOS both packages were downloadable in binary form using `brew install stlink openocd`.

In order to clone this repository, use `git clone --recursive`, this will allow to pull both the STM32Cube firmware package and the ticdecodecpp library.
In order to clone this repository, you may use `git clone --recursive`, this will allow to pull all supported STM32Cube firmware package and the ticdecodecpp library, however, this might take unnecessary time because it will pull firmwares for platforms you don't want to support.

Instead, you can directly pull only the necessary bsp by running `make all` (which is turn invokes `make fetch_bsp`) as indicated below.

### Build & flash

* Simply run `make` to build the project.
* Simply run `make all` to build the project.
* To program to a board via a ST-Link proble, just type: `make flash`. The target board will be flashed with the binary thas has been built.

### Executing
Expand Down

0 comments on commit 75e0373

Please sign in to comment.