McuOnEclipse Components: 22-Mar-2015 Release

There is a new release of the McuOnEclipse components available on SourceForge, with the following main changes:

  1. Shell: Fixed and improved history handling.
  2. MinIni: Option to select local/stack or global memory for buffers
  3. FreeRTOS: Ability to use the tick counter instead of dedicated timer for performance measurement.
  4. FSL_USB_Stack: Added deinitialization for USB stack.
  5. FatFsMemSDHC: added custom card detection and write protection pin handling.
  6. Multiple Bug Fixes
SourceForge McuOnEclipse

SourceForge McuOnEclipse

Continue reading

Advertisements

C++ with Kinetis Design Studio

Unlike CodeWarrior, the Kinetis Design Studio (at least in V1.1.1) does not offer a choice between C and C++ projects. That makes sense with the GNU ARM Eclipse plugins, other than the CodeWarrior gcc integration, there is no need for setting up a special tool chain for C++ (see “Compiling C Files with GNU ARM G++“). While this is great, things are not perfect yet, so I’m providing in this post the information needed to properly setup a C++ project with Kinetis Design Studio V1.1.1.

Debug View of Startup Code Calling C++ Constructors

Debug View of Startup Code Calling C++ Constructors

Continue reading

Tutorial: PWM with DMA on ARM/Kinetis

For a project I need to change the PWM duty cycle after a PWM period is over. One way to do this is to have an interrupt at the end of the PWM period, and then set the new PWM duty (compare) register value in the interrupt. That works fine for ‘slow’ PWM frequencies, but if the PWM frequency is high, the CPU load is massively increasing. A better way is to use DMA (Direct Memory Access).

FRDM-KL25Z with DMA PWM and Logic Analyzer

FRDM-KL25Z with DMA PWM and Logic Analyzer

Continue reading

GNU Linker, can you NOT Initialize my Variable?

my students sometimes are afraid to ask questions, although I urge them ask any question. In my opinion there are no ‘dumb’ questions: only questioning things let us think and learn new things. I see that many readers of this blog are *not* afraid to comment or ask questions. The WordPress statistics shows 5’687 questions/comments for this blog (thank you all!), and the spam filter protected me from 202,341 items (ok, these *are* dumb) :-).

The ‘question of the week’ comes from Andy. That question caused me some serious head scratching, but the same time I have learned something important and useful for my next project: how to tell the ARM GNU linker *not* to initialize variables?

GNU ARM Embedded Linker Options

GNU ARM Embedded Linker Options

Continue reading

Variable Debugging with Eclipse Kepler

The current Eclipse Kepler version comes with changes for debugging variables. I have students coming from the earlier Eclipse versions, so here are a few tips for dealing with variables in Eclipse Kepler.

Variables View in Eclipse

Variables View in Eclipse

Continue reading

EnterCritical() and ExitCritical(): Why Things are Failing Badly

I have carefully implemented my firmware. It works perfectly for hours, days, months, maybe for years. I there would not be a problem: the firmware crashes sporadically :-(. Yes, I’m using watchdogs to recover, but hey: it is a serious problem. And because it happens only under rare and special conditions, it is hard to track it down or to debug it.

Accessing shared data

Accessing shared data from the main application and from an interrupt

The thing is: these nightmares exist, and they are real and nasty. I’m pushing my students hard on this topic: It is about how to protect critical sections. And what could go wrong. And here is just yet another example: how it can go badly wrong if you are not careful. And it took me a while too to realize where the problem is. It was not a fun ride….

Continue reading

FreeRTOS Heap with Segmented Kinetis K SRAM

While working on a project for the FRDM-K20D50M, I faced a problem: I was running out of SRAM for my application. The GNU linker reports: “section `.bss’ will not fit in region `m_data'”: 😦

bss will not fit in region m_data

bss will not fit in region m_data

But my device has 16 KByte of SRAM, and I knew I use much less than 10 KByte. So what is the problem? Continue reading

text, data and bss: Code and Data Size Explained

In “Code Size Information with gcc for ARM/Kinetis” I use an option in the ARM gcc tool chain for Eclipse to show me the code size:

   text       data        bss        dec        hex    filename
 0x1408       0x18      0x81c       7228       1c3c    size.elf

I have been asked by a reader of this blog what these item numbers really mean. Especially: what the heck is ‘bss’???? 🙂

Continue reading

Live View for Variables and Memory

Debugging is usually a ‘stop-inspect-continue’ process. That does not work very well for watching a system which continuously changes its state. For this usually I toggle an LED, or write things to the console to watch with a human eye what is going on. But there is something very powerful in the CodeWarrior debugger too: to display variables and memory content while the target is running.

Variable Live View

Variable Live View

Continue reading