- Download the JLINK software from Segger.com
- Run "J-LINK STR9 Commander" tool (it's under Segger-> JLink ARM 3.95a -> Processor Specific Utilities).
- Type "?" to get a list of commands
- Type "erase all" to fully erase the chip.
- Type "setb 1" to set the boot bit to bank 1.
- Type "q" to quit.
- Now you can use the flash loader of EWARM to install the code.
Monday, January 26, 2009
How to install a bootloader on a STR912 without CAPS or Raisonance
ST recommends CAPS (their GUI) to install the STR912. However, that requires a Raisonance JTAG adapter. You can do it with just IAR EWARM and Segger tools.
Adding an external file to a perl module
Let's say you want a perl module to scream "argh" on failure. You find a argh.wav file and want to bundle it with the perl pm file. The problem is loading the wav file without knowing the full path. Perl's current working directory can be any where, and the location of the wav file or module file may not be in the same location as the starting pl file. To find the starting pl file, you can use the FindBin::Bin module, but this doesn't work for modules. If you want to know the location of the module (pm) file instead, you can use the %INC hash to get it. This hash value gets set when you "use" the pm file. Once you know where the pm file is, you can use the dirname() function to get the directory name, then add the name of the wav file.
Here is an example (in a perl module called "Scream.pm"):
Here is an example (in a perl module called "Scream.pm"):
use File::Basename;
use Win32::Sound;
my $wavfile = dirname($INC{"Scream.pm"})."/argh.wav";
Win32::Sound::Play($wavfile);
Thursday, January 15, 2009
Tools for mocking-up C++ classes
I haven't played with this yet, but it seems to have its heart in the right place.
http://code.google.com/p/googlemock/wiki/ForDummies
http://code.google.com/p/googlemock/wiki/ForDummies
Neat source of icons
I stumbled upon this cache of free icons if you follow the LGPL.
http://commons.wikimedia.org/wiki/Crystal_Clear
Don't use a virtual function in a constructor
Virtual functions should be used until an object is fully constructed. That is because the constructor builds the virtual function table in pieces. When it is constructing the base class, the derived class virtual function table is not yet constructed. So if you call a virtual function, you are calling the virtual function of the base class not the derived class. This is worse if the base class is a pure interface, ie the virtual functions are declared as pure (ie " =0;"), because you can't call a pure function -- the pointer points to NULL and your program crashes.
Subscribe to:
Posts (Atom)