Fixing avr-eclipse paths

20 Aug

Fixing avr-eclipse paths

Just before summer, I started consulting work for a hardware startup here in Oslo. As part of this I've gotten to play around with and integrate lots of new toys such as VISA card readers and various communication solutions. I also inherited some AVR code for a circuit developed specifically for the project and yesterday I set up the tooling.

I guess I could have used all sorts of software alternatives to program the microcontroller, but since the people that created the codebase used Avr-Eclipse, I figured that I'd check it out. Using a GUI makes finding the right fuse settings a breeze and I love to have proper syntax highlighting and completion. Setting it up was easy using this guide, but getting the code to compile properly was somewhat difficult so I thought I'd jot down what I learned in case it helps others.

Setting path for AVR tools in Eclipse

All my problems boiled down to Eclipse not using the PATH variables for avr-gcc and avrdude. On my system I have CrossPack installed for working with pure AVR projects and then I typically use the Arduino tool + Sublime for anything Arduino-related. The Arduino tool automatically adds some things to PATH on the Mac/OSX so in theory, avr-eclipse should just find and use this. It didn't. Instead it pointed to an old, uninstalled version installed by MacPorts on my old Mac that got ported over to my second Mac. All the folders were empty as I unsinstalled MacPorts to use Brew instead several years ago, but the "smart" feature insisted that these empty folders were better than looking at the system PATH variable. I altered the PATH values to point to the CrossPack installation but that didn't help either.

The creators of the avr-eclipse plugin have tried to add some smarts to the configuration, but that failed completely for me. To set the correct location of the AVR tools you want to use, open the Eclipse menu > Preferences and then expand AVR > Paths like this:

Forget the Rescan button if you know what path you want to use. If you don't know the path to avr-gcc and the other tools, just open a terminal window and type:

which avr-gcc

This will tell you the path of the avr-gcc that can be reached through the normal PATH settings on your machine. Now you'd think that this is all you need to do, right?

Fixing the standard includes

I kept getting errors like this.

undefined reference to `debug'
undefined reference to `asm'

It basically means that AVR-eclipse can't find the class definitions for these files. To fix it, Right Click the name of your project in the Package Explorer window and select Properties at the bottom of this menu. This brings up the local preferences for the project. Go to the "C/C++ General" entry and expand the "Paths and Symbols" option. Make sure you're linking to the right version of the include files here:

If you've set the correct AVR hardware and the right programmer, you should now have a working setup. Hope this helps someone as it was rather hard to google all the bits required to get to this.

 

Testing with Testflight

10 Jul

Testing with Testflight

After Apple purchased Testflight, the service has been integrated into the workflow when publishing apps. Any app with a distribution profile can be sent to users for testing and the process is actually quite smooth compared to the old version. First your build is vetted by Application Loader (or XCode) and then you turn on testing for that specific build. I did however run into an issue worth publishing in case others run into it.

Normally, you'll just flick a switch to turn on Testflight Beta Testing and the app is ready to be tested by all internal to the team. In my case, I could flick the switch but nothing happened. I called Apple Developer support, but the guy I talked with completely failed at understanding what my issue was and he insisted on sending me something I knew was incorrect. He just wouldn't listen when I tried to tell him that something was wrong:

I eventually understood that the first of the two warnings (... must contain the correct beta entitlement) did not have anything to do with my certificate or provisioning file, but rather a missing directive in my app descriptor. Some googling led me to this article that explained how one had to add the beta-reports-active key to the Entitlements part of the descriptor. I now got an error when uploading the 

Build 168 does not contain the correct beta entitlement.

After reading all the replies to this thread I realised that I should not set the mobileProvision-file to be for AdHoc distribution. It should just be a Distribution profile for App Store. That's it.

I also had another issue getting my AIR app published this time. After updating to the latest XCode, I got the following error when uploading the app:

Invalid Bundle: The bundle does not support the minimum version os specified in info.plist

Turns out one have to add a bit about MinimumOSVersion to the InfoAdditions-section of the descriptor file as well. My entire iPhone descriptor settings are now like this:

