stm32mp: stm32prog: add FIP header support

Add support of TF-A FIP header in command stm32prog for all the boot
partition and not only the STM32IMAGE.

This patch is a preliminary patch to support FIP as second boot stage
after TF-A BL2 when CONFIG_TFABOOT is activated for trusted boot chain.

The FIP is archive binary loaded by TF-A BL2, which contains the secure OS
= OP-TEE and the non secure firmware and device tree = U-Boot.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
This commit is contained in:
Patrick Delaunay 2021-04-02 14:05:17 +02:00 committed by Patrice Chotard
parent 0441b48570
commit 4fb7b3e108
4 changed files with 63 additions and 36 deletions

View file

@ -309,11 +309,10 @@ static u8 stm32prog_header(struct stm32prog_data *data)
/* force cleanup to avoid issue with previous read */
dfu_transaction_cleanup(dfu_entity);
ret = stm32prog_header_check(data->header_data,
&data->header);
stm32prog_header_check(data->header_data, &data->header);
/* no header : max size is partition size */
if (ret) {
/* no stm32 image header : max size is partition size */
if (data->header.type != HEADER_STM32IMAGE) {
dfu_entity->get_medium_size(dfu_entity, &size);
data->header.image_length = size;
}
@ -389,7 +388,7 @@ static u8 stm32prog_start(struct stm32prog_data *data, u32 address)
data->dfu_seq = 0;
printf("\n received length = 0x%x\n", data->cursor);
if (data->header.present) {
if (data->header.type == HEADER_STM32IMAGE) {
if (data->cursor !=
(data->header.image_length + BL_HEADER_SIZE)) {
stm32prog_err("transmission interrupted (length=0x%x expected=0x%x)",
@ -789,7 +788,7 @@ static void download_command(struct stm32prog_data *data)
}
}
if (image_header->present) {
if (data->header.type == HEADER_STM32IMAGE) {
if (data->cursor <= BL_HEADER_SIZE)
goto end;
/* compute checksum on payload */