Creating a bootloader for MSP430
Technical Note 13285
This Technical Note discusses how to create a bootloader for MSP430.
There are different ways to create a bootloader and application for MSP430. With IAR Embedded Workbench for MSP430, we recommend creating two separate projects:
One project for the bootloader and one for the application.
After that, it is possible to "merge" the bootloader and application projects for downloading, using the "--image_input" linker option.
To merge the bootloader code into the main application, you can use the --image_input and -g linker options, similar to (example):
In the linker configuration file, add:
When the main application is built, a single output file including the bootloader (but without debug info) is generated.
One of the reasons for creating separate projects for the bootloader and the application is that the compiler uses "support functions" (for example "?DivMod16u", "?ShiftLeft32"), and these functions cannot easily be manually placed or suppressed.
See "--image_input" in Help -> IAR Linker and Library Reference Guide
This option corresponds to the "Raw binary image" option in Project -> Options -> Linker -> Config.
To load debug info, use Project -> Options -> Debugger -> Images -> Download extra image (Debug info only).
Alternative suggestion (debugging)
...debugging with the Simulator OR the FET Debugger Driver.
Both drivers are able to download Extra Images. (This is used in the following steps).
- (As above) Build one project for the bootloader and one for the application.
- Don't "merge" the projects at link time!
- Let the application project be the active project.
- Add the bootloader project (to the application project) with Project -> Options -> Debugger -> Images -> Download extra image
- Important - Make sure that the check box "Debug info only" isn't checked. (I.e the opposite to the 'Generic suggestion'.)
- There are some extra considerations.
- Disable "run to main" as there will exist 2 main function (one each in the bootloader and in the application).
- Disable "Stack plug in" (in the Tools -> Options dialog).
- When debugging - take advantage of the View > 'Images' window, where (using he context menu) debug information from either image can be suppressed.
All product names are trademarks or registered trademarks of their respective owners.