Putting a variable at a fixed place

I am using HEW 4.09 and toolchain 5.1.0 with an SH4.

I want to put a vaiable at a fixed location with a fixed value.  My pedecessor did it this way:

          .SECTION    Version,DATA,ALIGN=4

          ; This is the BootCode Version

          ; Stored at section Version (H'0C011FFC), which was added to OptLinker

          ; H'0C011FFC is the SDRAM address. 

          ; The System code will read this, so it can be reported to the host

          ; Format is xx.xx so H'30303039 = '0''0'.'0''9'


          .DATA.L     H'30323030


This is mapped into Flash so other modules can read the version even when the code is not running.

But I want to modify the number based on a define during compiliation.

I just can't see how to.  Any ideas for me?

  • This compiler is really old. I have no idea what #pragma it may use. An actual compiler could place this data in a C variable and change the default section for it as shown below. This data would be stored in section DVersion.

    #define BOOTCODE "02.00"

    #pragma section D Version          // change default section name

    unsigned char V_Bootcode[]={BOOTCODE};

    #pragma section                         // switch back to default section name

  • Thanks, that is just right!