Debugging ARM Cortex-M0+ Hard Fault with MTB Trace

And here it is again: a Hard Fault exception raised by the ARM Cortex-M0+ on my Freedom board:

Hard Fault in Debug View

Hard Fault in Debug View

A reason for hard faults are for example dereferencing a NULL pointer. The issue with the ARM Cortex hard fault exception stack is: it is not easy to find out where in the code the problem is.I have created a Processor Expert component to help me to find the location of such an exception. With the Eclipse based CodeWarrior for MCU10.3 there is another way: Trace with the MTB (Micro Trace Buffer)!

Continue reading

Reducing the build time with gcc for ARM and CodeWarrior

Eclipse based CodeWarrior for MCU10.3 comes with gcc build tools for Kinetis/ARM cores. While it features the parallel build make, I noticed that especially for larger projects build times are not as fast as it should be. The good news is: I was able to cut down my build time to less than half with a simple change :-).

When I looked at the output folder where all the object and make files are stored by Eclipse, I noticed that it has as well the listing files generated:

Listing Files in output folder

Listing Files in output folder

Continue reading

The Freedom Robot

I have the Arduino Motor Shield working, the Ultrasonic module is pinging around, Christmas brought some small DC toy motors, and a bag of plastic gears is on my desk. All the good ingredients for a small robot: the Freedom Robot!

❗ Warning: Multiple Coke bottles have  been destroyed, and a FRDM box got hurt during his experiment! 😯 Do not try yourself if you cannot handle it.:-)

Smile

Smile

Continue reading

Tutorial: Ultrasonic Ranging with the Freedom Board

Question: What makes 8 times ‘beep’, but I cannot hear it?

Answer: My ultrasonic range finder 🙂

FRDM-KL25Z with HC-SR04

FRDM-KL25Z with HC-SR04

What I have added to my FRDM-KL25Z board is an ultrasonic distance sensor, measuring distances up to 4 meters.

Continue reading

A new Freedom Board: FRDM-KL05Z

Christmas and New Year time is great: Gifts and time to work on my home projects. But this post is not about one gift I have organized for myself: a Raspberry Pi ;-)). No, this post is about a gift I have received from Freescale: a *new* Freedom board, the FRDM-KL05Z :-).

FRDM-KL05Z Board and Box

FRDM-KL05Z Board and Box

Continue reading

A Processor Expert Component to Help with Hard Faults

Ahrg! Again my ARM application crashed somewhere and I ended up in a HardFault exception :-(. In my earlier post I used a handler to get information from the processor what happened. But it is painful to add this handler again and again. So I decided to make things easier for me: with a special HardFault Processor Expert component :-).

After adding this HardFault component to my project, it automatically adds an entry to the vector table. So no manual steps are needed: having the component in the project and enabled will do the needed steps.

Continue reading

Migrating Kinetis-L Projects from Beta to Final MCU 10.3

I have successfully used CodeWarrior for MCU10.3 beta version for many projects. With the advent of the final CodeWarrior for MCU10.3, I want to migrate my existing projects to the new and final version. First: my existing projects work as well in the final version, which is good news. But there are two things to change to take advantage of the final 10.3:

  1. Linker file memory split
  2. ARM Micro Trace Buffer (MTB) support

Continue reading

LED’s for Kinetis, simplified

Sometimes it takes a while until things get better. Same thing applies to software: from time to time a refactoring and simplification makes sense. Especially if the underlying technology has been improved. With CodeWarrior for MCU10.3 available, it is time to refactor the LED component.

Continue reading

HD44780 2×16 Character Display for Kinetis and Freedom Board

In my earlier Nokia LCD post I described a ‘free of charge’ way to add a LCD display to my FRDM-KL25Z board. If that Nokia display is not available, or an alphanumeric display is enough, then the Hitachi HD44780 display is a low cost option as well.

The HD44780 (or compatible) display is one of the most common displays available. And they usually conly costs around $10 or less. I have used a ‘blue’ 3.3V version of such a display already in my lectures with a Freescale S08 microcontroller. So I thought it would be nice to port the driver to the Kinetis and the KL25Z on it.

LCD Boards with FRDM-KL25Z

LCD Boards with FRDM-KL25Z

A recent post of TKJ Electronics about such a really inexpensive (only $5) HD44780 display caught my attention. And finally I had two of such TKJ displays in my postal mail box yesterday. Time to have some fun on a weekend 🙂

Continue reading

Reducing Code Size with gcc and EWL

If you have not noticed: the final CodeWarrior for MCU10.3 has been released on the Freescale web :-).

It comes with a few changes compared to the 10.3beta release, and one is about the library configuration. I noticed that new projects created with the wizard are around 4 KByte larger than I expect them to be. For example my rather simple application below uses 8 KByte of code, where my expectation would be in the range of around 4 KByte:

   text       data        bss        dec        hex    filename
   8644         24       1108       9776       2630    Freedom_2x16_HTA.elf

Continue reading