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.

MSP4305328 Custom Bootstrap Loader

Other Parts Discussed in Thread: MSP430F5328, MSP430F5418A

Hello, 

I have been developing a Custom Bootstrap Loader for the MSP430F5328 using Code Composer 6.0.1 and TIs compiler v4.3.3. I have followed the instructions posted on http://processors.wiki.ti.com/index.php/Custom_MSP430_BSL and tested using the suggestions listed on SLA450C. I am using UART to communicate to the device and have modified the BSL430_PI_USCIA.c and BSL_Device_file.h to accommodate my use. I have not modified the Low_Level_Init.asm file, but have added a function to turn on LEDs when entering the main bootloader sequences (Active Low). When testing the file and removing the Low_level_init.asm the file works as expected. I first flash the bootloader and modify the MSP430 properties to flash to the appropriate Zarea sections. When I add my application code, it seems like I never enter the bootloader section. 

My main applications contains a function call to ((void (*)(void))0x1000)(); Yet , based on the unlit LEDs and unresponsive scripter, my program halts without entering the main function call in BSL430_Command_interpreter.c Are there any additional modifications required to make the bootloader function properly? 

I greatly appreciate your assistance. 

void main(void)
{
	P5DIR |= (LED0|LED1);
	P5OUT &= (~(LED0|LED1)); // Reversed since they are Anodes
    unsigned char eventFlags = 0;
    volatile int i, ii;

    BSL430_API_RAM_Clear(); // Moved from BSL430_API_init() into independent function
    BSL430_API_init();
    PI_init();
    
    while (1)
    {

        eventFlags = PI_receivePacket();
        if (eventFlags &  DATA_RECEIVED)
        {
            interpretCommand();
        }
    }
}

  • Hi Ivan,

    A couple of ideas:

    In your main application, do you make sure to disable global interrupts before calling the jump to 0x1000 to enter BSL?

    Do you leave BSL430_PI_USCIA.c having none parity and 9600 baud just like the default BSL? Or did you modify to add parity or any other setting? Does it work with the scripter software when you do not do the software entry but test just the BSL? I ask this because the default BSL scripter uses none parity, so if you changed this setting the BSL scripter won't work without modification.

    Ivan Romero said:
    When testing the file and removing the Low_level_init.asm the file works as expected

    Why do you remove Low_level_init.asm - do you have this programmed in when you program in your application code? I believe that the code for the ZAREA is actually set by BSL430_Low_Level_Init so I think there won't be anything at 0x1000 if you haven't included this file? If you read out your binary image from your part using something like the Elprotronic Fet-Pro430 Lite software, can you see if there is anything programmed at 0x1000? 

    Regards,

    Katie

  • Hi Katie,

    Thank you for the quick response! appreciate your suggestions and have responded accordingly.

     

    Katie Pier said:
    In your main application, do you make sure to disable global interrupts before calling the jump to 0x1000 to enter BSL?

    I make use of __bic_SR_register(GIE); to disable my interrupts. 

    Katie Pier said:
    Why do you remove Low_level_init.asm - do you have this programmed in when you program in your application code?

    I remove the Why do you remove Low_level_init.asm for testing the scripter. I've created a separate project and configured my linker so that I can test the  BSL430_PI_USCIA.c, this adequately receives messages from the scripter, but does not perform any of the memory modifying operations. The final bootstrap project has all of the files included in the collateral from SLAA450C, with the modifications and implementation that I've made and tested to BSL430_PI_USCIA.c, The linker file is the same as the one included in the SLAA450C project(lnk_msp430f5418a.cmd).

    After using FET-Pro-LIte I flashed my project with my custom Bootloader then I flashed my application. I then saved memory .txt file. I repeated this process, but this time I used the released BSL image. Both of these files were identical. Afterwards, I compared my custom BootstrapLoader with the released image and found these were identical, with the exception that my custom bootloader seems to have interrupt vectors stored from 0xFF80-0xFFFE and the image is blank. 

    Based on this output, it leads me to believe that the modifications I've made to BSL430_PI_USCIA and BSL430_Command_Definitions are not being saved. Any suggestions? 

    Thanks!

  • Hi Ivan,

    I got a little bit lost in the sequence of things you said you tried with flashing/reading the firmware. Let's back up one step - when you build your bootloader image, you are generating a binary file - correct? Are you using the steps here to generate for example a TI-txt file?: http://processors.wiki.ti.com/index.php/Generating_and_Loading_MSP430_Binary_Files#Using_CCS_v6.x

    When you look at that generated file (from building just your release version of your BSL, not main application code), and compare it to the file in the Released BSL Images folder in the SLAA450 zip file download, do they look like they are in the same areas of memory? The BSL image you generate should be completely contained in the BSL area at 0x1000-0x17FF and should not include any addresses that are outside of that. Is this true?

    You mentioned interrupt vectors - your BSL should not use any interrupt vectors - do you have any of these in your BSL software? This is because the BSL is running out of the BSL Flash - interrupt vectors are always in main flash, so you cannot use them while running BSL. You need to use polling instead - see www.ti.com/lit/pdf/slaa450 p. 5 section 1.3.1 Software Overview where it mentions that the Peripheral Interface should not use interrupt vectors.

    Regards,

    Katie

  • Hi Katie,

    I apologize for the confusion. Correct, I follow the steps to create the txt file. The release from my custom bootloader and the Release BSL Images are in the same areas of memory. Any addresses outside of the BSL area at 0x1000-0x17FF are all listed as 0xFFFF. I do not use any interrupt vectors in any of my functions, only the source provided from the example project.

    EDIT: I've included the .txt output file to this message for reference. 

    @1000
    04 3C FE 3F FF 3F FF 3F FF 3F 30 40 42 10 
    @1010
    00 08 08 
    @1014
    3D 90 AD DE 04 20 3E 90 EF BE 01 20 03 3C 0C 43 
    0D 43 10 01 3C 41 3D 41 10 01 0C 43 B2 D0 03 80 
    82 01 B2 B0 10 00 80 01 01 24 2C D3 10 01 81 00 
    00 5C 00 18 F2 40 C4 17 0E 1D 00 18 F2 40 C4 17 
    12 1D B0 13 AE 17 0C 43 B0 13 66 10 B0 13 C0 17 
    53 
    @1066
    @17f0
    FF FF 2E 10 A5 3C 5A C3 FF FF 00 10 FF FF FF FF 
    @ffd2
    BA 17 BA 17 
    @ffda
    BA 17 BA 17 BA 17 BA 17 BA 17 BA 17 
    @ffea
    BA 17 BA 17 BA 17 BA 17 BA 17 BA 17 BA 17 BA 17 
    BA 17 BA 17 42 10 
    q
    

    When I compile my project, I get the following
    warning #10204-D: could not resolve index library "libmath.a" to a compatible library.

    Could that be causing any issues? Or is there perhaps an issue with Code Composer 6.0.1 and TIs compiler v4.3.3? I've followed your steps listed here: http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/246869, yet I've still come to no success. Just to make sure that my assumptions are correct, when the bootloader enters properly, it should enter the main loop inside of the BSL430_Command_Interpreter, correct? Is there any chance that the modifcations I've made to the Command interpreter are not being written to the device? I've tried to follow the assembly file and make modifications, but I'm not sure how it enters this area. Finally, I erased some of the #pragmas that were located in the project, would removing these cause the issue? Any feedback would be immensely helpful. 

    Thanks again fro your time,
    Ivan

  • Hi Ivan,

    When building your BSL project, did you go change the selected device variant under Project > Properties > General to match the device that you are using (F5328)? Please note, that when you change the device variant, it includes a different linker file. The BSL project you were working off of had a modified linker file for the F5418A device. You will want to open that linker file and observe the sections that are changed/added (FLASH, ZAREA, BSL430_VERSION_VENDOR, etc) - it might be helpful to open both the lnk_msp430f5418a.cmd file from the BSL example project, and the unmodified lnk_msp430f5418a.cmd file from some other clean project which should have the normal unaltered header file. Note down what is different in the BSL linker file, and add these sections/make these changes to the lnk_msp430f5328.cmd file. I've attached one I tried here:

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/166/lnk_5F00_msp430f5328.cmd

    When I used this linker file when building the BSL project, which I had modified to set an LED on the target board in main of the BSL430_command_interpreter.c, I was able to then load a separate application code that called the jump to 0x1000 and successfully saw the LED turn on indicating that I did enter BSL.

    Maybe this was your problem? Maybe you were missing this linker file changes, or were still building for the F5418A? I think it will be best to try to use the F5328 linker file as these are different device sub-families so they have a bit different features/modules/memory sizes.

    Regards,

    Katie

    P.S.

    As a note - to make sure your BSL code is getting written to the BSL area in CCS, you need to make sure that you have gone under Project > Properties > Debug > MSP430 Properties and under Download Options make sure to select both "Erase main, information and protected information memory" as well as checking "Allow Read/Write/Erase access to BSL memory". If you use Elprotronic to write the data in instead, you'd have to go to Setup > Memory Options and select Used by Code File (including selected BSL) with all BSL boxes checked.

  • Thank you so much for all of your assistance! I had previously configured my Linker file, but I suppose that it must have been some slight detail that I overlooked. I have successfully used the scripter to modify my device. I have some errors regarding CRC, but they are slight with respect to my prospects. 

    Again, thank you very much. 

**Attention** This is a public forum