Re: Using ASM with Java in TINIOS
Peter Wein <[email protected]> Thu, 10 Jun 2004 11:26:21 +0200
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
Hello Theraputh, I am working on this , too. As far as I know, for the TINIm400 sytem form DS, it is as easy to scrog the system as it is to restore it again by using JavaKit to transmit the TINI Software on it. So I don't think it is possible to destroy permanently by software. If you carefully look at the ~\Tinidir\examples\native it is possible to return values. For programming your ISR there are maybe two possibilities: 1.)ISR Routines you better program in assembler or in SDCC, but then without a startup code and any libraries. All c functions you will need for this, you must then copy as native from the include directory. But there is no warranty that this will work. This is my way, because I need some evaluating functions of the c environment. Then you can look up in the *.map file, which your c compiler probably produces, and see where your ISR stays. It must be out of the range of the TINI OS, for example from Bank 48 - 4f of the flash. 2.) Assembler: best option. Same storing like above mentioned. In the end you must put some info to the vector table, which resides for the TINIm400 at 0x0000xx, and for the TINI m390 at 0x010000, as far as I know. For example a LJMP to your ISR, for example for Timer 1: 0x00000b 02 0x00000c 49 0x00000d 01 0x00000e 48 which means LJMP $490148, where maybe your ISR resides. If you need a tool to do this , I can sent you off list a JAVA hexmonitor and disassembler which I created for my own purposes. As far as I know there is no tool available from DS that can do this. To return a value from ISR: I think it is difficult to give it directly back. But maybe after initializing your ISR in a native library, you can hand in a Pointer (a argument to your initializing ISR routine) to your specified data via NatLib_LoadPrimitive NatLib_LoadWidePrimitive NatLib_LoadJavaByteArray NatLib_LoadPointer Then you store the received pointer away in TINI OS non available memory (for example bank 48 to 4f) And your ISR just look at the pointer and return the value to the pointed TINI OS memory and voila you can actualize your value with a ISR! But that is the theory that can work, as far as I know, I haven't tried it completely out, but it seems to be reasonable. Hope this helps you! kind regards Peter Theeraputh Mekathikom wrote: >Dear sir, > >Thank you for your recommendation, I'm really out of >the jungle. Now, I'm tring to write some native code. >But I still have several questions after I read >through Native API.txt and other files you gave me. > >I'm not sure that my approach is going to be correct >and afraid to break my system. Is it possible to break >the board ? (if my code write to some critical memory >address or loop forever). If I unintentional do that, >can I restore them? (e.g. reload the OS). > >I also wonder that is it possible to call back java >from native code, like to notify that the code is >finished doing something because I may need to >override the serial interrupt (and when ISR finish >doing something, then call back the application). > >With Best Regards, >Theeraputh Mekathikom > > > > > >__________________________________ >Do you Yahoo!? >Friends. Fun. Try the all-new Yahoo! Messenger. >http://messenger.yahoo.com/ > > > > _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini