Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MuviumLerosSDK fails to build more complex Blink.java #3

Open
sinclairrf opened this issue Feb 25, 2012 · 3 comments
Open

MuviumLerosSDK fails to build more complex Blink.java #3

sinclairrf opened this issue Feb 25, 2012 · 3 comments

Comments

@sinclairrf
Copy link

The enclosed replacement for java/target/src/Blink.java produces the following error message during the fourth operation in "make java_app".

PreCondition Failed : Method Bytecodes error : java.lang.ArrayIndexOutOfBoundsException: 30 - Blink:run
Exception in thread "main" java.lang.RuntimeException: PreCondition Failed : Method Bytecodes error : java.lang.ArrayIndexOutOfBoundsException: 30 - Blink:run
at aj.a(Unknown Source)
at X.a(Unknown Source)
at cP.a(Unknown Source)
at MuviumMetal.main(Unknown Source)
make: *** [java_app] Error 1

Steps to reproduce the error

  1. Get a fresh check-out of leros
  2. Replace java/target/src/Blink.java
  3. type "make tools"
  4. type "make java_app"

The rest of this is the replacement for Blink.java:

/* Copyright 2012, Sinclair R.F., Inc. */

import com.muvium.leros.Native;
import com.muvium.MuviumRunnable;

public class Blink extends MuviumRunnable {

//////////////////////////////////////////////////////////////////////////////
//
// Image pointer class
//
//////////////////////////////////////////////////////////////////////////////

public class ImageBuffers {

public short        input;

public ImageBuffers(short _input) {
  input = _input;
}

}; // class ImageBuffers

//////////////////////////////////////////////////////////////////////////////
//
// Constants
//
//////////////////////////////////////////////////////////////////////////////

// Input addresses
final static short ADDR_STATUS = 0;
final static short ADDR_SIZE_IMAGE_1 = 1;
final static short ADDR_SIZE_IMAGE_2 = 2;

// Output addresses
final static short ADDR_INPUT_BUFFER_0 = 0;
final static short ADDR_INPUT_BUFFER_1 = 1;

// input status bits
final public static int STATUS_IX_IMAGE_1 = 1;
final public static int STATUS_IX_IMAGE_2 = 2;
final public static int STATUS_IX_IMAGE_OUT = 4;

//////////////////////////////////////////////////////////////////////////////
//
// objects
//
//////////////////////////////////////////////////////////////////////////////

ImageBuffers imageBuffersA;
ImageBuffers imageBuffersB;

//////////////////////////////////////////////////////////////////////////////
//
// Process the specified input image channel.
//
//////////////////////////////////////////////////////////////////////////////

private void testInputImage(
int status_new,
int changed,
int mask,
short addr_size,
ImageBuffers buffers,
short addr_input_buffer
) {

// If the status has not changed then don't do anything else with the image.
if ((changed & mask) == 0)
  return;

// If the image has started, then don't do anything else with it.
if ((status_new & mask) == 0)
  return;

// Otherwise, an image has finished and we need to see if it's a good image.
short size = (short) Native.rd(addr_size);
if (size != 307200) // 640*480 = 307200
  return;

Native.wr(addr_input_buffer, buffers.input);

} // testInputImage()

//////////////////////////////////////////////////////////////////////////////
//
// main program
//
//////////////////////////////////////////////////////////////////////////////

public void run() {

int status_changed;
int status_new      = 0;
int status_old      = 0;

imageBuffersA = new ImageBuffers((short)0x0000);
imageBuffersB = new ImageBuffers((short)0x0800);

for (;;) {

  // Get the current status and note which bits have changed.
  status_new = Native.rd(ADDR_STATUS);
  status_changed = status_new ^ status_old;

  // Check each input image stream for completion of a good image.
  testInputImage(status_new, status_changed, STATUS_IX_IMAGE_1,
    ADDR_SIZE_IMAGE_1, imageBuffersA, ADDR_INPUT_BUFFER_0);
  testInputImage(status_new, status_changed, STATUS_IX_IMAGE_2,
    ADDR_SIZE_IMAGE_2, imageBuffersB, ADDR_INPUT_BUFFER_1);

  // Select the new output buffers when the output generation is in a lull.
  if (((status_changed & STATUS_IX_IMAGE_OUT) != 0)
   && ((status_new & STATUS_IX_IMAGE_OUT) == 0)) {
    status_old = status_new;
  }

} // for (;;) ...

} // run()

}

@JamesCaska
Copy link
Collaborator

Hi,

MuviumLeros in its current form is lets just limited with a capital L

So while the plan is to pull across more of the full features like classes,
inner classes, more data types etc from the more complete muvium for
PicMicro right now we have some pretty strict limitations. Actually right
now its more like a C compiler but with the benefit of operating in the java
ecosystem

