ATMega/ ATXMega, IAR
embOS for ATMEL AVR / ATMega / ATXMega was developed for and with IAR's AVR compiler and supports the small data memory model offered by this compiler. It comes with an easy to use start workspace and start projects for IAR's embedded workbench.
Resources and performance data
| Memory usage | |
|---|---|
| Kernel size (ROM) | 1974 bytes |
| Kernel RAM usage | 25 bytes |
| RAM usage per task control block | 18 bytes |
| RAM usage per resource semaphore | 6 bytes |
| RAM usage per counting semaphore | 2 bytes |
| RAM usage per mailbox | 8 bytes |
| RAM usage per software timer | 8 bytes |
| RAM usage event | 0 bytes |
| Min. stack-size per task (RAM) | 100 bytes |
| Timing | |
| Context switch time | 346 clock cycles (49.4 µs), independent of number of tasks |
| Interrupt latency time | max. 168 clock cycles (24 µs) |
| Kernel CPU usage/TICK | less than 2% of total calculation time at 1000 Interrupts/second (1ms TICK) |
| Basic time unit (TICK) | typ. 1 ms, min. 50 µs (20 kHz interrupt frequency) |
| Features | |
| Max. no. of tasks | Unlimited (by available RAM only) |
| Max. no. of mailboxes | unlimited (by available RAM only) |
| Max. no. of semaphores (resource/binary/counting) | unlimited (by available RAM only) |
| Max. no. of software timers | unlimited (by available RAM only) |
| Max. no. of priorities | 255 |
| Stack size idle task (RAM) | 0(no memory needed) |
| Nested interrupts | permitted |
| Task switches from within ISR | possible |
Absolute timings given above were measured with embOS release build on an ATMega128 CPU running at 7.3728MHz.
embOSView offers system analysis during runtime

