cancel
Showing results for 
Search instead for 
Did you mean: 

boot code

info44
Associate II
Posted on April 18, 2004 at 17:07

boot code

4 REPLIES 4
info44
Associate II
Posted on May 17, 2011 at 11:59

I've got the boot flash memroy mapped from 0 to 7FFF and the main flash mapped from 8000 to FFFF. In the boot memory I've got a small code I use to reprogram the main flash with the RS232.

I would like to call the code in the main flash at adress 0x8000 with the boot code, but I don't find how to do it ?
info44
Associate II
Posted on May 17, 2011 at 11:59

I've change the memory organisation so :

Boot0 in code at adress 8000 to 9FFF

FS0 in data at adress 8000 to FFFF

I write the switch code in asembler because I don't know how to write it with keil v7 :

MOV DPTR, #0x2E2 ;access VM register

MOV A,#0x8C ;Jump to main flash

MOVX @DPTR,A

LJMP 0x8000 ;start the main code

My problem is I would like to put this function at the same place in the 2 code (boot and main). I try to put it in the startup.a51 with the instruction ORG FF00 before.

But in this case org is not an absolute adress but an offset.

How do you do to put your switch function at the same adress in the 2 codes ? is it possible to do this in a ''C'' function ?

Thanks for your reply

Seb

sbencke3
Associate II
Posted on May 17, 2011 at 11:59

If you want to put a specific function in a specif adress you have to follow this steps:

1- Creat a file, exemple: IAP_asm.c or if you are using assembler IAP_asm.s01.

2- Go to Option project and choose ''Option for target'';

3- Go to BL51Locate Tab;

4- Write in the Code (first line): ?PR?Switch_Flash?Iap_asm(0xXXXX)

where Switch_Flash is the name of the function that you use in the file IAP_asm.s01 ans 0xXXXX is the adress that you want.

Repit this for the two areas: main and boot flash.

With this the linker will put your function in the specif adress.

info44
Associate II
Posted on May 17, 2011 at 11:59

Thanks it's work well