Guide to Hacking the OSD: Developing for the OSD

From The Neuros Technology Wiki

Jump to: navigation, search
Previous Chapter Table of Contents Next Chapter

Contents

[edit] Developing for the OSD

[edit] Code Examples

In the following linked pages are some examples of code to give you an idea of things you can do with the Neuros API.

[edit] Setting up remote debugging with the GNU debugger (gdb)

Sometimes you want to set a breakpoint into the guts of your program to see what's going on or you want to keep it in check so you can be there when it segfaults. The GNU debugger (gdb) can be setup to debug from the comfort of your PC (possibly with graphical frontends like ddd) while the actual program runs on the OSD: remote debugging.

  • Ensure you're inside a neuros build environment with source OSD/neuros-bsp/neuros-env (where OSD is the place where all your neuros sources are).
  • First you need to install on the OSD a lightweight version of gdb called gdbserver that will act as a brige between the debugged program and the actual gdb on your machine. This is already built and ready in the toolchain, you just have to copy it from $TOOLCHAIN/target/gdbserver to any place you want on your osd (let's say /bin).
  • Now let's suppose you need to debug a program called "foo".
  • On the OSD issue gdbserver x:5551 foo (5551 is the port, it can be changed to whatever you like, x is a random string, gdbserver doesn't care about it anyway). gdbserver starts the program and stops it immediately, then waits for a remote gdb to tell it what to do.
  • On the PC start gdb or any other frontend you like. Be sure to start it as arm-linux-gdb and not regular gdb.
  • From the gdb console open a copy of the program you want to debug (it can simply be the actual program on a NFS-mounted OSD root) with file /path/to/program/foo
  • Connect to the remote gdbserver with target remote 192.168.1.100:5551 (substitute the port with the one you used before to start gdbserver and the IP address with the actual one for your OSD).

That's it. You should see a message on the OSD console where you started gdbserver telling you it has received a remote connection. From now on you can normally use gdb as if the program was running on your machine.

[edit] Cross compiling with Scratchbox

((NOTE: It might be just easier, if you want to do any kind of work with scratchbox, to use the Virtual Machine Development Environment, which has an installation of scratchbox inside, and doesn't need much setup))

There's a whole page dedicated to setting up and using sbox to compile your 3rd party applications. Note that it's not for building stuff using the Neuros toolchain (although i think you can use pre-built neuros libraries with it if you want).

New: How to build the neuros code (Neuros-Cooler, Nano-X, etc) in SB. Still a work in progress, and it may change frequently until its stable.

Previous Chapter Table of Contents Next Chapter
Personal tools