Saturday, July 6, 2013

EmguCV and Getting the Right Libraries in the Right Places!

Some quick hints for now, and hopefully I'll fill this in more later : )

If you see the exception "The type initializer for 'Emgu.CV.CvInvoke' threw an exception." then you need to dig deeper to figure out what actually happened.  View details of the exception and drill down into the InnerException until you get to the bottom.  You'll probably find one of these...

Exception: Probable Cause
"An attempt was made to load a program with an incorrect format." : You are compiling for 32-bit but the OpenCV library you are using was compiled for 64-bit.  Or the other way around.

"Unable to load DLL 'opencv_core240': The specified module could not be found" : The core240 DLL is not in the same folder as your executable...or if you do have it there then you might need to install (or reinstall) The Microsoft Visual C++ 2010 redistributable package of the latest Service Pack (SP1 is current as of this writing).  x86: http://www.microsoft.com/en-us/download/details.aspx?id=8328  x64: http://www.microsoft.com/en-us/download/details.aspx?id=13523

Still having trouble loading the core240?  Use the great Dependency Walker tool from http://www.dependencywalker.com/ to open the core240 DLL and see what other DLLs might be missing!

Wednesday, January 9, 2013

CooCox and GCC-ARM 4.7 (2012q4)

Real quick update for those of you struggling to make GCC ARM 4.7.3 work with CooCox.

First of all, make sure that you when to the Project menu and selected the new toolchain path (e.g. ...\4.7 2012q4\arm-none-eabi\bin) AND set the linker to the new libm.a file in the new toolchain path (e.g. ...\4.7 2012q4\arm-none-eabi\lib\armv7e-m\fpu\libm.a  for the Hardware FPU library option)


If you properly configure the new libraries and you are getting a compiler error saying "[cc] arm-none-eabi-gcc: error: unrecognized command line option '-Wl'"
Download this file: org.coocox.builder.ui_1.0.0.201212141638.jar
and put it on your CoIDE plugins folder, e.g. C:\CooCox\CoIDE\plugins, overwriting the one that is there.

If you have other problems, and you're trying to use printf(), then you and I are in the same boat, so hold on for the solution.  For now get rid of printf() and try to be more creative about getting data out of the uC.

Thanks to these guys for the help on this one.

S



An Adventure in CooCox and Cortex M4 (STM32F4)

From the outset I think this is going to be a multipart blog of my journey though a new IDE and processor.  As before, this series will serve partially as my notebook of how to do it again and your more-or-less guide to how to do it the right way, including visibility of some pitfalls which might try to grab you.

Project Goals

A little intro to what I am trying to achieve.  I've come up with a brilliant idea for a product that until recently could only be done on a PC or single board computer (SBC) at great cost and inconvenience...at least when you come from a microcontroller and consumer product background like me.  I recently discovered the ARM Cortex M4 with integrated floating point unit (FPU) and realized that something like this running at 168MHz is exceeding the performance of my old Intel 486DX and possibly even my first Pentium MMX.  I decided it was time to go for it and created my shopping list:

  • Cortex M4
  • Development board with Ethernet connectivity
  • JTAG hardware
  • IDE and compiler that wouldn't limit my solution size
  • Schematic capture and board layout software suitable for a distributed development team
  • Be as cheap as possible since we don't have a customer yet!

My preferred flavor of ARM is the ST Microelectronics family so I started with the STM32F4 and chose the Olimex STM32-E407 development board. Olimex, based out of the eastern European country of Bulgaria, has great products, at great prices, with valuable support, and cheap shipping to the US.  Olimex also has great FTDI-based JTAG options, like the ARM-USB-TINY-H, that are very inexpensive and yet very powerful.  In the past I've used the TINY with IAR and Eclipse via the OpenOCD GDB Server so I was prepared for the manual process of starting the server and messing around with config files...but I was in for a treat.

Now enter the IDE choice.  I was going to use IAR Embedded Workbench for ARM because it is always easy to get started and the support is great.  In the past I've gotten away with the 32KB Kickstart version because my STM32F103 projects were never really that crazy, even with USB.  I started estimating my solution size and I knew 32KB wouldn't cut it, so I checked the prices on the full versions of IAR and immediately started thinking Eclipse again : )  Started Googling for new things that I may have missed in the past year and I found CooCox.org which is a free commercial (aka closed source) product based on Eclipse.  Now, you'll have to excuse me, but I don't really understand how free and commercial go together nor do I get how they close-sourced something based on Eclipse.  However, the product is amazing.  Incredible support for all the ARMs I care about, uses the ARM compiler, natively employs the Olimex JTAG, great community of developers, and actively being improved.  After a few months with it I actually prefer it over IAR thanks to the great text editor and debugger.  The only downside is that the Java-based engine is a bit slow to spool up the debugger in Windows (the only supported OS) on my aging MacBook Pro 2.4GHz Core2Duo.  Did I mention it is free and completely unlimited in code size?  Much more on all of this later.

