Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ ubuntu*.log

# EEPROM image file (created by SITL)
eeprom.bin

src/rustemu/include/*
src/rustemu/target/*
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ INCLUDE_DIRS := $(INCLUDE_DIRS) \
INCLUDE_DIRS := $(INCLUDE_DIRS) \
$(TARGET_DIR)

RUSTEMU_DIR := $(ROOT)/src/rustemu
RUSTEMU_INCLUDE_DIR := $(RUSTEMU_DIR)/include/
RUSTEMU_TARGET_DIR := $(RUSTEMU_DIR)/target/thumbv7em-none-eabihf/release
RUSTEMU_HEADER := $(RUSTEMU_INCLUDE_DIR)/rustemu.h
RUSTEMU_LIBRARY := $(RUSTEMU_TARGET_DIR)/librustemu.a
RUSTEMU_SRC := $(shell find $(RUSTEMU_DIR)/src -name '*.rs')

INCLUDE_DIRS := $(INCLUDE_DIRS) \
$(RUSTEMU_INCLUDE_DIR)

EXTRA_LD_FLAGS := $(EXTRA_LD_FLAGS) -L$(RUSTEMU_TARGET_DIR) -lrustemu

VPATH := $(VPATH):$(TARGET_DIR)

include $(ROOT)/make/source.mk
Expand Down Expand Up @@ -327,6 +339,12 @@ CLEAN_ARTIFACTS += $(TARGET_DFU)
# Make sure build date and revision is updated on every incremental build
$(OBJECT_DIR)/$(TARGET)/build/version.o : $(SRC)

$(RUSTEMU_LIBRARY): $(RUSTEMU_SRC)
cd src/rustemu && cargo build --release --target thumbv7em-none-eabihf

$(RUSTEMU_HEADER): $(RUSTEMU_LIBRARY)
cd src/rustemu && cbindgen --lang c -o $(PWD)/$(RUSTEMU_HEADER)

# List of buildable ELF files and their object dependencies.
# It would be nice to compute these lists, but that seems to be just beyond make.

Expand Down Expand Up @@ -390,7 +408,7 @@ $(TARGET_HEX): $(TARGET_BIN)

endif

$(TARGET_ELF): $(TARGET_OBJS) $(LD_SCRIPT)
$(TARGET_ELF): $(RUSTEMU_HEADER) $(RUSTEMU_LIBRARY) $(TARGET_OBJS) $(LD_SCRIPT)
@echo "Linking $(TARGET)" "$(STDOUT)"
$(V1) $(CROSS_CC) -o $@ $(filter-out %.ld,$^) $(LD_FLAGS)
$(V1) $(SIZE) $(TARGET_ELF)
Expand Down Expand Up @@ -683,7 +701,6 @@ test_versions:
test_%:
$(V0) cd src/test && $(MAKE) $@


# rebuild everything when makefile changes
$(TARGET_OBJS): Makefile $(TARGET_DIR)/target.mk $(wildcard make/*)

Expand Down
3 changes: 2 additions & 1 deletion src/main/blackbox/blackbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
#include "build/debug.h"
#include "build/version.h"

#include <rustemu.h>

#include "common/axis.h"
#include "common/encoding.h"
#include "common/maths.h"
#include "common/time.h"
#include "common/utils.h"
Expand Down
2 changes: 1 addition & 1 deletion src/main/blackbox/blackbox_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include "blackbox_encoding.h"
#include "blackbox_io.h"

#include "common/encoding.h"
#include "common/printf.h"

#include <rustemu.h>

static void _putc(void *p, char c)
{
Expand Down
53 changes: 0 additions & 53 deletions src/main/common/encoding.c

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/common/encoding.h

This file was deleted.

Loading