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

ID string in a flash

Hello,

I need to put an ID string (file name and version) at a particular address in a flash, so the programming application can read it from a hex / binary file.
I can probably use a scatter file, but is there any simpler solution ?

Cortex-M3 STM32F107
MDK-ARM 4.12

thank you,
Gennady

Parents Reply Children
  • I tried to follow the procedure suggested by Pontus Thuvesson in
    http://www.keil.com/forum/docs/thread16466.asp

    That is what I did:
    in a main:

    #pragma arm section rodata = "codeEnd"
    const uint8_t metadata[19] = {'J','0','0','_','1,'1',1, 3,57,0x08,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x55};

    ===================
    then I edited the scatter file to this:

    ; *************************************************************
    ; *** Scatter-Loading Description File generated by uVision ***
    ; *************************************************************
    
    LR_IROM1 0x08000000 0x00020000  {    ; load region size_region
      ER_IROM1 0x08000000 0x00020000  {  ; load address = execution address
       *.o (RESET, +First)
       *(InRoot$$Sections)
       .ANY (+RO)
       *.o(codeEnd, +Last)
      }
      RW_IRAM1 0x20000000 0x0000C000  {  ; RW data
       .ANY (+RW +ZI)
      }
    }
    

    and unchecked 'used memory layout from a target dialog'.

    Nevertheless the metadata[] array does not appear at the end of a program. Is there anything i did wrong ? or haven't done ?

  • I am still trying to get rid of extra data appearing at the end of an image after my string.
    According to http://www.keil.com/support/docs/3512.htm
    these is compressed RW initialization data.
    According to the difference between sizes of Load Region LR_IROM1 and Execution Region ER_IROM1 in a memory map, amount of these data is 124 bytes. I actually have 125, but maybe I miscalculated something.

    Anyway, all attempts to eliminate these data were unsuccessful. I tried adding --datacompressor=off in a linker options, some other staff - no luck.

    While doing extensive research on a forum, I saw quite a few references to 'putting metadata / special data at the very end of a rom image'. So it seems like there is a lot of expertise on this issue.

    Please, could someone point me in a right direction.

    Gennady

  • I think that what your wanting is similar to what I described in:

    http://www.keil.com/forum/docs/thread16898.asp

    Unfortunately, I found/got no solution.

  • How about this?

    ; *************************************************************
    ; *** Scatter-Loading Description File generated by uVision ***
    ; *************************************************************
    
    LR_IROM1 0x08000000 0x00020000  {    ; load region size_region
      ER_IROM1 0x08000000 0x00020000  {  ; load address = execution address
       *.o (RESET, +First)
       *(InRoot$Sections)
       .ANY (+RO)
      }
      RW_IRAM1 0x20000000 0x0000C000  {  ; RW data
       .ANY (+RW +ZI)
      }
    }
    
    LR_IROM2 +0 {
      ER_IROM2 +0  {
       *.o(codeEnd, +Last)
      }
    }
    

  • Mike, thank you so much !

    It works, and I see how you've done it.
    Beautiful.

    Gennady