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.

MSP430F5438A: Main Memory Bootloader - Outside of Program Code Problem

Part Number: MSP430F5438A

Tool/software:

Hi all,

I am trying to use the main memory bootloader.

By examining the reference project, I created "MSPBoot" and "App_Simple."
First, I write the "MSPBoot" code to the microcontroller, then I write the "App_Simple" code to the microcontroller using the differential download method.

I can run a simple LED blink project with MSPBoot.
I can also use interrupts (vector redirection works as expected).
The bootloader and the application can run successfully together.

However, as the complexity of the application code increases, at a certain point, the application code stops working.
I get the error:
"Break at address '0xf0000' with no debug information available, or outside of program code."
The address here is randomly generated.
Sometimes the operation stops with "Break at address "0xfcfc" with no debug information available, or outside of program code".
Sometimes the operation stops with "Break at address "0xfd22" with no debug information available, or outside of program code".

I was able to identify the point where the problem occurs.
When FLASH section usage 32752 byte, app works; but when FLASH section usage 32756 byte, app doesn't work.
The addition of just one line of code causes a 4-byte increase and
i get error "Break at address '0xXXXXX' with no debug information available, or outside of program code."

It maybe about stack issues. We should split the RAM region.
However, in the referenced MSPBoot and App_simple projects, the RAM regions are not split.
Both projects use the same RAM regions.

