Showing results for 
Search instead for 
Did you mean: 

Piping data to and from STM32 HW during debug?

Associate III

I am writing audio DSP applications, and to debug and test them I would like to pipe canned data from my Mac to my STM32 HW, then run either my whole algorithm or selected DSP blocks for unit testing, then send the results back to the Mac to compare against my SciPy model of the algorithm. It seems a common and simple thing to want to be able to do.

Is there a relatively painless way to do this? I could use the Eclipse GUI to load STM32 memory from a file, then run code that process that memory block, then transfer it back to the Mac with the GUI. But doing this repeatedly in such a way as to create a smooth development flow and support any sort of semi-automated unit testing would be pretty awkward, and time consuming to do on a regular basis.

Is there a way to do this from the gdb debugger console? That would at least be a bit quicker once it's set up? Or is there a way to run the whole Eclipse session from a command line to load the program, load the data, run the program, stop the program, and read the data back? Then I'd only have to use the GUI to debug an issue, not to re-run regression tests.

Or is there a way to pipe data in and out using the debug port to support this idea, instead of loading and reading STM32 memory? 

Or maybe using the USB port (that seems like it would get pretty messy, unless there is already SW support for this idea.

I hope my desires make sense and someone has already figured a way to support this sort of development flow.

Thanks for any help!

Associate III

I'm thinking that maybe the best way to do this is to use the GUI for initial debug, and then use OpenOCD and GDB Server to automate testing. There are gdb commands to read and write memory, and Python code could drive the whole thing, loading program and data, running the program, retrieving the data.

But other suggestions are welcome!