GNU C has many extensions which make the programmer's life easier-... or not. But the resulting code is more efficient! One of these extensions is the compiler attribute preceding a function header specifying certain function behaviour. For example, a function can be forced to always be compiled inline with __attribute__((always_inline)). More than one attribute specifier can be used within the parentheses; full attribute syntax can be found here. Attributes can also specify the way the compiler treats types and variables.
Contiki employs attributes in its protothreading system (see core/sys/pt.h) for specifying return addresses via labels (core/sys/lc-addrlabels.h). The preferred alternative is a coroutine-based method (/core/sys/lc-switch.h) using switch-case control structures and the __LINE__ C macro.
Showing posts with label Contiki. Show all posts
Showing posts with label Contiki. Show all posts
Thursday, 29 May 2008
Friday, 9 May 2008
The cruise starts
One of my projects involve dynamic updating of kernel code on sensors running the Contiki OS. It seems there are many ways to do this, as shown in this presentation and supporting .pdf by Adam Dunkels et al. The Contiki layers and linking relationships are explained in detail in this and this document.
Wikipedia has a good overview of ELF, a very popular structure for dynamically linked modules. A hallo-world example from LinuxJournal (1995) is also a good starting point. This excellent tutorial shows how to use ELF when compiling really small ASM files (includes a specification of ELF), while this site explains in detail how the ELF structure is implemented using C libraries.
Wikipedia has a good overview of ELF, a very popular structure for dynamically linked modules. A hallo-world example from LinuxJournal (1995) is also a good starting point. This excellent tutorial shows how to use ELF when compiling really small ASM files (includes a specification of ELF), while this site explains in detail how the ELF structure is implemented using C libraries.
Subscribe to:
Posts (Atom)