What could be the reason I am unable to run the application software and bootloader software together?
I would appreciate your help.
Thanks.

  • Can you first debug the App code? You can use PC to jump into the App code. If it is work, then I there may be some problem with the BSL+APP.

  • Thanks .

    I tried to first debug the App code.

    I don't know how to use PC command only to jump app code. 

    So i modified my bootloader code only have 2 line of code. 


    // BOOTLOADER PROJECT
    int main( void )
    {
        WDTCTL = WDTPW + WDTHOLD;
        {((void (*)()) _Appl_Reset_Vector) ();}
    }


    But nothing changed.  When I add line below, I get error again.
    // APPLICATION PROJECT
    int main(void)
    {   
        xxx;
        xxx;
        xxx;
        xxx;
        
        P1DIR |= BIT0;
        P1DIR |= BIT0;
        P1DIR |= BIT0;  // this line make my project get error. comment for proper operations
        
        while(1)
        {
            xxx;
            xxx;
            xxx;
        }
    }

    When FLASH section usage 32752 byte, app works; but when FLASH section usage 32756 byte, app doesn't work.
    The addition of just one line of code causes a 4-byte increase and
    i get error "Break at address '0xXXXXX' with no debug information available, or outside of program code."

    Bootloader linker file :

    /******************************************************************************/
    /* LINKER COMMAND FILE FOR MSPBoot BOOTLOADER USING MSP430F5438A  */
    /* File generated with MSPBoot_linkergen_Flash.pl on 06-28-2024 */
    /*----------------------------------------------------------------------------*/
    
    
    /****************************************************************************/
    /* SPECIFY THE SYSTEM MEMORY MAP                                            */
    /****************************************************************************/
    /* The following definitions can be changed to customize the memory map for a different device
     *   or other adjustments
     *  Note that the changes should match the definitions used in MEMORY and SECTIONS
     *
     */
    /* RAM Memory Addresses */
    __RAM_Start = 0x1C00;                 /* RAM Start */
    __RAM_End = 0x5BFF;                     /* RAM End */
        /* RAM shared between App and Bootloader, must be reserved */
        PassWd = 0x1C00;                 /* Password sent by App to force boot  mode */
        StatCtrl = 0x1C02;             /* Status and Control  byte used by Comm */
        CI_State_Machine = 0x1C03;         /*  State machine variable used by Comm */
        CI_Callback_ptr = 0x1C04;   /* Pointer to Comm callback structure */
        /* Unreserved RAM used for Bootloader or App purposes */
        _NonReserved_RAM_Start = 0x1C08; /* Non-reserved RAM */
    
    /* Flash memory addresses */
    _Appl_Start = 0x5C00;             /* Start of Application area */
    _Appl_End = 0xF7FF;                 /* End of Application area */
    _Flex_Start = 0x10000;             /* Start of flex space (app or download, project-dependent) */
    _Flex_End = 0x45BF7;                 /* End of flex space (app or download, project-dependent) */
    
    
        /* Reserved Flash locations for Bootloader Area */
        __Boot_Start = 0xF800;         /* Boot flash */
        __Boot_Reset = 0xFFFE;                          /* Boot reset vector */
        __Boot_VectorTable = 0xFF80;      /* Boot vector table */
        __Boot_SharedCallbacks_Len = 6; /* Length of shared callbacks (2 calls =4B(msp430) or 8B(msp430x) */
        __Boot_SharedCallbacks = 0xFF7A; /* Start of Shared callbacks */
        _Appl_Proxy_Vector_Start = 0xF702; /* Proxy interrupt table */
        /* Reserved Flash locations for Application Area */
        _Appl_Checksum = (_Appl_Start);                   /* CRC16 of Application */
        _Appl_Start_Memory = (_Appl_Start+2);                 /* Application Area */
        _Appl_CRC_Size1 = (_Appl_End - _Appl_Start_Memory +1);         /* Number of bytes in lower memory calculated for CRC */
        _Appl_CRC_Size2 = (_Flex_End - _Flex_Start + 1); /* Number of bytes in upper memory calculated for CRC */
    
        _Appl_Reset_Vector = (__Boot_Start - 2);
        
        /* MEMORY definition, adjust based on definitions above */
    MEMORY
    {
        SFR                     : origin = 0x0000, length = 0x0010
        PERIPHERALS_8BIT        : origin = 0x0010, length = 0x00F0
        PERIPHERALS_16BIT       : origin = 0x0100, length = 0x0100
        // RAM from _NonReserved_RAM_Start - __RAM_End
        RAM                     : origin = 0x1C08, length = 0x3FF8
        // Flash from __Boot_Start -( __Boot_SharedCallbacks or INT_VECTOR_TABLE)
        FLASH                   : origin = 0xF800, length = 0x77A
        // Shared callbacks from __Boot_SharedCallbacks + Len (when used)
        BOOT_SHARED_CALLBACKS   : origin = 0xFF7A, length = 6
        // Boot vector Table from __Boot_VectorTable- __Boot_Reset
        INT_VECTOR_TABLE        : origin = 0xFF80, length = 0x7E
        // Boot reset from __Boot_Reset-_Flash_End
        RESET                   : origin = 0xFFFE, length = 0x0002
    }
    
    /****************************************************************************/
    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY                              */
    /****************************************************************************/
    
    SECTIONS
    {
        .bss        : {} > RAM                /* GLOBAL & STATIC VARS              */
        .data       : {} > RAM                /* GLOBAL & STATIC VARS              */
        .sysmem     : {} > RAM                /* DYNAMIC MEMORY ALLOCATION AREA    */
        .stack      : {} > RAM (HIGH)         /* SOFTWARE SYSTEM STACK             */
    
        .text       : {} >> FLASH        	  /* CODE                 */
        .cinit      : {} > FLASH        /* INITIALIZATION TABLES*/ 
        .const      : {} >> FLASH       /* CONSTANT DATA        */
        .cio        : {} > RAM          /* C I/O BUFFER                      */
    
        .BOOT_APP_VECTORS : {} > BOOT_SHARED_CALLBACKS
        /* MSP430 INTERRUPT VECTORS          */
        .BOOT_VECTOR_TABLE : {} > INT_VECTOR_TABLE
        .reset       : {}               > RESET  /* MSP430 RESET VECTOR         */ 
    }
    
    /****************************************************************************/
    /* INCLUDE PERIPHERALS MEMORY MAP                                           */
    /****************************************************************************/
    
    -l MSP430F5438A.cmd
    
    

    Application linker file : 

    /******************************************************************************/
    /* LINKER COMMAND FILE FOR MSPBoot BOOTLOADER USING MSP430F5438A  */
    /* File generated with MSPBootLinkerGen.pl on 06-28-2024 */
    /*----------------------------------------------------------------------------*/
    
    
    /****************************************************************************/
    /* SPECIFY THE SYSTEM MEMORY MAP                                            */
    /****************************************************************************/
    /* The following definitions can be changed to customize the memory map for a different device
     *   or other adjustments
     *  Note that the changes should match the definitions used in MEMORY and SECTIONS
     *
     */
    
    /* RAM Memory Addresses */
    __RAM_Start 			= 0x1C00;                 	/* RAM Start */
    __RAM_End 				= 0x5BFF;                  	/* RAM End */
    
    /* RAM shared between App and Bootloader, must be reserved */
    PassWd 					= 0x1C00;               	/* Password sent by App to force boot  mode */
    StatCtrl 				= 0x1C02;             		/* Status and Control  byte used by Comm */
    CI_State_Machine 		= 0x1C03;         			/* State machine variable used by Comm */
    CI_Callback_ptr 		= 0x1C04;   				/* Pointer to Comm callback structure */
    
    /* Unreserved RAM used for Bootloader or App purposes */
    _NonReserved_RAM_Start 	= 0x1C08; 					/* Non-reserved RAM */
    
    /* Flash memory addresses */
    __Flash_Start 			= 0x5C00;             		/* Start of Application area */
    
    /* Reserved Flash locations for Bootloader Area */
    __Boot_Start 			= 0xF800;         			/* Boot flash */
    __Boot_Reset 			= 0xFFFE;                   /* Boot reset vector */
    __Boot_VectorTable 		= 0xFF80;      				/* Boot vector table */
    __Boot_SharedCallbacks_Len 	= 6; 					/* Length of shared callbacks (2 calls =4B(msp430) or 8B(msp430x) */
    __Boot_SharedCallbacks 		= 0xFF7A; 				/* Start of Shared callbacks */
    _Appl_Proxy_Vector_Start 	= 0xF702; 				/* Proxy interrupt table */
    
    _BOOT_APPVECTOR 			= __Boot_SharedCallbacks;       /* Definition for application table             */
    
    
    /* MEMORY definition, adjust based on definitions above */
    MEMORY
    {
        SFR                     : origin = 0x0000, length = 0x0010
        PERIPHERALS_8BIT        : origin = 0x0010, length = 0x00F0
        PERIPHERALS_16BIT       : origin = 0x0100, length = 0x0100
        RAM                     : origin = 0x1C08, length = 0x3FF8
    
    	INFOA                   : origin = 0x1980, length = 0x80
        INFOB                   : origin = 0x1900, length = 0x80
        INFOC                   : origin = 0x1880, length = 0x80
        INFOD                   : origin = 0x1800, length = 0x80
    
        FLASH                   : origin = 0x5C02, length = 0x9B00			 // Flash from _App_Start -> (APP_PROXY_VECTORS-1)
        FLASH2                  : origin = 0x10000,length = 0x35BF8
        APP_PROXY_VECTORS       : origin = 0xF702, length = 252				 // Interrupt Proxy table from  _App_Proxy_Vector_Start->(RESET-1)
        RESET                   : origin = 0xF7FE, length = 0x0002			 // App reset from _App_Reset_Vector
    }
    
    /****************************************************************************/
    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY                              */
    /****************************************************************************/
    
    SECTIONS
    {
        .bss        		: {} > RAM                	/* GLOBAL & STATIC VARS              */
        .data       		: {} > RAM                	/* GLOBAL & STATIC VARS              */
        .sysmem     		: {} > RAM                	/* DYNAMIC MEMORY ALLOCATION AREA    */
        .stack      		: {} > RAM (HIGH)         	/* SOFTWARE SYSTEM STACK             */
    
        .text       		: {} >> FLASH | FLASH2    	/* CODE                 */
        .cinit      		: {} > FLASH        		/* INITIALIZATION TABLES*/
        .const      		: {} >> FLASH2 | FLASH    	/* CONSTANT DATA        */
        .cio        		: {} > RAM                	/* C I/O BUFFER                      */
    
        .APP_PROXY_VECTORS 	: {} > APP_PROXY_VECTORS 	/* INTERRUPT PROXY TABLE            */
        .reset       		: {} > RESET  				/* MSP430 RESET VECTOR                 */
    
        .text:_isr  		: {}  > FLASH             	/* Code ISRs                         */
    
    	.infoA     			: {} > INFOA              	/* MSP430 INFO FLASH Memory segments */
        .infoB     			: {} > INFOB
        .infoC     			: {} > INFOC
        .infoD     			: {} > INFOD
    }
    
    /****************************************************************************/
    /* INCLUDE PERIPHERALS MEMORY MAP                                           */
    /****************************************************************************/
    
    -l MSP430F5438A.cmd
    
    

    I would appreciate your help again.
    Thanks.

  • Here is the steps to set the PC directly

    Step1: Directly change the PC value

    Step2: Press Enter. Then it will jump to the related address

    To find the App code main entrance, you can find at there in the .map file:

    If you want to debug the BSL code and APP code together please:

    1. First download BSL code

    2. Second download App code after doing the changes as bellow. Then you can keep the BSL code and App code at the same time.

**Attention** This is a public forum