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.

MSP430F425: how to develope bootloader using flash memory for msp430f6779a in IAR using UART communication

Part Number: MSP430F425
Other Parts Discussed in Thread: MSP430F6779A, , MSP-FET

Hi Everyone ,

       I am using MSP430F6779A  processor i want to boot loader for dumping the code in my device using serial port. How can i create the boot loader for the MSP430F6779A , is there any library reference or how to develop the custom boot loader . Please response soon ASAP.     

  • Hi Sumit,

    Are you using the MSP430F6779A or the MSP430F425? The MSP430F425 is not recommended for new designs.

    TI provides MSPBoot that shows examples of how to create a boot loader in main memory and program the device via a serial interface. However, this is only designed for TI's small memory model MSP430 devices (<65kb). We are currently working on a large memory model version that would be more applicable to the MSP430F6779A  but it will be several months before it is released. I would start by studying MSPBoot and use it as a base for your boot loader. Then, as you develop your code, I can help guide you through any of the obstacles you may face when attempting to port to a large memory model device. 

    Best regards, 
    Caleb Overbay

  • Hi Sumit,

    In addition to what Caleb said, I'd also like to point out that there does exist already in the MSP430F6779A a built-in bootloader in a special area of BSL flash. This is a UART-based bootloader that you can use to load code into the part - more information about how to interface with it can be found in www.ti.com/.../slau319 BSL User's Guide.

    Because this bootloader is in the 2kB BSL flash, you can actually customize that bootloader instead of the method that Caleb mentioned, as long as you can keep your bootloader code under 2kB - so then you could use whatever interface or protocol that you want. There's more information on customizing the flash-based bootloader in www.ti.com/.../slaa450 and the associated software: software-dl.ti.com/.../index_FDS.html. This would be a better solution to implement than MSPBoot if possible - but the limitation is that you only have 2kB for your customization as I mentioned.

    I hope this helps to provide some guidance.

    Regards,
    Katie
  • Hi Caleb,

    Hi Katie,

    thanx for very fast response, i will go through the documents provided by you guys in suggestion and i'll update the result as soon as possible.

    i have downloaded the MSP BSL library and working on it but i am getting some problem, may be these documents will help in solving the problems..

    although after trying my level best i'll give you the update soon...

    thanxxx and regards,

    Sumit

  • hi Katie,

    as i had already updated that i was working on MSP BSL  library and i had manipulated the code as per the requirement of my device but when i am compiling the code i am getting an error while linking as

    Fatal Error[e72]: Segment BSL430_VERSION_VENDOR must be defined in a segment definition option (-Z, -b or -P)


    i have read in the forum itself someone has stated that this error may come due to the code has been developed for an older version of an IDE, may be i have to make some changes in linker file to solve it.

     i am using IAR 6.10 i want to know that how can i solve this error for my IDE.......please help me out....

    thanxx.....

    Sumit.

  • Hi Sumit,

    The BSL requires a customized linker file - you should check if your project is set up to use this. You can find an example linker file in MSP430BSL_1_00_12_00\5xx_6xx_BSL_Source\MSP430F552x_TA_UART\CONFIG lnk430_BSL_AREA_RAM_2400-33FF.xcl.

    Observe that this linker file includes:

    -Z(CONST)BSL430_VERSION_VENDOR=1010-1010

    Which should resolve your error message I believe.

    You will need to make a version of this linker file for your particular device - simply copy the example file I mentioned above and put it in your directory with your project. Because the BSL area is at the same addresses on all of these parts, I think that you will only need to modify the addresses for the RAM to match the datasheet RAM addresses for your device. The RAM is specified in the line:

    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,DATA16_HEAP+_DATA16_HEAP_SIZE=2400-33FF

    Simply change those addresses at the end of the line to reflect the RAM from your device datasheet.

    You will probably want to rename the linker file also because the name currently reflects the RAM addresses 2400-3FFF which is different than on your device. Finally, you need to set the Project > Options > Linker to use this file. On the Config tab under linker configuration file check the box for "override default" and then include a path to your customized linker command file in your project directory. You can start the path with $PROJ_DIR$\ and then provide a path relative to your project file if you'd like.

    Please let me know if this helps to resolve your issue.

    Regards,

    Katie

  • hi Katie,

    thanks for providing support to me and  of course it helped me in solving my problem by following the answer suggested by you. one thing i want to add is that apart from making the version of the linker file of the particular device and changing the RAM address as per the device we also have to change the address of code segment as per the device.

    <

    -Z(DATA)CODE_I
    -P(CODE)CODE,CODE_ID=10000-8BFFF

    >

    thanks again for supporting me,,,,,,,,

    regards,

    Sumit

  • Hi Sumit,

    Setting your CODE,CODE_ID to go to addresses 10000-8bFFFh is not correct if you are trying to place your code in the BSL area of memory. The BSL project should always set the code to the segment 1010-17EFh on all F5xx/6xx parts for BSL projects, because the addresses for the BSL area of memory is only 2kB on all F5xx/6xx parts and is always at the addresses 0x1000-17FF (the slight difference in what is reserved in the linker for code is that some of the addresses are used for version information, signature, jump table, etc).

    Now if this was a normal project for normal application code area (not bootloader), then yes the linker file will have different code address area per device.

    Was your BSL code not fitting in the 1010-17EFh addresses and you were getting an error or something?

    Regards,
    Katie
  • hi Katie,

    yes, if i am using the  address 1010-17EF for code  it is throwing an error message that is

    Error[e104]: Failed to fit all segments into specified ranges. Problem discovered in segment CODE. Unable to place 39 block(s) (0x7ba byte(s) total) in  
    0x79a byte(s) of memory. The problem occurred while processing the segment placement command "-P(CODE)CODE,CODE_ID=1010-17EF", where at  
    the moment of placement the available memory ranges were "CODE:1056-17ef"

    but if i am using the address location 10000-8BFFF then it is compiling successfully without any error

    //*****************************************************************
    //
    // XLINK command file for IAR Embedded Workbench for MSP430.
    //
    // This file describes the BSL memory locations, and RAM
    //*****************************************************************
    
    
    // ---------------------------------------------------------
    // Stack and heap sizes.
    // ---------------------------------------------------------
    
    // Uncomment for command line use
    //-D_STACK_SIZE=80
    //-D_DATA16_HEAP_SIZE=80
    //-D_DATA20_HEAP_SIZE=80
    
    
    // ---------------------------------------------------------
    // Define cpu.
    // ---------------------------------------------------------
    
    -cmsp430
    
    // ---------------------------------------------------------
    // Read-write memory.
    // ---------------------------------------------------------
    
    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,DATA16_HEAP+_DATA16_HEAP_SIZE=01C00-09BFF
    -Z(DATA)DATA20_I,DATA20_Z,DATA20_N,DATA20_HEAP+_DATA20_HEAP_SIZE
    -Z(DATA)CSTACK+_STACK_SIZE#
    
    
    // ---------------------------------------------------------
    // Read only memory
    // ---------------------------------------------------------
    
    // ---------------------------------------------------------
    // Version Info
    
    -Z(CONST)BSL430_VERSION_VENDOR=1010-1010
    -Z(CONST)BSL430_VERSION_CI=1011-1011
    -Z(CONST)BSL430_VERSION_API=1012-1012
    -Z(CONST)BSL430_VERSION_PI=1013-1013
    
    // BSL Signatures
    -Z(CONST)BSLSIG=0x17F0-17FB
      //  contains:
      //  BSL Start Vector             
      //  BSL Unlock Function Vector   
      //  BSL Unlock Signature 1       
      //  BSL Unlock Signature 2       
    -Z(CONST)JTAGLOCK_KEY=0x17FC-17FF
      //  if it contains:
      //  0x0000 0x0000 or
      //  0xFFFF 0xFFFF the JTAG will be unlocked otherwise JTAG is locked
    
    
    // ---------------------------------------------------------
    // Code
    
    -Z(CODE)CSTART,ISR_CODE=1010-17EF
    
    // ---------------------------------------------------------
    // Constant data
    
    -Z(CONST)DATA16_C,DATA16_ID,DIFUNCT=1010-17EF
    
    
    // -----------------------------------------------
    // Information memory
    //
    
    //-Z(CONST)INFO=1800-19FF
    //-Z(CONST)INFOA=1980-19FF
    //-Z(CONST)INFOB=1900-197F
    //-Z(CONST)INFOC=1880-18FF
    //-Z(CONST)INFOD=1800-187F
    
    // ---------------------------------------------------------
    // All memory 0 - 0xFFFFF
    // ---------------------------------------------------------
    
    // -------------------------------------------------------------------
    //  BSL Memory
    // -------------------------------------------------------------------
    -Z(CODE)ZAREA=1000-100F
    -Z(CODE)ZAREA_CODE=1010-17FF
    -Z(CODE)BSL0=1010-11FF
    -Z(CODE)BSL1=1200-13FF
    -Z(CODE)BSL2=1400-15FF
    -Z(CODE)BSL3=1600-17EF
    
    // ---------------------------------------------------------
    // Code
    
    -Z(DATA)CODE_I
    -P(CODE)CODE,CODE_ID=1010-17EF                           //10000-8BFFF if i am using this address no problem but i don't know how it will be a normal app plzz explain
    //-P(CODE)CODE=1070-17AB
    //-P(CODE)VCORE=17AC-17EF
    
    // ---------------------------------------------------------
    // Constant data
    -Z(CONST)DATA20_C,DATA20_ID=1010-17EF                   
    
    
    // ---------------------------------------------------------
    // Interrupt vectors
    // ---------------------------------------------------------
    
    -Z(CODE)INTVEC=FF80-FFFF
    -Z(CODE)RESET=FFFE-FFFF                              //address modified from FFAE-FFAF to FFFE-FFFF..
    
    // ---------------------------------------------------------
    // The end
    // ---------------------------------------------------------

    these are the modification done by me in the code please go through it and help me in solving the issue and what i am doing wrong,,,

    thanks for supporting me;;;;;

    regards,
    Sumit

  • Hi Sumit,

    If you change the addresses it will compile without error - but now it is not placing the code into BSL memory. Even though it builds, the BSL will not actually work correctly in this way, because when you get to the code that is outside of the BSL memory it will jump out of BSL and you won't be able to return/re-enter. Because the code is in main memory you also would lose it when the mass erase is performed before programming the part, so your BSL wouldn't actually work.

    From the error message you got, your code is size 0x7ba and the available space is only 0x79a - so your code is REALLY close to fitting (only 32 bytes off). You have a few options:
    1. Try to get the BSL to fit in the BSL area. This could be by checking compiler options to make sure it is optimizing for size over speed, or it could also involve doing some hand optimization of your code to try to shave off those last 32 bytes. Check if there's anything unnecessary being included - maybe there are some commands from the base BSL that you don't really need to support and could exclude?
    2. Otherwise, you're going to have to go with a totally different, main memory area bootloader solution like MSPBoot. but this is going to be A LOT more effort and is much more complex. It would be best if you can fit your code in the BSL area.

    Regards,
    Katie
  • hi Katie,

    thanks again, i had solved that error by optimizing my code using project > options > c/c++compiler > optimization by setting the level as medium

    but now when i am sending the RX password command to unlock the device it is giving response as incorrect header and Packet size exceeds

    buffer but i have kept buffer size as 260..if i am sending the synchronization character as 0x80 then also it is giving the same response as Packet size

    exceeds buffer. i am not getting what is happening and how can i unlock my boot loader, please help me how can i start my boot loader working.

    thanks and regards,

    Sumit

  • Hi Sumit,

    What are you using as the host to send these commands to the BSL? If you just want to test your BSL with the PC, I would recommend you can use the BSL Scripter software found here: software-dl.ti.com/.../index_FDS.html to run on the host side. This will handle all the protocol things for you, you just have to provide a script file that is essentially a list of commands. There is a user's guide at the same link. The BSL Scripter runs on the PC, and you need to use hardware to interface the PC with your MSP430 device - this can be the MSP-FET tool, following the connections in www.ti.com/.../slau647 the MSP Debugger's guide see section 5.6.5.1 JTAG Target connector - for BSL you must connect TEST, RST, and then the BSL pins you are using (e.g. UART_TXD and UART_RXD for UART BSL).

    Or do you need to access the MSP430 from a different device or micro, not the PC? In any case, what is listed above should be a known good software with which to test your BSL, to determine if the issue is on the host side or the target side.

    Regards,
    Katie
  • Hi Katie,

    thanks for the continuous support and help

    i am using my pc as host and it is having window 32, so the problem is that after downloading the BSL scripter when i am trying to run the BSL SCRIPTER .exe file it is giving an error as it is not a valid WIN32 application..

    is there any other version of BSL scripter available for WIN32 if it is available please share the link to download it, or is give  any solution to solve this issue i have tried to solve this but not succeed..please help..>>>>>>>>>

    thanks and regards,

    Sumit

  • Hi Sumit,

    I have not seen this issue before. Could you try this previous version 1.00.03.00 to see if you see the same error?

    Regards,

    Katie

  • Hi Katie,

    i have tried all the previous version available at MSP BSL Download folder but each and every version is having the same problem..

    BLS Replicator amd BSLDEMO2 these both are working fine.. but BLS Scripter is having problem.

    i think this application has been developed for 64bit windows OS..

    can't i test my bootloader using docklight , if i am sending command using docklight why it is giving error response..

    thanks and regards,

    Sumit

  • Hi Sumit,

    Can you provide more detailed information on what 32-bit version of Windows you are using? e.g. Windows XP, Windows 7, Windows 10 etc? We might have a test machine so we could try to replicate your issue.

    Regards,

    Katie

  • Hi Katie,

    i am using windows xp...

    thanks and regards,

    sumit

  • Hi Sumit,

    The BSL Scripter v3.x was developed for Windows 7 and newer version. I would suggest you to download the BSL Scripter v2.x that is still available  on this link. The script and command are all the same, except the BSL Scripter v.2.x does not have the command line interface, so you always have to provide the script.

    Please let me know if you have further questions.

  • Hi Katie,

    i have downloaded the software from the link provided by you, but again the same error is coming.. below is the link i have used to download the package..

    MSP430/MSP432 BSL Programmer Package (BSL scripter)   9812K

    http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPBSL/1_00_00_00/index_FDS.html

  • hi santosa,
    i have downloaded the package from the link given by you , but still i am facing the same problem, i have given the link in one of my reply to you but i had mentioned Katie there by mistake as she is continuously supporting me for the bsl....so don't get angry for my mistake and please help me out to solve this issue...
    thanks and regards,
    sumit
  • Hi Sumit,

    no worries! :) I just had the win XP machine and tried the BSL Scripter v2 and v3, and unfortunately both are not supported in XP. We provided the source code in the package for BSL Scripter v2 and v3, is it possible for you to build the BSL Scripter on your XP machine? I suggest to try the BSL Scripter v2, since it used the windows library. The BSL Scripter v3 requires the Boost libraries which I don't think will work in XP.
  • Hi Fatma,

    actually i have already developed the custom bootloader for my device using MSP BSL packages available on the TI website, now the only thing i want is to check  that is it working properly or not, for checking purpose only i want to use BSL Scripter.....or can you tell me how can i use the inbuilt bootloader provided by TI in controller itself to program the device using serial cable...

    thanks and regards.

    Sumit

  • Hi Fatma,

    now  i am proceeding my BSL application using BSL scripter in windows and and the BSL scripter is running fine. But now the problem is that when i am giving the script file name in the BSL scripter it is giving error for each script as Unknown Ack Value!..can you please help me how can i solve this error or why this error is coming.. i am attaching the log file and the script file..

    23.txt
    //
    //Script example 6xx UART BSL
    //Device tested: MSP430F6459
    //Comm Bridge used: MSP-BSL Rocket
    //
    //Download the blink application
    //through UART BSL
    //
    LOG
    MODE 6xx UART 9600 COM7
    //gives the wrong password to
    //mass erase the memory
    RX_PASSWORD .\pass32_wrong.txt
    DELAY 2000
    RX_PASSWORD .\pass32_default.txt
    RX_DATA_BLOCK .\BSL_430.txt
    //RX_DATA_BLOCK .\blinkLED_f6459.txt
    CRC_CHECK 0x1010 0x0020 0x4872  
    CRC_CHECK 0xffc6 0x00D0 0xacf7 
    SET_PC 0x1010

    23_2017May29_103040.log
    ---------------------------------------------------------
    BSL Scripter 3.2.1
    PC software for BSL programming
    2017-May-29 10:30:40
    ---------------------------------------------------------
    Input file script is : C:/Users/ITSUPPORT/Desktop/bsl-scripter-windows/6xx_uart/23.txt
    MODE 6xx UART 9600 COM7
    //gives the wrong password to
    //mass erase the memory
    RX_PASSWORD .\pass32_wrong.txt
    	Read Txt File  : C:\Users\ITSUPPORT\Desktop\bsl-scripter-windows\6xx_uart\pass32_wrong.txt
    	[ACK_ERROR_MESSAGE]Unknown ACK value!
    DELAY 2000
    	Delay 2000 ms
    RX_PASSWORD .\pass32_default.txt
    	Read Txt File  : C:\Users\ITSUPPORT\Desktop\bsl-scripter-windows\6xx_uart\pass32_default.txt
    	[ACK_ERROR_MESSAGE]Unknown ACK value!
    RX_DATA_BLOCK .\BSL_430.txt
    	Read Txt File  : C:\Users\ITSUPPORT\Desktop\bsl-scripter-windows\6xx_uart\BSL_430.txt
    	[ACK_ERROR_MESSAGE]Unknown ACK value!
    	Time elapsed of writing 256 bytes : 1.27 seconds
    	Speed of writing data :0.1969(kB/s)
    //RX_DATA_BLOCK .\blinkLED_f6459.txt
    CRC_CHECK 0x1010 0x0020 0x4872  
    	[ACK_ERROR_MESSAGE]Unknown ACK value!
    CRC_CHECK 0xffc6 0x00D0 0xacf7 
    	[ACK_ERROR_MESSAGE]Unknown ACK value!
    SET_PC 0x1010
    

    thanks and regards,

    Sumit

  • Hi Fatma,

    i forgot to mention that i am using MSP-FET430UIF communicate with BSL and i observed that it is not communicating with the BSL because if i am disconnecting the MSP-FET430UIF from the device then also it is giving the same error i.e "unknown ack value".....after disconnecting the debugger from the USB itself then only it is giving some different error as "unable to find the specified file"

    and is there any need to download the visual studio 2013 and the boost and hidapi package to start the communication if i have already developed the custom bootloader for my device, now i am using windows 10 64bit pc as host..

  • Hi Sumit,

    The MSP-FET430UIF (older FET tool, is grey) does not support BSL. The MSP-FET (new FET tool, is black) does support BSL. Please see MSP Debugger's Guide www.ti.com/lit/pdf/slau647 Table 1 showing debug probes features.

    Do you have access to an MSP-FET tool?

    Regards,

    Katie

  • Hi Katie,

    thanks for replying again, actually i don't have MSP-FET, that's why i want to know what can i do now, as i have tested using docklight giving some command like mass erase rx password and bsl version commands and it is giving the correct response but now i am not getting that how can i dump my application code using serial port.

    one more thing that after loading the BSL application to my device i am giving hardware reset sequence to invoke the bootloader then only it is giving response to any command or else it is not responding to any command, is it the right way or not...

    thanks and regards,

    Sumit

     

  • Hi Sumit,

    I see you do not have access to MSP-FET, only MSP-FET430UIF. You also mentioned you are able to do some BSL commands over serial port, so you must have a serial port connection to the device. If you are able to get some commands to work via serial port + docklight, you should be able to use BSL Scripter with that serial port instead of MSP-FET because essentially it is using the same mechanism. Just make sure to use the correct COM port in your script so that it corresponds to your serial port. If it works with docklight, it should work with the scripter if you have invoked the bootloader the same way that you mentioned is working for when you are using docklight.


    For your comment about doing a reset to invoke the bootloader after loading BSL area of the part with your custom BSL - yes I think this is required to reset the device before you can start using the BSL.

    Please try using your existing serial port connection rather than MSP-FET430UIF with the BSLScripter and report if it is now working, or still failing in the same way.

    Regards,
    Katie
  • Hi Katie,

    thanks again,,, yea BSL is working fine with serial port as you have suggested to work with serial port instead of MSP-FET430UIF, it is responding for the wrong password as well as default password but for the application code it is giving error "File type is not valid for BSL Scripter!" i am attaching my script files please check it where i am doing wrong..

    8461.23.txt
    //
    //Script example 6xx UART BSL
    //Device tested: MSP430F6459
    //Comm Bridge used: MSP-BSL Rocket
    //
    //Download the blink application
    //through UART BSL
    //
    LOG
    MODE 6xx UART COM2
    //gives the wrong password to
    //mass erase the memory
    RX_PASSWORD .\pass32_wrong.txt
    RX_PASSWORD .\pass32_default.txt
    RX_DATA_BLOCK .\emeter-6779.txt
    CRC_CHECK 0x1800 0x008E  
    CRC_CHECK 0xC000 0x0395
    CRC_CHECK 0xC396 0x0029
    CRC_CHECK 0xC3C0 0x3BC0
    CRC_CHECK 0xFFCC 0x0002
    CRC_CHECK 0xFFEA 0x0002
    CRC_CHECK 0xFFF0 0x0002
    CRC_CHECK 0xFFF6 0x0002
    CRC_CHECK 0xFFFE 0x68F8  
    SET_PC 0x1800
    23_2017Jun06_120910.log
    ---------------------------------------------------------
    BSL Scripter 3.2.1
    PC software for BSL programming
    2017-Jun-06 12:09:10
    ---------------------------------------------------------
    Input file script is : C:/Users/ITSUPPORT/Desktop/hgfhgfhf/6xx_uart/23.txt
    MODE 6xx UART COM2
    //gives the wrong password to
    //mass erase the memory
    RX_PASSWORD .\pass32_wrong.txt
    	Read Txt File  : C:\Users\ITSUPPORT\Desktop\hgfhgfhf\6xx_uart\pass32_wrong.txt
    	[ERROR_MESSAGE]BSL Password is error!
    RX_PASSWORD .\pass32_default.txt
    	Read Txt File  : C:\Users\ITSUPPORT\Desktop\hgfhgfhf\6xx_uart\pass32_default.txt
    	BSL Password is correct!
    RX_DATA_BLOCK .\emeter-6779.txt
    	File type is not valid for BSL Scripter!
    
    emeter-6779A.txt

    Thanks and regards,

    Sumit

  • Hi Sumit,

    I just tried this and reproduced your issue, but it resolved when I rename the file emeter-6779.txt and update the script to match. I think it is having an issue with the "-" in the filename. Can you try changing the filename?

    Regards,
    Katie
  • Hi Katie,

    thanks a lot for your continuous support and help now the bsl is working fine  i had just dumped my application in device and restarted the device and the application is running fine..one thing i want to know that i am giving the standard RESET sequence using hardware RST and TEST pin to start BSL program execution is there any other way to do the same..

    thanks and regards,

    Sumit

  • Hi Sumit,


    The standard way to enter BSL is through the RESET and TEST sequence that you mentioned. There are some other options - you can jump to BSL from your main application code by using the sequence described in section 3.8.1 Starting the BSL from an External Application in the BSL User's Guide www.ti.com/.../slau319. You can have your application do this jump after any predefined set of conditions that you like, just include it in your application code.
    Additionally, since you are using a custom bootloader in the F6779A, you could modify the bootloader code to enter based on whatever you would like - e.g. a certain pin being held low/high at startup, a certain value being located at a certain address in flash at startup, a blank reset vector, etc.

    Do you have something particular in mind?

    Regards,
    Katie

  • Hi Katie,

    thanks for your great  help and support , i asked because i want  to remove the external hardware to invoke the bsl because as what i am doing to invoke the bsl that needs two extra push buttons on my device which i don't want to do, i want to invoke the bsl through the custom bootloader application itself..

    thanks and regards,

    Sumit

  • Hi Sumit,

    Are you saying you want to invoke the bootloader from the host side? In this case, you could define a UART command in your main application that, when received, does the software invoke of the bootloader that I mentioned. Then from the host side you just have to send the command from the serial port. Note that this will only work when you already have some application code already loaded, but you could do firmware updates in this method after initial device programming.

    Regards,
    Katie
  • Hi Katie,

    thanks for your help and support, i had just  asked the above question for my knowledge, i don't want to do anything extra, as i have completed my project successfully, thanks thanks a lot..

    Regards,

    Sumit

**Attention** This is a public forum