2019-03-28 05:48 AM
how i can configure my project to make a relocatable application , i use the IAR workbench.
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
.
.
.
...
/* 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 ?
2019-03-28 05:53 AM
Will still have to deal with the fact the vector table has absolute addresses.
In IAR I'd expect a check box item for compiler/linker to generate position independent code. Check the documentation and support materials, surely covered.
2019-03-28 05:56 AM
where i can found the documentation please ?
2019-03-28 05:57 AM
Options / C/C++ Compiler / Code / Position-independence
2019-03-28 06:00 AM
I already activated this option , i still have the problem how the IVECT table be relocatable ?
2019-03-28 09:12 AM
Check the system_stm32l4xx.c and system_stm32l4xx.h files for the SystemInit() function.
At the end of it, you'll find the instructions to relocate the Vector Table.
In particular, you nee to write the SCB->VTOR register to set the address location (SRAM or FLASH) and the offset within that location.