Address jump

Hi,

 in my project I am try to jump 0x8002000 address . but I am facing some failure,

 

typedef void (*FunctionPointer)(void);
 
// Example function to jump to another address
void jumpToAddress(uint32_t * address) {
 
//address =0x800029c;
    // Define a function pointer with the address
    FunctionPointer jumpFunction = (FunctionPointer)address;
    //void (*jumpFunction)(void) = (void (*)(void))address;
 
    // Disable interrupts if needed
       __disable_irq();
 
       // Set the program counter (PC) to the new address
       SCB->VTOR = address;
 
       // Execute an instruction to ensure that the jump takes effect
       __DSB();
       __ISB();
 
       // Re-enable interrupts if needed
       __enable_irq();
 
    // Call the function via the function pointer
    jumpFunction();
}
 
 
this is my address jump function .
 

int main(void)
{
/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */
SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */

/* Initialize all configured peripherals */
MX_GPIO_Init();
/* USER CODE BEGIN 2 */
//myFunction();
jumpToAddress(0x8002000);

/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}

this is my main function.

 

this image is my .map file for my project.

I am try to jump 0x8002000 address my project  shown ,

 

 

 

this output. so kindly help to me.

thanks

Parents Reply Children