What version should i use?
I try to use even version numbers for more stable ones and odd for the experimental ones. Any release with substantial change to the code is experimental. If i have worked a while with such a version and did not change to much i call it stable. For the users of my OS this difference is of not much importance. Therefore i would advice always use the latest version. If you run into something, email me or (and!) put it on the source force forum. I will only fix bugs in the latest version to keep the workload manageable.
Why an other embedded OS?
This OS was designed with only one goal: it must be small. This is reflected in the number of possibilities to reduce flash and ram usage. However, i tried not to let quality suffer. I think Femto OS is the smallest OS on the planet at this time.
Why is the OS so complex?
To get to a small system, we need a lot of tricks. One of them is the very extensive use of preprocessor code. Stuff you do not need is not included in the kernel. So there are many configuration parameters. However, it may be complex, it is not complicated: All configuration is done at one place; you include only one header file in your code; all OS calls have understandable names; the preprocessor checks most configuration errors; there is parameter verification for the function calls; etc etc.
Best thing is to walk through the Getting Started Guide and look through the source of the examples, to get a feeling for this OS.
I need feature X, can you add it for me?
First ask yourself if it is really an OS like feature. If so, you can request me by email to have a look at it. I will certainly not add anything which increases the footprint of the core. Optional code (like the Femto FS) can be added if the area of application is wide enough. In case of paid support, more is possible, but that code will probably not end up in the main codebase.
Are you planning to port this OS to xmega?
Although this OS is targeted at the smaller devices, the smallest of the xmega series seem to be a valid target too. So i plan to port this to xmega indeed, but the release will probably not be soon. Expect it in release 0.93.
Are you planning to port this to device X?
Porting is really not that difficult any more from version 0.87 and onwards. Please try it yourself first by modifying the device.h file and adding an AT-yourdevice.asm file. Have a look at the existing ports. And, although possible, i don't think it is likely i will port this OS to other architectures. I am really pleased with the AVR core! I will be more than happy however to assist anyone who wants to give it a try.
You changed the api again, this is unbearable!
Yes, and probably this will happen some more times in the future. The reason is that i want the api to one logical suite of calls. To that end it may be needed to change the names and calling conventions from time to time.
Do you have any tools to make life easy?
The distribution has a number of scripts that may be handy:
- install_toolchain: installs the latest gcc toolchain.
- install_workspace: installs an eclipse workspace with all projects.
- compile: compiles demo projects for every supported device
- flash: flash the binary onto the device
How do i get started on Windows, Linux or Mac?
I advise Eclipse with CDT on all platforms, i tested it with the toolchain in my distro and it simply works!
Can i use WinAVR without cygwin?
Yes, you can. I have quickly tested compilation of all example projects under WinAVR and it is possible. Just install as in the Readme, but skip the install toolchain part (but do install the workspace!) Call the compile and flash scripts with the keyword 'system'. If you do not want to install cygwin at all, you must perform all steps (placing the files at the right locations, rename the config files, using the correct compiler options etc etc) by hand. I would say, for experts only.
Can i use AVR Studio?
Yes, if you use WinAVR as compiler, which you must have installed yourself. [Femto OS is made for gcc, and i don't think it is easy to port it to other compilers, even though i am using mostly standard C.] The distribution contains an command line installer to generate all project files for the demo projects. After running, you simply open en compile each project. In this approach no need for cygwin.
Can i use Eclipse with AVR plugin?
I have never tested it, but i see no reason why not. For the moment however, you are on your own.
Does Femto OS run under the Arduino IDE?
Femto OS runs on the Arduino hardware, but you have to some handwork. But running Femto OS under the Arduino IDE is a more difficult. I will only publish this if there is very high demand. Maintaining such software is a lot of work.
What is this crap? It does not even compile!
Indeed that is possible. There are many switches and configuration parameters and devices so there are very many combinations possible and rest assured, i did not even test a small fraction of them. Most of the times when i encounter such an error it is just a typo. So start with the Hello World application and the examples. The examples should compile and run without errors! Of course, you checked that you included all functions you use, and that you did not misspell a task name? The preprocessor checking code will prevent a compile in most cases that do not make sense. Occasionally an error may also show up in the core code while your code is to blame.
The examples run, but my code size is still bigger!
First of all, the code size can only be identical when everything else is identical, thus
- the same GCC version (4.3.3), binutils etc as i had, and
- the same chip, and
- all configuration parameters are identical and
- and all compiler options identical.
Examples ship 'non-optimized', so you have to activate optimization (cfgSysOptimized to cfgTrue). Further, you have cfgSysGCCstartup set to cfgReplace and do not let gcc add any startup code (-nostartfiles in eclipse) when linking. Now you should obtain the low values i got. Note that if you switch back from cfgReplace to cfgOverride or cfgKeep you activate the gcc startupcode again. (otherwise the application we probably enter a reset loop)
Compiling the demo's out of the box with the compiler script should also give the same results if you add the option compact:
./script/compile all cross compact
How do I reduce ram use as much as possible?
Here are several possibilities
- If you still have some flash left consider the inline option (and inline your own code as much as possible too) Code gets larger, but calls tend to get less deep, so less stack is needed.
- Eliminate boolean parameters and work as much as possible with bit masks. GCC generates much more efficient code in general. Also, it may help to compact function parameters into one byte and split them with masks again. I used this technique frequently inside the Femto OS.
- Realize that a design can always be done more efficiently even if you already made it more efficient. From the first (working) version of Femto OS until this first release, i gained a factor two on almost all test applications, just by redesign and without loss of functionality.
- If possible try to make use of the same register use, stack size, and other configuration parameters that must be defined on a task by task basis. In such cases the preprocessor can produce shorter code.
Function X does not work but it used to, what happened?
Make sure, if you change anything to optimized code, you increase all stack sizes and activate all checks. A program does not have to crash when it is short of stack, but may behave in any way. I have experienced this countless times, and even knowing this lesson, i still get caught sometimes. Even the most minor change to the code requires a full new optimization cycle! With Femto OS you are living on the edge, be prepared to bleed.
My program runs for a while and than crashes or resets.
Most probably you are short of stack space. If checks are activated that should not go unnoticed but it may happen that the overflow occurs somewhere where no context switch takes place, or there is some other reason why the check does not catch the overflow. Thus, first action is to increase the stack and to incorporate manual checks. Of course, you run with checks activated when developing.
What about debugging?
Debugging (with breakpoints) is hard on an OS, because of the interrupts that keep coming. For tracing there is a trace tool (windows only) that reads the parallel port. The OS has a tracehook, and emits events about its actions. The application builder can also call the trace function and send its bytes. It is also possible to send a marker, that triggers the start of the tracing in the trace tool.
The leds on my STK500 start flashing in a strange fashion.
At start up three quick blinks of all leds indicate a reset has occurred. If all leds keep on flashing simultaneously, your device has come into a reset-loop. This can be caused by many different errors, but i would make sure that you have all registers saved on the context, and have enough stack for each task and the OS.
If the two most significant leds flash alternating, or if you have 'running leds' then this is an error message. See on the Code | Error page for more information. If the error is not fatal, the OS will terminate the offending task and continue with the other tasks.
Contact: info@femtoos.org | CC-BY License: Ruud Vlaming. |