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.

TM4C1294NCPDT: Placing Variables in Specific Memory Location - TM4C1294NCPDT with CCS

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: UNIFLASH,

Hi.

Is there any equivalent this command from Keil in CCS?

In Keil, I can use


const unsigned short CHECKSUM __attribute__((section(".ARM.__at_0xF0000"))) = 0x0F88;

and then I can open binary file and change the value at the address 0xF0000 to anything I want.

but I can't find anything in CCS 10.1.

I want to reserve 4 bytes of memory at special memory in .bin file so I can do the CRC and save the CRC value at that memory in Binary file. Later I can read it back and display it on an LCD screen.

I have tried with

#define DEFAULT __attribute__((at(0x400))) = 0x10

but when I open bin file with HxD and look at address 0x400. It is not correct value so my define is not correct.


Anyone can help ?

  • p/s: I just want to display the application checksum. I plan to reserve 4 bytes address, do the CRC of the application bin file. Then save the CRC value to the reserve address by Hex Editor application. Or anyone have any better idea to calculate the application checksum and display to a screen?

  • I want to reserve 4 bytes of memory at special memory in .bin file so I can do the CRC and save the CRC value at that memory in Binary file.

    The TI compiler supports Linker-Generated CRC Tables, which allows for a CRC to be generated at link time. See section 8.9 Linker-Generated CRC Tables in ARM Assembly Language Tools v20.2.0.LTS User's Guide (Rev. Y)

    How to get .text section size at run time using CCS 5.1 on TM4C129x? is an example of getting a CRC generated at link time, which is checked at runtime by the CRC module in a TM4C129 device.

  • In Keil, I can use


    const unsigned short CHECKSUM __attribute__((section(".ARM.__at_0xF0000"))) = 0x0F88;

    With the TI ARM compiler v20.2.4 I was able to use the following in a source file:

    const unsigned short CHECKSUM __attribute__((location(0xF0000),retain)) = 0x0F88;

    Where:

    • The location attribute sets the address of the variable.
    • The retain attribute ensure the linker doesn't discard the variable if not referenced in the program. Did that because my simple test case didn't try and use the CHECKSUM variable.

    The linker map file show the variable has been placed at the specified address in its own section:

    SEGMENT ALLOCATION MAP
    
    run origin  load origin   length   init length attrs members
    ----------  ----------- ---------- ----------- ----- -------
    00000000    00000000    0000024c   0000024c    r-x
      00000000    00000000    00000208   00000208    r-- .intvecs
      00000208    00000208    00000044   00000044    r-x .text
    000f0000    000f0000    00000002   00000002    r--
      000f0000    000f0000    00000002   00000002    r-- .TI.bound:CHECKSUM
    20000000    20000000    00000200   00000000    rw-
      20000000    20000000    00000200   00000000    rw- .stack

    And looking at the created binary file shows the value 0x0f88 at adress 0xf0000 :

    $ hexdump TM4C1294NCPDT_fixed_checksum.bin 
    0000000 0200 2000 0235 0000 023b 0000 023d 0000
    0000010 023f 0000 023f 0000 023f 0000 0000 0000
    0000020 0000 0000 0000 0000 0000 0000 023f 0000
    0000030 023f 0000 0000 0000 023f 0000 023f 0000
    0000040 023f 0000 023f 0000 023f 0000 023f 0000
    *
    0000150 0000 0000 0000 0000 023f 0000 023f 0000
    0000160 023f 0000 023f 0000 0000 0000 023f 0000
    0000170 023f 0000 023f 0000 023f 0000 023f 0000
    *
    0000200 023f 0000 0000 0000 4808 f380 8808 4908
    0000210 6808 f440 0070 6008 bf00 bf00 f000 f810
    0000220 2000 f000 f811 2001 f000 f80c 0200 2000
    0000230 ed88 e000 f7ff bfe8 4770 e7fe e7fe e7fe
    0000240 2001 4770 bf00 e7fe 2000 4770 0000 0000
    0000250 0000 0000 0000 0000 0000 0000 0000 0000
    *
    00f0000 0f88                                   
    00f0002

    The example project is attached. A post-build step was used to run armobjcopy to create the binary file.

    TM4C1294NCPDT_fixed_checksum.zip

  • I can see it set the value 0f88 at address 0xF0000 but when I use the Hex Editor to changed the value. And load the application, it still display the old value (0x0F88) while I already changed the value at address to something else. Not sure why.

  • And load the application, it still display the old value (0x0F88) while I already changed the value at address to something else

    How are you loading the application?

  • I just use the UniFlash and download to the edited bin file to the TM4C1294NCPDT.

  • I will try other method that you mention "How to get .text section size at run time using CCS 5.1 on TM4C129x". I goal is just get the Application CRC and display it out. I just want to keep track of my software version even with a small change.