AM620-Q1: Query on Storing CRC32 Value in U-Boot Environment

Part Number: AM620-Q1

Tool/software:

Dear TI Team,

 

I am using U-Boot on the AM62x platform(linux-am62x-Evm-09.02.01.09 SDK ) and I'm trying to automate the below process of calculating and storing the CRC32 value of a memory region in an environment variable.

Manual Steps I followed:

  • setenv check_crc 'sf probe 0 0 0; sf read 0x93000000 0xA00000 0x5693e0; crc32 0x93000000 0x5693e0'
  • setenv crc32_value <calculated_crc_value>

I want to automate the above steps & store the  calculated_crc_value in environment variable. 

I couldn't find a straightforward way to capture the output of the `crc32` command and store it in an environment variable.I've tried using the `setenv` command with backticks, but it didn't work. I've also tried using the `setexpr` command, but it's not possible to use it to capture the output of the `crc32` command.

Method 1:  setenv check_crc 'sf probe 0 0 0; sf read 0x93000000 0xA00000 0x5693e0; crc32 0x93000000 0x5693e0; setenv crc32_value ${crc32}'

Logic: Execute the `crc32` command and capture its output using backticks. Store the output in the `crc32_value` environment variable. result is failed 

Method 2: Using `exec` command

setenv my_cmd 'crc32 0x93000000 0x5693E0'

setenv crc32_value $(exec $my_cmd)

`my_cmd` that executes the `crc32` command. Use the `exec` command to execute `my_cmd` and capture its output.result is failed.

Could you please provide guidance on how to achieve this? Are there any other commands or workarounds that I can use to store the CRC32 value in an environment variable?

Thanks & Regards,

Yashavantha Gowda