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.

Creating a data structure only hex file

I am using CCS 5.5 and ARM 5.1.2.  I wish to create a project that will produce a hex file containing a data structure only - no executable code.

I have the hex file produced as expected, but would like to ditch the main function.

How can I do that?

#include "TNVM.h"

#pragma RETAIN(assemblyData)
#pragma DATA_SECTION(assemblyData, ".adata")
// struct format rev, {major, minor rev}, fw part number, swlut
const TNVM_AssemblyData assemblyData = {
		2,
		"0123456789",
		"ASSEMBLY#",
		"BUILD",
		"SN",
		{1,0},
		'L',
		0
};

void main(void) {

}

Produces:

:20000000002A4AD05FEA000C8B071CD1830722D1102A08D370B4103A78C978C0103AFBD238
:2000200070BC103238D0042A2CD3082A05D30C2A24BF08C908C008C908C008C908C0920796
:200040002AD0920F22E00B780370491C401C521E22D08B07F7D1C30714D18307D8D0121F7E
:2000600012D308C903801B0C4380001D121FF8D20AE008C903701B0A43701B0A83701B0A02
:20008000C370001D121FF4D2121D05D00B780370491C401C521EF9D160467047F0B51E48BC
:2000A0000127F84201D000F097F81E4D1E4F1F4EBD4206D203CD0478A4003459401CA047B2
:2000C000F6E7164D164FBD4202D210CDA047FAE7F0BD03251BE0416808300A1C2A400BD1E6
:2000E0001A1C2A40AB4305D0046804300C600431043BF9D1131C05D0047801300C700131F4
:20010000013BF9D1021C2A4001D0A84304300368002BE0D17047C046FFFFFFFF0000000061
:2001200000000000B8020000C0020000B002000070B510F8014B1BE0401C5AB11D0A09D1B5
:20014000022510F8016B6D1E46EA0323F9D101E0042B02D310F8015B03E0254601E001F8E8
:20016000015B5B1EB3F1FF3FF9D101E001F8013B10F8013B9C42F9D110F8013B002BE7D1D5
:2001800010F8015B03782D025B19D5D170BD70474EF68851CEF2000108684FF0F00340EAA9
:2001A0000340086009488546094885446F4607208743BD4607486F460760FFF76FFF00F0F6
:2001C0004FF8012000F030F8FEE7C04600000020000800001008002070B50F4D064673888C
:2001E000002416E0A00000EBC40030184168C26880684AB92A6852B10A7855F822304A1C74
:2002000001461046984701E0FFF7FAFE7388641CA4B2A342E6DC70BDB002000000BF7047C6
:2002200008B5FFF7FBFFFEE738B50546094800688047094C201D006810B101462846884735
:20024000206800B18047054800688047FFF7E8FF38BDC046000800200808002004080020C6
:200260000449B1F1FF3F07BF0021081C0868091DFFF78DBFFFFFFFFF0349086070470249BC
:20028000091F08607047704704080020D0F80320C31D08461946FFF7B3BE0122FFF748BF35
:2002A0000001870200008702010E0001000000009B0200008D020000A00200000008002025
:20F800000230313233343536373839000000000000000000415353454D424C592300000056
:20F82000000000000000004255494C4400000000534E0000000000000000000000000000B7
:08F8400000000001004C000073
:00000001FF

I would like just the last four lines.

  • John Osen said:
    I wish to create a project that will produce a hex file containing a data structure only - no executable code.

    I haven't tried it, but reading the ARM Assembly Language Tools v5.1 User's Guide SPNU118L section 12.5 The SECTIONS Directive explains how the hex conversion utility SECTIONS directive can be used to only convert specific sections.

    Maybe that than be used to make the hex file only contain the .adata data section?

  • Brilliant!  Tested and proved in less than 2 minutes!