LEJOS OSEK: ANSI C/C++, RTOS for NXT

Post your NXJ projects, project ideas, etc here!

Moderators: roger, 99jonathan, imaqine

LEJOS OSEK: ANSI C/C++, RTOS for NXT

Postby takashic » Mon May 21, 2007 3:03 am

Hello everyone and special thanks to LEJOS developers,

I would like to introduce a new project that is standing on the shoulders of giants.

LEJOS OSEK: http://sourceforge.net/projects/lejos-osek is an open source firmware for LEGO Mindstorms NXT.
LEJOS OSEK consists of LEJOS NXJ platform source code,
TOPPERS OSEK: http://www.toppers.jp/en/index.html kernel source code, and glue code to make them work together.
LEJOS OSEK can provide:
-ANSI C/C++ programming environment by using GCC (GNU-ARM) tool chain
-LEJOS NXJ platform based device API for NXT Sensors, Motors, and other devices
-TOPPERS OSEK provided real-time multi tasking features proven in automotive industry
-Rate Monotonic Scheduling with 1msec resolution by using OSEK Alarm
-Several examples (include a NXTway)
-Fast execution and less memory consumption
I.e. Application is executed natively on the ARM7 and NXTway consumed totally just about 20k bytes (includes LEJOS OSEK itself)

LEJOS OSEK is focused on real-time control applications for NXT, thus nice GUI/file system are out of target.
Additionally, we can provide a graphical modeling, simulation, and code generation environment which is called Embedded Coder Robot NXT.
Embedded Coder Robot NXT is LEGO Mindstorms NXT specific Blockset of The MathWorks MATLAB® & Simulink® products.
LEJOS OSEK is also used as the run time environment of the Embedded Coder Robot NXT applications.
Embedded Coder Robot NXT can be downloaded from The MathWorks File Exchange site:
http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do?objectId=144&objectType=Category

Note:
Porting TOPPERS OSEK to the NXT was done by Professor Masaaki Mizuno
Department of Computing and Information Sciences,
Kansas State University (masaaki@cis.ksu.edu)

Have fun,
takashic
Last edited by takashic on Sun Jul 29, 2007 11:43 pm, edited 3 times in total.
takashic
Novice
 
Posts: 32
Joined: Mon May 21, 2007 2:22 am

Postby takashic » Tue May 22, 2007 2:34 am

I think I should describe more about LEJOS OSEK for those who are not familiar with terms and words used in LEJOS OSEK (especially about OSEK).
-What is OSEK :?:
OSEK is an open standard specification for automotive electronics and software such as engine management system, anti-lock break system.
For more detailed information, please check: http://en.wikipedia.org/wiki/OSEK.
OSEK conformed software (i.e. Real-Time Operating System) has been used in the millions of vehicles on the road such as Mercedes Benz, BMW, VW…

-What is TOPPERS OSEK :?:
Specification of OSEK is open and now some parts of OSEK are standardized by ISO. The official ISO number is ISO 17356.
So technically, anybody can develop an OSEK conformed Real-Time Operating System (RTOS).
TOPPERS OSEK is an open source OSEK kernel and developed by TOPPERS project.
TOPPERS(Toyohashi OPen Platform for Embedded Real-time Systems) has been managed by a Non Profit Organization founded in Sep. 2003 and
has been led by Professor Hiroaki Takada of Nagoya University in Japan.

-Pros of LEJOS OSEK :D
1. You can write application in ANSI C/C++ (not C based, but real C with GCC) for the NXT.
2. You can develop real-time control application (i.e. NXTway) by using OSEK provided features (I.e. Rate Monotonic Scheduling with 1 msec resolution, multi-tasking, event synchronization, resource protection for shared global resource...)
3. Fast execution and less memory consumption. LEJOS OSEK does not use virtual machine (or byte interpreter) technology,
so application is natively executed on the ARM7 and LEJOS OSEK itself consumed only about 10 Kbytes. (Rest of memory, you can use for your application)
4. Equivalent to automotive software development environment. If you wanted to work for (or were interested in) automotive industry,
LEJOS OSEK might be a good material to learn about how they develop software for vehicles.

