CMSIS dsp - no hardware debugging

I normally work with data in Matlab, but I have to to convert my Matlab work to CMSIS dsp library. I don't have any experience in embedded programming and I can't understand how some things work.
I downloaded Keil MDK pack with their IDE and CMSIS dsp pack. I can open pack installer in IDE, choose Simulator as board and copy example with DSP_Lib. Then I have example program and it builds, everything looks fine.
How can I however run this program and analyse input and output signal?
If I start debug I can go throught entire program but I can't get any values. There is code:
#if defined(SEMIHOSTING)
#include <stdio.h>
Printing output could help but it doesn't work as semihosting is not definied in any of DSP examples. So how can I get values of output so I could what signal did I get? I don't have any hardware so I need to simulate this procces.
In this Youtube clip there is at least memory window where You can see nice decimal values of an array in testOuput variable. If I try to do the same I can only see some random hex values.
Any help with understanding how it works or how to get what I need would be great.
  • My go-to for print output is the Event Recorder. I used the CMSIS DSP FIR example for a Cortex-M0 target. It ran out of the box, with the only modifications needed being to change the debugger target and add EventRecorder. These steps worked for me:

    1. Use the Manage Run Time Environment tool to enable Event Recorder and send STDOUT to EVR. This will add EventRecorderConf.h to your project, under the Compiler group.
    2. Add #include "EventRecorder.h" to your main file
    3. Open EventRecorderConf.h and use the configuration wizard set the timer source to SysTick
    4. Add the statement EventRecorderInitialize(EventRecordAll,1); to main(), before you do any STDIO.
    5. Open the project options and add SEMIHOSTING to the list of defines on the C/C++ tab
    6. (Optional) Set the debugger to Simulation (because I don't have MDK Pro, so couldn't use the default debug target of fast models)
    7. Recompile
    8. Launch the debugger
    9. Set up your memory window to the data you want to see. Right click in the middle of the displayed data and set the format (e.g., float) so that it doesn't show as hex.
    10. Open a debug printf window with View > Serial Windows > Debug (printf) window
    11. Run the code

    If all went well, you should see non-zero floating-point data in your output and whatever you wanted printing in the debug printf window.

    EventRecorder is very useful and quite well documented. You can use the EventRecorder API to push any data you like to the debug host. The IDE also supports user-defined debug functions (see uVision help) that can be defined to pretty-print your output to the debugger's command window, 

  • I've worked with a DSP project where I needed to print the values of functions out. What I did was added functions to the ini file listed at the Options for Target - Debug tab's Initialization File field. If you don't have one, just use a text editor to create it and save to as file_name.ini.  The functions acted as wrappers for the stdio printf. There was an array, output[1023], being used with fft functions that I was interested in. In one context the first 512 elements were interesting, in another, all 1024 were interesting. 

    .ini contents: 

    FUNC void print_output512(void){
    	unsigned int i;
    	printf("BEGIN OUTPUT 512\n");
    	printf("BEGIN OUTPUT 512\n");		
    	printf("BEGIN OUTPUT 512\n");
    	for(i = 0; i < 512; i++) {                                                       
    FUNC void print_output1024(void){
    	unsigned int i;
    	printf("BEGIN OUTPUT 1024\n");
    	printf("BEGIN OUTPUT 1024\n");
    	printf("BEGIN OUTPUT 1024\n");
    	for(i = 0; i < 1024; i++) {                                                       

    If I recall correctly, you then compile and in debug use the command INCLUDE file_name.ini. Then you can set a breakpoint where your interested in viewing values and call the functions by name in the command window. You can copy and paste from here. 

  • As far as the memory window goes, you can change the data format by right clicking, and clicking Decimal. This should take global effect. 

    Also, you could look at using the Logic Analyzer

    You could also look at using DMA to store values to RAM and dump it later.

More questions in this forum