Menu

Netbeans avr-ld error

2013-03-11
2013-03-12
  • Carl van Denzen

    Carl van Denzen - 2013-03-11

    Using Netbeans (on Windows this time), I get errors while linking the BlinkLed program.

    There are two unknown symbols: Const0005 and statics. The symbol Const0005 should have the value 1000 (thousand), it is the delay time I use in the Java program.
    The problem is possibly triggered by the unusual setup I have chosen. The Haiku download is in a separate directory from the Java file. But maybe someone can explain in what file Const0005 and statics could be.

    Java code is quite easy to read for me, but the C code is somewhat mysterious to me.

    Linker output:
    Start avr-ld
    haikuJava/arduino/tutorial/BlinkWithThread.o:(.progmem.data+0xa): undefined reference to statics' GNU ld (WinAVR 20081205) 2.19 haikuJava/arduino/tutorial/BlinkWithThread.o:(.progmem.data+0xf): undefined reference toConst0005'
    haikuJava/arduino/tutorial/BlinkWithThread.o:(.progmem.data+0x13): undefined reference to statics' haikuJava/arduino/tutorial/BlinkWithThread.o:(.progmem.data+0x18): undefined reference toConst0005'
    haikuJava/arduino/tutorial/BlinkWithThread.o:(.progmem.data+0x22): undefined reference to statics' haikuJava/arduino/tutorial/BlinkWithThread.o:(.progmem.data+0x35): undefined reference tostatics'
    haikuJava/arduino/tutorial/BlinkWithThread.o:(.progmem.data+0x38): undefined reference to `java_lang_Thread__class'
    Result: 1

    The C file:
    /*
    public class arduino.tutorial.BlinkWithThread extends java.lang.Thread
    filename ./arduino/tutorial/BlinkWithThread.class
    compiled from BlinkWithThread.java
    compiler version 51.0
    access flags 33
    constant pool 41 entries
    ACC_SUPER flag true

    Attribute(s):
    SourceFile(BlinkWithThread.java)

    1 fields:
    static byte ledPin

    4 methods:
    public void <init>()
    public void run()
    public static void main(String[] arg0)
    static void <clinit>()

    */

    include "haikuC/haikuConfig.h"

    // arduino/tutorial/BlinkWithThread

    include "haikuJava/arduino/tutorial/BlinkWithThread.h"

    // java/lang/Thread

    include "haikuJava/java/lang/Thread.h"

    // haiku/avr/lib/arduino/WProgram

    include "haikuJava/haiku/avr/lib/arduino/WProgram.h"

    /*
    public void <init>()
    Code(max_stack = 1, max_locals = 1, code_length = 5)
    /

    undef JMETHOD

    define JMETHOD arduino_tutorial_BlinkWithThreadinitV

    const arduino_tutorial_BlinkWithThreadinitV_t JMETHOD PROGMEM ={
    1+1 +2, 0, 1, // max_stack, purLocals, purParams

    OP_ALOAD_0, // 0: aload_0
    OP_INVOKESHORT_java_lang_ThreadinitV, // 1: invokespecial java.lang.Thread.<init> ()V (1)
    OP_RETURN, // 4: return
    };

    /*
    public void run()
    Code(max_stack = 2, max_locals = 1, code_length = 29)
    /

    undef JMETHOD

    define JMETHOD arduino_tutorial_BlinkWithThread_run_V

    const arduino_tutorial_BlinkWithThread_run_V_t JMETHOD PROGMEM ={
    2+1 +2, 0, 1, // max_stack, purLocals, purParams

    OP_GETSTATIC_B, SADR(arduino_tutorial_BlinkWithThread_ledPin), // 0: getstatic arduino.tutorial.BlinkWithThread.ledPin B (2)
    OP_ICONST_1, // 3: iconst_1
    OP_INVOKESHORT_haiku_avr_lib_arduino_WProgram_digitalWrite_BBV, // 4: invokestatic haiku.avr.lib.arduino.WProgram.digitalWrite (BB)V (3)
    OP_LDC2_W_L, CADR(Const0005), // 7: ldc2_w 1000 (4)
    OP_INVOKESHORT_haiku_avr_lib_arduino_WProgram_delay_JV, // 10: invokestatic haiku.avr.lib.arduino.WProgram.delay (J)V (6)
    OP_GETSTATIC_B, SADR(arduino_tutorial_BlinkWithThread_ledPin), // 13: getstatic arduino.tutorial.BlinkWithThread.ledPin B (2)
    OP_ICONST_0, // 16: iconst_0
    OP_INVOKESHORT_haiku_avr_lib_arduino_WProgram_digitalWrite_BBV, // 17: invokestatic haiku.avr.lib.arduino.WProgram.digitalWrite (BB)V (3)
    OP_LDC2_W_L, CADR(Const0005), // 20: ldc2_w 1000 (4)
    OP_INVOKESHORT_haiku_avr_lib_arduino_WProgram_delay_JV, // 23: invokestatic haiku.avr.lib.arduino.WProgram.delay (J)V (6)
    OP_GOTO, TARGET(0), // 26: goto #0
    };

    /*
    public static void main(String[] arg0)
    Code(max_stack = 2, max_locals = 1, code_length = 18)
    /

    undef JMETHOD

    define JMETHOD arduino_tutorial_BlinkWithThread_main_YLjava_lang_String_V

    const arduino_tutorial_BlinkWithThread_main_YLjava_lang_String_V_t JMETHOD PROGMEM ={
    2+1 +2, 0, 1, // max_stack, purLocals, purParams

    OP_GETSTATIC_B, SADR(arduino_tutorial_BlinkWithThread_ledPin), // 0: getstatic arduino.tutorial.BlinkWithThread.ledPin B (2)
    OP_ICONST_1, // 3: iconst_1
    OP_INVOKESHORT_haiku_avr_lib_arduino_WProgram_pinMode_BBV, // 4: invokestatic haiku.avr.lib.arduino.WProgram.pinMode (BB)V (7)
    OP_NEW, ADR(arduino_tutorial_BlinkWithThreadclass), // 7: new <arduino.tutorial.BlinkWithThread> (8)
    OP_DUP, // 10: dup
    OP_INVOKESHORT_arduino_tutorial_BlinkWithThread
    initV, // 11: invokespecial arduino.tutorial.BlinkWithThread.<init> ()V (9)
    OP_INVOKEVIRTUAL, B(0), LB(MSG_start
    _V), // 14: invokevirtual arduino.tutorial.BlinkWithThread.start ()V (10)
    OP_RETURN, // 17: return
    };

    /*
    static void <clinit>()
    Code(max_stack = 1, max_locals = 0, code_length = 6)
    /

    undef JMETHOD

    define JMETHOD arduino_tutorial_BlinkWithThreadclinitV

    const arduino_tutorial_BlinkWithThreadclinitV_t JMETHOD PROGMEM ={
    1+0 +2, 0, 0, // max_stack, purLocals, purParams

    OP_BIPUSH, B(13), // 0: bipush 13
    OP_PUTSTATIC_B, SADR(arduino_tutorial_BlinkWithThread_ledPin), // 2: putstatic arduino.tutorial.BlinkWithThread.ledPin B (2)
    OP_RETURN, // 5: return
    };

    const class_t arduino_tutorial_BlinkWithThreadclass PROGMEM = {
    & java_lang_Thread
    class,
    sizeof(arduino_tutorial_BlinkWithThread),
    1,
    {
    {MSG_run___V, (ByteCode *)(&arduino_tutorial_BlinkWithThread_run_V)},
    }
    };

    HaikuConfig.h:
    typedef struct {
    uint8_t max_stack; int8_t purLocals; uint8_t purParams;

    OP_bc op0;                                                             // 0:    aload_0
    OP_bc op1;                                                             // 1:    invokespecial   java.lang.Thread.<init> ()V (1)
    OP_bc op4;                                                             // 4:    return
    

    } arduino_tutorial_BlinkWithThreadinitV_t;
    extern const arduino_tutorial_BlinkWithThreadinitV_t arduino_tutorial_BlinkWithThreadinitV;

    typedef struct {
    uint8_t max_stack; int8_t purLocals; uint8_t purParams;

    OP_bc op0; OPadr a0;                                                   // 0:    getstatic       arduino.tutorial.BlinkWithThread.ledPin B (2)
    OP_bc op3;                                                             // 3:    iconst_1
    OP_bc op4;                                                             // 4:    invokestatic    haiku.avr.lib.arduino.WProgram.digitalWrite (BB)V (3)
    OP_bc op7; OPcon c7;                                                   // 7:    ldc2_w      1000 (4)
    OP_bc op10;                                                            // 10:   invokestatic    haiku.avr.lib.arduino.WProgram.delay (J)V (6)
    OP_bc op13; OPadr a13;                                                 // 13:   getstatic       arduino.tutorial.BlinkWithThread.ledPin B (2)
    OP_bc op16;                                                            // 16:   iconst_0
    OP_bc op17;                                                            // 17:   invokestatic    haiku.avr.lib.arduino.WProgram.digitalWrite (BB)V (3)
    OP_bc op20; OPcon c20;                                                 // 20:   ldc2_w      1000 (4)
    OP_bc op23;                                                            // 23:   invokestatic    haiku.avr.lib.arduino.WProgram.delay (J)V (6)
    OP_bc op26; OPtrg a26;                                                 // 26:   goto        #0
    

    } arduino_tutorial_BlinkWithThread_run_V_t;
    extern const arduino_tutorial_BlinkWithThread_run_V_t arduino_tutorial_BlinkWithThread_run_V;

    typedef struct {
    uint8_t max_stack; int8_t purLocals; uint8_t purParams;

    OP_bc op0; OPadr a0;                                                   // 0:    getstatic       arduino.tutorial.BlinkWithThread.ledPin B (2)
    OP_bc op3;                                                             // 3:    iconst_1
    OP_bc op4;                                                             // 4:    invokestatic    haiku.avr.lib.arduino.WProgram.pinMode (BB)V (7)
    OP_bc op7; OPadr f7;                                                   // 7:    new     <arduino.tutorial.BlinkWithThread> (8)
    OP_bc op10;                                                            // 10:   dup
    OP_bc op11;                                                            // 11:   invokespecial   arduino.tutorial.BlinkWithThread.<init> ()V (9)
    OP_bc op14; OP__8 a14; OP__8 b14;                                      // 14:   invokevirtual   arduino.tutorial.BlinkWithThread.start ()V (10)
    OP_bc op17;                                                            // 17:   return
    

    } arduino_tutorial_BlinkWithThread_main_YLjava_lang_String_V_t;
    extern const arduino_tutorial_BlinkWithThread_main_YLjava_lang_String_V_t arduino_tutorial_BlinkWithThread_main_YLjava_lang_String_V;

    typedef struct {
    uint8_t max_stack; int8_t purLocals; uint8_t purParams;

    OP_bc op0; OP__8 b0;                                                   // 0:    bipush      13
    OP_bc op2; OPadr a2;                                                   // 2:    putstatic       arduino.tutorial.BlinkWithThread.ledPin B (2)
    OP_bc op5;                                                             // 5:    return
    

    } arduino_tutorial_BlinkWithThreadclinitV_t;
    extern const arduino_tutorial_BlinkWithThreadclinitV_t arduino_tutorial_BlinkWithThreadclinitV;

    ifndef arduino_tutorial_BlinkWithThread

    typedef struct {
    heapControl;
    struct {
    jobject target; //Ljava/lang/Runnable;
    jobject next; //Ljava/lang/Thread;
    jint state; //I
    jobject programcounter; //Ljava/lang/Object;
    jobject stackpointer; //Ljava/lang/Object;
    jobject stackframe; //Ljava/lang/Object;
    jobject stack; //Ljava/lang/Object;
    jlong waitUntil; //J
    jobject locks; //Ljava/lang/Object;
    jboolean interrupt; //Z
    jobject waitingOn; //Ljava/lang/Object;
    } user;
    } arduino_tutorial_BlinkWithThread;

    endif

    extern const class_t arduino_tutorial_BlinkWithThread__class;

     
    • genom2

      genom2 - 2013-03-12

      Hello Carl,
      I would realy like to help. But, to have a starting point, I do miss the answers on my last post in the other discussion thread.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.