Hi everyone,
I am planning to learn Java.
Can I access HW registers in Java? Or can I call C function from Java program?
Thanks.
Hi everyone,
I am planning to learn Java.
Can I access HW registers in Java? Or can I call C function from Java program?
Thanks.
Even though I don't know much about Java, I know these tidbits:
No, you cannot directly access hardware from Java. I would be surprised to find a serious Java for embedded use that did not include library functions to do so, however.
Java itself doesn't provide a means to call C functions, but most Java run time environments provide a means to call external code. Of course, if you're calling external code then you have to maintain code bases in C _and_ Java...
-- Tim Wescott Control systems and communications consulting
If I design a HW platform, how can I run Java in this bare machine.
dick writes: [...]
Your first step should be to find a newsgroup with "java" in its name.
-- Keith Thompson (The_Other_Keith) kst-u@mib.org San Diego Supercomputer Center
quoted text - As per my basic understanding, for your hardware platform you need to Develop or Port Java Run Time Environment
-Raxit
You need a Java run-time environment to run Java, at which point the machine would no longer (by my definition) be "bare".
-- Tim Wescott Control systems and communications consulting
A typical embedded system will not have the CPU power or memory to interpret the bytecode at runtime, so that leaves two options:
My opinion is that Java is a poor language choice for most embedded system projects. But you can come to you own conclusion about that.
[comp.lang.c removed from newsgroups]
So you can compile programs once in one platform, and run them nowhere?
I bet you can't.
Yes - using JNI. The catch is that the overhead introduce by this is such that in most cases the resulting code is almost as slow as an all Java code.
Don't be (a) silly (b) atopical.
You can't in C, either.
That is, of course, going to depend on how much work the C code does; "most cases" is sheer handwaving.
-- Chris "(render unto \X that which is X's)(C | Java)" Dollin Hewlett-Packard Limited registered office: Cain Road, Bracknell,
Why, given you clearly don't know if it's going to do you any good?
If you must ask, that strongly implies it's a bad idea for you to learn Java at this point. You have to analyze what it means to use Java instead of C first.
I'll be blunt. If you must ask, you can't.
Read up on this,
"The platform is a combination of the broad-based I/0, a full TCP/IP stack, and an extensible Java runtime environment that simplifies development of the network connected equipment"
and also this
and this is not Java, but could be more interesting :
a code example is here
-jg
Not directly.
My java is *way* rusty but ... you might take a look at the "javah" tool, which is used to generate C/C++ header files and stubs based on a java class file.
-- Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460
[Please don't quote signature blocks. I've correct this here.]
This is, of course, getting way off-topic for comp.lang.c. I'm sure there is an "embedded Java" newsgroup out there, and Google returns a sick amount of hits for that phrase.
However, it may be instructive to consider that implementing embedded systems does not have to be all bare-metal bit-banging. There is a relatively long tradition of interpreted byte-code slinging in the embedded world.
It really depends on your application and deployment.
-- clvrmnky Direct replies will be blacklisted. Replace "spamtrap" with my name to
Is there any C syntax extension that support multi-thread like Java syntax? or how can I use C Macro to hide the OS routine call in C program?
I don't like the style: fun(...) { p(); . . . v(); }
I want to use syn fun(...) { . . . }
another question is how to disable "goto", can I write #define goto error("no goto")
No.
What makes you think you need to do that, or that OS routine calls would even exist in an embedded systems?
Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
It appears to have nothing to do with C nor with Java.
-- Army1987 (Replace "NOSPAM" with "email") No-one ever won a game by resigning. -- S. Tartakower
No.
Do a web search for "JNI java". It's a bloody pain in the posterior. As far as I can see, you have no C questions whatsoever in your post. Probably, Java questions go better in a Java group.
What has Microsoft's proprietary closed nonsense got to do with Java? Or, for that matter, embedded programming?
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.