This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Creation of a binary containing only data

Other Parts Discussed in Thread: TMS470MF04207, UNIFLASH


I'm using a TMS470MF04207 and I would like to create a binary that contains only data that will be stored into its flash memory.

So I've declared and defined all my variables and put for all of them the const keyword plus the RETAIN pragma.

I also would like to flash them at specified address in flash in order to be able to access it from an application.

Here is my sys_link.cmd :

-l rtsv7M3_T_be_eabi.lib
* Memory Map
FLASH0 (RX) : origin=0x00004000 length=0x00004000

* Section Configuration
.text : fill = 0xffffffff {} > FLASH0
.data : fill = 0xffffffff {} > FLASH0
.const : fill = 0xffffffff {} > FLASH0
.cinit : fill = 0xffffffff {} > FLASH0
.pinit : fill = 0xffffffff {} > FLASH0


My problem is that when I take a look at the .map file that is created, I notice that none of my data is contained in the binary.

So I would like to know if it is even possible to do what I want to do. And if anyone can see what is wrong in what or how I've done.

If you need more information, don't hesitate !

Thank you in advance for your answers.


  • Christophe Bonniot said:

    I think you mean to write this: --retain=".const*"

    If that doesn't work, consider a different technique.  Instead of specifying which sections to keep, name the symbols which need to be defined.  The option --undef_sym=symbol_name option says the definition of that symbol must be found, and all the sections associated with it must be kept.  I'm not 100% sure this will work, because this option is intended to be used to force the linker to include certain sections from a library.  But I think it will have the effect you seek here.

    Thanks and regards,


  • Hi

    Thanks a lot for your answer, I've tried to put --undef_sym=symbol_name but I get compilation errors saying that the symbols I want to apply the undef_sym directive are undefined symbols.

    I succeeded to make them appear in the .map file by doing something with them in the main function. But when I try to flash the output binary, nowFlash is telling me "No data found in input file within given range". Note that no range is specified.

    I thought that if the symbols appeared in the .map file with the right size for every one of them, it would mean they could be flashed, am I wrong ?
    if anyone has any idea ! 

    Thank you in advance for your answers.


  • Please put the following in your next post:

    • The assembly source (even if compiler generated) for one of the files which defines data in the .const section
    • The linker map file
    • The compiler version
    • The exact command line used to conduct the link
    Thanks and regards,
  • Hi George,

    I'm sorry for the time I took to answer.

    You will find the generated asm file which contains the data in the .const section, it also contains the main function.

    The compiler version is 5.0.1

    The command line used to link :

    "/opt/ti/ccsv5/tools/compiler/tms470/bin/armcl" -mv7M3 --code_state=16 --abi=eabi -g --diag_warning=225 --display_error_number --enum_type=packed -k -z --stack_size=0 -m"" --heap_size=0 -i"/opt/ti/ccsv5/tools/compiler/tms470/lib" -i"/opt/ti/ccsv5/tools/compiler/tms470/include" --reread_libs --warn_sections --display_error_number --absolute_exe --rom --rom_model --be32 --unused_section_elimination=off -o "TensionWaves.out"  "./Tensions.obj" -l"rtsv7M3_T_be_eabi.lib" "../sys_link.cmd" 

    Unfortunately, it appears that map files are not allowed to be uploaded here, so here are the first lines concerning the symbols loaded in the .const section. If you need more lines, tell me, I'll either send the file to you by email or I'll post it here.

    OUTPUT FILE NAME: <TensionWaves.out>
    ENTRY POINT SYMBOL: "_c_int00" address: 00004f95


    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    FLASH0 00004000 00004000 00001054 00002fac R X


    output attributes/
    section page origin length input sections
    -------- ---- ---------- ---------- ----------------
    .const 0 00004000 00000d80
    00004000 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGC_GPS_ANT_WAVE1)
    00004060 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGC_GPS_ANT_WAVE2)
    000040c0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGC_GPS_ANT_WAVE3)
    00004120 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_FC_WAVE1)
    00004180 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_FC_WAVE2)
    000041e0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_FC_WAVE3)
    00004240 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_GPS_WAVE1)
    000042a0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_GPS_WAVE2)
    00004300 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_GPS_WAVE3)
    00004360 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_PERM_WAVE1)
    000043c0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_PERM_WAVE2)
    00004420 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_PERM_WAVE3)
    00004480 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_SD_WAVE1)
    000044e0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_SD_WAVE2)
    00004540 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_3V3_SD_WAVE3)
    000045a0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_GPS_ANT_POLAR_WAVE1)
    00004600 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_GPS_ANT_POLAR_WAVE2)
    00004660 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_GPS_ANT_POLAR_WAVE3)
    000046c0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_3G_WAVE1)
    00004720 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_3G_WAVE2)
    00004780 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_3G_WAVE3)
    000047e0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_TOUCH_WAVE1)
    00004840 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_TOUCH_WAVE2)
    000048a0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_TOUCH_WAVE3)
    00004900 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_USER_WAVE1)
    00004960 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_USER_WAVE2)
    000049c0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_5V_VBUS_USER_WAVE3)
    00004a20 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_8V_MIC_WAVE1)
    00004a80 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_8V_MIC_WAVE2)
    00004ae0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_8V_MIC_WAVE3)
    00004b40 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_MIC_BIAS_WAVE1)
    00004ba0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_MIC_BIAS_WAVE2)
    00004c00 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_MIC_BIAS_WAVE3)
    00004c60 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_VBSW_WAVE1)
    00004cc0 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_VBSW_WAVE2)
    00004d20 00000060 Tensions.obj (.const:DIAG_ADIN_IDX_DIAGV_VBSW_WAVE3)

  • I cannot reproduce your issue.  When I build Tensions.asm and then link it, I see a .const section with contents in it.  Here is one way to see that ...

    % armofd --obj_display=none,sections Tensions.out | find ".const"
          2 .const                    0x00000020 0x00000020  0xd80     4   Y

    That third hex number, 0xd80, is the length of the .const section.  Its not zero.  armofd is a utility that comes with the ARM compiler.  Use it to see things in object files and libraries.  Please try that command on the .out file you create.  What does it show for the .const section?

    Thanks and regards,


  • Hi Georges,

    Thank you for your answer.

    When I run that command, I get the following

    3 .const 0x00004000 0x00004000 0xd80 4 Y

    Which is the same thing than you except for the start address and the same thing than in the map file.

    My issue is when I try to flash, nowFlash is telling me that there are no input data to flash from the .out file.
    I have not tried with uniflash yet, I will and I'll let you konw how it goes.

    If you have other ideas until then, tell me.

    Thanks again.


  • Christophe Bonniot said:

    When I run that command, I get the following

    3 .const 0x00004000 0x00004000 0xd80 4 Y

    Then I am 99% sure the problem is in the flash programming tools, and not with the compiler tools.  We who watch this forum are not familiar with flash programming tools.

    Christophe Bonniot said:
    I have not tried with uniflash yet, I will

    According to this post, UniFlash is replacing nowFlash.

    I recommend you start a new thread in the Hercules forum.  Or, if you prefer, I can move this thread to that forum.

    Thanks and regards,


  • I would prefer that you move this thread, that way I won't have to reexplain everything and people will have access to all the research you made to help me.

    Thank you again for your help.

    Kind regards.

  • Hi,

    Does anyone have an idea ? I'm really stuck on this.

    Thank you in advance.


  • Hello Christophe,

    nowFlash will report that error when something in the object file is trying to be written to a memory range that is not available on the device.  If you could post your actual .out file you are trying program I can determine what nowFlash does not like.

  • Hello John,

    Uniflash succeeded to flash the .out file, I took a look at the memory in the memory browser of Code Composer Studio and the memory is correctly set.

    I don't have access to a Windows computer so I can't test it again on nowFlash but it should behave the same way since I did not change anything.

    So I'm not sure why it worked with Uniflash and did not with nowFlash. I'm still uploading my out file in order for you to investigate if you want to.

    If you find the issue and its solution or if you cannot reproduce the behaviour I had, please let me know.

    I have rename the file to TensionWaves.123 in order to be able to upload it here, but it is the .out file, you just have to rename it.

    Thank you.