Available Emulators
- ATMEL
- ADTEC
Additional information
IAR Web site for additional compiler info / support
ATMEL Web site for additional CPU info / support
Board support packages
embOS comes with lots of ready to go start projects and support packages for various AVR/ATMega CPUs and starterboards.
| CPU | Eval board |
|---|---|
| Atmel ATmega64 | Atmel ATmega64 |
| Atmel ATmega103 | Atmel ATmega103 |
| Atmel ATmega128 | Atmel ATmega128 |
| Atmel ATmega2561 | Atmel ATmega2561 |
| Atmel ATXmega128 | Olimex AVRPX128A1 |
Release notes V3.84 for IAR
- Tool chain used for build
- New features
- Improvements
- Program corrections
- Known problems/limitations
- Release history
- Miscellaneous
Tool chain used for build
The following tools have been used:
Compiler: IAR ICCAVR V5.51.0
Assembler: IAR AAVR V5.51.0
Librarian: IAR XLIB V4.61L
Workbench: IAR IarIdePm V5.6.5
Performance
Release build, small memory model
Task switch time: 362 cycles = 90.5 us (@4MHz)
Interrupt latency: 136 cycles = 34.0 us (@4MHz)
Stack check build with profiling, small memory model
Task switch time: 402 cycles = 100.5 us (@4MHz)
with profiling: 915 cycles = 228.7 us (@4MHz)
Interrupt latency: 136 cycles = 34.0 us (@4MHz)
New features
Version 3.84
- Update to embOS generic sources V3.84.
- BSP for ATXmega128 added.
Version 3.32m
- embOS heap memory functions added.
- Update to embOS generic sources V3.32m.
Version 3.32d3
- embOS now comes also with libraries for AVR v6 CPUs, option -v6 of IAR compiler
Version 3.32d2
- Update to new IAR embedded workbench
The start projects were updated to the new IAR embedded Worbench V.5.7 and the new compiler V5.40. - New embOS pulgin V3.82.2 delivered with embOS
embOS now comes with the new embOS plugin which runs under the new IAR embedde workbench.
Version 3.32c
- OS_EVENT_WaitTimed() implemented
New event object function to wait for an event with a timeout limit. - ATmega2561 supported
embOS now comes with a sample project for ATmega2561 CPU which is prepared to run in CSpy simulator. - Additional libraries for CPU variant 5.
embOS now comes with libraries for CPUs with 24bit code address width, option -v5 of IAR compiler.
Version 3.32b
- Task context modified for debug builds
The number of task activations is now part of the task context in debug builds.
The number of activations are therefore displayed in the task list window of embOS plugin, when an embOS debug library is used.
Previous versions of embOS showed this information in profiling builds only.
Version 3.32a
- A parameter may be passed to a task function
Using the new embOS functions OS_CREATETASK_EX() or OS_CreateTasEx() allows to pass a void pointer as parameter to a task.
Version 3.32
- Event objects introduced
Event objects are standalone objects which are not assigned to a specific task.
Event objects may be used to synchronize one or multiple task to a specific event.
Events can be triggered from a task, a timer, or an interrupt handler. - embOS stack check modified
The internal stack check of embOS, used in stack check or debug builds, was modified to avoid some problems with IARs stack check plugin for CSPy.
Now embOS uses the same character for stack check as the stck check plugin from IAR.
This ensures, IARs stack check plugin will show correct level of CSTACK and IRQ_STACK usage. - embOS IAR kernel awareness plugin updated
Modified stack check version of embOS required a modified embOS plugin for IAR CSpy.
The new Plugin, version 1.00e, can handle both versions of embOS stack check methods, the previous version, and the new one, which uses a different stack check character.
The previous embOS Plugin now does not show correct values for task stack usage.
To replace the older plugin, please follow the instructions in the embOS plugin documentation.
Version 3.30a
- embOS internal time handling modified to allow long delays
For 8- and 16-bit CPUs the maximum range for delays and timer periods is limited to 32767 embOS timer ticks, because time comparison ist done by integer calculation.
By recompiling sources with datatype OS_TIME defined as signed long, longer delays and timer periods up to 2147483647 ticks can be realized.
The embOS libraries of object versions for 8- and 16-bit CPUs are still delivered with the limitation to 32767 timer ticks.
Version 3.28p
- New error handling for version without round robin scheduling
In debug versions of embOS, OS_Error() is called with error code OS_ERR_TASK_PRIORITY, if a task is created with a priority which is already assigned to an other task.
OS_Error() is also called with the same errorcode, if a task priority is assigned by call of OS_SetPriority() and the new priority is already assigned to an other task.
Round robin switching can be disabled by recompiling sources with OS_RR_SUPPORTED defined as 0.
Version 3.28l
- OS_SignalCSemaMax()
New counting semaphore handling function which specifies a maximum count value.
This allows counting semaphores used as binary semaphores.
Version 3.28k
- embOS awareness Plugin for IAR CSpy
A new plugin for IAR CSPy which shows information about tasks, system variables, mailboxes, timers and semaphores is delivered with embOS.
Version 3.28i
- OS_DeleteRSema()
New resource semaphore handling function allows to delete resource semaphores during runtime.
Version 3.28h
- Additional error checks in debug builds of embOS
OS_CreateRSema() now generates an error, when the addressed resource semaphore was already created before.
OS_CreateCSema() now generates an error, when the addressed counting semaphore was already created before.
OS_CreateMB() now generates an error, when the mailbox was already created before.
OS_CreateTimer() now generates an error, when the software timer was already created before.
OS_MEMF_Create() now generates an error, when the addressed fixed size memory pool was already created before.
Version 3.28g
- OS_GetSuspendCnt()
New info function to examine suspension state and count of a task.
Version 3.26
- OS_Terminate() modified
Task may be terminated anytime, regardless of task state.
All resources claimed by the terminated task are automatically released.
Version 3.24
- OS_PutMailFront() / OS_PutMailFront1
New mailbox functions to enable LIFO behavior of mailboxes. - OS_PutMailFrontCond() / OS_PutMailFrontCond1()
New conditional mailbox functions to enable LIFO behavior of mailboxes.
Version 3.20g
- Small Flash derivates supported
Since version 3.20g, embOS for AVR is delivered with additional libraries for CPU derivates with small flash memory.
This enables usage of embOS with ATmega64 or smaller derivates.
Version 3.20
- OS_Suspend() / OS_Resume() implemented
New functions to suspend and resume tasks unconditionally. - Fixed size memory blocks implemeted
New functions to allocate fixed size memory blocks from embOS.
Version 3.10k
- OS_GetMailTimed()
New mailbox retrieval function with timeout.
Version 3.10d
- OS_GetpCurrentTimer()
New info routine. May be used in timer callback routines to examine which timer expired. - OS_GetpCurrentTask()
New info routine. May be used to examine current running task.
Version 3.10
- Data format for communication with embOSView modified
For terminal I/O in embOSView, the data format was changed. Therefore embOSView V3.10 or later is required. - OS_WaitSingleEvent()
Unmasked events remain unchanged when function returns. - OS_WaitSingleEventTimed()
Unmasked events remain unchanged when function returns. Timeout for waiting can be specified.
Version 3.08a
- Support for ATmega128
Internal data structures modified to support ATmega128. - Message Queue functionality enhanced
OS_Q_GetPtrCond() function enables conditional request of data from Queue without task suspension.
OS_Q_GetMessageCnt() functions delivers number of messages in the queue.
Version 3.08
- Message Queues
Message queues enable intertask communication with messages of various size.
Improvements
Version 3.32d2
- Some warnings eliminated in source builds
Previous versions of embOS for AVR generated some warnings and remarks when the embOS sources were compiled.
Adding some CPU specific type definitons solved the problem, embOS now compiles without warnings.
Version 3.28n
- embOS round-robin scheduling may be disabled.
Round-robin scheduling may be disabled by recompiling sources with OS_RR_SUPPORTED defined as 0.
This will save some bytes of RAM and ROM and may make sense for small CPUs.
Version 3.28g
- embOS scheduling simplified
Task activation and deactivation on "waitable objects" as mailboxes, semaphores, events, fixed size memory blocks now all use the same scheduling method.
This modification saves ROM and RAM and makes scheduler easier to understand and to maintain.
Applications which accessed internal data structures of waitable objects directly have to be modified.
Version 3.10f
- Memory requirements reduced
Granularity enhanced for non embOSView builds to save ROM and RAM
Program corrections
Version 3.32d1
- OS_CreateTask() for ATmega256x corrected.
OS_CreateTask() did not inintialize the task control structure correctly for CPUs with extended programm memory range.
If the start address of the task function was located at an address higher than 0x20000, the task was not started, the system crashed.
If the scheduler itself was located above a start addess of 0x20000, the system also crashed when starting a task. This bug existed in all previous versions of the rtos5S libraries and is fixed with version 3.32d1 of embOS for AVR.
Version 3.32a
- embOSView corrected.
embOSView sometimes showed wrong task state "Terminated" for tasks which were not terminated.
This bug existed in all previous versions of emBOSView and is fixed with version 3.32a.
Version 3.30d
- OS_MEMF_Create() corrected.
Alignment check of buffers for fixed size memory blocks did not work correctly in debug libraries of embOS.
OS_Error() was called during OS_MEMF_Create(), even though the memory pool buffers start address was correctly aligned.
This problem existed since embOS version 3.28m in all debug build libraries and is fixed with version 3.30d.
Version 3.30b
- OS_Suspend() corrected.
OS_Suspend() did not work correctly, when an activated task with higher priority than the running task was suspended.
When the task with highest priority was suspended during system initialization before embOS was started, embOS crashed during the call of OS_Start(), or called the embOS error handler OS_Error() with error code OS_ERR_INV_TASK (128).
The same crash occured, when the application was running in a critical region and a task with higher priority was activated, but not started because of the critical region, and was then suspended by a call of OS_Suspend().
This problem existed in all previous embOS versions and is fixed with version 3.30b.
Version 3.28q
- Problem with suspended tasks which were on delay fixed.
If a task which was on delay was suspended, the delay timer for that task was not handled.
This might have resulted in additional longer delay when the task was resumed later.
This problem existed in all previous embOS versions and is fixed with version 3.28q.
Version 3.28p
- OS_Suspend() corrected.
OS_Suspend() did not work correctly, when the current task was suspended from within an interrupt handler, or from a critical region.
The application crashed, or called the embOS error handler OS_Error() with error code OS_ERR_INV_TASK (128).
As OS_Suspend() automatically enters a critical region in debug-trace builds, OS_Suspend() also failed, when it was called to suspend the current task in debug-trace builds of embOS.
This problem existed in all previous embOS versions and is fixed with version 3.28p.
- Alignment problems fixed for fixed size memeory blocks
Some CPUs, mainly the 32bit RISC types, require aligned buffer start addresses for fixed size memory pools.
The debug version of embOS now checks alignment of buffer start address and data blocks in the buffer. If data blocks and buffer start address is not aligned, an error is generated and embOS error handler is called during creation of a fixed size memory pool.
This problem existed in all previous embOS versions and is fixed with version 3.28m.
Version 3.28l
- OS_MEMF_Free() added
The function OS_MEMF_Free() was not included in embOS libraries, but was documented in embOS users manual and was also declared in RTOS.h.
This problem existed in all previous embOS versions and is fixed with version 3.28l.
Version 3.28k
- OS_MEMF_IsInPool() corrected
OS_MEMF_IsInPool() failed, if a pointer was checked which pointed to the first address after the memory pool. This pointer was reported as belonging to the pool.
This problem existed in all previous embOS versions and is fixed with version 3.28g.
Version 3.28g
- OS_WakeTask() for trace build corrected
OS_WakeTask() in trace build disabled task switches.
This problem existed since version 3.24 and is fixed with version 3.28g. - OS_GetMailTimed() / mailbox handling corrected
During call of OS_GetMailTimed, interrupts were re-enabled too early. If a mail was just put into a mailbox and the timeout occured at the same time, a mailbox internal control variables which managed waiting tasks was set to a wrong value.
This resulted in wrong mailbox handling and caused task waiting for mail kept suspended, even though, mail was available. This problem existed in all previous versions of embOS and is fixed with version 3.28g.
Version 3.26a
- OS_MEMF_Release() corrected
OS_MEMF_Release() might have failed according to absolute address of memory block.
The problem occured because address calculation was done with 16bit interger value.
Calculation was modified to use 32bit values to fix the problem.
Version 3.26
- OS_GetTime() corrected
OS_GetTime() enabled interrupts in previous versions. This could block software timers on slow systems.
Corrected with version 3.26 of embOS.
This problem exists in all previous embOS versions and is fixed with version 3.20c.
Version 3.20c
- OS_GetMailTimed() corrected
OS_GetMailTimed () did not retrieve a mail after 256 calls, the waiting task remained suspended. Corrected with version 3.20c of embOS.
This problem exists in all previous embOS versions and is fixed with version 3.20c.
Version 3.10p
- GetMail functions corrected
Internal functions for retrieving mail from a mailbox did not disable interrupts. This could cause message losses, when mail was written into mailboxes from within interrupt handlers.
This problem exists in all previous embOS versions and is fixed with version 3.10p.
Version 3.10n
- UDATAx segments removed
To be compatible with newer version of IAR compiler/linker, the UDATA0 segment, previously used for embOS internal data, is now replaced by segment NEAR_Z.
Known problems/limitations
Only small memory model supported
Version 3.10n
- IAR ICCA90 compiler no longer supported
Current version of embOS AVR is designed for current IAR AVR compiler. A version for older IAR compiler ICCA90 can not be delivered.
Release history
| Version | Release date | Short explanation |
| V3.84 | 11. Oct 2011 | Update to embOS generic sources V3.84. BSP for ATXmega128 added. |
| V3.32m | 26. Oct 2010 | embOS heap memory functions added. Update to embOS generic sources V3.32m. |
| V3.32d3 | 27. May 2010 | embOS AVR v6 libraries added. |
| V3.32d2 | 21. Dec 2009 | Update to new IAR compiler V5.40 |
| V3.32c | 20. Oct 2006 | Update to new embOS sources V3.32c |
| V3.28h | 02. Sep 2005 | Update to new embOS sources V3.28h |
| V3.26.1 | 29. Aug 2005 | Update for IAR compiler 4.11A |
| V3.26 | 15. Mar 2005 | Update to IAR compiler 4.10B, embOS sources 3.26 |
| V3.24 | 14. Dec 2004 | Update to IAR compiler 3.20, embOS sources 3.24 |
| V3.20g | 15. Jun 2004 | 'Small Flash'-derivates supported |
| V3.20f | 03. Jun 2004 | Update to new embOS sources 3.20f and new IAR compiler version 3.10 |
| V3.10n | 25. Feb 2003 | V3.10n Update to new version 3.10 |
| V3.08d | 25. Jun 2002 | V3.08d Initial release for AVR compiler |
Miscellaneous
This document was first released with version 3.08b of the software.
Software released earlier is documented internally. This information is available at request.
ATMega/ ATXMega, IAR
