Pages

Showing posts with label C++. Show all posts
Showing posts with label C++. Show all posts

Tuesday, November 12, 2013

Eclipse Setup for C, C++, Java, Python, PHP, PERL, Shell Scripst, Verilog and VHDL with Vim-Like Editing

General

Install Eclipse
yum install eclipse
Vim-Like Editing
yum install eclipse-vrapper

for C/C++ (using CDT)
Install CDT
yum install eclipse-cdt

for Java (using JDT)

Install JDT
yum install eclipse-jdt

Specify Java VM
http://stackoverflow.com/questions/2030434/eclipse-no-java-jre-jdk-no-virtual-machine

for Python (using Pydev)
Install Pydev
yum install eclipse-pydev

for PHP(using PHP Eclipse)
Install PHP Eclipse
yum ibnstall eclipse-phpeclipse

for PERL (using EPIC)

Install EPIC
yum install eclipse-epic
OR
Install pad-walker for debugging
yum install perl-PadWalker

Launch Eclipse
eclipse &
Add Software Source
Select "Help/Install New Software" from menu bar
Click "Available Software Sites"
Click "Add"
Enter following information:
Name "EPIC"
Location "http://e-p-i-c.sf.net/updates"
Install "EPIC Main Components"
Install "EPIC Main Components" in the available software.
REF: http://www.epic-ide.org/download.php

for Shell Scripts (using Shelled Eclipse)
Install Shelled Eclipse
yum install eclipse-shelled

for Verilog and VHDL (using Veditor)
Install Veditor
yum install eclipse-veditor


Monday, September 9, 2013

Cross Compile C for Android

Download NDK
http://developer.android.com/tools/sdk/ndk/index.html


Create Folders and Files
mkdir jni
mkdir libs
mkdir obj

jni/hello.c
#include <stdio.h>
int main(int argc, char **argv)
{
        printf("HelloWorld\n");
        return 0;
}


jni/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# module names
 LOCAL_MODULE    := hello_world
# list of C files for compiler
 LOCAL_SRC_FILES := hello.c
#build executables
include $(BUILD_EXECUTABLE)


Build
android-ndk-r9/ndk-build

Binary for android is located within obj/local/armeabi/hello_world .

Tuesday, August 28, 2012

gdb and ddd Tutorial

Compile with debug support
    gcc -g myprog.c -o myprog

Start ddd and load program
    ddd myprog

Load a program. (You can skip this step because we load the program in previous step)
     file myprog


 Breakpoints
Set a breakpoint at specific line (e.g. break at line 7 of myprog.c)

     break myprog.c:7

Set a breakpoint at when calling specific function (e.g break when myfunc is called)
     break myfunc

Set a conditional breakpoint (e.g. variable myvar <= 3)
     break myprog.c:7 if myvar <= 3

Show breakpoints
     info breakpoints

Ignore specific breakpoint (e.g. ignore breakpoint 1 for 100 times. You can get number from "show breakpoints")
      ignore 1 100

Delete a breakpoint (Delete breakpoint 1. You can get number from "show breakpoints")
     delete 1


Control
Set watchpoint. (Stop execution when program changes the specific variable)
      watch myvar

Continue running after it hit a breakpoint
     continue

Finish (Finish current function)
     finish

Step Over (Trace into a function)
     step

Next (Treat function as a normal statement)
     next

Run/Restart the program
     run



Variables
Print content of specific variable (e.g. print content of myvar)
     print myvar

Print in hexadecimal
     print/X myvar