Skip to main content
Associate II
December 5, 2023
Solved

Failsafe FIP update with PSA_FWU_SUPPORT

  • December 5, 2023
  • 2 replies
  • 2070 views

Hi,

i'm implementing our field-update using the A/B mechanism for FIP image.

Would like to use the Update Client described on the page as a template:

https://wiki.st.com/stm32mpu/wiki/Secure_Firmware_Update#Update_Client

But no idea where to find it. I didn't find anything promising in the meta- repos from st?

Where to get it? I think i will be able to do the metadata things. But it would be interesting how to read the backup registers from Linux:

register TAMP_BKP10R ? How to read it?

I'm on a STM32MP13x

thanks + br,

Simon Kretschmer
DSA Datasystems / comlet GmbH

This topic has been closed for replies.
Best answer by Christophe Guibout

Hello @SimK,

ST Microlectronics provides the A/B mechanism, but the update client is a software component on top of linux which is provided by a third part as for example Rauc, Mender, SWUpdate...

Today, here is a tool to read/write into metadata : https://github.com/CGUSTM/fwu_gen_metadata.

To read a tamper register value from linux, I would use devregs or devmem2.

BR,

Christophe

 

2 replies

Christophe Guibout
ST Employee
December 8, 2023

Hello @SimK,

ST Microlectronics provides the A/B mechanism, but the update client is a software component on top of linux which is provided by a third part as for example Rauc, Mender, SWUpdate...

Today, here is a tool to read/write into metadata : https://github.com/CGUSTM/fwu_gen_metadata.

To read a tamper register value from linux, I would use devregs or devmem2.

BR,

Christophe

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
SimKAuthor
Associate II
December 19, 2023

Hi Christophe, thank you for your answer...

the documentation speaks so naturally of the update tool that I assumed you just had to find it somewhere.

I have implemented it in the meantime, as suggested with devmem2, if anyone is wondering where to find the register, here is my test script:

 

# read out FWU_INFO register from TAMP region
# return value is a structure, separated by '|' :
# status|active_partition|bootcounter
# with status of (success|fail)
function getBootInfoFromBKPRegister() {
  #    FWU_INFO TAMP is BKUP Register 10
  #    TAMP base address 5C00A000h
  #    BKPxR offset           100h
  #    index 10 (10*4)         28h (40)
  #                      5c00A128h
  #    this register contains in
  #       bit[7:4] bootcounter
  #       bit[3:0] active partition
  local bkupreg
  if bkupreg=$(devmem2 0x5c00A128); then
      local bootinfo
      bootinfo=$(echo "${bkupreg}" | awk '/Read at address/ {print $NF}')
      local BkpActivePartition
      BkpActivePartition=$(echo "${bootinfo}" | rev | cut -c 1)
      local BkpBootcounter
      BkpBootcounter=$(echo "${bootinfo}" |  rev | cut -c 2)
     
      echo "success|$BkpActivePartition|$BkpBootcounter"
  else
      echo "fail|Error occurred during devmem2 operation"
  fi
}
 
btw, the mechanism is working fine :)
Christophe Guibout
ST Employee
December 19, 2023

Hi SimK,

 

Thanks for your feedback !

BR,

Christophe

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.