...
Create folder /lib/firmware if it does not exist using following command in Linux.
Code Block theme Midnight mkdir -p /lib/firmware
- Copy bitstream file (in .bin format) to be loaded to PL into folder /lib/firmware/.
Select the type of bitstream to be loaded to PL using below command in Linux.
Code Block theme Midnight echo <bitstream_type> > /sys/class/fpga_manager/fpga0/flags
where bitstream type can be selected from below table.
Note that above values can be ORed based on type of bitstream to be loaded. For example, if bitstream image is to be authenticated in OCM and decrypted using device key, the flag should be written with value 0x14 (0x04 OR 0x10)bitstream_type
Usage
0x01
Partial bitstream
0x020x40
Authentication with image in DDR. Once bitstream is authenticated, it is either copied to PL or sent to AES crypto engine based on the bitstream image type.
0x040x80
Authentication with image in OCM. During authentication of the bitstream block, the system stores the hash of the bitstream block chunk during authentication. Once authentication is passed, during the transfer of the bitstream block to PL or to AES engine, system revalidates hashes of chunk chunks to make sure the image is not modified after authentication.
0x080x20
Decryption using user key (user key in KUP register)
0x100x4
Decryption using device key
0x60 Authentication(DDR memory) + Decryption using user key. Once bitstream is authenticated, it is sent to the AES crypto engine based on the bitstream image type. 0xA0 Authentication(OCM memory) + Decryption using user key. Once bitstream is authenticated, it is sent to the AES crypto engine based on the bitstream image type. 0x44 Authentication(DDR memory) + Decryption using Device key. Once bitstream is authenticated, it is sent to the AES crypto engine based on the bitstream image type. 0x84 Authentication(OCM memory) + Decryption using Device key. Once bitstream is authenticated, it is sent to the AES crypto engine based on the bitstream image type. If user key to be used for bitstream decryption, the key should be stored in file and pushed using following command in Linux.
Code Block theme Midnight cat <user_defined_key_file> > /sys/class/fpga_manager/fpga0/key
For example,
User key 2584B3F7844A0A0AECD36F0E511DA724E38492277D71192462AFC6975936EED0 is stored in usr_key.txt file and this file is pushed to system using following command.
echo usr_key.txt > /sys/class/fpga_manager/fpga0/key
Now download the bitstream using following command in Linux.
Code Block theme Midnight echo <bitstream_file_name> > /sys/class/fpga_manager/fpga0/firmware
where bitstream_file_name is the name of file copied into folder /lib/firmware in step 2.
...