SE050 ハードウェア接続テスト追加

- test_scp03_se050.c: 実機 SE050 接続テスト
- 対応チップ:SE050C0, SE050C1, SE050E0, SE050E1
- ifdef でチップ選択 (make SE050_CHIP=xxx)
- AN12436 デフォルト PlatformSCP03 キー使用
- 実 I2C HAL による接続/認証フローテスト

使用例:
  make SE050_CHIP=SE050C0 test_se050
  make SE050_CHIP=SE050E1 test_se050
This commit is contained in:
km
2026-03-26 09:29:39 +09:00
parent 2ad959bde9
commit 0a97209e8c
3 changed files with 597 additions and 3 deletions
+38 -3
View File
@@ -27,9 +27,29 @@ LIB = libse050_wireguard.a
# Test executables
TEST_SCP03 = test_scp03
TEST_HARDWARE = test_scp03_hardware
TEST_SE050 = test_scp03_se050
# Chip selection (default: SE050C0)
SE050_CHIP ?= SE050C0
# I2C bus options
I2C_OPTS ?=
# Chip ID mapping
ifeq ($(SE050_CHIP),SE050C0)
CHIP_ID = 0
else ifeq ($(SE050_CHIP),SE050C1)
CHIP_ID = 1
else ifeq ($(SE050_CHIP),SE050E0)
CHIP_ID = 2
else ifeq ($(SE050_CHIP),SE050E1)
CHIP_ID = 3
else
$(error Invalid SE050_CHIP. Use SE050C0, SE050C1, SE050E0, or SE050E1)
endif
# Default target
all: $(LIB) $(TEST_SCP03) $(TEST_HARDWARE)
all: $(LIB) $(TEST_SCP03) $(TEST_HARDWARE) $(TEST_SE050)
# Create build directory
build:
@@ -49,6 +69,11 @@ $(TEST_HARDWARE): tests/test_scp03_hardware.c $(LIB)
@mkdir -p build
$(CC) $(CFLAGS) -o build/$@ $< build/$(LIB) $(LDFLAGS)
# SE050 hardware test with chip selection
$(TEST_SE050): tests/test_scp03_se050.c $(LIB)
@mkdir -p build
$(CC) $(CFLAGS) -DSE050_CHIP=$(CHIP_ID) -o build/$@ $< build/$(LIB) $(LDFLAGS)
# Compile source files
src/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
@@ -57,13 +82,23 @@ src/%.o: src/%.c
tests/%.o: tests/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Run tests
# Run all tests
test: all
@echo "Running SCP03 tests..."
./build/$(TEST_SCP03)
@echo ""
@echo "Running SCP03 hardware tests..."
@echo "Running SCP03 hardware tests (mock)..."
./build/$(TEST_HARDWARE)
@echo ""
@echo "Note: To run SE050 hardware tests, use:"
@echo " make SE050_CHIP=SE050C0 test_se050"
# Run SE050 hardware tests (requires actual hardware)
test_se050: $(TEST_SE050)
@echo "Running SE050 hardware tests..."
@echo "Chip: $(SE050_CHIP)"
@echo "I2C Bus: /dev/i2c-1 (use I2C_BUS=/dev/i2c-X to change)"
./build/$(TEST_SE050) $(I2C_OPTS)
# Clean build artifacts
clean: