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.

Documentation for MSP430x5xx Boot Code - MSP430F5529

Per slau208h (MSP430x5xx Family User Guide) section 1.9 "Boot Code" is there any documentation that explains this code? I may need to write my own to change how the BSL can be invoked on startup. 

  • Ben,

    boot code and BSL are two different things. If you want to make a custom BSL, please refer to:

    www.ti.com/lit/slaa450

  • I wasn't asking how to do a custom BSL; I was asking how to do custom boot code. On the 5529, if the PUR pin is held high after BOR reset, the BSL is invoked. The check for the PUR pin is part of the boot code. I need to know how to modify this check. 

  • Ben,

    I understand what you are looking for, and you can't basically alter the boot code since it is in ROM. What you are looking for is basically to modify the BSL_Protect function. Please refer to the SLAA450 link above, chapter 1.2.1 "BSL Protect Function".

  • Leo is right. While the BSL entry sequence is detected in hardware, it is the BSL_Protect function that actually checks it. And this function is part of the BSL and called by the boot code. Its return value tells the boot code whether to call the BSL or to start the application.
    Of course you can alter this function to do any BSL entry check you want. But it means compiling a new bootloader, even if you don't touch the BSL code itself.

  • I am starting to see the picture here, but this is new territory so I have more questions. 

    I am looking through the example code in the SLAA540 zip file. I see a cstartup.s43 @ SLAA450\5xx_6xx_BSL_Source\Peripheral_Interfaces\USB -- is this the boot code? This code initializes memory segements, calls low_level_init, and then calls main(). Is this the program that is called after a reset? Is this the boot code that Leo said is loaded in ROM? 

    It seems this code would then call the main() function in file BSL430_Command_Interpreter.c located @ SLAA450\5xx_6xx_BSL_Source\Command_Interpreter. Is this correct? 

    I see another file, BSL430_Low_Level_Init.s43, located @ SLAA450\5xx_6xx_BSL_Source\MSP430F552x_USB. At the BSL_Protect label, I can see the exact code I want to override. It is looking at the PUR_IN; if high, it will jump to REQUEST_BSL. But I don't understand how/where this portion of code is called. 

  • Jens-Michael -- are you sure the BSL entry sequence is detected in hardware? That may be the missing link from per my previous post. Can you point me to any documentation for this? If indeed hardware, I wonder if this runs for a period of time before the boot code ever starts, or if they run in parallel? 

  • @ Leo: What is the address space for the boot code in ROM? I don't see anything in the User Guide. Is this code actually located in Flash? Can I modify this code using the linker?

    Also, if I modify the address loaded in the Reset Vector in the linker, I should be able to point to my on boot code, correct? 

  • @ Leo and Jens-Michael

    Per Jens-Michael Forum Usage post: RTFM. After reading SLAA450, it is starting to make sense. 

    The BSL_Protect function is called by the boot code. I think the non-usb versions, they check SYSBSLIND, which I think is set by some hardware function. For the usb versions, they check if the PUR_IN signal is high. I can write my own BSL_Protect function to get the behavior I need.

    If a BSL entry sequence is detected, then it runs BSL code. Eventually it should set the PC to user code or reset the device. 

    If a BSL entry sequence is NOT detected, then the BSL_Protect function checks the reset vector. If not blank (for usb version), it ultimately jumps to user code, which I think is the address stored in the reset vector. I believe this is the cstartup.s43 code that will initialize memory and then call the main() function. 

    Is this correct or close to right? 

  • Ben Hagan said:
    Is this correct or close to right? 

    This pretty much sums it up. There might be mistakes in detail, but I'm not so much experienced on this area to see them.

    except one: the BSL_Protect funciton itself doesn't start the application. because it is only called afer a POR, not a PUC, so it is more likely that it is th eboot code that finally starts the application, after BSL_Protect returned. (Else there would be duplicate application start code)

    cstartup.s43 is the start code for C programs (global variael init, stack init etc.) and the reset vector points to it - in case of a C program. Howwever, this is compiler-specific stuff. Other compiler, other startup code.

**Attention** This is a public forum