cancel
Showing results for 
Search instead for 
Did you mean: 

Switch from first Flash to second and vice-versa

sbencke3
Associate II
Posted on February 12, 2004 at 11:03

Switch from first Flash to second and vice-versa

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

Hi Phaze,

You are right about the offset caused by C51STARTUP. I take a look in the file *.m51 and the functions are in different places. I tried to do what do you say, but it isn’t work yet. Do you know a way to put a C function in a specify area using this linker options? Do you find other way to o this ?

Thanks

jdaniel
Associate II
Posted on May 17, 2011 at 11:58

Sombra,

Yes... I know how to do it. First, take a look in your main application at the *.m51 file. Find the address of the segment ?C_C51STARTUP and write it down. Now, go into uVision2 and open the project for your program in secondary flash. Go to project->options for target. Pick the ''BL51 Locate'' tab. In the edit box labeled ''code'' type the following:

?C_C51STARTUP(0xADDR)

where ADDR is the hex address where C_C51STARTUP is located in your main flash application. Now recompile the project. Then go and take a look in the *.m51 file for the location of this segment and make sure it now matches what you see in the m51 file for the first project. Then download them to flash and give it a shot.

If they don't match, it could be because they're in very low code space and running into an interrupt vector location or something. In that case, you'll have to move the location of BOTH the C_C51STARTUP segments for each application to some specific area outside the interrupt vector addresses (above 0xFF).

Also, I'm not sure if you meant to ask this, but you wanted to know how to put a C function somewhere in code space. This is done the same as above, with the code options, but you need to know how Keil names the segments. If you have a file named foo.c and a function bar(), then Keil would name the program segment either

?PR?BAR?FOO

or

?PR?_BAR?FOO

I'm not sure why it throws the underscore in sometimes and not others. Anyhow... I hope some of this helps.

Best Regards,

pHaze426