Jump to content
Forum sending old emails Read more... ×
tml

Simple MSP430F5529 bootloader

Recommended Posts

Hi,
I have spent quite a significant amount of time to figure out how and then write a simple bootloader for MSP430F5529 that I would like to share with you.

It was written for mspgcc (4.6.3) and uses small memory model; for accessing high flash (20-bit addressed) I use some simple assembler inlines. It won't work out of the box in CCS.

This project is fully functional and I use it to remotely reflash my weather station (https://plus.google.com/u/0/photos/102121325118286323880/albums/5936572393229426625?authkey=CJ3N8Y2CtJiOIQ). I just push the new application image onto the web server, then the application working on the target device downloads it, parses and puts onto the flash and then lets the bootloader do the rest of the work.

The methods used for reflashing are kinda primitive (e.g. word access, while the block write would be way more efficient), anyway, I had to have this up and running in reasonable time.
I think making the code CCS-compatibile is not a big deal, the main part is flash access enclosed in flash.c. Moving code to RAM is even simpler in CCS with LOAD and RUN directives.

Anyway, any issue reports and comments are welcome!

repo url: https://bitbucket.org/eltomek/msp430bootloader

Best Regards,
Tomek

 

EDIT: fixed the link to the repo.

Share this post


Link to post
Share on other sites

Thanks for sharing Tomek! You should post more details about the weather station, the pictures of it look pretty nice!

Hi,

I will definitely share all the details about my project when only it gets done, deployed in the field and the code is polished to the minimum extent needed for it to be shown to the people ;-) Right now it's full of todos and hacks.

I plan to release it as an open hardware and open software project, the first will be easier though.

 

Best Regards,

tml

Share this post


Link to post
Share on other sites

Why did you choose this route over the internal BSL?

When I started thinking about doing the bootloader I indeed got interested in the BSL but then I found out over the websites that:

1. invoking BSL requires a physical reset (source: http://processors.wiki.ti.com/index.php/Custom_MSP430_BSL#Device_Startup_Sequence - " NOTE: The boot code will be only executed on hardware reset (pulling down the /RST signal). Software reset such as using watchdog timer, setting the PMMSWBOR or PMMSWPOR of PMMCTL0 will not trigger the boot code.")

2. it needs to be written in plain asm (source unknown). I still don't know whether this is true and don't understand why can't this be written in C. I did not dig into this question as I decided to go with the current form of the bootloader.

 

If you can put more light onto this I'd be more than happy! :)

 

Best Regards,

tml

Share this post


Link to post
Share on other sites

Hi Tomek,

cool weather station project!

Btw, you can always invoke the TI BSL by jumping to 0x1000 from your application, without any physical reset...

The project you are linking to (Custom MSP430 BSL) is not the official TI BSL. The official one is written almost completely in C. You can find more info on this here and here.

 

Good luck with your project and best regards,

Max

Share this post


Link to post
Share on other sites

Hi Tomek,

cool weather station project!

Btw, you can always invoke the TI BSL by jumping to 0x1000 from your application, without any physical reset...

The project you are linking to (Custom MSP430 BSL) is not the official TI BSL. The official one is written almost completely in C. You can find more info on this here and here.

 

Good luck with your project and best regards,

Max

Thanks for good words!

 

As for jumping to 0x1000 it's ok but it needs a sane application - if a damaged one gets flashed it will be unable to jump to BSL for recovery.

 

Best Regards,

Tomek

Share this post


Link to post
Share on other sites

You are right with the sane application. A CRC check in your start up code, a update mechanism that would copy the new firmware, checks it, the marks it for safe execution or similar could probably help...

Share this post


Link to post
Share on other sites

The repo link is bad and I am working on a very similar project and would love to see it

Fixed the link in the main post, sorry!

 

I will need to rework the bootloader to add PetitFs + microSD supportso that it makes backup and reflashes from the SD, not the MCU flash. This way the working image size can be extended to MCU flash size minus bootloader coode size. So if you planned similar functionality and can open the source that'd be great! :-)

Share this post


Link to post
Share on other sites

you don't know how happy this makes me. My College senior design project is using the same LP and needs to do remote firmware updates over satellite communication. Thanks for sharing

Share this post


Link to post
Share on other sites

you don't know how happy this makes me

You don't know how happy this makes me that my 1st open source project is useful for somebody!  :biggrin: 

 

All you need to do is from the host application to store the proper image on the download area of the MCU's flash and then manage the bootloader flags. If you had any problems please let me know.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×