This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SROM Sections

I have an XC167 application that needs to place the code from two modules into the SROM class in order to copy code from Flash to the internal program memory. I can use the following in the User Sections of the Linker but this will not adapt automatically to the growth of the first module.

?PR?ABC%ABC_CODE(0xe00000)[],
?PR?DEF%DEF_CODE(0xe00400)[]

Is there a way of specifying that the sections are placed immediately after one another?

  • Hi Barry,

    unfortunetaly no, as far as I know.
    You have to get the length from a look inside the map file.
    But may be, you can combine your code
    in one class (using #pragma rename CODECLASS=YOURCLASS) for this module
    and locate the whole class, for e.g.
    MYCLASS(0xE00000-0xE00420)
    instead of:
    ?PR?ABC%ABC_CODE(0xe00000),
    ?PR?DEF%DEF_CODE(0xe00400)

    But you have also to get the length, from the
    map. I hope KEIL support can answer this question.

    Stefan

  • Try just to state the second section without address specification. So this should work:
    ?PR?ABC%ABC_CODE(0xe00000)[],
    ?PR?DEF%DEF_CODE[]

  • Dear KEIL team,

    thank's for support! ;-)

    Stefan

  • This is excellent! This whole SROM feature is great.

  • Well I tried this and it does not work unfortunately. Removing the exec_address causes the line in my code that copies this from Flash to RAM

    hmemcpy(SROM_PS_TRG(ABC), SROM_PS_SRC(ABC), SROM_PS_LEN(ABC));
    hmemcpy(SROM_PS_TRG(DEF), SROM_PS_SRC(DEF), SROM_PS_LEN(DEF));
    
    to fail, giving three error messages:
    *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL
        SYMBOL:  _PR_DEF_s_
        MODULE:  ..\objFiles\MAIN.obj (MAIN)
    
    *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
        SYMBOL:  _PR_DEF_s_
        MODULE:  ..\objFiles\MAIN.obj (MAIN)
        ADDRESS: 002EH
    
    *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
        SYMBOL:  _PR_DEF_s_
        MODULE:  ..\objFiles\MAIN.obj (MAIN)
        ADDRESS: 0032H
    

    The only thing changed was the removal of the execution address in the DEF User Section so it now looks like:
    ?PR?ABC%ABC_CODE(0xe00000)[],
    ?PR?DEF%DEF_CODE[]
    

    I tried using an empty set of parenthesis but that caused a syntax error.

    Any other ideas?

  • I tried it out too,

    with an own little example and it works with the syntax as provided by KEIL's support.
    I was able to locate two datasections directly after each other and a codesection
    to a specific place.
    The syntax error was not reproduceable to me.

    I used following syntax with an own little
    testprogram I wrote:

    ?ID?MYSEC2%IDATA(0x00F600)[],?ID?MYSEC1%IDATA[],
    ?PR?TESTCLASS%NCODE(0xC0E000)
    
    Thus was changing the way of my testsection data memory.

    BTW: It works also without the [ ]'s, as I have tested.

    Stefan

  • Hi Barry,

    may be under L166/MISC the box
    "Create Relocatable Output File (LINKONLY)"
    is checked ?

    If I do so I can produce unresolved externals.
    If you uncheck this, these errors should be disappear.

    I can reproduce this behaviour.

    A checked LINKONLY seems to be default.

    Stefan

  • Thanks Stefan but LINK_ONLY is not checked.
    Your example uses a data section. Have you tried using a code section, placing it in the SROM class and then copy the code to the RAM area as in Keil App Note 138? My code works correctly if the exec_address is included in the specification for each section I want placed in the SROM class but fails with the formerly mentioned errors when I remove the exec_address from all but the first User Section.

  • Thanks Stefan but LINK_ONLY is not checked.
    Your example uses a data section. Have you tried using a code section, placing it in the SROM class and then copy the code to the RAM area as in Keil App Note 138? My code works correctly if the exec_address is included in the specification for each section I want placed in the SROM class but fails with the formerly mentioned errors when I remove the exec_address from all but the first User Section.

  • Hi Barry,

    no I did it not with the SROM class.
    I only checked the syntax.
    Generally I have used with code section,
    which was working too.
    Give me time to try and check out with SROM class.

    Stefan

  • That's me again.
    I try it and it will not work with SROM class. I played additionally with '&' sign to try append the second section directly,
    but there was not the effect, that areas for
    execution was append direct each after another. :-(

    Stefan