D-Flash s19 file creation

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

D-Flash s19 file creation

跳至解决方案
1,811 次查看
davide_ferrari
Contributor II

Hi

I'm using CW 5.0 for S12XE family

I'd like to know whether it is possible to create a CW project where I specify only the eeprom (D-flash) data structures (no code etc.).

Theorically, I'd like to build this project and then use the S19 file as it is to program only the D-Flash content through a BDM programmer.

 

Thank you very much.

Davide

标签 (1)
0 项奖励
1 解答
683 次查看
davide_ferrari
Contributor II

Thank you very much. It works fine. :smileyvery-happy:

 

Contrary to what I said before, the INIT specifier dosn't work for const structure, because the linker modifies the structure allocation to the .init segment (that is not linked at the address I want).

 

I've solved this problem by specifying the "Link as ROM library" option in the linker.

 

So now my .prm file looks like this:

 

SEGMENTS

EEPROM_00     = READ_ONLY   DATA_FAR IBCC_FAR  0x000800 TO 0x000BFB FILL 0xFF;
      CRC32_EE_00   = READ_ONLY   DATA_FAR IBCC_FAR  0x000BFC TO 0x000BFF;                   

END

 

 

PLACEMENT

      EEPROM_CONFIGURATION  INTO EEPROM_00;
END

 

CHECKSUM 
    CHECKSUM_ENTRY
        METHOD_CRC32
        OF      READ_ONLY   0x000800 TO 0x000BFB
        INTO    READ_ONLY   0x000BFC SIZE 4      

        UNDEFINED 0xff
    END
END

 

ENTRIES /* keep the following unreferenced variables */
    /* OSEK: always allocate the vector table and all dependent objects */
  //_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
 

   list of the structures names that must be allocated

END

 

STACKSIZE 0

 

 

Thank you again for your help

Davide

Message Edited by davide.ferrari on 2009-10-08 02:05 PM

在原帖中查看解决方案

0 项奖励
4 回复数
683 次查看
CompilerGuru
NXP Employee
NXP Employee

Sure, why not.

In the linker prm file tell the linker with the INIT directive to start linking at your global constant instead of the default _Startup, also refer to the same constant with the INIT directive. Remove all VECTOR entries (and whatever you use to setup the vector table). Remove the start12.c (and any other not used c files) from the project (or at least from the build configuration).

 

Then there are some warnings (about the stack, initialization and similar) which you can be disabled.

 

So after the changes, the prm would loke like:

STACKSIZE 0//VECTOR 0 _StartupINIT SampleConstantMAIN SampleConstant

 

 

0 项奖励
683 次查看
davide_ferrari
Contributor II

Thank you for your answer.

 

It seems working, but the problem now is that the compiler/linker doesn't allocate the const structures that I've defined (there are more than one) because they are not used anywhere.

 

I couldn't find how to disable this optimization, could you please advise how to do it?

 

Many thanks

Davide

0 项奖励
683 次查看
kef
Specialist I

Try adding this to your prm file:

 

ENTRIES /* keep the following unreferenced variables */
   *
END

 

Above will also link all *.lib functions, so probably you will need to remove libraries from your data-only project.

 

Another option is to link everything from specified object files:

 

ENTRIES
   myFile1.o:* myFile2.o:*

END

Message Edited by kef on 2009-10-08 12:50 PM
0 项奖励
684 次查看
davide_ferrari
Contributor II

Thank you very much. It works fine. :smileyvery-happy:

 

Contrary to what I said before, the INIT specifier dosn't work for const structure, because the linker modifies the structure allocation to the .init segment (that is not linked at the address I want).

 

I've solved this problem by specifying the "Link as ROM library" option in the linker.

 

So now my .prm file looks like this:

 

SEGMENTS

EEPROM_00     = READ_ONLY   DATA_FAR IBCC_FAR  0x000800 TO 0x000BFB FILL 0xFF;
      CRC32_EE_00   = READ_ONLY   DATA_FAR IBCC_FAR  0x000BFC TO 0x000BFF;                   

END

 

 

PLACEMENT

      EEPROM_CONFIGURATION  INTO EEPROM_00;
END

 

CHECKSUM 
    CHECKSUM_ENTRY
        METHOD_CRC32
        OF      READ_ONLY   0x000800 TO 0x000BFB
        INTO    READ_ONLY   0x000BFC SIZE 4      

        UNDEFINED 0xff
    END
END

 

ENTRIES /* keep the following unreferenced variables */
    /* OSEK: always allocate the vector table and all dependent objects */
  //_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
 

   list of the structures names that must be allocated

END

 

STACKSIZE 0

 

 

Thank you again for your help

Davide

Message Edited by davide.ferrari on 2009-10-08 02:05 PM
0 项奖励