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.

Flash monitor SLAA341 using MSP430G2553

Other Parts Discussed in Thread: MSP430G2553

Hi,

I'm having some issues trying to implement the flash monitor on a MSP430G2553, what I did was modify the linker file in the app, then compile and then program the launchpad, but always goes wrong.

Do I have to compile the app program with the flash monitor all together or I can program only the app with the linker modifyed?

Also I don't know If the modified link file is wright.

Taking a look to the memory map of the MSP430G2553, looks like that I only have to change the end direction wich is 0xC000
Thanks.

ANDRÉS FELIPE
P.D. The file has all my tries.

// ************************************************
//
// XLINK configuration file for MSP430G2553
//
// Copyright 1996-2010 IAR Systems AB
//
// $Revision: 7965 $
//
// ************************************************

// ---------------------------------------------------------
// Description
//

//
// Usage:
//
// xlink [file file ...] -f lnk430g2553.xcl
//
// -----------------------------------------------
// Device summary
//

//
// Core: MSP430
//
// Interrupt vectors: 16
//
// Peripheral units: 0-01FF
//
// Information memory (FLASH): 1000-10FF
//
// Read/write memory (RAM): 0200-03FF
//
// Read-only memory (FLASH): C000-FFFF
//


// -----------------------------------------------
// Segments
//

// -------------------------------------
// Data read/write segments (RAM)
//

//
// segment Usage
// ------- --------------------------
// DATA16_Z Data initialized to zero
// DATA16_I Data initialized by copying from DATA16_ID
// DATA16_N Data defined using __no_init
// DATA16_HEAP The heap used by 'malloc' and 'free'
// CSTACK Runtime stack
// TLS16_I Thread-local storage for main thread
// (require custom runtime library)
//


// -------------------------------------
// Program and data read-only segments (FLASH)
//

//
// segment Usage
// ------- --------------------------
// DATA16_C Constant data, including string literals
// DATA16_ID initializers for DATA<nn>_I
// INFO Information memory
// INFOA Information memory, bank A
// INFOB Information memory, bank B
// INFOC Information memory, bank C
// INFOD Information memory, bank D
// CSTART Program startup code
// CODE Program code
// ISR_CODE Program code for interrupt service routines
// DIFUNCT Dynamic initialization vector used by C++
// CHECKSUM Checksum byte(s) generated by the -J option
// INTVEC Interrupt vectors
// RESET The reset vector
// TLS16_ID Thread-local initializers for main thread
// (require custom runtime library)
//
// Notes:
//
// * The INFOx and INFO segments overlap, this allows data either to be
// placed in a specific bank or anywhere in the info memory.
//
// * The INTVEC and RESET segments overlap. This allows an application to
// either use the reset vector provided by the runtime library, or
// provide a reset function by defining an interrupt function associated
// with the reset vector.
//


// ---------------------------------------------------------
// Configuation
//

// -----------------------------------------------
// Stack and heap sizes
//

// Uncomment for command line use
//-D_STACK_SIZE=80
//-D_DATA16_HEAP_SIZE=80


// -----------------------------------------------
// Define cpu
//

-cmsp430


// -----------------------------------------------
// Support for placing functions in read/write memory
//

-QCODE_I=CODE_ID


// ---------------------------------------------------------
// Placement directives
//

// -----------------------------------------------
// Read/write memory
//

-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I,DATA16_HEAP+_DATA16_HEAP_SIZE=0200-03FF
-Z(DATA)CODE_I
-Z(DATA)CSTACK+_STACK_SIZE#


// -----------------------------------------------
// Read-only memory
//

// -------------------------------------
// Information memory
//

-Z(CONST)INFO=1000-10FF
-Z(CONST)INFOA=10C0-10FF
-Z(CONST)INFOB=1080-10BF
-Z(CONST)INFOC=1040-107F
-Z(CONST)INFOD=1000-103F

// -------------------------------------
// Constant data
//

////-Z(CONST)DATA16_C,DATA16_ID,TLS16_ID,DIFUNCT,CHECKSUM=C000-FFDF
//////-Z(CONST)DATA16_C,DATA16_ID,DIFUNCT=C000-FBDF
//////-Z(CONST)CHECKSUM=C000-FBDF
-Z(CONST)DATA16_C,DATA16_ID,TLS16_ID,DIFUNCT,CHECKSUM=C000-FBDF
// -------------------------------------
// Code
//

