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

Store code constants in external flash or e2prom

So my problem is that i want to store string constants in an external SPI e2prom or flash memory. The thing is that i want to generate the content (a hex file ) of the memory using Keil if possible. Can someone give me some ideas. Thank you.

  • //////////////////////////////////////////////////////////////////////
    //
    //  FILE:     S1616160
    //
    //  COPYRIGHT: Copyright TwinVision N.A., 2008
    //
    //  eeprom contents for amber 16 pin 16 high 160 wide signs
    //
    //
    
    //                                                                          m t    w   h  w   h  e l e c
    //                                                                          f y    d   g  d   g  b l e k
    //                                                                          g p    t   t  t   t  t n x s
    //                                                                            e    1   1  2   2  s   2 m
    //
    //                              0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1    1   1  1   1  1 1 1 1
    //                              0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7    8   9  a   b  c d e f
    unsigned char code SIGNFMT[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x00,160,16,000,00,0,2,0,0, // 00
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,          // 2
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,          // 4
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,          // 6
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,          // 8
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,          // a
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,          // c
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};         // e
    


    to build it

    rem @ECHO OFF
    
    if "%KURT%"=="0" goto ditz
    SET DDIR=tools\keil
    goto isset :ditz
    SET DDIR=keil
    :isset cd ..\bld
    copy ..\sou\S1616160.c *.* >..\trash\trashbin if not exist cmplst.txt goto nocmdl
    del cmplst.txt
    :nocmdl
    call batcmp S1616160
    if not exist cmplst.txt goto naser
    echo on
    rem /////////////////////////////////
    rem ///////// COMPILE ERRORS ////////
    rem /////////////////////////////////
    type cmplst.txt | more
    rem saved in file cmplst.txt
    pause
    @ECHO OFF
    :naser c:\%DDIR%\c51\bin\bl51 S1616160.obj TO O1616160.omf RS(256) IX >protl.log IF errorlevel=2 GOTO tell
    goto show
    :tell
    echo on
    rem ////////////////////////////////////////
    rem //////////// linker ERRORS /////////////
    rem ////////////////////////////////////////
    rem errors and warnings are in protl.log
    rem link map is in as.m51
    pause
    :show
    echo on
    type protl.log | more
    pause
    @ECHO OFF :hexc1
    c:\%DDIR%\c51\bin\oh51 O1616160.omf HEXFILE (..\hex\X1616160.hex) cd ..\mk

    I am sure it can be done in th IDE as well, but would not know how since I, for reasons of other builds, do not use it

    Erik