mirror of https://github.com/wolfSSL/wolfBoot.git
Test through 'test-delta' target
- changed syntax for test-expect-version to accept a UART_DEVpull/125/head
parent
3b0c434a13
commit
301bc3e0b6
1
Makefile
1
Makefile
|
@ -82,6 +82,7 @@ standalone:
|
|||
|
||||
include tools/test.mk
|
||||
include tools/test-enc.mk
|
||||
include tools/test-delta.mk
|
||||
|
||||
ed25519.der:
|
||||
$(Q)$(KEYGEN_TOOL) $(KEYGEN_OPTIONS) src/ed25519_pub_key.c
|
||||
|
|
|
@ -110,6 +110,10 @@ endif
|
|||
ifeq ($(UART_FLASH),1)
|
||||
CFLAGS+=-D"UART_FLASH=1"
|
||||
APP_OBJS+= ../src/uart_flash.o ../hal/uart/uart_drv_$(UART_TARGET).o
|
||||
else
|
||||
ifeq ($(TARGET),stm32wb)
|
||||
APP_OBJS+=../hal/uart/uart_drv_$(UART_TARGET).o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),kinetis)
|
||||
|
|
|
@ -39,11 +39,17 @@ void main(void) {
|
|||
uint32_t updv;
|
||||
hal_init();
|
||||
boot_led_on();
|
||||
uart_init(115200, 8, 'N', 1);
|
||||
#ifdef SPI_FLASH
|
||||
spi_flash_probe();
|
||||
#endif
|
||||
version = wolfBoot_current_firmware_version();
|
||||
updv = wolfBoot_update_firmware_version();
|
||||
uart_tx('*');
|
||||
uart_tx((version >> 24) & 0xFF);
|
||||
uart_tx((version >> 16) & 0xFF);
|
||||
uart_tx((version >> 8) & 0xFF);
|
||||
uart_tx(version & 0xFF);
|
||||
if ((version == 1) && (updv != 8)) {
|
||||
uint32_t sz;
|
||||
boot_led_off();
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
DELTA_TEST_UPDATE_VERSION?=2
|
||||
SIGN_ARGS?=--ecc256
|
||||
SIGN_DELTA_ARGS?=--ecc256 --encrypt /tmp/enc_key.der
|
||||
USBTTY?=/dev/ttyACM0
|
||||
TIMEOUT?=60
|
||||
EXPVER=tools/test-expect-version/test-expect-version /dev/ttyACM0
|
||||
|
||||
tools/uart-flash-server/ufserver: FORCE
|
||||
@make -C `dirname $@`
|
||||
@rm -f src/libwolfboot.o
|
||||
|
||||
|
||||
test-delta-update: factory.bin test-app/image.bin tools/uart-flash-server/ufserver tools/delta/bmdiff
|
||||
@st-flash erase
|
||||
@diff .config config/examples/stm32wb-delta.config || (echo "\n\n*** Error: please copy config/examples/stm32wb-delta.config to .config to run this test\n\n" && exit 1)
|
||||
$(SIGN_TOOL) $(SIGN_ARGS) --delta test-app/image_v1_signed.bin test-app/image.bin \
|
||||
$(PRIVATE_KEY) $(DELTA_TEST_UPDATE_VERSION)
|
||||
@st-flash write factory.bin 0x08000000
|
||||
@echo Expecting version '1'
|
||||
@(test `$(EXPVER)` -eq 1)
|
||||
@echo
|
||||
@st-flash write test-app/image_v2_signed_diff.bin 0x08028000
|
||||
@sleep 1
|
||||
@st-flash reset
|
||||
@echo Expecting version '1'
|
||||
@(test `$(EXPVER)` -eq 1)
|
||||
@sleep 10
|
||||
@st-flash reset
|
||||
@echo Expecting version '2'
|
||||
@(test `$(EXPVER)` -eq 2)
|
||||
@echo "TEST SUCCESSFUL"
|
||||
|
|
@ -70,12 +70,16 @@ int main(int argc, char** argv)
|
|||
sigset(SIGALRM, alarm_handler);
|
||||
|
||||
|
||||
if (argc > 2) {
|
||||
printf("Usage: %s [trigger command]\n", argv[0]);
|
||||
if ((argc > 3) || (argc < 2)) {
|
||||
printf("Usage: %s UART_TTY [trigger command]\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
serialfd = open(UART_DEV, O_RDWR | O_NOCTTY);
|
||||
serialfd = open(argv[1], O_RDWR | O_NOCTTY);
|
||||
if (serialfd < 0) {
|
||||
fprintf(stderr, "Cannot open serial port %s: %s\n", argv[1], strerror(errno));
|
||||
exit(2);
|
||||
}
|
||||
tcgetattr(serialfd, &tty);
|
||||
cfsetospeed(&tty, B115200);
|
||||
cfsetispeed(&tty, B115200);
|
||||
|
@ -92,9 +96,9 @@ int main(int argc, char** argv)
|
|||
|
||||
alarm(TIMEOUT);
|
||||
|
||||
if (argc > 1) {
|
||||
if (argc > 2) {
|
||||
fprintf(stderr, "Executing \"%s\"\n", argv[1]);
|
||||
system(argv[1]);
|
||||
system(argv[2]);
|
||||
}
|
||||
|
||||
while (i >= 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
TEST_UPDATE_VERSION?=2
|
||||
WOLFBOOT_VERSION?=0
|
||||
EXPVER=tools/test-expect-version/test-expect-version
|
||||
EXPVER=tools/test-expect-version/test-expect-version /dev/ttyS0
|
||||
BINASSEMBLE=tools/bin-assemble/bin-assemble
|
||||
SPI_CHIP=SST25VF080B
|
||||
SPI_OPTIONS=SPI_FLASH=1 WOLFBOOT_PARTITION_SIZE=0x80000 WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x00000 WOLFBOOT_PARTITION_SWAP_ADDRESS=0x80000
|
||||
|
|
Loading…
Reference in New Issue