Below I have modified your code to at least build - no idea if it works
though would need to setup some emulator test code

Limitations/Mods

  • No user classes, so replaced you image buffer with the int it was
    containing. No doubt you want to add more information to that class later
  • No shorts - replaced all shorts with Int. Actually all ints are shorts
    although that's just a limitation of the current math operations
  • Only static methods are supported so changed testInputImage to a static
  • Only 6 int variables per method including parameters so re-used the
    addr_size parameter for the size to make the limit

Cheers,
James Caska


import com.muvium.leros.Native;
import com.muvium.MuviumRunnable;

public class BlinkRF extends MuviumRunnable {

////////////////////////////////////////////////////////////////////////////
//
//
// Image pointer class
//

////////////////////////////////////////////////////////////////////////////
//
/*
public class ImageBuffers { //<<<<<<< Classes not supported

public short        input;

public ImageBuffers(short _input) {
  input = _input;
}

}; // class ImageBuffers
*/

////////////////////////////////////////////////////////////////////////////
//
//
// Constants
//

////////////////////////////////////////////////////////////////////////////
//

// Input addresses
final static int ADDR_STATUS = 0;
final static int ADDR_SIZE_IMAGE_1 = 1;
final static int ADDR_SIZE_IMAGE_2 = 2;

// Output addresses
final static int ADDR_INPUT_BUFFER_0 = 0;
final static int ADDR_INPUT_BUFFER_1 = 1;

// input status bits
final public static int STATUS_IX_IMAGE_1 = 1;
final public static int STATUS_IX_IMAGE_2 = 2;
final public static int STATUS_IX_IMAGE_OUT = 4;

////////////////////////////////////////////////////////////////////////////
//
//
// objects
//

////////////////////////////////////////////////////////////////////////////
//

//ImageBuffers imageBuffersA;
// ImageBuffers imageBuffersB;

static int imageBuffersA ; //<<<<<<< Removed Object reference
static int imageBuffersB ;

////////////////////////////////////////////////////////////////////////////
//
//
// Process the specified input image channel.
//

////////////////////////////////////////////////////////////////////////////
//

private static void testInputImage( //<<<<<<< Made a static method
int status_new,
int changed,
int mask,
int addr_size,
int buffers,
int addr_input_buffer
) {

// If the status has not changed then don't do anything else with the

image.
if (( changed & mask) == 0)
return;

// If the image has started, then don't do anything else with it.
if ((status_new & mask) == 0)
  return;

// Otherwise, an image has finished and we need to see if it's a good

image.
addr_size = Native.rd(addr_size); ////<<<<<<< Re-used the addr_size
variable as there is a limit of 6
if (addr_size != 307200) // 640*480 = 307200
return;

Native.wr(addr_input_buffer, buffers);

} // testInputImage()

////////////////////////////////////////////////////////////////////////////
//
//
// main program
//

////////////////////////////////////////////////////////////////////////////
//

public void run() {

    int status_changed  = 0; //<<<<<<< All variables should be

initialised
int status_new = 0;
int status_old = 0;

imageBuffersA = 0x0000; //new ImageBuffers((short)0x0000);
imageBuffersB = 0x0800; //new ImageBuffers((short)0x0800);

for (;;) {

  // Get the current status and note which bits have changed.
  status_new = Native.rd(ADDR_STATUS);
  status_changed = status_new ^ status_old;

  // Check each input image stream for completion of a good image.
  // Check each input image stream for completion of a good image.
  testInputImage(status_new, status_changed, STATUS_IX_IMAGE_1,
    ADDR_SIZE_IMAGE_1, imageBuffersA, ADDR_INPUT_BUFFER_0);
  testInputImage(status_new, status_changed, STATUS_IX_IMAGE_2,
    ADDR_SIZE_IMAGE_2, imageBuffersB, ADDR_INPUT_BUFFER_1);

  // Select the new output buffers when the output generation is in a

lull.

  if (((status_changed & STATUS_IX_IMAGE_OUT) != 0)
   && ((status_new & STATUS_IX_IMAGE_OUT) == 0)) {
    status_old = status_new;
  }





} // for (;;) ...

} // run()

}

@sinclairrf
Copy link
Author

Thank you James,

I'd been hoping to use the core for another project and was concerned
that I'd have to find another method.

I'll let you know what happens.

Rodney

On 02/26/2012 03:39 AM, JamesCaska wrote:

Hi,

MuviumLeros in its current form is lets just limited with a capital L

So while the plan is to pull across more of the full features like classes,
inner classes, more data types etc from the more complete muvium for
PicMicro right now we have some pretty strict limitations. Actually right
now its more like a C compiler but with the benefit of operating in the java
ecosystem

