[<<][staapl][>>][..]
Wed Jun 6 00:00:56 EDT 2012

gdb_req

Simple hack to make RPC channel from (embedded ARM) target program to
external linux application using GDB / JTAG.

  target -> app:  req.bin    binary request
  app -> target:  reply.gdb  gdb command reply

This is useful to write a test system with minimal modification of the
target program.  The test system can be structured as if it were
running on the resource-limited embedded target, while in effect it is
implemented by host code with arbitrary complexity.  The gdb_call()
below is a hook point to insert remote calls.  If the test system is
detached, gdb_call() is a NOP, and the application can perform its
normal behaviour.


##### gdb_req.c

#include <stdio.h>
unsigned int gdb_req = 0;

void gdb_call() {
}

int main(void) {
    for(;;) {
        gdb_req++;
        printf("OUT gdb_req = %d\n", gdb_req);
        gdb_call();
        printf("IN  gdb_req = %d\n", gdb_req);
    }
    return 0;
}

##### gdb_req.sh

# Dummy operation: replace with program that handles request.
hd req.bin
echo 'set gdb_req = 123' >reply.gdb


##### gdb_req.gdb

define service
       dump binary value req.bin gdb_req
       shell ./gdb_req.sh
       source reply.gdb
       continue
end

define start_service
       break gdb_call
       tbreak main
       run
       while 1
              service
       end
end





[Reply][About]
[<<][staapl][>>][..]