Multi File Failure

Side Project:

I received the OLED breakout PCBs from OHSpark this week #SSD1332Breakout. I also received some of the parts to build it with.  I am hoping to have a working OLED by the end of this next week.  I will start with it in SPI mode to use existing code that I know works.  Then I will have to migrate the library to use 8 bit parallel interface mode.

I have decided to move forward with the STM32F103 as the microcontroller for the Arduino Compass Toy.  The microchip part is still a possibility if the STM32 chip doesn’t work out.

The Challenge:

I posted an Arduino programming challenge to the community on Google+ and to twitter this week.

The challenge is to make a blink sketch that has nothing in it’s loop().

This is a just for fun challenge. The only requirements are that the LED blinks and loop() is empty.

I ask that submissions are made on February 22nd 2017 tagged with #ArduinoEmptyLoopChallenge

Click here to see the Google+ post.

Adventures in TDD:

I got back to learning TDD through eclipse.  On my system, when I run the cute tutorial program in eclipse, I get an error.  The error dialog is named Problem Occurred.  The error is ‘Running GCov’ Has encountered a problem. an internal error occurred during:”Running GCov”.  Under details it says “An internal error occurred during:”Running GCov”. java.lang.NullPointerException.  I think GCov is supposed to help me find any errors that are found in my testing. I searched for this error and only found some bug reports that look similar for a much older version of GCov

I ran eclipse from a terminal window to see if I got any more messages and it was silent.  I found that I could use the command line argument -consolelog to get more information.  It shows two crash reports, both null pointer exceptions.  I tried it with only one test that passes, I still get a null pointer exception with running GCov.

I decided to see if the plugins for GCov were installed and found two plugins for it. So I removed the one for Cute and left the one for IDE integration and it ran without any errors.  I double clicked on the Test.gcda and it opened up over 30 files in the editor window.  I decided to try it with the Cute GCov plugin and see what happens then.  It’s back to failing.  Installing the Cute GCov plugin triggered an install of the GCov integration plugin. I proceeded to remove the Cute GCov plugin again.  Finally ready to move forward.

Make the test, watch it fail:

The first step in TDD is to make the test code and try to compile. This must fail or the test isn’t right.

I started with the Cute tutorial I worked with last week. I decided on a simple function to implement.

I need a 64×64 pixel 2D rendering of a wireframe sphere for my side project. Because my final processor is a microcontroller, I want all math to be integer based.  This looks like too big of a problem to start with.  I need to produce a circle within a 64×64 Pixel Grid.  I want to completely draw the screen to a frame buffer before writing it to the display. I want the frame buffer to be 96×64 with the sphere in the middle.

My first function will be drawSphereOutline(PframeBuffer) My first function was to clear the framebuffer. clearFrameBuffer(PframeBuffer). I created 2 arrays of 96x64x3 bytes. I pass frameBuffer to the function to be tested and I initialized expectedResult to all 0. Of course the build fails because there is no function clearFrameBuffer.  There is not even a file for it.  My new file will be called FrameBuffer.c and a header file called FrameBuffer.h.  This step failed as it should have.

I was able to create the FrameBuffer.c and FrameBuffer.h files but I failed to get it to link to the test routine.  Maybe this is because the testing framework is in c++.  I am looking for more tutorials.

This was a frustrating week. I could really use some help with this. Do you have any suggestions for tutorials? Have you experimented with multi source file projects in Eclipse? How about mixing c and c++ code?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.