<iPhone>
<InfoAdditions><![CDATA[
  <key>UIDeviceFamily</key>
  <array>
   <string>1</string>
   <string>2</string>
  </array>
  <key>UIApplicationExitsOnSuspend</key>
     <false/>
     <key>MinimumOSVersion</key>
  <string>6.1</string>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
<Entitlements>
        <![CDATA[
   <key>aps-environment</key>
   <string>production</string>
   <key>application-identifier</key>
   <string>XXXXXXX.com.myapp.appname</string>
   <key>keychain-access-groups</key>
   <array>
    <string>XXXXXXX.*</string>
   </array>
   <key>get-task-allow</key>
   <false/>
   <key>beta-reports-active</key>
   <true/>
        ]]>
</Entitlements>
</iPhone>

Popcorn Time!

06 Jul

Popcorn Time!

Just a little summer sigh... I keep reading articles like this one (translated to English) about the famed Popcorn Time software that let's anyone view pretty much any movie when they want. In this article, the word "strømming" means "streaming" and the headline is that streaming of pirated movies has more than doubled the last year.

Nobody but the movie industry is surprised! We all want to stream movies like we've been able to for music for quite some time now.

In my opinion, Popcorn Time is Netflix done right, but without any legal issues holding them back. Suing Popcorn Time or it's users will not solve the problem. Just as with music - new distribution models will pop up and they'll be your competition in the future. The longer you wait, the worse you basically make it for yourself.

Read more...

Including Native extensions on OSX

01 Jun

Including Native extensions on OSX

Making a small GUI project that controls some hardware today and stubled upon a bug that I solved when using the neat COM-port extension for AIR by Nick Kwiatkowski.

I got the following error upon compiling:

Process terminated without establishing connection to debugger.
Not supported native extensions profile

This comes from the AIR project being set to target all platforms by default. By adding the "supportedProfiles" tag in the application XML, the problem will disappear:

<supportedProfiles>extendedDesktop</supportedProfiles>

This solves the first problem, but you'll most likely get another one:

Process terminated without establishing connection to debugger.
The content cannot be loaded because there was a problem loading an extension: Error: Requested extension com.quetwo.Arduino.ArduinoConnector could not be found.

This comes from the Native Extension not being included with the project by default. Right click your Project -> Properties -> Actionscript Build Packaging -> Native Extensions and check the checkbox under Package. Flash Builder may incorrectly claim that "This ANE is not used in the application". If all goes well, your project should now compile.

Also be sure to read the old FAQ on Google Code to get your Arduino Connector project up and running on both Windows and Mac as you'll find that the DLLs pthreadGC2.dll and libgcc_s_dw2-1.dll are required.

Teaching with robots

20 Oct

Teaching with robots

The last two years I've done a course in at Westerdals Oslo School of Art, Communication and Technology (formerly NITH). The school offers Bachelor & Master studies in informatics and I've been brought in as a teacher on the topic of Embedded Systems. The course (200 hrs total) is a volunteer topic for third year students that covers all the basic use of Microcontrollers as well as some Embedded Linux.

It's been a great experience and I get to play santa - giving students a customised version of this kit. 4Tronix have been very helpful in making me a super Arduino-kit that covers the entire curriculum at a price that the school can live with. The only part of the curriculum that isn't covered by this kit is robotics and motor control. This year I think I've found a near perfect solution that I though I'd share with other educators.

Read more...

Making a custom 3D printer controller

20 Aug

Making a custom 3D printer controller

While working on my new printer, I realised how ugly most reprap controllers are. All those I've seen use large SD cards & bulky oldskool LCD's with really poor contrast and viewing angles. Why not use Micro SD & an OLED screen?

You can actually build your own custom controller using any combination of screen, SD reader and encoder, but I couldn't find a good description of how to do it, so here it is. Setting it up with the Marlin firmware can however be a daunting task, so this article aims to document how I went about doing it.

Read more...

Why I’ll never use Windows Phone again

04 Aug

Why I’ll never use Windows Phone again

It's been a while since I posted a good rant. Here's one that's been brewing for some time. I refuse to belive that ANY Microsoft employes that ever had an iPhone or Android, actually tried to use Windows Phone for a full year. I have and I can tell you - it's utter bullshit. I don't doubt that a lot of talented people have worked hard to make it happen, but without someone capable of telling what is good and bad, you cannot succeed. The whole OS reeks of a lack of interest and use.

I gave it a full year as I figured they'd get som time to fix the major bugs. Despite three fixes delivered over the air, they have not solved anything that could help me like the platform. They have however added a menu with "Extra settings" that I'll never use.

Here's my 6 biggest annoyances:

Read more...

Summertime

07 Jul

Summertime

I really love those squeezed-in weeks of work in between family holidays. It's a rare time to catch up on thing like blogging, reading & updating a few personal projects. I just finished reading The Martian by Andy Weir that I got recommended from @hpeikemo. It's a really thrilling book that I'm sure we'll see as a hollywood movie soon. The story is kind of a "Robinson Crusoe meets McGyver on Mars". After reading it, I gave it to my son who completed it in just two and a half day. Great summer read!

Read more...

What platform next?

20 Feb

What platform next?

In 2013, Adobe completely dropped the ball on the Flash Player and AIR. All further development has been moved to India. This normally means that the software has been put in what is referred to as "Maintenance mode". Any serious bugs will be fixed, but don't expect much in terms of new features. If you take a look at the Release Notes for AIR 4.0, you'll see what I mean.

Read more...

Apple is not currently accepting applications built with AIR 3.9

03 Feb

Apple is not currently accepting applications built with AIR 3.9

From the 1st of February, you'll get the following error message when trying to submit your Adobe AIR based app to Apple's App Store:

    Apple's web service operation was not successful
    Unable to authenticate the package: somenumber.itmsp
    ERROR ITMS-9000: "This bundle is invalid. Apple is not currently accepting applications built with this version of the SDK." at SoftwareAssets/SoftwareAsset (MZItmspSoftwareAssetPackage)

From February, you'll have to build your AIR apps using the iOS 7 SDK (comes with XCode 5). In other words - if you are using Flash Builder or the Open Source Flex SDK to make iOS apps, you'll need to upgrade a bit. Adobe added support for this in the 4.0 Beta version of the AIR SDK that is now available on Adobe Labs. I do not know how this affects Windows users, but for Mac users you just download Xcode 5.x and use this instead of XCode 4.x. Next you download the AIR 4.0 Beta SDK and install it. Instructions for how to install/upgrade your AIR SDK can be found here.

With the beta and XCode installed, all you have to do is to up the version number to 4.0 in your App XML and maybe update the path to the new iOS simulator for testing.

Note: this only applies to new submissions. All apps that are already approved are still good.