cancel
Showing results for 
Search instead for 
Did you mean: 

Self written bootloader - How to Jump to Application

asaltoun
Associate
Posted on March 26, 2009 at 19:54

Self written bootloader - How to Jump to Application

5 REPLIES 5
asaltoun
Associate
Posted on May 17, 2011 at 13:03

Hi

How I can jump from the my bootloader to the Application at 0x08004000

My bootloader address (0x08000000 - 0x0800Cfff )

I tried

typedef void (*JUMP_TO)(void);

static unsigned int start_adr=0x08000000;// Main code start address

void JumpToStart(void)

{

JUMP_TO go_entry;

go_entry = (JUMP_TO) (start_adr);

// Jump to Zero Reset

go_entry();

}

But failed

Thanks

Arie

pandoraems
Associate II
Posted on May 17, 2011 at 13:03

i assume you found bootloading examples floating around the forum

don't forget to setup new interrupt table location for the app you'r etrying to launch from bootloader. (usually done in NVIC init function in examples). Also not sure what toolchain you're using, but in gcc a thing easy to forget is adjusting the linker .ld file

hope this will get you going

lordac
Associate II
Posted on May 17, 2011 at 13:03

i'm not sure that i understand correctly

you have bootloader at 0x08004000 and application at 0x08000000?

if yes you can do that in this way:

in bootloader:

#define BOOTLOADER_APP_ADDR 0x08000000

typedef void (*pFunction)(void);

pFunction Jump_To_Application;

u32 JumpAddress;

//Disable Interupts if you are using it in bootloader app

NVIC_DeInit();

//and interrupts which isn't menaged by NVIC and you are using in bootloader app, for egzample sysytick

SysTick_ITConfig(DISABLE);

JumpAddress = (*(vu32*)(BOOTLOADER_APP_ADDR + 4));

Jump_To_Application = (pFunction) JumpAddress;

/* Initialize user application's Stack Pointer */

__MSR_MSP(*(vu32*) BOOTLOADER_APP_ADDR);

Jump_To_Application();

in application don't forget:

NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x8000000);

marknorman9
Associate II
Posted on May 17, 2011 at 13:03

''i assume you found bootloading examples floating around the forum''

please can you tell me where I'd like to see it?

picguy
Associate II
Posted on May 17, 2011 at 13:03

This may not be what you are looking for but I will give it a shot.

The bootloader should be separate from your application. The ROM reset vector points to your bootloader. The bootloader’s job begins mostly by jumping to your application’s start. Use interrupt slot 7 at 0x1C (it’s “reserved�) for your application start.

If your boot loader is to run and uses interrupts put your vector in RAM or if you have space relocate the vectors to your bootloader program space.

After the boot loader runs you have 2 choices. Die and wait for an external reset. Or make the processor reset (deadman timer perhaps) to start the just loaded application.