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.

how to use #define in asm file?



Hi all,

I want to use a general purpose header file (config_device.h), to switch compilation dependency, e.g. for the password programmation to enable/disable jtag access (file passwords.asm). The two files I'm using are listed here above.

I'm not able to use correctly a #define declared in header file in my asm file. Where could I find info how to make this? Or some examples?

Thanks in advance,

Regards

Blaise


/**
 * @file config_device.h
 */


#define TRUE 1
#define FALSE 0


/**
 * Define program jtag password
 */
#define    PROGRAM_JTAG_PW_DISABLE (FALSE)

/**
 * Define program jtag password enable
 */
#define PROGRAM_JTAG_PW_ENABLE (TRUE)

/**
 * program jtag password selector
 *
 */
#define PROGRAM_JTAG_PW (PROGRAM_JTAG_PW_ENABLE)


* File: passwords.asm
***********************************************************************
***********************************************************************
* Dummy passwords of 0xFFFF are shown. The user can change these to
* desired values.
*
* CAUTION: Do not use 0x0000 for all 8 passwords or the CSM module will
* be permanently locked. See References [8-12] for more information.
***********************************************************************

    .cdecls C, NOLIST, "config.h"

    .if PROGRAM_JTAG_PW = TRUE

    .mmsg "program JTAG password enable"

    .sect "csmpasswds"

    .int 0x5555 ;     PWL0 (LSW of 128-bit password)
    .int 0x5555 ;    PWL1
    .int 0x5555 ;    PWL2
    .int 0x5555 ;    PWL3
    .int 0x5555 ;    PWL4
    .int 0x5555 ;    PWL5
    .int 0x5555 ;     PWL6
    .int 0x5555 ;    PWL7 (MSW of 128-bit password)

    .else

    .mmsg "program JTAG password disable"

    .sect "csmpasswds"

    .int 0xFFFF ;     PWL0 (LSW of 128-bit password)
    .int 0xFFFF ;    PWL1
    .int 0xFFFF ;    PWL2
    .int 0xFFFF ;    PWL3
    .int 0xFFFF ;    PWL4
    .int 0xFFFF ;    PWL5
    .int 0xFFFF ;     PWL6
    .int 0xFFFF ;    PWL7 (MSW of 128-bit password)

    .endif

;----------------------------------------------------------------------
    .sect "csm_rsvd"

    .loop (3F7FF5h - 3F7F80h + 1)
        .int 0x0000
    .endloop
;----------------------------------------------------------------------
    ;.end ;end of file passwords.asm

  • Hi,

    I hope this thread can shed some light to your query:

    http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/147742.aspx

    Regards,

    Gautam

  • Hello,

    Are you using C2000?

    Maybe you can read http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=SPRU513&fileType=pdf (page 101-102)

    Hope you can find it there.

    Best regards,

    Maria

  • Hi Gautam, hi Maria,

    thanks you for your help, it was useful.

    In these litterature (SPRU513, page 304), I discover that macro value are not interpreted as they are converted, so I have to modify booth my header and asm files:

    bad method

    *.h file

    #define TRUE 1

    #define PROGRAM_JTAG_PW_ENABLE (TRUE)

    #define PROGRAM_JTAG_PW (PROGRAM_JTAG_PW_ENABLE)

    *.asm file

    .if PROGRAM_JTAG_PW = TRUE

    good method

    *.h file

    #define PROGRAM_JTAG_PW

    //#undef PROGRAM_JTAG_PW)

    *.asm file

        .cdecls C,NOLIST,"config.h"

        .if $defined(PROGRAM_JTAG_PW)

        .else

        .endif

    Best regards

  • Good Good!

    Happy Working.

    Regards,

    Gautam