////-Z(CODE)CSTART,ISR_CODE,CODE_ID=C000-FFDF
////-P(CODE)CODE=C000-FFDF
//////-Z(CODE)CSTART,ISR_CODE,CODE_ID=C000-FBDF
//////-P(CODE)CODE=C000-FBDF
-Z(CONST)CSTART,ISR_CODE,CODE_ID=C000-FBDF
-P(CONST)CODE=C000-FBDF

// -------------------------------------
// Interrupt vectors
//

////-Z(CODE)INTVEC=FFE0-FFFF
////-Z(CODE)RESET=FFFE-FFFF

//////-Z(CONST)INTVEC=FBE0-FBFF
//////-Z(CONST)RESET=FBFE-FBFF

-Z(CONST)INTVEC=FBE0-FBFF
-Z(CONST)RESET=FBFE-FBFF

  • Modify the Linker xcl file is the easy part. Modify the source code and assemble/link it is so so. Make sure it runs correctly is the hard part.

    You could do the App separately. It does not matter. I would make the App as simple as possible to begin with.
  • Thanks old_cow_yellow,
    I'm still stock with the Linker part, what I can see is that if I don't change the reset vector and the interrupt I can compile, and the program works. But I need change the possition cause I would like to see the indirection calling to the new vector place.

    I need directions please.

    Thanks again.

    ANRÉS FELIPE
  • Your modified Linker file is correct.

    What works? What doesn't?
  • Hi,

    The code works when I let the interrupt vector and reset vector with no changes, like this, and I can program my launchpad

    -Z(CODE)INTVEC=FFE0-FFFF
    -Z(CODE)RESET=FFFE-FFFF

    , but with the new directions, compiles but I can't program the launchpad

    -Z(CODE)INTVEC=FBE0-FBFF
    -Z(CODE)RESET=FBFE-FBFF

    The message in the IAR says,

    FATAL ERROR:Error to re-initialize

    Sesion aborted!

    Thanks

  • Without changing the location of all the vectors, the App is like any other "normal" App and works without the Monitor. But the Monitor will have a big problem in starting itself because its own Reset Vector is occupied by the App's Reset vector. It will also have a smaller problem to download a different App because the new App may need different values for the vectors and the Monitor need to erase the old App's vectors. If the vectors are in the same Flash Sector as the Monitor itself, this is a difficult job.

    Changing the location of the vectors will solve the Monitors problems. But the App cannot run without the Monitor because the App cannot start itself nor invoke the ISRs (see below). IAR thus refuse to download the code. You need to tell IAR to generate the code in the MSP430.TXT format file. The Monitor is able to download that file into the chip and start the App this way. It will also re-direct the interrupts. (I think slaa341 said all this!)

    The MSP430 hardware only knows that FFE0-FFFF are the vectors. It cannot use FBE0-FBFF as vectors. The Monitor uses smoke and morrows to make FBE0-FBFF appear like vectors.
  • Hi,
    What I understand from you is that you need to work with both App and Monitor, and I think is pretty logic when you say " The Monitor uses smoke and morrows to make FBE0-FBFF appear like vectors", the linker itself cannot change the MSP430 hardware, but looking again the document says in page 9: "It is also necessary to change the default project options to use the modified linker command file and to
    generate the MSP430-TXT formatted output file. If the generate extra output option is selected, the linker generates both a binary executable file that the debugger can load into flash via the JTAG emulator and the text formatted file that the monitor can use." according to that I can make my App program with the new linker, then programm it in the msp430 and debbug, like a "normal" progam. But to me has more sense what you say if I understand you correctly.

    Thanks
    ANDRÉS FELIPE
  • You are on the right track now.

    I said: ",,, IAR thus refuse to download the code...", that was wrong. But you do not need to use it as your Monitor can do it. If you do use IAR to download, be sure to set the "Retain unchanged memory" option. Otherwise the Monitor will not be erased from the memory.
  • Typo in last sentence of previous msg:
    Otherwise the Monitor WILL BE erased from the memory.
  • Hi again,
    old_cow_yellow, You were completly right, now with some modifications I can compile and debug the program, I still have to do some changes but it is a step forward.

    Thank you very much

**Attention** This is a public forum