Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

FlashPro-ARM/GangPro-ARM programmers support the ability to read the SFI chip certificate and save it to a file on disk.

Read The read and save chip certificate to file feature is possible also accessible by using the API-DLL.

F_ReadSTM32Certificate

General Description

Read device certificate from connected devices to FlashPro-ARM/GangPro-ARM programmers and save to file(cert_1.bin, cert_2.bin etc.)

...

  • STM32U5 Series

  • STM32L5 Series

  • STM32H5 Series

Syntax

Code Block
INT X F_ReadSTM32Certificate( char* path );

Input

char *path : path to save certificate file

  • ““: save in execute place

Output

INT_X : result of operation

  • 1 - success

  • 2 - selected not supported vendor or family

  • 3 - target not opened(no connection established)

  • 4 - can’t create file or path don't exists

  • 5 - error during read certificate

...

Code example

Code example in python how use F_ReadSTM32Certificate

Code Block
languagepy
import os
import sys
import ctypes

#FP-ARM - comment this out and uncomment GP-ARM to use demo for GangPro-ARM
if (sys.platform == "win32"):
    libname = "./FlashProARM-FPAsel.dll"
else:
    libname = "libmultifparm.so"
#GP-ARM - commented out - comment this out and uncomment FP-ARM to use demo for FlashPro-ARM
#if (sys.platform == "win32"):
#    libname = "./GangProARM-FPAsel.dll"
#else:
#    libname = "libmultigparm.so"

init_file = bytes('FPAs-setup.ini', 'utf-8')
if (sys.platform == "win32"):
    config_file_path = bytes('ConfigFiles\\STM32U5_cert.cfg', 'utf-8')
else:
    config_file_path = bytes('STM32U5_cert.cfg', 'utf-8')

#Load library
lib = ctypes.cdll.LoadLibrary(libname)

# Get number of connected adapters
instances = lib.F_OpenInstancesAndFPAs(init_file)
print("Connected adapters: {}".format(instances))

# Init all adapters
result = lib.F_Set_FPA_index(0)
print("F_Set_FPA_index(0): {}".format(result))
result = lib.F_Initialization()
print("F_Initialization: {}".format(result))

# Get adapters serial numbers
serials = []
for instance in range(1, instances+1):
    serials.append(lib.F_Get_FPA_SN(instance))
print(serials)

result = lib.F_ConfigFileLoad(config_file_path)
print("F_ConfigFileLoad: {}".format(result))
# Select one adapter
result = lib.F_Set_FPA_index(1)
print("F_Set_FPA_index(1): {}".format(result))
# Open Target (required before F_ReadSTM32Certificate )
result = lib.F_Open_Target_Device()
print("F_Open_Target_Device".format(result))
result = lib.F_ReadSTM32Certificate("")
print("F_ReadSTM32Certificate: {}".format(result))
result = lib.F_Close_Target_Device()
print("F_Close_Target_Device: {}".format(result))

Useful links

[1] FlashPro-ARM & GangPro-ARM DLL User Guide