Skip to main content

SVN: Squawk-Native vs Squawk

2 replies [Last post]
khumalo
Offline
Joined: 2006-12-03
Points: 0

Can someone give a quick run down of the purpose of the different branches?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
derek_white
Offline
Joined: 2006-09-08
Points: 0

Well, the trunk is the active, "working" branch. The squawk-native branch is a work-in-progress that may or may not even compile. We hope to merge squawk-native back up to the trunk soon.

The main features in the squawk-native branch are:

1) MORE FLEXIBLE PLATFORM SUPPORT
Currently Squawk builds either on the desktop by delegating all IO to a JVM process, or on the bare metal, implementing basic OS features in Squawk. This is a bit of overhead on the desktop, but worse makes it impossible to run on devices large enough to support an OS, but too small to run a Java SE JVM.

The new branch explicitly supports 4 basic types of platforms. From build.properties:
# PLATFORM TYPE may be one of:
# BARE_METAL - Squawk runs on the bare metal, implementing interrupts, timers, etc.
# DELEGATING - Squawk delegates all IO to another JVM, via JNI
# NATIVE - Squawk runs on an OS, and calls native OS routines for IO, etc.
# SOCKET - Squawk delegates all IO to another JVM, via a socket
#
# The builder will synthesize definitions of four additional properties: PLATFORM_TYPE_BARE_METAL,
# PLATFORM_TYPE_DELEGATING, PLATFORM_TYPE_NATIVE, and PLATFORM_TYPE_SOCKET, which can be used
# by the Java and C preprocessors to conditionally compile code.
# Uncomment one of the following definitions:
#PLATFORM_TYPE=BARE_METAL
#PLATFORM_TYPE=DELEGATING
PLATFORM_TYPE=NATIVE
#PLATFORM_TYPE=SOCKET

2) CLDC/JAVA NATIVE ACCESS
To implement "PLATFORM_TYPE=NATIVE" we've designed a mechanism to call out to native code. At it's most basic, a foreign function mechanism has to:

- Getting a "pointer" to C variables and functions looked up by name.
- Peek/poke memory via a pointer.
- Call a C function (via function pointer looked up as described above), passing primitives and pointers.

It's also nice to add support for structured memory, being able to get data out of C structures. We've implemented something similar to Java Native Access (http://jna.dev.java.net), but for CLDC and with some extra features.

This is in a lot of flux, but it should be fun!

3) GENERIC POSIX IO
The code also includes implementations of files and sockets for most POSIX platforms.

That's enough preview for now. Most of it is checked in, but I have some major changes to the JNA code in the works...

khumalo
Offline
Joined: 2006-12-03
Points: 0

>...devices large enough to
> support an OS, but too small to run a Java SE JVM.

Are you targeting TinyOS?

> # SOCKET - Squawk delegates all IO to another
> JVM, via a socket

Or not necesserarily a JVM eh?

> This is in a lot of flux, but it should be fun!

:-)

Derek, thanks for the update! That does make things a little clearer (and decisions a little harder :-(