Jump to content

1K serial gdb_bootloader

Recommended Posts

I made an MSP based MP3 player that was able to update it's fimware via a file on an MMC card. I very much like that you don't need any specialised software on the computer side to use this.

You should post the code and an article for MP3 player. I'm sure people would be interested in how you were able to squeeze MP3 decoding on the msp430.



Link to post
Share on other sites
  • 7 months later...
  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Inspiration: So I'm looking at making a small msp430fr5739 based board. I was thinking that I would be able to use the msp430 launchpad to program them. However, I hit a snag in that they don't seem t

See my comments about CCS and linux here:  http://e2e.ti.com/support/microcontrollers/msp430/f/166/p/255423/897643.aspx#897643

OK, I uploaded the code to github:   github.com/RickKimball/msp430_code/tree/master/fabooh/apps/gdb_bootloader   To grab this code using git, use git clone: $ git clone https://github.com/RickKim

Posted Images

It might be a basic question, but which should be done to upload the bootloader code once?

Can I use IDE  CCSv5 or Energia, that I know that they work with the MSP-FET?

I'm not sure how it is setup for panstamp. Originally I provided a Makefile you ran from the command line. The makefile would build the gdbloader.elf file that is loaded using mspdebug. If you are using an MSP-FET you would have to use the tilib interface. So, from the command line it would look like:

$ mspdebug tilib "prog gdbloader.elf"


This question should be even more stupid, but I can

Link to post
Share on other sites

While I'm not convinced this is a useful thing, I do think making this work with msp430-elf-gcc is somewhat interesting. It illustrates that you can get small code out of the msp430-elf-gcc. I don't have a wizzimote, but I do have an Olimex msp430-ccrf. The msp430-ccrf uses the same chip as the panstamp and the wizzimote (CC430F5137). The pinout configuration for the msp430-ccrf is different than the panstamp so pins.h changed. I didn't look at the wizzimote pinout so I can't say how different it is.


I've created a CCS Version 6 project that can be imported off the "Getting Started Page" / Import Project. I did spend some time on this code tweaking some things for msp430-elf-gcc. I also changed the header files so the key addresses (the start of user flash and the start of the gdb_bootloader code) are referenced from the ldscript with some custom symbols instead of having to keep the header and the ldscript in sync by hand. CCS 6 automatically creates an ldscript for your project. This feature does make it easier to tweak the script for specific usage. I've modified the default cc430f5137.ld for the gdb_bootloader. The ROM start and length haved changed and I've added some custom symbols. Unlike the panstamp which loads the gdb_bootload code into the BSL loader flash space, I decided to load this version's gdb_bootloader starting at address 0xF980. This reduces to total amount of flash by 3 segments as those segments end up being reserved for the gdb_bootloader. You end up with 31104 usable flash bytes instead of 32630. I think this is a safer approach. I just leave the BSL loader alone and it is available if you ever need it.


I used an msp430f5529 launchpad to program the msp430-ccrf. However, any FET that works with CCS6 is fair game. Once the gdb_loader code is on the msp430-ccrf, pressing the button while booting will put you into gdb loader mode. Look at the comments in gdb_bootloader.cpp about how to connect to it with msp430-elf-gdb.


Attached find the CCS Version 6. gdb_bootloader project modified for the msp430-ccrf. The simple blink project can be a starting point for your user code. It includes a modified cc430f5137.ld ldscript with the ROM length reduced by 1536.


Link to post
Share on other sites

Thanks a lot for your help and spending your time in this.

I downloaded the blink_msp430_ccrf.zip, but I can't see the CCS v6 gdb bootloader project to download it... is it in other place, I searched in github but I didn't find it or am I missing something?


I modified the pins.h of panstamp to match with the pins.h of the wizzimote.


The reason that I'm not directly using tilib is that I was not able in Arduino 1.5 :(. I should have configured wronly platform.txt, but don't know how to do it properly. In addition the gdb-bootloading you propose  will let  me work with the uart-usb cable, as not always the msp-fet is available.



Link to post
Share on other sites
  • 1 year later...

Thanks for the great contribution! I am a newbie and quite interested in using this for a project I am working on. I have a few questions:


  1. What is required to initiate the gdb server/software update via a terminal command as opposed to pressing and holding down P1.3?
  2. Is the bootloader compatible image files built generically with CCS6 and the TI compiler? (sample projects from TI resource explorer, for example)
  3. If not, what modifications are necessary?

Thanks a lot in advance for your help!

Link to post
Share on other sites
  • What is required to initiate the gdb server/software update via a terminal command as opposed to pressing and holding down P1.3?
If you don't want to trigger loading based on the P1.3 button you will have to change the code yourself to use some other trigger.



  • Is the bootloader compatible image files built generically with CCS6 and the TI compiler? (sample projects from TI resource explorer, for example)
  • If not, what modifications are necessary?


The code probably doesn't do the right thing for the TI compiler. I think I hardcoded the start address to use the start of flash as msp430-gcc did by default for the reset vector. If you look at the panstamp version, I fixed that version to use the starting address provided by the TI compiler. The changed code just looks at the reset vector address that the TI compiler generates, which jumps around and is not fixed to the start of flash.


To put this stuff in perspective, many of reasons I wrote this code are no longer problems. I wouldn't use this approach today. There are low cost launchpads that work properly on linux with any chip. Also, mspdebug now supports BSL over a UART now, so you could also use that protocol without having to write any host code.


Back when I did this code, the FRAM launchpad cost $30 and it didn't even work with linux and CCS. The msp430f5529 launchpad didn't exist. There wasn't any host side application that worked on all 3 OS platforms that could do BSL. There are lot of better options available today.


What is the project you are doing that you think is a good fit for this?




Link to post
Share on other sites

Thanks for the confirmation!




What is the project you are doing that you think is a good fit for this?


The project I am working on will be providing OTA firmware updates to the MSP430G2553 via a serial over bluetooth in place of the serial cable; the host side being a linux server. Any recommendations on the most efficient means of tackling this? 

Link to post
Share on other sites
  • 1 month later...

I updated the code so that you can use it with CCS TI compiler created binaries. However you have to use the restore feature of msp430-gdb.

This address the question asked in this post: http://forum.43oh.com/topic/3661-1k-serial-gdb-bootloader/?p=68134 from @@PortHarcourtBoy


See example here:




Previously I used a hard coded user reset vector of 0xc000. This worked fine with msp430-gcc however with the TI compiler and new msp430-elf-gcc that might not be true.  Now it hides the user provided reset vector in flash and uses that.  However, the code still clocks in in at  less than 1k.



Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...