Question
Position-Independent Code for STM32L4 relocatable application
how i can configure my project to make a relocatable application , i use the IAR workbench.
- i activated the --ROPI option in IAR Options
- i modified the .s file as follow :
MODULE ?cstartup
;; Forward declaration of sections.
SECTION CSTACK:DATA:NOROOT(3)
SECTION .intvec:CODE:NOROOT(2)
EXTERN PI_Reset_Handler
PUBLIC __vector_table
.
.
.
PUBWEAK Reset_Handler
SECTION .text:CODE:NOROOT:REORDER(2)
Reset_Handler
LDR R0, =PI_Reset_Handler
BX R0
.
.
.- i modified in main.c
...
/* Private functions ---------------------------------------------------------*/
extern void __iar_data_init3(void);
extern void __iar_program_start(void);
void PI_Reset_Handler(void)
{
SystemInit();
__iar_data_init3();
__iar_program_start();
}
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{ ....But when i put the binary file of app in flash at address (0x8010000) , my boot when jump to app , the app can't run . i remarked that the NVIC must be relocated . but the problem when i relocated the NVIC ( add an offset x10000) , i see the same problem .
So how i can configure my app to be relocatable please ?