-Cons of LEJOS OSEK :(
1. No nice GUI/File system. LEJOS OSEK is tightly linked with application statically.
2. No safety guard for memory protection. If you used C pointer in wrong way, program may be crashed.

takashic
takashic
Novice
 
Posts: 32
Joined: Mon May 21, 2007 2:22 am

Postby bbagnall » Tue May 22, 2007 4:28 pm

Hi Takashic,

Thanks for your additional comments. I downloaded your software and see you've really done a thorough job with everything, including the menu screens.

I just wanted to let you know we are pleased that you were able to figure out our code and do so much with it. One of the worries we always have with leJOS is that no one will be able to understand our source code except for us, which is a bit frightening. The fact that you were able to go in and understand it without assistance from us is very reassuring to the developers. You did a great job!

- Brian
User avatar
bbagnall
Site Admin
 
Posts: 383
Joined: Fri Aug 04, 2006 4:03 pm

Postby spideyfly » Sat May 26, 2007 10:24 am

:D Hi there, this looks great...I've been looking for something that can use plain ANSI C. I do have a question or two though.

What are the different roles of TOPPERS OSEK and LEJOS here? I know TOPPERS is a RTOS, but I'm not sure what features of LEJOS are being used.

Since LEJOS-OSEK is using the LEJOS VM, with wrapper functions for C, how does program flow happen?

Are programs allowable in different types of languages? For instance, say I wanted to write code using Haskell, and I replaced the LEJOS VM with a Haskell one, does the program execute in the same way?

Thanks in advance for those clarifications.
spideyfly
New User
 
Posts: 18
Joined: Sat May 26, 2007 10:15 am

Postby takashic » Sun May 27, 2007 2:56 am

spideyfly wrote:What are the different roles of TOPPERS OSEK and LEJOS here? I know TOPPERS is a RTOS, but I'm not sure what features of LEJOS are being used.

Since LEJOS-OSEK is using the LEJOS VM, with wrapper functions for C, how does program flow happen?

Are programs allowable in different types of languages? For instance, say I wanted to write code using Haskell, and I replaced the LEJOS VM with a Haskell one, does the program execute in the same way?


LEJOS OSEK uses only LEJOS platform source code stored in lejos_nxj\src\nxtvm\platform directory. Platform code is the BIOS for the ARM7 in the NXT. So VM part is not used for LEJOS OSEK.

I don't know about Haskell, but LEJOS developers have done a great job to clearly separate ARM7 specific part and VM (especially compared to LEGO original firmware), so technically, it might be possible to integrate Haskell VM above the LEJOS platform.

In my experience, there is one thing to be reminded to hack LEJOS NXJ. I think that most important part of the platform code is I2C comm. between the ARM7 and the co-processor (AVR). This is the lifeline of the NXT (to get external inputs include buttons). I2C comm. is done every 1msec (read or write) and it restricts over all system architecture. This restriction is derived from LEGO, not LEJOS.
takashic
Novice
 
Posts: 32
Joined: Mon May 21, 2007 2:22 am

Postby epokh » Tue May 29, 2007 10:06 am

That's what I was waiting for!
I can port easily neural networks and fuzzy systems on topper!
COOOOOOOOOOOOOOL
epokh
Novice
 
Posts: 26
Joined: Wed Feb 21, 2007 5:46 pm

Postby takashic » Tue Jun 12, 2007 9:28 am

LEJOS OSEK Website is open.
http://lejos-osek.sourceforge.net/index.htm

API Reference (includes LEJOS platform C) and a NXTway(-DS) video are also available.

takashic
takashic
Novice
 
Posts: 32
Joined: Mon May 21, 2007 2:22 am

Postby dimastep » Sun Jul 08, 2007 11:21 pm

takashic wrote:LEJOS OSEK Website is open.
http://lejos-osek.sourceforge.net/index.htm

API Reference (includes LEJOS platform C) and a NXTway(-DS) video are also available.

takashic


Great project! Though I see the source code is not under CVS control - I wanted to add method calls for acceleration sensor etc...
dimastep
New User
 
Posts: 4
Joined: Sun Jul 08, 2007 10:26 pm

Postby takashic » Wed Jul 11, 2007 6:51 am

Hi,

LEJOS OSEK ver.1.03 was just released.
http://lejos-osek.sourceforge.net/

1.03 includes a minor bug fix and a new interesting application example which is called NXT GT.
NXT GT is a Bluetooth based R/C car and you can control the NXT GT by using a PC analog game pad controller!
takashic
Novice
 
Posts: 32
Joined: Mon May 21, 2007 2:22 am

Postby MitacARC » Tue Jul 24, 2007 2:27 pm

Hi Takashic,

I have tried the new version of Lejos-OSEK, and it works great. I am specially fond of its capacity for R/C control through the Bluetooth link. Thank you very much.


sean
MitacARC
New User
 
Posts: 1
Joined: Tue Jul 24, 2007 2:22 pm

Eclipse and LEJOS OSEK

Postby takashic » Wed Aug 01, 2007 7:10 am

Hi,

If you were looking for a nice IDE for LEJOS OSEK application development, why wouldn't you use Eclipse? I tested it and it works pretty well!
http://lejos-osek.sourceforge.net/eclipse.htm
takashic
Novice
 
Posts: 32
Joined: Mon May 21, 2007 2:22 am

Postby behzadsamadi » Sun Aug 05, 2007 3:23 am

Hi,

I installed LEJOS OSEK, Cygwin and GNU ARM. However, when I want to compile the helloworld project, I get the following error

ERROR: alarm.o uses hardware FP, whereas HelloWorld_ram.elf uses software FP

I was wondering how I can fix it. Thanks a lot for your time.

Behzad
behzadsamadi
New User
 
Posts: 5
Joined: Sun Aug 05, 2007 3:18 am
Location: Montreal, Canada

Postby takashic » Sun Aug 05, 2007 5:51 am

behzadsamadi wrote:Hi,

I installed LEJOS OSEK, Cygwin and GNU ARM. However, when I want to compile the helloworld project, I get the following error

ERROR: alarm.o uses hardware FP, whereas HelloWorld_ram.elf uses software FP

I was wondering how I can fix it. Thanks a lot for your time.

Behzad


Would you confirm FPU configuration of GNU ARM? The NXT has
an ATMEL AT91SAM7S256 and this chip does not have FPU, so FPU should
be checked off. To fix this issue, you may need to re-install GNU ARM.

Takashic
takashic
Novice
 
Posts: 32
Joined: Mon May 21, 2007 2:22 am

Postby CoBB » Sun Aug 05, 2007 6:56 am

Or just try adding the -mhard-float or -msoft-float switch.
User avatar
CoBB
Novice
 
Posts: 73
Joined: Tue Apr 24, 2007 12:24 pm

Postby behzadsamadi » Mon Aug 06, 2007 11:10 am

Hi Takashi,

I did not select FPU while installing GNU ARM.

Hi CoBB,

I don't know where to put those flags.


In fact, when I try to build TestMotor (ecrobotNXT sample in MATLAB/Simulink), I get the following error.


Linking TestMotor_app_ram.elf
/cygdrive/c/cygwin/GNUARM/bin/arm-elf-ld -o TestMotor_app_ram.elf /cygdrive/C/cygwin/ecrobotNXT/environment/lejos_osek/lejos_nxj/src/nxtvm/platform/nxt/uart.o ...

ERROR: /cygdrive/C/Progra~1/MATLAB/R2007a/rtw/c/libsrc/rt_sat_div_int8.o uses software FP, whereas TestMotor_app_ram.elf uses hardware FP
.
.
.

I can compile (make) LEJOS_OSEK examples such as "alarmtest" and "helloworld" without any problem. It seems that the conflict is because of the MATLAB files to be linked in the project. My MATLAB is R2007a.

Thanks,
Behzad
behzadsamadi
New User
 
Posts: 5
Joined: Sun Aug 05, 2007 3:18 am
Location: Montreal, Canada

Next

Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron
more stuff