Set Flash Memory Location to certain values on MSP430 using GCC

553 Views Asked by At

How do you set a few bytes of flash to be programmed by the flash programmer during programming of the mcu to be a certain value using msp GCC toolchain? For example, TI C/C++ compiler toolchain, includes assembler, and the following lines of assembly set the memory locations to the desired values:

;----------------------------------------------------------------------
 .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

Is there a way to do something similar using msp GCC toolchain?

1

There are 1 best solutions below

5
On

The GNU assembler has the same mechanisms. For example, here is how the MSP430 startup code puts the address of the startup code into the reset vector:

        .section ".resetvec", "a"
__msp430_resetvec_hook:
        .word   __crt0_start

As with the TI compiler, this requires the section (here: .resetvec) to be defined in the linker script.