Skip to main content
Visitor II
February 12, 2004
Question

Switch from first Flash to second and vice-versa

  • February 12, 2004
  • 11 replies
  • 1663 views
Posted on February 12, 2004 at 11:03

Switch from first Flash to second and vice-versa

    This topic has been closed for replies.

    11 replies

    Visitor II
    May 17, 2011
    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