Skip to content

Commit

Permalink
Make the rust project the main application_processor directory
Browse files Browse the repository at this point in the history
  • Loading branch information
pawnlord committed Jan 28, 2024
1 parent 4f839ed commit f7795cc
Show file tree
Hide file tree
Showing 30 changed files with 40 additions and 25 deletions.
7 changes: 7 additions & 0 deletions application_processor/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[target.thumbv7em-none-eabihf]


rustflags = [
"-C", "link-arg=--nmagic",
"-C", "link-arg=--verbose"
]
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions application_processor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ include $(LIBS_DIR)/libs.mk

# Include the rules for building for this target. All other makefiles should be
# included before this one.
include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk
include $(TARGET_LC).mk

# Include the rules that integrate the SBTs. SBTs are a special case that must be
# include after the core gcc rules to extend them.
Expand All @@ -416,13 +416,15 @@ MAKECMDGOALS:=$(.DEFAULT_GOAL)
endif


all:
all: lib
# Extend the functionality of the "all" recipe here
arm-none-eabi-size --format=berkeley $(BUILD_DIR)/$(PROJECT).elf
mv $(BUILD_DIR)/$(PROJECT).a $(BUILD_DIR)/lib$(PROJECT).a
mkdir -p ../build
cargo make -e BUILD_TYPE=release ap --verbose

libclean:
$(MAKE) -f ${PERIPH_DRIVER_DIR}/periphdriver.mk clean.periph

clean:
# Extend the functionality of the "clean" recipe here

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion rust_ap/bindgen.h → application_processor/bindgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
#include "mxc_errors.h"
#include "string.h"
#include "stdbool.h"
#include "stdint.h"
#include "stdint.h"
#include "global_secrets.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions application_processor/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,21 @@ override BOARD=FTHR_RevA
MFLOAT_ABI=soft

IPATH+=../deployment
IPATH+=inc/
VPATH+=src/

# ****************** eCTF Bootloader *******************
# DO NOT REMOVE
LINKERFILE=firmware.ld
STARTUPFILE=startup_firmware.S
ENTRY=firmware_startup


# ****************** eCTF Crypto Example *******************
# Uncomment the commented lines below and comment the disable
# lines to enable the eCTF Crypto Example.
# WolfSSL must be included in this directory as wolfssl/
# WolfSSL can be downloaded from: https://www.wolfssl.com/download/

# Disable Crypto Example
CRYPTO_EXAMPLE=0

# Enable Crypto Example
#CRYPTO_EXAMPLE=1
File renamed without changes.
2 changes: 1 addition & 1 deletion rust_ap/src/main.rs → application_processor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod bindings;
#[no_mangle]
pub extern "C" fn main(_argc: isize, _argv: *const *const u8) -> isize {
unsafe {
bindings::tmpfile();

}
0
}
Expand Down
17 changes: 8 additions & 9 deletions ectf_tools/build_ap.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ def build_ap(

logger.info("Running build")
output = asyncio.run(run_shell(
f" cd {design} "
f" && pwd"
f" && nix-shell --command \""
f" cd rust_ap"
f" && make clean"
f" && make && make release"
# f" && cp build/max78000.elf {output_elf} "
# f" && cp build/max78000.bin {output_bin}"
f"\""
f"cd {design} && "
f"pwd && "
f"nix-shell --command "
f"\"cd application_processor && "
f" make clean && "
f" make && make release && "
f" cp build/max78000.elf {output_elf} && "
f" cp build/max78000.bin {output_bin}\""
))

if not os.path.exists(output_bin):
Expand Down
10 changes: 4 additions & 6 deletions rust_ap/Makefile → insecure_application_processor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ include $(LIBS_DIR)/libs.mk

# Include the rules for building for this target. All other makefiles should be
# included before this one.
include $(TARGET_LC).mk
include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk

# Include the rules that integrate the SBTs. SBTs are a special case that must be
# include after the core gcc rules to extend them.
Expand All @@ -416,15 +416,13 @@ MAKECMDGOALS:=$(.DEFAULT_GOAL)
endif


all: lib
all:
# Extend the functionality of the "all" recipe here
mv $(BUILD_DIR)/$(PROJECT).a $(BUILD_DIR)/lib$(PROJECT).a
mkdir -p ../build
cargo make -e BUILD_TYPE=release ap --verbose
arm-none-eabi-size --format=berkeley $(BUILD_DIR)/$(PROJECT).elf

libclean:
$(MAKE) -f ${PERIPH_DRIVER_DIR}/periphdriver.mk clean.periph

clean:
# Extend the functionality of the "clean" recipe here

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions insecure_application_processor/inc/ectf_params.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef __ECTF_PARAMS__
#define __ECTF_PARAMS__
#define AP_PIN "123456"
#define AP_TOKEN "0123456789abcdef"
#define COMPONENT_IDS 0x11111124, 0x11111125
#define COMPONENT_CNT 2
#define AP_BOOT_MSG "Test boot message"
#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,23 @@ override BOARD=FTHR_RevA
MFLOAT_ABI=soft

IPATH+=../deployment
IPATH+=inc/
VPATH+=src/

# ****************** eCTF Bootloader *******************
# DO NOT REMOVE
LINKERFILE=firmware.ld
STARTUPFILE=startup_firmware.S
ENTRY=firmware_startup


# ****************** eCTF Crypto Example *******************
# Uncomment the commented lines below and comment the disable
# lines to enable the eCTF Crypto Example.
# WolfSSL must be included in this directory as wolfssl/
# WolfSSL can be downloaded from: https://www.wolfssl.com/download/

# Disable Crypto Example
CRYPTO_EXAMPLE=0

# Enable Crypto Example
#CRYPTO_EXAMPLE=1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f7795cc

Please sign in to comment.