Добавить загрузку F28335 по ProtoCAN и сервисные команды клиента
This commit is contained in:
@@ -264,7 +264,7 @@ static void test_rejects_wrong_session_and_compatibility(void)
|
||||
data[3] = 3U;
|
||||
put_u32(&data[4], 1U);
|
||||
assert(command(&boot, 7U, PCAN_BOOT_CMD_BEGIN_COMPAT, data, 8U));
|
||||
assert(fake.last_data[0] == PCAN_BOOT_STATUS_WRONG_HARDWARE);
|
||||
assert(fake.last_data[0] == PCAN_BOOT_STATUS_WRONG_DEVICE);
|
||||
assert(boot.state == PCAN_BOOT_STATE_FAILED);
|
||||
}
|
||||
|
||||
@@ -306,8 +306,41 @@ static void test_single_slot_update(void)
|
||||
assert(memcmp(fake.flash[0], image, sizeof(image)) == 0);
|
||||
}
|
||||
|
||||
static void test_services_timeout_and_retries(void)
|
||||
{
|
||||
pcan_boot_t boot; fake_t fake;
|
||||
uint8_t image[8]={0},compat[8]={0}; unsigned count;
|
||||
setup(&boot,&fake); boot.config.session_timeout_ms=30000;
|
||||
pcan_boot_poll(&boot,0xFFFFFF00UL);
|
||||
assert(command(&boot,7,PCAN_BOOT_CMD_ENTER_BOOT,NULL,0));
|
||||
assert(command(&boot,8,PCAN_BOOT_CMD_ENTER_BOOT,NULL,0));
|
||||
assert(boot.session_id==7 && fake.last_data[0]==PCAN_BOOT_STATUS_BUSY);
|
||||
assert(command(&boot,7,PCAN_BOOT_CMD_ERASE,image,1));
|
||||
assert(fake.last_data[0]==PCAN_BOOT_STATUS_INVALID_SIZE);
|
||||
pcan_boot_poll(&boot,29743); assert(boot.state!=PCAN_BOOT_STATE_IDLE);
|
||||
pcan_boot_poll(&boot,29744); assert(boot.state==PCAN_BOOT_STATE_IDLE);
|
||||
assert(command(&boot,0,PCAN_BOOT_CMD_PING,NULL,0));
|
||||
assert(pcan_boot_id_msg_body(fake.last_id)==12);
|
||||
count=fake.sends;
|
||||
assert(pcan_boot_process(&boot,pcan_boot_make_id(1,0,7,15,13,0),NULL,0));
|
||||
assert(fake.sends==count); pcan_boot_poll(&boot,boot.discovery_at);
|
||||
assert(fake.sends==count+1 && pcan_boot_id_msg_body(fake.last_id)==1);
|
||||
assert(!pcan_boot_process(&boot,pcan_boot_make_id(1,0,7,15,9,0x702),NULL,0));
|
||||
begin_update(&boot,image,8);
|
||||
put_u16(compat,boot.manifest.product_type);
|
||||
compat[2]=boot.manifest.hardware_revision_min; compat[3]=boot.manifest.hardware_revision_max;
|
||||
put_u32(compat+4,boot.manifest.firmware_version);
|
||||
assert(command(&boot,7,4,compat,8)); assert(fake.last_data[0]==0);
|
||||
assert(command(&boot,7,5,NULL,0)); count=fake.erases;
|
||||
assert(command(&boot,7,5,NULL,0)); assert(fake.erases==count && fake.last_data[0]==0);
|
||||
assert(pcan_boot_process(&boot,request_id(PCAN_BOOT_MSG_DATA_B,0),image,8));
|
||||
assert(command(&boot,7,6,NULL,0)); assert(command(&boot,7,6,NULL,0)); assert(fake.last_data[0]==0);
|
||||
assert(command(&boot,7,7,NULL,0)); assert(command(&boot,7,7,NULL,0)); assert(fake.last_data[0]==0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
test_services_timeout_and_retries();
|
||||
test_id_layout();
|
||||
test_crc32_reference();
|
||||
test_complete_update();
|
||||
|
||||
Reference in New Issue
Block a user