MSP430G2755 Main Memory Bootloader UART Porting Guide
[Copy link]
TI's MSP430 supports online upgrades by loading the Bootloader in the main program. Through the online upgrade function, customers can update the internal program of the MSP430 and remotely repair Bugs at any time through an external processor. At the same time, TI also provides reference code based on MSP430G2553. This article describes in detail how to transplant the Bootloader of MSP430G2553 to MSP430G2755 and use the MSP 430G2553 Host to upgrade the MSP430G2755 Device. 1. Introduction to MSP430 Main Memory Bootloader In MSP430G2xx, there is actually a ROM version of BSL (Bootloader), but this BSL only supports online upgrades of external MCUs through UART, and all protocols are solidified, and it is impossible to modify or change other interface methods for upgrade operations. Therefore, this requires a Bootloader that can run in the main program, allowing the external MCU to perform user-defined upgrade operations. At the same time, TI also provides a reference example based on MSP430G2553, which can be downloaded from the following link: http://software-dl.ti.com/msp430 ... test/index_FDS.html The reference code version used in this article is MSPBoot_1_01_00_00. The figure below shows the entire software framework of MSPBoot. Figure 1 MSPBoot software framework 2. Code transplantation process of MSPBoot 2.1 Generation of MS430G2755 CMD file First, use Per tool to generate CMD file (Generating Linker Files). Per tool will generate two CMD files, one for MSP430G2755 Bootloader and the other for MSP430G2755 application. The operation instructions are as follows: C:\Users\a0223791\Desktop\MSP430-BSL-IAP\MSPBoot_1_01_00_00\linkerGen>perl MSPBootLinkerGen.pl -file lnk_msp430G2755_Uart_1KB -dev MSP430G2755 -params 0x8000 0xFFE0 0xFC00 48 6 0x1100 0x20FF 0x80 0x1000 0x10BF There are several important parameters as follows, <0x8000 > = Start address of Flash/FRAM For MSP430G2553, the address is 0xC000, while the address of MSP430G2755 needs to be changed to 0x8000 <0xFFE0 > = Address of interrupt vector table The address of the interrupt vector table is 0xFFE0, which is the same for MSP430G2553 and MSP430G2755 <0xFC00> = Start address of Bootloader The starting address of Bootloader is 0xFC00, which is the same for both <48 > =Size of the proxy table The 48 here corresponds to 12 interrupt vectors, each interrupt vector occupies 4Bytes <6> = Size of shared vectors There are 3 interrupt vectors (P1/Time/Dummy) in the application, each interrupt vector occupies 2Byte,The corresponding parameters are 6 <0x1100> = Start address of RAM The start address of RAM also needs to be modified to 0x1100 of MSP430G2755 <0x20FF > = End address of RAM The end address of RAM also needs to be modified to 0x20FF of MSP430G2755 = Size of the stack The default stack size of MSP430G2755 is 0x80 <0x1000> = Start address of info memory used for bootloader The start and end addresses of Information are the same for MSP430G2553 and MSP430G2755, no modification is required <0x10BF > = End The start and end addresses of information memory used for bootloader are consistent for MSP430G2553 and MSP430G2755 and do not need to be modified. Note the modified parameter 6 and the number of interrupt vectors. The interrupt vectors in the bootloader do not need to be modified. Only the interrupt vectors in the MSP430G2755 application program App need to be modified. The following figure shows the distribution of interrupt vectors in the Bin file. [color=rgb(85, 85, Figure 2 MSP430G2755 interrupt vector Figure 3 MSP430G2755 Bin file corresponding to the virtual interrupt vector table Note that the 809C here and 80E2 correspond to P1_Isr and Timer_A, GPIO interrupt and timer interrupt in MSP430G2755 application. The figure below shows the distribution of virtual interrupt vector table in MSP430G2755Bootloader. Figure 4 MSP430G2755Bootloader Virtual Interrupt Vector Table 2.2 Adding CMD Files to the Project Add the CMD files generated in step 2.1 to the MSP430G2755 Bootloader and application App projects, as shown in the following figure Figure 5 MSP540G2755 CMD file Pay special attention, if you are using TI's default MSP430G2755 project, you need to select the device model of the original project as MSP430G2755, delete the G2553 CMD file that comes with the MSP430G2755, and use the generated MSP430G2755 CMD file. 2.3 Application txt converted to c file Use CCS compiler to compile the application of MSP430G2755. After the compilation is completed, a txt file will be generated for download. We need to convert this generated txt file into a .c file. This .c file can be used by the main control MCU and downloaded to MSP430G2755 through Bootloader. The conversion and running instructions are as follows, C:\Users\ a0223791\Desktop\MSP430-BSL-IAP\G2755_Porting\MSPBoot_1_01_00_00\430txt _converter>430txt2C.pl App1_MSPBoot.txt AppForHostG2755.c App1 Through this step, the generated .c file is added to the main function file path in the main MCU. Here the main control MCU we tested is MSP430G2553. The program after adding is shown in the figure below. Figure 6 Host MCU adds upgrade program 2.4 Write CRC check address information Through the previous step, we added the application that needs to be upgraded in the main control MSP430G2553. At the same time, we also need to modify the CRC address information of the target upgrade chip (MSP430G2755) in the main MCU. The modification reference is as follows, Figure 7 MSP430G2553 adds CRC address information [align= left] Note that the CRC generation tool in the MSPBoot User Guide is no longer needed to perform the CRC check. We can see that the CRC check is actually calculated directly in the main MCU and the CRC value is placed in the specified location. Figure 8 MSP430G2553 Calculate CRC Value 2.5 Modify MSP430G2755 Application Here we tested changing the default UART ports P1.1 and P1.2 of MSP430G2553 to P3 of MSP430G2755 hardware.4 and P3.5 UART receive data interface. The actual reference code is as follows, Figure 9 MSP430G2755 UART port modification Pay special attention to the fact that in the MSP430G2755 application App, there are two interrupts that are used by default, namely the P1 port and the timer interrupt. The P1 port and the Timer interrupt cannot be directly shielded. This will cause the MSP430G2553 to fail to start the application normally after the Host master successfully upgrades the MSP430G2553. If these two interrupt vectors are not needed in the application, the parameter <6> = Size of shared vectors needs to be modified in the first step of generating the CMD file. 3. Summary Through the above steps, we have completed the transplantation from MSP430G2553 to MSP430G2755 Bootloader. Let's summarize the MSP430G2755 The entire program architecture of Bootloader and application App is analyzed as follows. We used the tool to read the total code of MSP430G2755 in which the main program transplanted BootLoader. The MSP430G2755 storage Flash address is analyzed as follows: 0x8000-0x8100 is the application program; 0xFBC0-0xFBF0 is the virtual interrupt vector table; 0xFC00-0xFFD0 is the Bootloder; 0xFFE0-0xFFF0 is the real interrupt vector table. 102)] png[/img][/url]png[/img][/url]
|