cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sudo_rm_rf
Visitor
Visitor
567 Views
Registered: ‎07-27-2020

Configure PL with Partial Bitstream from OCM

Hi,

I have a ZCU102 board. I'm trying to configure the PL with a partial bitstream that will be stored in OCM. I'm using the functions from the files xilfpga.c and xilfpga_pcap.c

https://github.com/Xilinx/embeddedsw/blob/master/lib/sw_services/xilfpga/src/xilfpga.c

https://github.com/Xilinx/embeddedsw/blob/master/lib/sw_services/xilfpga/src/interface/zynqmp/xilfpga_pcap.c

I mainly used this function from xilfpga.c

u32 XFpga_PL_BitStream_Load(XFpga *InstancePtr,
UINTPTR BitstreamImageAddr,
UINTPTR AddrPtr_Size, u32 Flags)
{
u32 Status = XFPGA_FAILURE;
 
/* Validate the input arguments */
Status = XFpga_ValidateBitstreamParam(InstancePtr, BitstreamImageAddr,
AddrPtr_Size, Flags);
if(Status != XFPGA_SUCCESS) {
goto END;
}
 
/* Validate Bitstream Image */
Status = XFpga_PL_ValidateImage(InstancePtr, BitstreamImageAddr,
AddrPtr_Size, Flags);
if ((Status != XFPGA_OPS_NOT_IMPLEMENTED) &&
(Status != XFPGA_SUCCESS)) {
goto END;
}
 
/* Prepare the FPGA to receive configuration Data */
Status = XFpga_PL_Preconfig(InstancePtr);
if (Status != XFPGA_SUCCESS &&
Status != XFPGA_OPS_NOT_IMPLEMENTED) {
goto END;
}
 
/* write count bytes of configuration data into the PL */
Status = XFpga_PL_Write(InstancePtr,
InstancePtr->WriteInfo.BitstreamAddr,
InstancePtr->WriteInfo.AddrPtr_Size,
InstancePtr->WriteInfo.Flags);
if (Status != XFPGA_SUCCESS) {
goto END;
}
 
/* set FPGA to operating state after writing */
Status = XFpga_PL_PostConfig(InstancePtr);
if (Status == XFPGA_OPS_NOT_IMPLEMENTED) {
Status = XFPGA_SUCCESS;
}
 
END:
return Status;

}

Initially, I tested my program storing the partial bitstream on DDR and it worked fine. My problem now is that I need to store it on OCM (256Kb I think), but the bitstream file is too large (500Kb) so it's not going to work. A potential solution I found was to compress the bitstream file, however it was still to large.

For now I'm downloading the bit into DDR(I can't do dow -data bitstream.bit 0xfffc0000 will error out because bitstream is too large) and copying chunks of data to OCM, call XFpga_PL_Write(); increase DDR addresses to get new data and copy it to OCM and repeat until the all the bitstream is sent.

What I've been doing now is to make my own XFpga_PL_BitStream_Load() function. First call XFpga_Initialize();  comment out XFpga_ValidateBitstreamParam(); and XFpga_PL_ValidateImage(); call XFpga_PL_Preconfig();

send chunks of the Bitstream file using the function XFpga_PL_Write(); in a loop until the all the data in the bitstream is sent and then when all chunks are sent call XFpga_PL_PostConfig. Would this work? I was looking at the functions XFpga_PL_PostConfig and XFpga_PL_Write and it seems its mandatory to use XFpga_ValidateBitstreamParam(); (It looks to me these like functions were designed to send the whole bitstream file in one chunk instead of little pieces)

I would appreciate if someone could confirm what I'm trying to do is possible or not. Maybe there is a better solution. Thanks.

 

Tags (4)
0 Kudos
3 Replies
denist
Xilinx Employee
Xilinx Employee
371 Views
Registered: ‎10-11-2011

Are you asking if you can load the bitstream in chunks from DDR?

The answer is YES and the FSBL in DDR_LESS mode is a good example of it.

I believe it chunks the bitstream in 8Kbytes (but it could be 32K, I don't remember).

 

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
sudo_rm_rf
Visitor
Visitor
351 Views
Registered: ‎07-27-2020

Yes, that's what I was asking. But I was wondering if it could be done using the library xilfpga and not using the FSBL. It seems to me that this library only supports loading the full bitstream. 

0 Kudos
denist
Xilinx Employee
Xilinx Employee
238 Views
Registered: ‎10-11-2011

The Xilfpga examples do assume the bitstream (full or partial) is stored in DDR as a starting point. That part you definitely need to modify.

The Xilfpga itself can do authentication without DDR and in that case the bitstream is getting chunked in OCM.

To me you can either take the Xilfpga and figure out a way to feed the partial bitstream not from DDR or take a look at FSBL without DDR, see how it does it (it's loading the bitstream from flash without using DDR) and use the same strategy/function calls.

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos