reboot and pass tests

This commit is contained in:
Conor Patrick
2018-12-03 00:01:41 -05:00
parent bfa2d2830d
commit eb39e0f2c4
5 changed files with 26 additions and 43 deletions

View File

@@ -4,7 +4,7 @@
#define DEBUG_UART USART1
#define DEBUG_LEVEL 1
#define DEBUG_LEVEL 0
#define NON_BLOCK_PRINTING 0

View File

@@ -166,6 +166,7 @@ int main(int argc, char * argv[])
if (REBOOT_FLAG)
{
delay(250);
device_reboot();
}
}

View File

@@ -102,7 +102,7 @@ void delay(uint32_t ms)
}
void device_reboot()
{
NVIC_SystemReset();
}
void device_init()
{
@@ -586,7 +586,8 @@ int bootloader_bridge(uint8_t klen, uint8_t * keyh)
switch(req->op){
case BootWrite:
printf1(TAG_BOOT, "BootWrite: %08lx\r\n",(uint32_t)ptr);
if ((uint32_t)ptr < APPLICATION_START_ADDR || (uint32_t)ptr >= APPLICATION_END_ADDR)
if ((uint32_t)ptr < APPLICATION_START_ADDR || (uint32_t)ptr >= APPLICATION_END_ADDR
|| ((uint32_t)ptr+req->len) > APPLICATION_END_ADDR)
{
printf1(TAG_BOOT,"Bound exceeded [%08lx, %08lx]\r\n",APPLICATION_START_ADDR,APPLICATION_END_ADDR);
return CTAP2_ERR_NOT_ALLOWED;
@@ -603,7 +604,7 @@ int bootloader_bridge(uint8_t klen, uint8_t * keyh)
exit(1);
}
flash_write((uint32_t)ptr,payload, req->len + (req->len%4));
flash_write((uint32_t)ptr,payload, req->len);
break;
case BootDone:
printf1(TAG_BOOT, "BootDone: ");