Skip to content

MuviumLerosSDK fails to build more complex Blink.java #3

@sinclairrf

Description

@sinclairrf

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()

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions