cancel
Showing results for 
Search instead for 
Did you mean: 

Position Independent Code

prsh
Associate II

Hello

I am trying to merge USB CDC code into an existing code which is a Keil multi project code. I am using the USB CDC code generated by stm32cubemx for data transmission and reception testing. 

The multi project is position independent build and when i add the files from USB CDC test application into it, it throws following errors and warnings. I am new to PI concept and would really appreciate if someone could guide me over this and help me resolve these.

Thanks.

*********************************************

*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'

WARNING: usbd_cdc_if.c(150): warning: #1357-D: static initialisation of variable "USBD_Interface_fops_FS" using address of CDC_Init_FS may cause link failure -ropi
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =


linking...
.\objects\zero.axf: Error: L6248E: usbd_cdc.o(.data) in PI region 'ER_RW' cannot have address type relocation to USBD_CDC_Init in PI region 'ER_RO'.

*********************************************

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hi @prsh 

If still facing this issue, about the warning, in usbd_cdc_if.c, change the static initialization of USBD_Interface_fops_FS by calling initialization function to set these variables at runtime.  

Second, about the section placement error, you may attach your linker script to check with you! 

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.

View solution in original post

1 REPLY 1
FBL
ST Employee

Hi @prsh 

If still facing this issue, about the warning, in usbd_cdc_if.c, change the static initialization of USBD_Interface_fops_FS by calling initialization function to set these variables at runtime.  

Second, about the section placement error, you may attach your linker script to check with you! 

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.