Briefly on schematic and layout: I used to use OrCAD Capture and Layout.  Well, Layout was retired in 16.2 and I decided if I had to learn something new (like 16.3+ PCB Editor) then I better be smart about where I spend my time learning.  OrCAD isn't cheap, but its not expensive.  Until you have three engineers who want to share files and co-develop.  I'll save the EDA comparison for later, but for now go read about KiCAD at their website and on Wikipedia.  Perfect? No.  Free? Yes.  Cross platform? Mostly...stick to Windows or Linux.

Ok, that's the project intro. Time to delve into CooCox so I can save some of my thoughts and get back to work.

Thursday, February 23, 2012

2009 MacBook Pro 8GB RAM and Hybrid HDD Upgrade [UPDATED]

Just for the record, I updated my 2009 MBP 13" from 4GB of RAM to 8GB of RAM.  From the factory it was spec'ed to have a maximum of 4GB, but somewhere along the road Apple updated the BIOS/EFI to allow 8.  Maybe it was around the release of Lion, but as long as you have it you are ready.  It wasn't trouble free for me as I initially purchased two 4GB 1333MHz DD3 from Crucial thinking the Mac would underclock them to the specified 1066MHz.  Nope.  Multiple hard-as-a-rock crashes, not even a blue screen or grey screen or reboot, just stopped.  Windows via Bootcamp would start and run for a bit at 1333MHz, but MacOS wouldn't even get close.  Swapped them SODIMMs out for 1066MHz parts and everything was great.  I've had a two hard freezes since the upgrade, but not sure if it is x64 compatibility with some of my engineering hardware drivers or what.

I really wanted an SSD for the laptop, but I needed at least 500GB which was just too much money for now, so I found a Seagate Momentous 750GB Hybrid drive on Amazon.  It is a 7200RPM laptop hard drive with an 8GB SSD buffer integrated, with 32MB of RAM buffer, too.  I found it for just $20 more than a regular 750GB so I went for it.  Turns out it was a good choice! Loading the operating systems and dev tools is very noticeably faster, and I was coming from a Western Digital Scorpio Black 320GB 7200RPM drive.  Since then I read some reviews at Gizmodo and Anandtech and my feelings were confirmed by their benchmarks.  Sometimes you get SSD performance and sometimes you are limited by the spinning platters but still get performance as good as a high end desktop disk.  I'm so happy I ordered another one for my 2007 iMac because I'm tired of hearing the factory 3.5" drive churn and I'm pretty sure it'll breath new life in to the ol' girl.

[UPDATE 1/9/2013]
Love the upgrade still, the initial freezes must have been unrelated.  Everything is great working the old computer to death with Mountain Lion, Parallels 7, and Windows 7 x64.  My wife's new Core i7 MacBook Air with 8GB of RAM and 512GB SSD is making me look kinda dumb now though.

S

Microsoft Office Crashing When Editing Chart Titles

Wow, it's been 3 months since my last post.  I guess I'm not learning enough!  Well, that's not true.  It's been a busy time of moving to a new home, moving also to a new office, releasing a new software product, and crazy holidays.  It's fun!

Today's biggie is a result of changing my Boot Camp installation to Windows 7 x64.  After the complete redo of my Windows partition I had the strangest problem of Office 2007 crashing 100% of the time when I tried to edit the chart or axis title of a chart in Excel.  I think it also happened when editing text blocks in Paint.  Well after LOTS of searching, service pack installs, and many restarts I found this: Microsoft Technet

In summary this is all you need to do, and from what I read it affects Office 2007 and Office 2010 equally, for me it was only the x64 version, but you never know.

  • Open Control Panel
  • In view mode “View by Category”, find the section “Clock, Language and Region”
  • Click “Change Keyboards or other input methods”
  • Press the button “Change Keyboards”
  • Press the button “Add”
  • Scroll down to “English (United States)” and expand.
  • Check box “US”
  • Press OK.
  • Press OK. — You’ll see two keyboards listed “US” and “United States (Apple)”
  • Press OK.



Wednesday, November 16, 2011

Magic Safari Disappearing Trick

Maybe its an old developer bug/Easter egg, or a iPhone 2G jailbreak shadow hanging on, but since I can remember (iPhone 3G iOS3, iPhone 3GS iOS4, iPhone 4S iOS5) triple tapping my Safari icon will make it disappear and the only way to bring it back is to move the icons around which makes it pop back, but it still won't work anymore.  I have to restart the phone to make it work, otherwise I need to use the taskbar or search in Spotlight to open the app.  None of my co-workers or family have the phenomenon.  Anyone else?

Tuesday, November 15, 2011

Shortcuts to WiFi and Other Settings on iPhone Homescreen

Finally! One click access to the WiFi switch without having to jailbreak.

http://iphoneza.co.za/IconSettings/

Thx u for the WiFiz.