Saturday, August 30, 2008

r68 with Ubuntu/Debian Installer

While setting m4s up on my new laptop, I got frustrated with perl mods. Calling 'sudo make pmods_ubuntu' will now install all prerequisite perl modules.


Thursday, August 21, 2008

r67 with Register Fingerprinting

karen% m4s /fingerprint/regs
r12 60
r13 6
r14 48
r15 221

This example was compiled with an old version of IAR, which would only pass parameters in r12 and r14. r15 is the first scratch register, and r13 the second. GCC allocates r15, r14, r13, r12; recent revisions of IAR allocate r12, r13, r14, r15.


Tuesday, July 22, 2008

r66, with a critical fix

R66 contains a fix to a critical bug introduced around r60. Upgrade immediately to regain use of subs.

--Travis Goodspeed
<travis at>

Sunday, June 29, 2008

r60, in which much needed refactoring begins.

Howdy y'all,

It's an understatement to say that the m4s code has become a bit cluttered. To that end, I've begun to separate the code into modules and scripts. The code code has been moved to remains as a simple wrapper.

Further, a scripting feature has been added. Scripts reside in $m4s/scripts, and it is my intention to remove all unessential code from into the scripting directory. A script is called by name, preceded by a forward slash. The script, for example, is called as "/loadmacros". Subdirectories are supported. A matching textfile, loadmacros.txt, contains a short description for generating documentation.

Also, .lib.import.hashed is no longer run by default at initialization. Be sure to call it if you expect to recognize functions.

Please email me if you've any confusion regarding this processor, or have uncovered any bugs therein.

--Travis Goodspeed
<travis at>

Friday, June 27, 2008

r60 with 'graph' directive

I've just committed a minor but useful feature to make my life easier while generating function flow diagrams. The new syntax follows,
echo "select insflow(asm) from code where ...;" | m4s sql graph >"


Monday, May 12, 2008

r59 with Boost::Graph requirement

R59 is out with minor fixes and the prerequisite that I promised. Better install Boost::Graph before updating.


Wednesday, April 30, 2008

Upcoming Boost::Graph Requirement

Heads up! Beginning with the (not-yet-committed) r58, msp430static will require the Boost::Graph module from CPAN.

Sunday, April 27, 2008

r57 with Standard Library Hashes

R57 includes a major new feature. A hashed function symbol library has been committed to the subversion repository. If I have a copy of a function, and you have that function in an example program, you can now recover it with a single command after initialization!

Consider the following example, wherein a stripped LED blinker is loaded and its symbols recovered.
karen% msp430-objdump -D blink.exe | m4s init
Reading library hashes.
Reading code.
karen% m4s .symbols.recover
karen% m4s .funcs
4000 .text
403a __ctors_end
403e _unexpected_
404c __nesc_atomic_start
4060 __nesc_atomic_end
4068 4068
4084 Msp430TimerCapComP
4094 Msp430TimerCapComP
40a4 Msp430TimerCapComP
40b4 40b4
40fa 40fa
4118 CC2420ControlM
411a 411a
41da SchedulerBasicP
4230 4230
432e TransformCounterC
43a4 Msp430TimerP
43b8 43b8
43dc 43dc
4568 MSP430ClockM
4584 MotePlatformC
459c 459c
45ea 45ea
46a2 46a2
475a TransformAlarmC
4798 AlarmToTimerC
47dc VirtualizeTimerC
482c 482c
48a2 48a2
4910 Msp430ClockP
497c SchedulerBasicP
4994 McuSleepC
4a58 __stop_progExec__
Revision 57 includes hashed symbols for TinyOS, Contiki, GNU's libc, and ImageCraft ICCV7's libc. If you have access to other libraries, please send me the file produced by m4s .contribute.lib after inputing the library.

(Note that msp430static only includes one-way hashes of library functions. This is more spartan than the fingerprint format used for privately-imported libraries, but it's necessary to comply with copyright law.)

--Travis Goodspeed
<travis at>

Saturday, April 26, 2008

r54 insshort()

I've added a sub for shortening assembly code. It contains less information than the long-hand variety, but it's handy for blog postings and diagrams. insflow() and fnflow() now use this by default.

m4s> select insshort(asm) from code limit 20;
4000: mov #23168, &0x0120
4006: mov #19036, r15
400a: mov #4352, r14
400e: mov #4354, r13
4012: cmp r14, r13
4014: jz $+12
4016: mov.b @r15+, 0(r14)
401a: inc r14
401c: cmp r13, r14
401e: jnc $-8
4020: mov #4354, r15
4024: mov #4407, r13
4028: cmp r15, r13
402a: jz $+12
402c: mov.b #0, 0(r15)
4030: inc r15
4032: cmp r13, r15
4034: jnc $-8
4036: br #0x43dc


Wednesday, April 23, 2008

r52 with Flow Diagrams

I've added flow graphs to msp430static, though they can use a bit of work. The following is a flow digram of __nesc_atomic_end from TinyOS 2.x:

This was generated by:
echo "select fnflow(asm) from funcs
where name like '__nesc_atomic_end';" |
m4s sql |
dot -Tps2 -o

Saturday, April 12, 2008

r50 with .contribute.bsl, default shell, and a revised

Revision 50 has been committed. I've added the .contribute.bsl macro, made the "shell" directive default, and added a revised memory mapper macro.

The new memmap macro draws FFFFFFFF areas--which are likely uninitialized flash--as black. '.word ????' code--which I find large expanses of in some ripped images--are grey. This coloring should only be apparent on code which has been dumped from a chip, as most compilers leave such expanses undefined. I also fixed the ragged edge and overlapping pixel bugs. A screenshot of the default programming of the MSP-EXP430FG4618 kit follows.

The shell directive is now default, so typing "m4s shell" can now be shortened to "m4s" if no parameters are necessary.
karen% svn update
At revision 50.
karen% m4s
msp430static r50
from Sat, 12 Apr 2008

Copyright (c) 2008, Travis Goodspeed <travis at>

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.
m4s sql>

I'm interested in the BSL code of the various msp430 chips. If you use msp430static on a ROM image recovered from a physical device, please run the following script to send me the chip's BSL code:
m4s sql> .contribute.bsl                                                        
BSL found for chipid=f46f.
Please email ./bsl_f46f.txt.gz to <tmgoodspeed at>
with 'CONTRIBUTE_BSL f46f' as the title.
m4s sql>

--Travis Goodspeed
<travis at>

Announcing the MSP430static Blog

Rather than polluting my own blog with msp430static minutia, I've decide to create this site. This will mostly be for announcements, such as feature additions. Long articles will remain on my own blog.

--Travis Goodspeed
<travis at>