{"id":674,"date":"2009-08-23T17:04:07","date_gmt":"2009-08-23T21:04:07","guid":{"rendered":"http:\/\/tim.cexx.org\/?p=674"},"modified":"2009-08-23T17:04:07","modified_gmt":"2009-08-23T21:04:07","slug":"my-quickie-guide-for-setting-up-mspgcc-for-ez430-cc2500","status":"publish","type":"post","link":"https:\/\/tim.cexx.org\/?p=674","title":{"rendered":"My quickie guide for setting up mspgcc for ez430-cc2500"},"content":{"rendered":"<p>Mostly for my own reference for the next time I have to set it up on a new machine, but may help others on their first time install. Valid as of Feb. or so this year.<\/p>\n<p><b>Software &#8216;shopping&#8217; list<\/b> (all free\/OSS tools)<br \/>\nSet up <a href=\"http:\/\/mspgcc.sourceforge.net\/\">the toolchain (mspgcc)<\/a>. There seem to be several important tools<br \/>\nmissing from the mspgcc distro as of this writing, including &#8216;make&#8217; and<br \/>\nmsp430-insight (graphical debugger) that the docs claim are included<br \/>\nwith the package. So the complete shopping list is:<\/p>\n<p>mspgcc-win32:<br \/>\n<a href=\"http:\/\/downloads.sourceforge.net\/mspgcc\/mspgcc-20081230.exe?use_mirror=voxel\">http:\/\/downloads.sourceforge.net\/mspgcc\/mspgcc-20081230.exe?use_mirror=voxel<\/a><br \/>\nNOTE: This binary IIRC was not linked on Sourceforge&#8217;s downloads page at the time; there was only an older build and this link had to be fished from semi-private newsgroup postings. If there is a newer binary available, download that one.<\/p>\n<p>MinGW\/msys (provides &#8216;make&#8217; and some utilities) :<br \/>\n<a href=\"http:\/\/downloads.sourceforge.net\/mingw\/MinGW-5.1.4.exe?use_mirror=voxel\">http:\/\/downloads.sourceforge.net\/mingw\/MinGW-5.1.4.exe?use_mirror=voxel<\/a><br \/>\nIf it gives you the options of installing minGW and msys, say YES to both.<\/p>\n<p>CoreUtils (provides unix-like &#8216;rm&#8217; tool required by make) :<br \/>\n<a href=\"http:\/\/gnuwin32.sourceforge.net\/packages\/coreutils.htm\">http:\/\/gnuwin32.sourceforge.net\/packages\/coreutils.htm<\/a><\/p>\n<p>Skipping the debugger for now until I figure out how to use it myself ;-) Seems to work occasionally under win32, but it&#8217;s flaky.<\/p>\n<p><b>Required Knowledge<\/b> Assuming you already know C and have the appropriate chip documentation\/datasheets.<br \/>\nHave a quick read-through of the mspgcc FAQ and manual. Both are<br \/>\nreasonably short for what they are.<br \/>\nFAQ: <a href=\"http:\/\/mspgcc.sourceforge.net\/faq\/t2.html\">http:\/\/mspgcc.sourceforge.net\/faq\/t2.html<\/a><br \/>\nManual: <a href=\"http:\/\/mspgcc.sourceforge.net\/manual\/\">http:\/\/mspgcc.sourceforge.net\/manual\/<\/a><\/p>\n<p>The manual contains a lot of advanced stuff you can skip at first, or<br \/>\nskip entirely. This includes (at minimum) the stuff about customizing<br \/>\nthe startup\/end procedures, stack, the entire ABI section, inline<br \/>\nassembly, and stuff about building mspgcc (the package you get is<br \/>\nalready built).<\/p>\n<p>Get familiar with &#8216;make&#8217;. Outside of kinky application-specific tools<br \/>\nlike the Microchip assembler\/compiler and &#8216;IAR Kickstart&#8217;, the rest of<br \/>\nthe free world uses <i>make<\/i> to automate compiling, linking,<br \/>\ninstalling\/running and packaging their code. Go into the mspgcc<br \/>\n&#8216;examples&#8217; folder and find the blinking LEDs example (e.g.<br \/>\nE:\\mspgcc\\examples\\leds). Open up the file called Makefile in Wordpad<br \/>\nand have a look inside. This is the master script that will smartly<br \/>\nhandle all your compiling, programming the chip, and avoid you rewriting<br \/>\nlots of code whenever you change chips. The contents will probably look<br \/>\nlike gibberish, there are only a few parts that are important for our<br \/>\npurposes. The make tool installed by mingw32 is named &#8216;mingw32-make&#8217;.<\/p>\n<p>How make works is you specify one or more &#8216;targets&#8217;, i.e. things make<br \/>\ncan do. Running make with no target specified compiles your program.<br \/>\nSome other targets are &#8216;mingw32-make clean&#8217; (delete your old build and<br \/>\nany scratch files), or &#8216;mingw32-make download&#8217; (compiles your program,<br \/>\ndownloads it to the chip and runs it). All the necessary commands to<br \/>\nhandle each target are in the Makefile.<\/p>\n<p>Since the top half of the ez430 kit is essentially the USB Sy-Bi-Wire programmer, you have to change the download command to:<\/p>\n<p>msp430-jtag &#8211;spy-bi-wire -lpt=USBFET -e leds.elf<\/p>\n<p>I.e. in the Makefile you&#8217;d find and change the download section to:<\/p>\n<p>download-jtag: all<br \/>\n    msp430-jtag &#8211;spy-bi-wire -lpt=USBFET -e ${NAME}.elf<\/p>\n<p>As long as you have the Makefile open, now is a good time to find the<br \/>\nCPU= line and change it to match the msp430 variant you are actually<br \/>\nusing. In the case of the eZ430 board:<br \/>\nCPU             = msp430x2274<\/p>\n<p>Now when you #include the base generic <io .h> as you will for most any<br \/>\nmspgcc project, it will automatically switch in the correct headers and<br \/>\nperipheral support for that specific CPU.<br \/>\n<\/io><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mostly for my own reference for the next time I have to set it up on a new machine, but may help others on their first time install. Valid as of Feb. or so this year. Software &#8216;shopping&#8217; list (all free\/OSS tools) Set up the toolchain (mspgcc). There seem to be several important tools missing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_FSMCFIC_featured_image_caption":"","_FSMCFIC_featured_image_nocaption":"","_FSMCFIC_featured_image_hide":"","iawp_total_views":9,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-674","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/tim.cexx.org\/index.php?rest_route=\/wp\/v2\/posts\/674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tim.cexx.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tim.cexx.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tim.cexx.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tim.cexx.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=674"}],"version-history":[{"count":4,"href":"https:\/\/tim.cexx.org\/index.php?rest_route=\/wp\/v2\/posts\/674\/revisions"}],"predecessor-version":[{"id":678,"href":"https:\/\/tim.cexx.org\/index.php?rest_route=\/wp\/v2\/posts\/674\/revisions\/678"}],"wp:attachment":[{"href":"https:\/\/tim.cexx.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tim.cexx.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tim.cexx.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}