Skip to content

Commit ccf794c

Browse files
committed
Added test makefile targets for test automation
1 parent d8c9c15 commit ccf794c

5 files changed

Lines changed: 47 additions & 2 deletions

File tree

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ NO_ASM?=0
1919
EXT_FLASH?=0
2020
ALLOW_DOWNGRADE?=0
2121
NVM_FLASH_WRITEONCE?=0
22-
2322
LSCRIPT:=hal/$(TARGET).ld
2423

2524
OBJS:= \
@@ -145,9 +144,12 @@ wolfboot-align.bin: wolfboot.elf
145144
$(OBJCOPY) -O binary $^ $@ --pad-to=$(BOOT0_OFFSET) --gap-fill=255
146145
$(SIZE) wolfboot.elf
147146

147+
148148
test-app/image.bin:
149149
make -C test-app TARGET=$(TARGET) EXT_FLASH=$(EXT_FLASH)
150150

151+
include tools/test.mk
152+
151153
tools/ed25519/ed25519_sign:
152154
make -C tools/ed25519
153155

@@ -188,3 +190,5 @@ distclean: clean
188190
make -C tools/ecc256 clean
189191
rm -f *.pem *.der tags ./src/ed25519_pub_key.c ./src/ecc256_pub_key.c
190192

193+
FORCE:
194+

lib/wolfssl

Submodule wolfssl updated 163 files

test-app/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ static int check(uint8_t *pkt, int size)
182182
return -1;
183183
}
184184

185+
volatile uint32_t time_elapsed = 0;
185186
void main(void) {
186187
uint32_t tlen = 0;
187188
volatile uint32_t recv_seq;
@@ -209,6 +210,9 @@ void main(void) {
209210
memset(page, 0xFF, PAGESIZE);
210211
asm volatile ("cpsie i");
211212

213+
while(time_elapsed == 0)
214+
WFI();
215+
212216

213217
hal_flash_unlock();
214218
version = wolfBoot_current_firmware_version();

test-app/timer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ int timer_init(uint32_t clock, uint32_t prescaler, uint32_t interval_ms)
145145
return 0;
146146
}
147147

148+
extern volatile uint32_t time_elapsed;
148149
void isr_tim2(void)
149150
{
150151
static volatile uint32_t tim2_ticks = 0;
@@ -158,6 +159,7 @@ void isr_tim2(void)
158159
else
159160
pwm_init(master_clock, 10 * tim2_ticks);
160161

162+
time_elapsed++;
161163
}
162164

163165

tools/test.mk

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
TEST_UPDATE_VERSION?=2
2+
EXPVER=tools/test-expect-version/test-expect-version
3+
4+
$(EXPVER):
5+
make -C tools/test-expect-version
6+
7+
test-update: test-app/image.bin FORCE
8+
$(SIGN_TOOL) test-app/image.bin $(PRIVATE_KEY) $(TEST_UPDATE_VERSION) 131072
9+
dd if=test-app/image.bin.v$(TEST_UPDATE_VERSION).signed of=test-update.bin bs=1 count=131067
10+
printf "pBOOT" >> test-update.bin
11+
sudo st-term reset init || true
12+
sleep 2
13+
sudo st-flash --reset write test-update.bin 0x08040000
14+
15+
test-erase: FORCE
16+
sudo st-term reset init || true
17+
sleep 2
18+
sudo st-flash erase
19+
20+
21+
test-factory: factory.bin
22+
sudo st-term reset init || true
23+
sleep 2
24+
sudo st-flash --reset write factory.bin 0x08000000
25+
26+
test-reset: FORCE
27+
sudo st-info --reset || true
28+
29+
30+
31+
## Test cases:
32+
33+
test-00-forward-update: $(EXPVER) FORCE
34+
make test-factory
35+
$(EXPVER)

0 commit comments

Comments
 (0)