15 January 2018

(SOLVED) Cypress PSOC5LP Failure to Format sprintf Floats

The default behaviour of Creator 4.1 is to skip processing of floating point variables for ARM based processors.  This is due to the newlib-nano library from ARM and Creator project build settings.  If you do not need to format floats then the default settings will save valuable flash space.  However, this gotcha is likely to trip the unsuspecting as good code will not perform as expected.

To following demonstration code does not perform as expected:

#include "project.h"
#include <stdio.h>
int main(void)
    CyGlobalIntEnable; /* Enable global interrupts. */

    float num = 12.35;
    char msg[20];


Adding a breakpoint and running the code with a local variable watch results in the msg char array is inspected:

This would result in an output of: "Test:" followed by a NULL '\000' if the string were transmitted.  This is not is expected or wanted.

The Solution

Some reconfiguartion is needed.  The Linker settings can be found under Project > Build Settings:

Change the Use newlib-nano Float Formating to TRUE.

To account for this change the size of the heap needs to increase.  The heap size can be set within the System tab under Design Wide Resources in the Project tree:

Increase Heap size to 0x200 bytes.

Re-build the project and the output of sprintf is now as expected:

I hope this resolves any difficulties you may be experiencing.  Enjoy!

PS. If your code doesn't appear to be working make sure you are using floating point arithmetic and using constants in their floating point form: 10.0, 1.5, 0.35 etc.

06 December 2017

Updating Google Map Entries

I don't generally keep the contact details for my local takeaways in my phone - why should I when they are a simple web search away?
Well when they are either wrong or not immediately apparent.  So I updated the Google entry and included the correct opening hours as well.  This was a simple process, even on a smartphone, and whiled away the time waiting for food to be cooked.  Today I received Google's confirmation email of a successful edit and publication:

The process was simple clicking the suggest an edit link just under opening times:

I wish the update had been sooner because about a week ago my son did a search and placed an order for collection, but it transpired the Yuit Loung the order was placed with was not local... The lesson reinforced: sanity check your search result.

This guinea pig has new and more relevant things to focus.

13 September 2017

Hello World GitHub and Wuthering Bytes 2017

Like many things in life that I feel I should understand or do, like finishing one of many incomplete home DIY projects or my CEng application - it has only been twenty since I registered for that one! - I lack competence in Git.  It was explained to me in an hour session a few years ago now for a complex project, but I could not easily and repeatably login to the development server and so it was a frustrating experience and I moved onto something else.

A couple of weekends ago I went to Wuthering Bytes 2017.  Billed as a festival of technology in the heart of the Pennines and running from 1st to 10th September I had a fun, interesting and sometimes frustrating time listening to talks and participating in workshops.  The Open Source Hardware Camp running at the weekend covered topics: 
  • artificial intelligence and machine learning by Alan Wood
  • RISC-V architecture by Graham Markall
  • micro:bit conception and prototyping by Lawrence Archard
  • the Robot Operating System (ROS) by Nick Weldin
  • Computer Science from the ground up by Ken Boak
  • Do's and Don'ts of building and selling an electronics kit by Jenny List
  • and lastly a favourite of mine Conservatory and Garden Automation by Rod Moody.
As part of the myStorm BlackIce workshop I installed Git and cloned part of a repository: https://gitlab.com/Folknology/mystorm/tree/BlackIce/tutorial/BlackIce/blink.  It was really easy, in Windows using the command prompt:

Anyway, at an Alexa software developers day, we made extensive use of the web interface to Github and the RAW button to simplify code deployment into AWS Lambda and the developer console for Alexa.  The RAW button provides a format free version of the code suitable for a Select All > Copy and Paste into the appropriate destination.  The RAW button is located at the top right of the code box:

Lastly, this morning I followed a short guide on the GitHub website that I had missed before - a Hello World guide.  It runs through the parts of git that I had yet to cover:

  1. Creating a repository
  2. Staring and managing a new branch
  3. Making changes to a file and pushing them to GitHub as commits, and
  4. Opening and merging a pull request
I feel after this I have a better handle on the environment.  Anecdotally most of the functionality is ignored.


08 August 2017


I used to use XMind to for mind mapping, with an academic license, but have just changed to FreeMind an Open Source alternative.

I think it is a good piece of software and have 'mapped' some of my thoughts on how the Live Action Role Play work of Curious Pastimes works.