Below I have modified your code to at least build - no idea if it works
though would need to setup some emulator test code

Limitations/Mods

  • No user classes, so replaced you image buffer with the int it was
    containing. No doubt you want to add more information to that class later
  • No shorts - replaced all shorts with Int. Actually all ints are shorts
    although that's just a limitation of the current math operations
  • Only static methods are supported so changed testInputImage to a static
  • Only 6 int variables per method including parameters so re-used the
    addr_size parameter for the size to make the limit

Cheers,
James Caska


import com.muvium.leros.Native;
import com.muvium.MuviumRunnable;

public class BlinkRF extends MuviumRunnable {

////////////////////////////////////////////////////////////////////////////
//
//
// Image pointer class
//

////////////////////////////////////////////////////////////////////////////
//
/*
public class ImageBuffers { //<<<<<<< Classes not supported

 public short        input;

 public ImageBuffers(short _input) {
   input = _input;
 }

}; // class ImageBuffers
*/

////////////////////////////////////////////////////////////////////////////
//
//
// Constants
//

////////////////////////////////////////////////////////////////////////////
//

// Input addresses
final static int ADDR_STATUS = 0;
final static int ADDR_SIZE_IMAGE_1 = 1;
final static int ADDR_SIZE_IMAGE_2 = 2;

// Output addresses
final static int ADDR_INPUT_BUFFER_0 = 0;
final static int ADDR_INPUT_BUFFER_1 = 1;

// input status bits
final public static int STATUS_IX_IMAGE_1 = 1;
final public static int STATUS_IX_IMAGE_2 = 2;
final public static int STATUS_IX_IMAGE_OUT = 4;

////////////////////////////////////////////////////////////////////////////
//
//
// objects
//

////////////////////////////////////////////////////////////////////////////
//

//ImageBuffers imageBuffersA;
// ImageBuffers imageBuffersB;

static int imageBuffersA ; //<<<<<<< Removed Object reference
static int imageBuffersB ;

////////////////////////////////////////////////////////////////////////////
//
//
// Process the specified input image channel.
//

////////////////////////////////////////////////////////////////////////////
//

private static void testInputImage( //<<<<<<< Made a static method
int status_new,
int changed,
int mask,
int addr_size,
int buffers,
int addr_input_buffer
) {

 // If the status has not changed then don't do anything else with the

image.
if (( changed& mask) == 0)
return;

 // If the image has started, then don't do anything else with it.
 if ((status_new&  mask) == 0)
   return;

 // Otherwise, an image has finished and we need to see if it's a good

image.
addr_size = Native.rd(addr_size); ////<<<<<<< Re-used the addr_size
variable as there is a limit of 6
if (addr_size != 307200) // 640*480 = 307200
return;

 Native.wr(addr_input_buffer, buffers);

} // testInputImage()

////////////////////////////////////////////////////////////////////////////
//
//
// main program
//

////////////////////////////////////////////////////////////////////////////
//

public void run() {

  int status_changed  = 0; //<<<<<<<  All variables should be

initialised
int status_new = 0;
int status_old = 0;

 imageBuffersA = 0x0000; //new ImageBuffers((short)0x0000);
 imageBuffersB = 0x0800; //new ImageBuffers((short)0x0800);

 for (;;) {

   // Get the current status and note which bits have changed.
   status_new = Native.rd(ADDR_STATUS);
   status_changed = status_new ^ status_old;

   // Check each input image stream for completion of a good image.
   // Check each input image stream for completion of a good image.
   testInputImage(status_new, status_changed, STATUS_IX_IMAGE_1,
     ADDR_SIZE_IMAGE_1, imageBuffersA, ADDR_INPUT_BUFFER_0);
   testInputImage(status_new, status_changed, STATUS_IX_IMAGE_2,
     ADDR_SIZE_IMAGE_2, imageBuffersB, ADDR_INPUT_BUFFER_1);

   // Select the new output buffers when the output generation is in a

lull.

   if (((status_changed&  STATUS_IX_IMAGE_OUT) != 0)
    &&  ((status_new&  STATUS_IX_IMAGE_OUT) == 0)) {
     status_old = status_new;
   }





 } // for (;;) ...

} // run()

}


Reply to this email directly or view it on GitHub:
#3 (comment)

@MarcoPalma
Copy link

Hi, I got master head revision fresh install.
I use minGW in Windows 7 either on cygwin or under command prompt.
I do:
mingw32-make tools
mingw32-make java_app
and so far everything is ok.
but if I do
mingw32-make
in the default directory I get several errors.
What am I missing?
could you create a very small tutorial for newbies to understand at least how to make the file work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants