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.

Setting flash memory locations to certain value on MSP430 during firmware flash using GCC toolchain

The TI BSL430_Low_Level_Init.asm has the following lines of code:

;----------------------------------------------------------------------
 .sect ".BSLSIG"
 .retain
;----------------------------------------------------------------------
                 .word       0xFFFF         ; 0x17F0
BslProtectVecLoc .word       BSL_Protect    ; 0x17F2 adress of function
PBSLSigLoc       .word       03CA5h         ; 0x17F4 1st BSL signature
SBSLSigLoc       .word       0C35Ah         ; 0x17F6 2nd BSL signature
                 .word       0xFFFF         ; 0x17F8
BslEntryLoc      .word       BSL_Entry_JMP  ; 0x17FA BSL_Entry_JMP

How can I accomplish the same thing using the msp GCC tool-chain?

  • You can assemble that code with the TI assembler and then link it into the larger project with the GCC linker.  Is that practical?

    If you need to re-write this to work with the GCC assembler ... I don't think anyone who frequents this forum has that knowledge.  Consider posting in the MSP forum.  Or, if you prefer, I can move this thread into that forum.

    Thanks and regards,

    -George

  • George,

    I never had luck mixing tool-chains in one project and I do not think this will pass our code review, so there has to be a way to make it happen.
  • I'm sorry, I don't know how to do the equivalent of ".retain" for the GCC toolchain, but you can get very close to what you need by letting GCC figure it out.  Write a C program like so:

    extern unsigned char BSL_Protect, BSL_Entry_JMP;
    
    __attribute__((section(".BSLSIG"), used)) const unsigned char *BslProtectVecLoc = &BSL_Protect;
    __attribute__((section(".BSLSIG"), used)) const unsigned char *BslEntryLoc      = &BSL_Entry_JMP;
    
    __attribute__((section(".BSLSIG2"), used)) const unsigned int   PBSLSigLoc       = 0x3CA5;
    __attribute__((section(".BSLSIG2"), used)) const unsigned int   SBSLSigLoc       = 0xC35A;
    

    and then use "gcc -S" to generate the assembly code.  This assembly code is for Linux; you'd need to use the MSP gcc to get the right type sizes.

            .file   "foo.c"
            .globl  BslProtectVecLoc
            .section        .BSLSIG,"aw",@progbits
            .align 8
            .type   BslProtectVecLoc, @object
            .size   BslProtectVecLoc, 8
    BslProtectVecLoc:
            .quad   BSL_Protect
            .globl  BslEntryLoc
            .align 8
            .type   BslEntryLoc, @object
            .size   BslEntryLoc, 8
    BslEntryLoc:
            .quad   BSL_Entry_JMP
            .globl  PBSLSigLoc
            .section        .BSLSIG2,"a",@progbits
            .align 4
            .type   PBSLSigLoc, @object
            .size   PBSLSigLoc, 4
    PBSLSigLoc:
            .long   15525
            .globl  SBSLSigLoc
            .align 4
            .type   SBSLSigLoc, @object
            .size   SBSLSigLoc, 4
    SBSLSigLoc:
            .long   50010
            .ident  "GCC: (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204"
            .section        .note.GNU-stack,"",@progbits
    

    Of course this isn't quite what you want, but using this as an example should get you most of the way to writing the assembly code in GCC notation.