We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
MDK-ARM, uVision 3.4: I am looking for a way that a custom PC test app can directly control uVision so that it can open a project, build it, run it under the debugger, and capture any output from the running app. Preferrably the method would work for both simulator and target debugging.
Ignoring the control aspect for now, what methods exist to capture the output of a running embedded app?
A) The first method I see would be for the embedded app to print to a uart, and have a serial cable connected from the target back to the PC host. This would do the job but it does require a target board, a serial cable, and a free com port on both. It only works for target debugging.
B) A simulator version of this would use the assign command to redirect the debugger's serial window output to a host PC com port. I think in this configuration the output of the embedded app goes OUT of the PC com port. This would mean that to capture that output you would need to loop back that com port to a 2nd PC com port or find some wedge driver to intercept it on the host.
C) The most promising method would be to use the RT Agent feature which uses the ULink connection. This seems attractive since its fast, it works the same for target and simulator debugging, and doesn't tie up any serial ports. I think it also has minimal performance impact on the target app.
I tried using the LPC23xx Blinky demo modified for RT Agent and it worked great. When entering debug an RT Agent terminal window opens automatically, and the code can use RTA_printf() to send output to this terminal. When I tried modifying one of my own LPC2478 apps for RT Agent I ran into some problems. Although I got my code to compile, I found I needed to select MicroLIB or the app would hang before it reached main(). I could see it was trying to print "SIGRTMEM: Out of heap memory". I don't plan on using MicroLIB so thats one problem to be solved. Using MicroLIB, main() is reached but the RT Agent terminal never opens, and I don't see any way of manually opening this window to see if any output gets there.
Any info on this?
Assuming I can solve the first two problems, how do I capture/redirect the RT Agent window output to my PC app? Preferrably this would not use serial ports.
To clarify, I am not using RTX so I copied from example \keil\arm\rt agent\mcb2300\blinky
The 'out of heap memory' problem was just because no heap had been allocated in lp2400.s (duh). My code now compiles and runs without needing microlib.
The settings in my RTA_config.c are the same, and my previously working code snippet is:
{ RTA_init(); RTA_printf("hi\n"); while(1); ... }
I still can't get the RT Agent terminal window to open to see if any chars are sent there. What could be wrong?
The RT Agent terminal window is opened in View->Serial Window.
I found some troubleshooting tips in the Ulink2 user guide, and I can now get output in the RTA window, but only if I disable crucial parts of my own code related to setting up the stacks and vector tables. Otherwise I get no RTA output and it hangs in the RTA data abort error trap.
In short, these are the changes:
Copy the file RTA_config.c to your project folder and add to project. Check the config options for this file. Defaults were OK for me.
Edits to LPC2400.s: Add at least 0x100 to heap size EXTERN DAbt_Handler ;added for keil RT Agent debugging ;DAbt_Handler B DAbt_Handler ;comment out for keil RT Agent debugging
Add the following to each project module needing RTA output: #include <stdio.h> #include <RT_Agent.h> .. RTA_printf("whatever");
Add the following to the start of main(): RTA_Init(); //some xtra delay here?
I am using the RT Agent with FreeRtos. In this configuration, RT Agent does not work reliably until a short time after the scheduler is started. Adding delays does not seem to help.